void *data;
};
+static void _ctxpopup_hide(Evas_Object *popup);
+static void _ctxpopup_position(Evas_Object *obj);
+
static char *
_remove_tags(const char *str)
{
return ret;
}
-static void _ctxpopup_hide(Evas_Object *popup);
-static void _ctxpopup_position(Evas_Object *obj);
static void
-_entry_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
+_entry_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ evas_object_del(data);
+}
+
+static void
+_entry_hide_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ evas_object_hide(data);
+}
+
+static void
+_entry_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
{
if (evas_pointer_button_down_mask_get(e))
- _ctxpopup_hide(ext_mod->popup);
+ _ctxpopup_hide(data);
else
- _ctxpopup_position(data);
+ {
+ /*update*/
+ elm_entry_extension_module_data_get(obj, ext_mod);
+ _ctxpopup_position(data);
+ }
+}
+
+static void
+_entry_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ _ctxpopup_hide(data);
}
static void
_ctxpopup_hide(Evas_Object *popup)
{
evas_object_hide(popup);
- evas_object_event_callback_del(ext_mod->caller, EVAS_CALLBACK_MOVE, _entry_move);
- ext_mod->caller = NULL;
+ evas_object_event_callback_del(ext_mod->caller, EVAS_CALLBACK_DEL, _entry_del_cb);
+ evas_object_event_callback_del(ext_mod->caller, EVAS_CALLBACK_HIDE, _entry_hide_cb);
+ evas_object_event_callback_del(ext_mod->caller, EVAS_CALLBACK_MOVE, _entry_move_cb);
+ evas_object_event_callback_del(ext_mod->caller, EVAS_CALLBACK_RESIZE, _entry_resize_cb);
}
static void
if(!ext_mod) return;
Evas_Coord cx, cy, cw, ch, x, y, w, h;
+ elm_ctxpopup_direction_priority_set(ext_mod->popup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
if (!edje_object_part_text_selection_geometry_get(ext_mod->ent, "elm.text", &x, &y, &w, &h))
{
evas_object_geometry_get(ext_mod->ent, &x, &y, NULL, NULL);
}
cx = x + (w / 2);
cy = y + (h / 2);
+ Elm_Ctxpopup_Direction dir = elm_ctxpopup_direction_get(ext_mod->popup);
+ if (dir != ELM_CTXPOPUP_DIRECTION_UNKNOWN)
+ {
+ if (dir == ELM_CTXPOPUP_DIRECTION_UP)
+ cy = y + (h / 5);
+ else if (dir == ELM_CTXPOPUP_DIRECTION_DOWN)
+ {
+ elm_ctxpopup_direction_priority_set(ext_mod->popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT);
+ cy = y + h;
+ }
+ }
evas_object_move(ext_mod->popup, cx, cy);
}
}
ext_mod->cut(data,obj,event_info);
_ctxpopup_hide(obj);
- elm_object_scroll_freeze_pop(ext_mod->popup);
+ //elm_object_scroll_freeze_pop(ext_mod->popup);
}
static void
ext_mod->copy(data,obj,event_info);
_ctxpopup_hide(obj);
- elm_object_scroll_freeze_pop(ext_mod->popup);
+ //elm_object_scroll_freeze_pop(ext_mod->popup);
}
static void
ext_mod->cancel(data,obj,event_info);
_ctxpopup_hide(obj);
- elm_object_scroll_freeze_pop(ext_mod->popup);
+ //elm_object_scroll_freeze_pop(ext_mod->popup);
}
static void
{
if (!ext_mod) return;
- elm_object_scroll_freeze_pop(ext_mod->popup);
+ //elm_object_scroll_freeze_pop(ext_mod->popup);
}
// module api funcs needed
if(top)
{
ext_mod->popup = elm_ctxpopup_add(top);
- elm_object_tree_unfocusable_set(ext_mod->popup, EINA_TRUE);
+ elm_object_tree_focus_allow_set(ext_mod->popup, EINA_FALSE);
evas_object_smart_callback_add(ext_mod->popup, "dismissed", _ctxpopup_dismissed_cb, NULL);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _entry_del_cb, ext_mod->popup);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _entry_hide_cb, ext_mod->popup);
}
/*currently below theme not used,when guideline comes a new theme can be created if required*/
- elm_object_style_set(ext_mod->popup,"extended/entry");
+ //elm_object_style_set(ext_mod->popup,"extended/entry");
context_menu_orientation = edje_object_data_get
(ext_mod->ent, "context_menu_orientation");
if ((context_menu_orientation) &&
(!strcmp(context_menu_orientation, "horizontal")))
elm_ctxpopup_horizontal_set(ext_mod->popup, EINA_TRUE);
- elm_widget_sub_object_add(obj, ext_mod->popup);
if (!ext_mod->selmode)
{
if (!ext_mod->password)
//elm_ctxpopup_item_append(ext_mod->popup, "More", NULL, _clipboard_menu, obj );
}
// end for cbhm
- icon = elm_icon_add(ext_mod->popup);
- snprintf(buf, sizeof(buf), "%s/images/copy&paste_icon_search.png", PACKAGE_DATA_DIR);
- elm_icon_file_set(icon, buf, NULL);
- added_item = elm_ctxpopup_item_append(ext_mod->popup, NULL, icon, _search_menu, obj); // Search
+
+ const char *entry_str;
+ char *str;
+ entry_str = edje_object_part_text_get(ext_mod->ent, "elm.text");
+ str = _remove_tags(entry_str);
+ if (strcmp(str, "") != 0)
+ {
+ icon = elm_icon_add(ext_mod->popup);
+ snprintf(buf, sizeof(buf), "%s/images/copy&paste_icon_search.png", PACKAGE_DATA_DIR);
+ elm_icon_file_set(icon, buf, NULL);
+ added_item = elm_ctxpopup_item_append(ext_mod->popup, NULL, icon, _search_menu, obj); // Search
+ }
}
else
{
//elm_ctxpopup_item_append(ext_mod->popup, "More", NULL, _clipboard_menu, obj );
}
// end for cbhm
- icon = elm_icon_add(ext_mod->popup);
- snprintf(buf, sizeof(buf), "%s/images/copy&paste_icon_search.png", PACKAGE_DATA_DIR);
- elm_icon_file_set(icon, buf, NULL);
- added_item = elm_ctxpopup_item_append(ext_mod->popup, NULL, icon, _search_menu, obj); // Search
- }
+
+ const char *entry_str;
+ char *str;
+ entry_str = edje_object_part_text_get(ext_mod->ent, "elm.text");
+ str = _remove_tags(entry_str);
+ if (strcmp(str, "") != 0)
+ {
+ icon = elm_icon_add(ext_mod->popup);
+ snprintf(buf, sizeof(buf), "%s/images/copy&paste_icon_search.png", PACKAGE_DATA_DIR);
+ elm_icon_file_set(icon, buf, NULL);
+ added_item = elm_ctxpopup_item_append(ext_mod->popup, NULL, icon, _search_menu, obj); // Search
+ }
+ }
}
EINA_LIST_FOREACH(ext_mod->items, l, it)
{
}
if (ext_mod->popup && added_item)
{
- elm_object_scroll_freeze_push(ext_mod->popup);
+ //elm_object_scroll_freeze_push(ext_mod->popup);
_ctxpopup_position(obj);
evas_object_show(ext_mod->popup);
+ _ctxpopup_position(obj);
ext_mod->caller = obj;
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _entry_move, ext_mod->popup);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _entry_move_cb, ext_mod->popup);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _entry_resize_cb, ext_mod->popup);
}
else
ext_mod->caller = NULL;