1 #include <Elementary.h>
2 #include "elm_module_priv.h"
5 Elm_Entry_Extension_data *ext_mod;
8 _select(void *data, Evas_Object *obj, void *event_info)
10 ext_mod->select(data,obj,event_info);
11 evas_object_hide(ext_mod->popup);
15 _paste(void *data, Evas_Object *obj, void *event_info)
17 ext_mod->paste(data,obj,event_info);
18 evas_object_hide(ext_mod->popup);
22 _cut(void *data, Evas_Object *obj, void *event_info)
24 ext_mod->cut(data,obj,event_info);
25 evas_object_hide(ext_mod->popup);
29 _copy(void *data, Evas_Object *obj, void *event_info)
31 ext_mod->copy(data,obj,event_info);
32 evas_object_hide(ext_mod->popup);
36 _cancel(void *data, Evas_Object *obj, void *event_info)
38 ext_mod->cancel(data,obj,event_info);
39 evas_object_hide(ext_mod->popup);
43 _item_clicked(void *data, Evas_Object *obj, void *event_info)
45 Elm_Entry_Context_Menu_Item *it = data;
46 Evas_Object *obj2 = it->obj;
48 if (it->func) it->func(it->data, obj2, NULL);
50 if (!strcmp(it->label, "Menu"))
52 elm_cbhm_helper_init(obj);
53 elm_cbhm_send_raw_data("show");
56 evas_object_hide(ext_mod->popup);
59 // module api funcs needed
61 elm_modapi_init(void *m)
63 return 1; // succeed always
67 elm_modapi_shutdown(void *m)
69 return 1; // succeed always
72 // module fucns for the specific module type
74 obj_hook(Evas_Object *obj)
78 ext_mod = ELM_NEW(Elm_Entry_Extension_data);
79 elm_entry_extension_module_data_get(obj,ext_mod);
84 obj_unhook(Evas_Object *obj)
94 obj_longpress(Evas_Object *obj)
101 const Elm_Entry_Context_Menu_Item *it;
103 elm_entry_extension_module_data_get(obj,ext_mod);
104 if (ext_mod->context_menu)
106 if (ext_mod->popup) evas_object_del(ext_mod->popup);
107 else elm_widget_scroll_freeze_push(obj);
108 top = elm_widget_top_get(obj);
110 ext_mod->popup = elm_popup_add(top);
111 elm_object_style_set(ext_mod->popup,"menustyle");
112 elm_popup_set_mode(ext_mod->popup, ELM_POPUP_TYPE_ALERT);
113 elm_popup_title_label_set(ext_mod->popup,"CopyPaste");
114 list = elm_list_add(ext_mod->popup);
115 elm_object_style_set(list,"popup");
116 elm_list_horizontal_mode_set(list, ELM_LIST_COMPRESS);
117 elm_widget_sub_object_add(obj, ext_mod->popup);
118 if (!ext_mod->selmode)
120 if (!ext_mod->password)
121 elm_list_item_append(list, "Select", NULL, NULL,_select, obj);
122 if (1) // need way to detect if someone has a selection
124 if (ext_mod->editable)
125 elm_list_item_append(list, "Paste", NULL, NULL,_paste, obj);
127 // elm_ctxpopup_item_add(wd->ctxpopup, NULL, "Selectall",_select_all, obj );
131 if (!ext_mod->password)
133 if (ext_mod->have_selection)
135 elm_list_item_append(list, "Copy", NULL, NULL,_copy, obj);
136 if (ext_mod->editable)
137 elm_list_item_append(list, "Cut", NULL, NULL,_cut, obj);
141 _cancel(obj,ext_mod->popup,NULL);
142 elm_list_item_append(list, "Select", NULL, NULL,_select, obj);
143 if (1) // need way to detect if someone has a selection
145 if (ext_mod->editable)
146 elm_list_item_append(list, "Paste", NULL, NULL,_paste, obj);
151 EINA_LIST_FOREACH(ext_mod->items, l, it)
153 elm_list_item_append(list, it->label,NULL,NULL, _item_clicked, it);
158 elm_popup_content_set(ext_mod->popup, list);
159 evas_object_show(ext_mod->popup);
160 evas_render( evas_object_evas_get( ext_mod->popup ) );
163 ext_mod->longpress_timer = NULL;
167 obj_mouseup(Evas_Object *obj)
170 elm_entry_extension_module_data_get(obj,ext_mod);
171 if (ext_mod->longpress_timer)
173 if (ext_mod->have_selection )
175 _cancel(obj,ext_mod->popup,NULL);