#include <Elementary.h>
#include "elm_priv.h"
-
+#include "elm_module_priv.h"
/**
* @defgroup Entry Entry
* @ingroup Elementary
typedef struct _Mod_Api Mod_Api;
typedef struct _Widget_Data Widget_Data;
-typedef struct _Elm_Entry_Context_Menu_Item Elm_Entry_Context_Menu_Item;
typedef struct _Elm_Entry_Item_Provider Elm_Entry_Item_Provider;
struct _Widget_Data
Eina_Bool autoreturnkey : 1;
};
-struct _Elm_Entry_Context_Menu_Item
-{
- Evas_Object *obj;
- const char *label;
- const char *icon_file;
- const char *icon_group;
- Elm_Icon_Type icon_type;
- Evas_Smart_Cb func;
- void *data;
-};
-
struct _Elm_Entry_Item_Provider
{
Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item);
if ((wd->api) && (wd->api->obj_mouseup))
{
wd->api->obj_mouseup(data);
- }
- else
- {
+ }
if (wd->longpress_timer)
{
ecore_timer_del(wd->longpress_timer);
wd->longpress_timer = NULL;
- }
- }
+ }
}
static void
return obj;
}
+EAPI void elm_entry_extension_module_data_get(Evas_Object *obj,Elm_Entry_Extension_data *ext_mod)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ ext_mod->cancel = _cancel;
+ ext_mod->copy = _copy;
+ ext_mod->cut = _cut;
+ ext_mod->paste = _paste;
+ ext_mod->select = _select;
+ ext_mod->selectall = NULL; /* to be implemented*/
+ ext_mod->ent = wd->ent;
+ ext_mod->items = wd->items;
+ ext_mod->longpress_timer = wd->longpress_timer;
+ ext_mod->editable = wd->editable;
+ ext_mod->have_selection = wd->have_selection;
+ ext_mod->password = wd->password;
+ ext_mod->selmode = wd->selmode;
+}
/**
* This sets the entry object not to line wrap. All input will
--- /dev/null
+#ifndef ELM_MODULE_PRIV_H\r
+#define ELM_MODULE_PRIV_H\r
+\r
+typedef struct _Elm_Entry_Extension_data Elm_Entry_Extension_data;\r
+typedef struct _Elm_Entry_Context_Menu_Item Elm_Entry_Context_Menu_Item;\r
+typedef void (*cpfunc)(void *data, Evas_Object *obj, void *event_info);\r
+\r
+struct _Elm_Entry_Extension_data\r
+{\r
+ Evas_Object *popup;\r
+ Evas_Object *ent;\r
+ Ecore_Timer *longpress_timer;\r
+ Eina_List *items;\r
+ cpfunc select;\r
+ cpfunc copy;\r
+ cpfunc cut;\r
+ cpfunc paste;\r
+ cpfunc cancel;\r
+ cpfunc selectall;\r
+ Eina_Bool password :1;\r
+ Eina_Bool editable :1;\r
+ Eina_Bool have_selection: 1;\r
+ Eina_Bool selmode :1;\r
+};\r
+\r
+struct _Elm_Entry_Context_Menu_Item\r
+{\r
+ Evas_Object *obj;\r
+ const char *label;\r
+ const char *icon_file;\r
+ const char *icon_group;\r
+ Elm_Icon_Type icon_type;\r
+ Evas_Smart_Cb func;\r
+ void *data;\r
+};\r
+\r
+EAPI void elm_entry_extension_module_data_get(Evas_Object *obj,Elm_Entry_Extension_data *ext_mod);\r
+\r
+#endif\r
#include <Elementary.h>
+#include "elm_module_priv.h"
#include "elm_priv.h"
-typedef struct _Mod_Api Mod_Api;
-typedef struct _Widget_Data Widget_Data;
-typedef struct _Elm_Entry_Context_Menu_Item Elm_Entry_Context_Menu_Item;
-struct _Widget_Data
-{
- Evas_Object *ent;
- Evas_Object *popup;/*copy paste UI - elm_popup*/
- Evas_Object *ctxpopup;/*copy paste UI - elm_ctxpopup*/
- Evas_Object *bg;
- Evas_Object *hoversel;
- Ecore_Job *deferred_recalc_job;
- Ecore_Event_Handler *sel_notify_handler;
- Ecore_Event_Handler *sel_clear_handler;
- Ecore_Timer *longpress_timer;
- const char *cut_sel;
- const char *text;
- Evas_Coord wrap_w;
- Evas_Coord lastw;
- Evas_Coord downx, downy;
- Evas_Coord cx, cy, cw, ch;
- Eina_List *items;
- Eina_List *item_providers;
- Mod_Api *api; // module api if supplied
- int max_no_of_bytes;
- Eina_Bool changed : 1;
- Eina_Bool linewrap : 1;
- Eina_Bool char_linewrap : 1;
- Eina_Bool single_line : 1;
- Eina_Bool password : 1;
- Eina_Bool show_last_character : 1;
- Eina_Bool editable : 1;
- Eina_Bool selection_asked : 1;
- Eina_Bool have_selection : 1;
- Eina_Bool selmode : 1;
- Eina_Bool deferred_cur : 1;
- Eina_Bool disabled : 1;
- Eina_Bool context_menu : 1;
- Eina_Bool bgcolor : 1;
- Eina_Bool ellipsis : 1;
- Eina_Bool autoreturnkey : 1;
-};
-
-struct _Elm_Entry_Context_Menu_Item
-{
- Evas_Object *obj;
- const char *label;
- const char *icon_file;
- const char *icon_group;
- Elm_Icon_Type icon_type;
- Evas_Smart_Cb func;
- void *data;
-};
-
-
-static void
-_store_selection(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- const char *sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
- if (!wd) return;
- if (wd->cut_sel) eina_stringshare_del(wd->cut_sel);
- wd->cut_sel = eina_stringshare_add(sel);
-}
+Elm_Entry_Extension_data *ext_mod;
static void
_ctxpopup_position(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord cx, cy, cw, ch, x, y, mw, mh;
- if (!wd) return;
- evas_object_geometry_get(wd->ent, &x, &y, NULL, NULL);
- edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
+ evas_object_geometry_get(ext_mod->ent, &x, &y, NULL, NULL);
+ edje_object_part_text_cursor_geometry_get(ext_mod->ent, "elm.text",
&cx, &cy, &cw, &ch);
- evas_object_size_hint_min_get(wd->ctxpopup, &mw, &mh);
+ evas_object_size_hint_min_get(ext_mod->popup, &mw, &mh);
if (cw < mw)
{
cx += (cw - mw) / 2;
cy += (ch - mh) / 2;
ch = mh;
}
- evas_object_move(wd->ctxpopup, x + cx, y + cy);
- evas_object_resize(wd->ctxpopup, cw, ch);
+ evas_object_move(ext_mod->popup, x + cx, y + cy);
+ evas_object_resize(ext_mod->popup, cw, ch);
}
static void
_select(void *data, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = elm_widget_data_get(data);
- wd->selmode = EINA_TRUE;
- edje_object_part_text_select_none(wd->ent, "elm.text");
- edje_object_part_text_select_allow_set(wd->ent, "elm.text", 1);
- if (!wd->password)
- edje_object_signal_emit(wd->ent, "elm,state,select,on", "elm");
- elm_ctxpopup_scroller_disabled_set(obj, EINA_FALSE);
- elm_widget_scroll_hold_push(data);
+ ext_mod->select(data,obj,event_info);
evas_object_hide(obj);
}
static void
_paste(void *data, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- evas_object_smart_callback_call(data, "selection,paste", NULL);
- if (wd->sel_notify_handler)
- {
-#ifdef HAVE_ELEMENTARY_X
- Evas_Object *top;
-
- top = elm_widget_top_get(data);
- if ((top) && (elm_win_xwindow_get(top)))
- {
- ecore_x_selection_primary_request
- (elm_win_xwindow_get(top),
- ECORE_X_SELECTION_TARGET_UTF8_STRING);
- wd->selection_asked = EINA_TRUE;
- }
-#endif
- }
- elm_ctxpopup_scroller_disabled_set(obj, EINA_FALSE);
+ ext_mod->paste(data,obj,event_info);
evas_object_hide(obj);
}
static void
_cut(void *data, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = elm_widget_data_get(data);
- wd->selmode = EINA_FALSE;
- edje_object_part_text_select_allow_set(wd->ent, "elm.text", 0);
- edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
- elm_ctxpopup_scroller_disabled_set(obj, EINA_FALSE);
- elm_widget_scroll_hold_pop(data);
- _store_selection(data);
- edje_object_part_text_insert(wd->ent, "elm.text", "");
- edje_object_part_text_select_none(wd->ent, "elm.text");
- evas_object_hide(obj);
+ ext_mod->cut(data,obj,event_info);
+ evas_object_hide(obj);
}
static void
_copy(void *data, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- wd->selmode = EINA_FALSE;
- edje_object_part_text_select_allow_set(wd->ent, "elm.text", 0);
- edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
- elm_ctxpopup_scroller_disabled_set(obj, EINA_FALSE);
- elm_widget_scroll_hold_pop(data);
- _store_selection(data);
- edje_object_part_text_select_none(wd->ent, "elm.text");
- evas_object_hide(obj);
+ ext_mod->copy(data,obj,event_info);
+ evas_object_hide(obj);
}
static void
_cancel(void *data, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- wd->selmode = EINA_FALSE;
- edje_object_part_text_select_allow_set(wd->ent, "elm.text", 0);
- edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
- elm_ctxpopup_scroller_disabled_set(obj, EINA_FALSE);
- elm_widget_scroll_hold_pop(data);
- edje_object_part_text_select_none(wd->ent, "elm.text");
+ ext_mod->cancel(data,obj,event_info);
evas_object_hide(obj);
}
Elm_Entry_Context_Menu_Item *it = data;
Evas_Object *obj2 = it->obj;
- if (it->func) it->func(it->data, obj2, NULL);
+ if (it->func) it->func(it->data, obj2, NULL);
+ evas_object_hide(obj);
}
// module api funcs needed
EAPI void
obj_hook(Evas_Object *obj)
{
-
+ ext_mod = ELM_NEW(Elm_Entry_Extension_data);
+ elm_entry_extension_module_data_get(obj,ext_mod);
}
EAPI void
obj_unhook(Evas_Object *obj)
{
-
+ if(ext_mod)
+ free(ext_mod);
}
EAPI void
obj_longpress(Evas_Object *obj)
-{
-
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Object *top;
- const Eina_List *l;
- const Elm_Entry_Context_Menu_Item *it;
- const char *context_menu_orientation;
-
- if (wd->ctxpopup) evas_object_del(wd->ctxpopup);
- else elm_widget_scroll_freeze_push(obj);
- top = elm_widget_top_get(obj);
- if(top)
- wd->ctxpopup = elm_ctxpopup_add(top);
- elm_object_style_set(wd->ctxpopup,"entry");
- elm_ctxpopup_scroller_disabled_set(wd->ctxpopup, EINA_TRUE);
- context_menu_orientation = edje_object_data_get
- (wd->ent, "context_menu_orientation");
- if ((context_menu_orientation) &&
- (!strcmp(context_menu_orientation, "horizontal")))
- elm_ctxpopup_horizontal_set(wd->ctxpopup, EINA_TRUE);
-
- elm_widget_sub_object_add(obj, wd->ctxpopup);
- if (!wd->selmode)
- {
- if (!wd->password)
- elm_ctxpopup_label_add(wd->ctxpopup, "Select",_select, obj );
- if (1) // need way to detect if someone has a selection
- {
- if (wd->editable)
- elm_ctxpopup_label_add(wd->ctxpopup, "Paste", _paste, obj );
- }
- // elm_ctxpopup_label_add(wd->ctxpopup, "Selectall",_select_all, obj );
+{
+ if(!ext_mod) return;
+ Evas_Object *top;
+ const Eina_List *l;
+ const Elm_Entry_Context_Menu_Item *it;
+ const char *context_menu_orientation;
+
+ /*update*/
+ elm_entry_extension_module_data_get(obj,ext_mod);
+
+ if (ext_mod->popup) evas_object_del(ext_mod->popup);
+ else elm_widget_scroll_freeze_push(obj);
+ top = elm_widget_top_get(obj);
+ if(top)
+ ext_mod->popup = elm_ctxpopup_add(top);
+ elm_object_style_set(ext_mod->popup,"entry");
+ elm_ctxpopup_scroller_disabled_set(ext_mod->popup, EINA_TRUE);
+ 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_label_add(ext_mod->popup, "Select",_select, obj );
+ if (1) // need way to detect if someone has a selection
+ {
+ if (ext_mod->editable)
+ elm_ctxpopup_label_add(ext_mod->popup, "Paste", _paste, obj );
}
- else
+ // elm_ctxpopup_label_add(wd->ctxpopup, "Selectall",_select_all, obj );
+ }
+ else
+ {
+ if (!ext_mod->password)
{
- if (!wd->password)
+ if (ext_mod->have_selection)
{
- if (wd->have_selection)
- {
- elm_ctxpopup_label_add(wd->ctxpopup, "Copy",_copy, obj );
- if (wd->editable)
- elm_ctxpopup_label_add(wd->ctxpopup, "Cut",_cut, obj );
- }
- else
+ elm_ctxpopup_label_add(ext_mod->popup, "Copy",_copy, obj );
+ if (ext_mod->editable)
+ elm_ctxpopup_label_add(ext_mod->popup, "Cut",_cut, obj );
+ }
+ else
+ {
+ _cancel(obj,ext_mod->popup,NULL);
+ elm_ctxpopup_label_add(ext_mod->popup, "Select",_select, obj );
+ if (1) // need way to detect if someone has a selection
{
- _cancel(obj,wd->ctxpopup,NULL);
- if (1) // need way to detect if someone has a selection
- {
- if (wd->editable)
- elm_ctxpopup_label_add(wd->ctxpopup, "Paste", _paste, obj );
- }
- elm_ctxpopup_label_add(wd->ctxpopup, "Select",_select, obj );
+ if (ext_mod->editable)
+ elm_ctxpopup_label_add(ext_mod->popup, "Paste", _paste, obj );
}
}
}
- EINA_LIST_FOREACH(wd->items, l, it)
- {
- elm_ctxpopup_label_add(wd->ctxpopup, it->label,_item_clicked, it );
- }
- if (wd->ctxpopup)
- {
- _ctxpopup_position(obj);
- evas_object_show(wd->ctxpopup);
- }
- wd->longpress_timer = NULL;
+ }
+ EINA_LIST_FOREACH(ext_mod->items, l, it)
+ {
+ elm_ctxpopup_label_add(ext_mod->popup, it->label,_item_clicked, it );
+ }
+ if (ext_mod->popup)
+ {
+ _ctxpopup_position(obj);
+ evas_object_show(ext_mod->popup);
+ }
+ ext_mod->longpress_timer = NULL;
}
EAPI void
obj_mouseup(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->longpress_timer)
- {
- ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = NULL;
- if (wd->have_selection )
+/*update*/
+ elm_entry_extension_module_data_get(obj,ext_mod);
+ if (ext_mod->longpress_timer)
+ {
+ if (ext_mod->have_selection )
{
- _cancel(obj,wd->ctxpopup,NULL);
+ _cancel(obj,ext_mod->popup,NULL);
}
}
- else
+ else
{
- if (wd->have_selection )
+ if (ext_mod->have_selection )
{
obj_longpress( obj );
}
#include <Elementary.h>
+#include "elm_module_priv.h"
#include "elm_priv.h"
-typedef struct _Mod_Api Mod_Api;
-typedef struct _Widget_Data Widget_Data;
-typedef struct _Elm_Entry_Context_Menu_Item Elm_Entry_Context_Menu_Item;
-struct _Widget_Data
-{
- Evas_Object *ent;
- Evas_Object *popup;/*copy paste UI - elm_popup*/
- Evas_Object *ctxpopup;/*copy paste UI - elm_ctxpopup*/
- Evas_Object *bg;
- Evas_Object *hoversel;
- Ecore_Job *deferred_recalc_job;
- Ecore_Event_Handler *sel_notify_handler;
- Ecore_Event_Handler *sel_clear_handler;
- Ecore_Timer *longpress_timer;
- const char *cut_sel;
- const char *text;
- Evas_Coord wrap_w;
- Evas_Coord lastw;
- Evas_Coord downx, downy;
- Evas_Coord cx, cy, cw, ch;
- Eina_List *items;
- Eina_List *item_providers;
- Mod_Api *api; // module api if supplied
- int max_no_of_bytes;
- Eina_Bool changed : 1;
- Eina_Bool linewrap : 1;
- Eina_Bool char_linewrap : 1;
- Eina_Bool single_line : 1;
- Eina_Bool password : 1;
- Eina_Bool show_last_character : 1;
- Eina_Bool editable : 1;
- Eina_Bool selection_asked : 1;
- Eina_Bool have_selection : 1;
- Eina_Bool selmode : 1;
- Eina_Bool deferred_cur : 1;
- Eina_Bool disabled : 1;
- Eina_Bool context_menu : 1;
- Eina_Bool bgcolor : 1;
- Eina_Bool ellipsis : 1;
- Eina_Bool autoreturnkey : 1;
-};
-
-
-struct _Elm_Entry_Context_Menu_Item
-{
- Evas_Object *obj;
- const char *label;
- const char *icon_file;
- const char *icon_group;
- Elm_Icon_Type icon_type;
- Evas_Smart_Cb func;
- void *data;
-};
-
-
-static void
-_store_selection(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- const char *sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
- if (!wd) return;
- if (wd->cut_sel) eina_stringshare_del(wd->cut_sel);
- wd->cut_sel = eina_stringshare_add(sel);
-}
+Elm_Entry_Extension_data *ext_mod;
static void
_select(void *data, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = elm_widget_data_get(data);
- wd->selmode = EINA_TRUE;
- edje_object_part_text_select_none(wd->ent, "elm.text");
- edje_object_part_text_select_allow_set(wd->ent, "elm.text", 1);
- if (!wd->password)
- edje_object_signal_emit(wd->ent, "elm,state,select,on", "elm");
- elm_widget_scroll_hold_push(data);
- evas_object_hide(wd->popup);
+ ext_mod->select(data,obj,event_info);
+ evas_object_hide(ext_mod->popup);
}
static void
_paste(void *data, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- evas_object_smart_callback_call(data, "selection,paste", NULL);
- if (wd->sel_notify_handler)
- {
-#ifdef HAVE_ELEMENTARY_X
- Evas_Object *top;
-
- top = elm_widget_top_get(data);
- if ((top) && (elm_win_xwindow_get(top)))
- {
- ecore_x_selection_primary_request
- (elm_win_xwindow_get(top),
- ECORE_X_SELECTION_TARGET_UTF8_STRING);
- wd->selection_asked = EINA_TRUE;
- }
-#endif
- }
- evas_object_hide(wd->popup);
+ ext_mod->paste(data,obj,event_info);
+ evas_object_hide(ext_mod->popup);
}
static void
_cut(void *data, Evas_Object *obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- wd->selmode = EINA_FALSE;
- edje_object_part_text_select_allow_set(wd->ent, "elm.text", 0);
- edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
- elm_widget_scroll_hold_pop(data);
- _store_selection(data);
- edje_object_part_text_insert(wd->ent, "elm.text", "");
- edje_object_part_text_select_none(wd->ent, "elm.text");
- evas_object_hide(wd->popup);
+{
+ ext_mod->cut(data,obj,event_info);
+ evas_object_hide(ext_mod->popup);
}
static void
_copy(void *data, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- wd->selmode = EINA_FALSE;
- edje_object_part_text_select_allow_set(wd->ent, "elm.text", 0);
- edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
- elm_widget_scroll_hold_pop(data);
- _store_selection(data);
- edje_object_part_text_select_none(wd->ent, "elm.text");
- evas_object_hide(wd->popup);
+ ext_mod->copy(data,obj,event_info);
+ evas_object_hide(ext_mod->popup);
}
static void
_cancel(void *data, Evas_Object *obj, void *event_info)
{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- wd->selmode = EINA_FALSE;
- edje_object_part_text_select_allow_set(wd->ent, "elm.text", 0);
- edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
- elm_widget_scroll_hold_pop(data);
- edje_object_part_text_select_none(wd->ent, "elm.text");
- evas_object_hide(wd->popup);
+ ext_mod->cancel(data,obj,event_info);
+ evas_object_hide(ext_mod->popup);
}
static void
Elm_Entry_Context_Menu_Item *it = data;
Evas_Object *obj2 = it->obj;
- if (it->func) it->func(it->data, obj2, NULL);
+ if (it->func) it->func(it->data, obj2, NULL);
+ evas_object_hide(ext_mod->popup);
}
// module api funcs needed
EAPI void
obj_hook(Evas_Object *obj)
{
-
+ ext_mod = ELM_NEW(Elm_Entry_Extension_data);
+ elm_entry_extension_module_data_get(obj,ext_mod);
}
EAPI void
obj_unhook(Evas_Object *obj)
{
-
+ if(ext_mod)
+ free(ext_mod);
}
EAPI void
obj_longpress(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Object *top;
- const Eina_List *l;
- Evas_Object *list;
- const Elm_Entry_Context_Menu_Item *it;
-
- if (wd->popup) evas_object_del(wd->popup);
- else elm_widget_scroll_freeze_push(obj);
- top = elm_widget_top_get(obj);
- if(top)
- wd->popup = elm_popup_add(top);
- elm_object_style_set(wd->popup,"menustyle");
- elm_popup_set_mode(wd->popup, ELM_POPUP_TYPE_ALERT);
- elm_popup_title_label_set(wd->popup,"CopyPaste");
- list = elm_list_add(wd->popup);
- elm_object_style_set(list,"popup");
- elm_list_horizontal_mode_set(list, ELM_LIST_COMPRESS);
- elm_widget_sub_object_add(obj, wd->popup);
- if (!wd->selmode)
- {
- if (!wd->password)
- elm_list_item_append(list, "Select", NULL, NULL,_select, obj);
-
- if (1) // need way to detect if someone has a selection
- {
- if (wd->editable)
- elm_list_item_append(list, "Paste", NULL, NULL,_paste, obj);
-
- }
- //elm_list_item_append(list, "Selectall", NULL, NULL,_select_all, data);
+{
+ if(!ext_mod) return;
+ Evas_Object *top;
+ Evas_Object *list;
+
+ const Eina_List *l;
+ const Elm_Entry_Context_Menu_Item *it;
+
+ /*update*/
+ elm_entry_extension_module_data_get(obj,ext_mod);
+
+ if (ext_mod->popup) evas_object_del(ext_mod->popup);
+ else elm_widget_scroll_freeze_push(obj);
+ top = elm_widget_top_get(obj);
+ if(top)
+ ext_mod->popup = elm_popup_add(top);
+ elm_object_style_set(ext_mod->popup,"menustyle");
+ elm_popup_set_mode(ext_mod->popup, ELM_POPUP_TYPE_ALERT);
+ elm_popup_title_label_set(ext_mod->popup,"CopyPaste");
+ list = elm_list_add(ext_mod->popup);
+ elm_object_style_set(list,"popup");
+ elm_list_horizontal_mode_set(list, ELM_LIST_COMPRESS);
+ elm_widget_sub_object_add(obj, ext_mod->popup);
+ if (!ext_mod->selmode)
+ {
+ if (!ext_mod->password)
+ elm_list_item_append(list, "Select", NULL, NULL,_select, obj);
+ if (1) // need way to detect if someone has a selection
+ {
+ if (ext_mod->editable)
+ elm_list_item_append(list, "Paste", NULL, NULL,_paste, obj);
}
- else
+ // elm_ctxpopup_label_add(wd->ctxpopup, "Selectall",_select_all, obj );
+ }
+ else
+ {
+ if (!ext_mod->password)
{
- if (!wd->password)
+ if (ext_mod->have_selection)
{
- if (wd->have_selection)
- {
- elm_list_item_append(list, "Copy", NULL, NULL,_copy, obj);
- if (wd->editable)
- elm_list_item_append(list, "Cut", NULL, NULL,_cut, obj);
- }
- else
+ elm_list_item_append(list, "Copy", NULL, NULL,_copy, obj);
+ if (ext_mod->editable)
+ elm_list_item_append(list, "Cut", NULL, NULL,_cut, obj);
+ }
+ else
+ {
+ _cancel(obj,ext_mod->popup,NULL);
+ elm_list_item_append(list, "Select", NULL, NULL,_select, obj);
+ if (1) // need way to detect if someone has a selection
{
- _cancel(obj,wd->popup,NULL);
- if (1) // need way to detect if someone has a selection
- {
- if (wd->editable)
- elm_list_item_append(list, "Paste", NULL, NULL,_paste, obj);
- }
- elm_list_item_append(list, "Select", NULL, NULL,_select, obj);
+ if (ext_mod->editable)
+ elm_list_item_append(list, "Paste", NULL, NULL,_paste, obj);
}
}
}
- EINA_LIST_FOREACH(wd->items, l, it)
- {
- elm_list_item_append(list, it->label, NULL, NULL,_item_clicked, it);
- }
- if (wd->popup)
- {
- elm_list_go(list);
- elm_popup_content_set(wd->popup, list);
- evas_object_show(wd->popup);
- evas_render( evas_object_evas_get( wd->popup ) );
- }
- wd->longpress_timer = NULL;
+ }
+ EINA_LIST_FOREACH(ext_mod->items, l, it)
+ {
+ elm_list_item_append(list, it->label,NULL,NULL, _item_clicked, it);
+ }
+ if (ext_mod->popup)
+ {
+ elm_list_go(list);
+ elm_popup_content_set(ext_mod->popup, list);
+ evas_object_show(ext_mod->popup);
+ evas_render( evas_object_evas_get( ext_mod->popup ) );
+ }
+ ext_mod->longpress_timer = NULL;
}
EAPI void
obj_mouseup(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->longpress_timer)
+/*update*/
+ elm_entry_extension_module_data_get(obj,ext_mod);
+ if (ext_mod->longpress_timer)
{
- ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = NULL;
- if (wd->have_selection )
+ if (ext_mod->have_selection )
{
- _cancel(obj,wd->popup,NULL);
+ _cancel(obj,ext_mod->popup,NULL);
}
}
}
-