jackdanielz pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=ce701e61651202fe0408219869f1c3ca71726d94
commit ce701e61651202fe0408219869f1c3ca71726d94 Author: Daniel Zaoui <daniel.za...@samsung.com> Date: Tue Mar 25 14:00:33 2014 +0200 Eolian: Integration of Popup --- src/lib/Makefile.am | 10 +- src/lib/elc_popup.c | 469 ++++++++++----------------------------------- src/lib/elc_popup.eo | 193 +++++++++++++++++++ src/lib/elc_popup_eo.h | 3 + src/lib/elm_widget_popup.h | 6 +- 5 files changed, 312 insertions(+), 369 deletions(-) diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index bd68953..4c61a86 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -628,7 +628,9 @@ BUILT_SOURCES = \ elc_player.eo.c \ elc_player.eo.h \ elm_plug.eo.c \ - elm_plug.eo.h + elm_plug.eo.h \ + elc_popup.eo.c \ + elc_popup.eo.h EXTRA_DIST += \ elm_widget.eo \ @@ -682,7 +684,8 @@ EXTRA_DIST += \ elm_photocam_pan.eo \ elm_photo.eo \ elc_player.eo \ - elm_plug.eo + elm_plug.eo \ + elc_popup.eo nodist_includesunstable_HEADERS = \ elm_widget.eo.h \ @@ -736,5 +739,6 @@ nodist_includesunstable_HEADERS = \ elm_photocam_pan.eo.h \ elm_photo.eo.h \ elc_player.eo.h \ - elm_plug.eo.h + elm_plug.eo.h \ + elc_popup.eo.h diff --git a/src/lib/elc_popup.c b/src/lib/elc_popup.c index 6ecb8a4..bae62bc 100644 --- a/src/lib/elc_popup.c +++ b/src/lib/elc_popup.c @@ -6,8 +6,6 @@ #include "elm_priv.h" #include "elm_widget_popup.h" -EAPI Eo_Op ELM_OBJ_POPUP_BASE_ID = EO_NOOP; - #define MY_CLASS ELM_OBJ_POPUP_CLASS #define MY_CLASS_NAME "Elm_Popup" @@ -40,11 +38,9 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { static void _on_content_del(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void -_elm_popup_smart_translate(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elc_popup_elm_widget_translate(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd) { - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - Elm_Popup_Smart_Data *sd = _pd; Elm_Popup_Item *it; Eina_List *l; @@ -53,7 +49,7 @@ _elm_popup_smart_translate(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list * eo_do_super(obj, MY_CLASS, elm_obj_widget_translate(NULL)); - if (ret) *ret = EINA_TRUE; + return EINA_TRUE; } static void @@ -185,7 +181,7 @@ _size_hints_changed_cb(void *data, } static void -_list_del(Elm_Popup_Smart_Data *sd) +_list_del(Elc_Popup_Data *sd) { if (!sd->scr) return; @@ -199,7 +195,7 @@ _list_del(Elm_Popup_Smart_Data *sd) } static void -_items_remove(Elm_Popup_Smart_Data *sd) +_items_remove(Elc_Popup_Data *sd) { Elm_Popup_Item *it; @@ -211,12 +207,11 @@ _items_remove(Elm_Popup_Smart_Data *sd) sd->items = NULL; } -static void -_elm_popup_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_elc_popup_evas_smart_del(Eo *obj, Elc_Popup_Data *sd) { unsigned int i; - Elm_Popup_Smart_Data *sd = _pd; evas_object_smart_callback_del (sd->notify, "block,clicked", _block_clicked_cb); @@ -312,23 +307,19 @@ _access_obj_process(Eo *obj, Eina_Bool is_access) } } -static void -_elm_popup_smart_theme(Eo *obj, void *_pd, va_list *list) +EOLIAN static Eina_Bool +_elc_popup_elm_widget_theme_apply(Eo *obj, Elc_Popup_Data *sd) { Elm_Popup_Item *it; unsigned int i = 0; Eina_List *elist; char buf[1024], style[1024]; - Eina_Bool int_ret; - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - if (ret) *ret = EINA_FALSE; - Elm_Popup_Smart_Data *sd = _pd; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); eo_do_super(obj, MY_CLASS, elm_obj_widget_theme_apply(&int_ret)); - if (!int_ret) return; + if (!int_ret) return EINA_FALSE; _mirrored_set(obj, elm_widget_mirrored_get(obj)); @@ -396,7 +387,7 @@ _elm_popup_smart_theme(Eo *obj, void *_pd, va_list *list) /* access */ if (_elm_config->access_mode) _access_obj_process(obj, EINA_TRUE); - if (ret) *ret = EINA_TRUE; + return EINA_TRUE; } static void @@ -411,15 +402,14 @@ _item_sizing_eval(Elm_Popup_Item *it) evas_object_size_hint_max_set(edje, max_w, max_h); } -static void -_elm_popup_smart_sizing_eval(Eo *obj, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_elc_popup_elm_layout_sizing_eval(Eo *obj, Elc_Popup_Data *sd) { Eina_List *elist; Elm_Popup_Item *it; Evas_Coord h_box = 0, minh_box = 0; Evas_Coord minw = -1, minh = -1; - Elm_Popup_Smart_Data *sd = _pd; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); if (sd->items) @@ -444,21 +434,16 @@ _elm_popup_smart_sizing_eval(Eo *obj, void *_pd, va_list *list EINA_UNUSED) evas_object_size_hint_max_set(obj, -1, -1); } -static void -_elm_popup_smart_sub_object_del(Eo *obj, void *_pd, va_list *list) +EOLIAN static Eina_Bool +_elc_popup_elm_widget_sub_object_del(Eo *obj, Elc_Popup_Data *sd, Evas_Object *sobj) { Elm_Popup_Item *it; - - Evas_Object *sobj = va_arg(*list, Evas_Object *); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - if (ret) *ret = EINA_FALSE; Eina_Bool int_ret; - Elm_Popup_Smart_Data *sd = _pd; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); eo_do_super(obj, MY_CLASS, elm_obj_widget_sub_object_del(sobj, &int_ret)); - if (!int_ret) return; + if (!int_ret) return EINA_FALSE; if (sobj == sd->title_icon) { @@ -478,7 +463,7 @@ _elm_popup_smart_sub_object_del(Eo *obj, void *_pd, va_list *list) } } - if (ret) *ret = EINA_TRUE; + return EINA_TRUE; } static void @@ -1004,12 +989,9 @@ end: return EINA_TRUE; } -static void -_elm_popup_smart_text_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elc_popup_elm_layout_text_set(Eo *obj, Elc_Popup_Data *_pd EINA_UNUSED, const char *part, const char *label) { - const char *part = va_arg(*list, const char *); - const char *label = va_arg(*list, const char *); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); Eina_Bool int_ret; if (!part || !strcmp(part, "default")) @@ -1019,7 +1001,7 @@ _elm_popup_smart_text_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list) else eo_do_super(obj, MY_CLASS, elm_obj_layout_text_set(part, label, &int_ret)); - if (ret) *ret = int_ret; + return int_ret; } static const char * @@ -1043,18 +1025,19 @@ _content_text_get(const Evas_Object *obj) return str; } -static void -_elm_popup_smart_text_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static const char* +_elc_popup_elm_layout_text_get(Eo *obj, Elc_Popup_Data *_pd EINA_UNUSED, const char *part) { - const char *part = va_arg(*list, const char *); - const char **text = va_arg(*list, const char **); + const char *text; if (!part || !strcmp(part, "default")) - *text = _content_text_get(obj); + text = _content_text_get(obj); else if (!strcmp(part, "title,text")) - *text = _title_text_get(obj); + text = _title_text_get(obj); else - eo_do_super(obj, MY_CLASS, elm_obj_layout_text_get(part, text)); + eo_do_super(obj, MY_CLASS, elm_obj_layout_text_get(part, &text)); + + return text; } static Eina_Bool @@ -1189,20 +1172,15 @@ _action_button_set(Evas_Object *obj, elm_layout_sizing_eval(obj); } -static void -_elm_popup_smart_content_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elc_popup_elm_container_content_set(Eo *obj, Elc_Popup_Data *_pd EINA_UNUSED, const char *part, Evas_Object *content) { - const char *part = va_arg(*list, const char *); - Evas_Object *content = va_arg(*list, Evas_Object *); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - Eina_Bool int_ret; - unsigned int i; if (!part || !strcmp(part, "default")) - int_ret = _content_set(obj, content); + return _content_set(obj, content); else if (!strcmp(part, "title,icon")) - int_ret = _title_icon_set(obj, content); + return _title_icon_set(obj, content); else if (!strncmp(part, "button", 6)) { i = atoi(part + 6) - 1; @@ -1210,22 +1188,20 @@ _elm_popup_smart_content_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list) if (i >= ELM_POPUP_ACTION_BUTTON_MAX) { ERR("The part name is invalid! : popup=%p", obj); - int_ret = EINA_FALSE; - return; + return EINA_FALSE; } _action_button_set(obj, content, i); - - int_ret = EINA_TRUE; } else { + Eina_Bool int_ret; eo_do_super(obj, MY_CLASS, elm_obj_container_content_set(part, content, &int_ret)); + return int_ret; } - if (ret) *ret = int_ret; - return; + return EINA_TRUE; } static Evas_Object * @@ -1259,15 +1235,12 @@ _action_button_get(const Evas_Object *obj, return button; } -static void -_elm_popup_smart_content_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Evas_Object* +_elc_popup_elm_container_content_get(Eo *obj, Elc_Popup_Data *_pd EINA_UNUSED, const char *part) { Evas_Object *content = NULL; unsigned int i; - const char *part = va_arg(*list, const char *); - Evas_Object **ret = va_arg(*list, Evas_Object **); - if (!part || !strcmp(part, "default")) content = _content_get(obj); else if (!strcmp(part, "title,text")) @@ -1290,12 +1263,11 @@ _elm_popup_smart_content_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list) if (!content) goto err; - *ret = content; - return; + return content; err: WRN("The part name is invalid! : popup=%p", obj); - *ret = content; + return NULL; } static Evas_Object * @@ -1335,15 +1307,12 @@ _title_icon_unset(Evas_Object *obj) return icon; } -static void -_elm_popup_smart_content_unset(Eo *obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Evas_Object* +_elc_popup_elm_container_content_unset(Eo *obj, Elc_Popup_Data *_pd EINA_UNUSED, const char *part) { Evas_Object *content = NULL; unsigned int i; - const char *part = va_arg(*list, const char *); - Evas_Object **ret = va_arg(*list, Evas_Object **); - if (!part || !strcmp(part, "default")) content = _content_unset(obj); else if (!strcmp(part, "title,icon")) @@ -1360,36 +1329,27 @@ _elm_popup_smart_content_unset(Eo *obj, void *_pd EINA_UNUSED, va_list *list) else goto err; - *ret = content; - return; + return content; err: ERR("The part name is invalid! : popup=%p", obj); - *ret = content; + return NULL; } -static void -_elm_popup_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elc_popup_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elc_Popup_Data *_pd EINA_UNUSED) { - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - *ret = EINA_TRUE; + return EINA_TRUE; } -static void -_elm_popup_smart_focus_next(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static Eina_Bool +_elc_popup_elm_widget_focus_next(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd, Elm_Focus_Direction dir, Evas_Object **next) { Evas_Object *ao; Eina_List *items = NULL; Eina_List *base_items = NULL; - Elm_Popup_Smart_Data *sd = _pd; - - Elm_Focus_Direction dir = va_arg(*list, Elm_Focus_Direction); - Evas_Object **next = va_arg(*list, Evas_Object **); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - if (ret) *ret = EINA_TRUE; - /* access */ if (_elm_config->access_mode) { @@ -1421,30 +1381,21 @@ _elm_popup_smart_focus_next(Eo *obj EINA_UNUSED, void *_pd, va_list *list) *next = obj; eina_list_free(items); - return; + return EINA_TRUE; } -static void -_elm_popup_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elc_popup_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elc_Popup_Data *_pd EINA_UNUSED) { - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - *ret = EINA_TRUE; + return EINA_TRUE; } -static void -_elm_popup_smart_focus_direction(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static Eina_Bool +_elc_popup_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd, const Evas_Object *base, double degree, Evas_Object **direction, double *weight) { Evas_Object *ao; Eina_List *items = NULL; Eina_List *base_items = NULL; - Elm_Popup_Smart_Data *sd = _pd; - - Evas_Object *base = va_arg(*list, Evas_Object *); - double degree = va_arg(*list, double); - Evas_Object **direction = va_arg(*list, Evas_Object **); - double *weight = va_arg(*list, double *); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - if (ret) *ret = EINA_TRUE; /* access */ if (_elm_config->access_mode) @@ -1477,23 +1428,18 @@ _elm_popup_smart_focus_direction(Eo *obj EINA_UNUSED, void *_pd, va_list *list) (obj, base, items, eina_list_data_get, degree, direction, weight); eina_list_free(items); - return; + return EINA_TRUE; } -static void -_elm_popup_smart_event(Eo *obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elc_popup_elm_widget_event(Eo *obj, Elc_Popup_Data *_pd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info) { - Evas_Object *src = va_arg(*list, Evas_Object *); - Evas_Callback_Type type = va_arg(*list, Evas_Callback_Type); - Evas_Event_Key_Down *ev = va_arg(*list, void *); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - - if (ret) *ret = EINA_FALSE; (void)src; + Evas_Event_Key_Down *ev = event_info; - if (elm_widget_disabled_get(obj)) return; - if (type != EVAS_CALLBACK_KEY_DOWN) return; - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; if (!strcmp(ev->key, "Tab")) { @@ -1529,17 +1475,16 @@ _elm_popup_smart_event(Eo *obj, void *_pd EINA_UNUSED, va_list *list) goto success; } - return; + return EINA_FALSE; success: ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - if (ret) *ret = EINA_TRUE; + return EINA_TRUE; } -static void -_elm_popup_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_elc_popup_evas_smart_add(Eo *obj, Elc_Popup_Data *priv) { - Elm_Popup_Smart_Data *priv = _pd; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); char style[1024]; @@ -1601,19 +1546,15 @@ _elm_popup_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) edje_object_message_signal_process(wd->resize_obj); } -static void -_elm_popup_smart_parent_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void +_elc_popup_elm_widget_parent_set(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd, Evas_Object *parent) { - Elm_Popup_Smart_Data *sd = _pd; - Evas_Object *parent = va_arg(*list, Evas_Object *); - elm_notify_parent_set(sd->notify, parent); } -static void -_elm_popup_smart_access(Eo *obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static void +_elc_popup_elm_widget_access(Eo *obj, Elc_Popup_Data *_pd EINA_UNUSED, Eina_Bool is_access) { - Eina_Bool is_access = va_arg(*list, int); _access_obj_process(obj, is_access); } @@ -1630,8 +1571,8 @@ elm_popup_add(Evas_Object *parent) return obj; } -static void -_constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) +EOLIAN static void +_elc_popup_eo_base_constructor(Eo *obj, Elc_Popup_Data *_pd EINA_UNUSED) { eo_do_super(obj, MY_CLASS, eo_constructor()); eo_do(obj, @@ -1639,20 +1580,9 @@ _constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL)); } -EAPI void -elm_popup_content_text_wrap_type_set(Evas_Object *obj, - Elm_Wrap_Type wrap) -{ - ELM_POPUP_CHECK(obj); - eo_do(obj, elm_obj_popup_content_text_wrap_type_set(wrap)); -} - -static void -_content_text_wrap_type_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void +_elc_popup_content_text_wrap_type_set(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd, Elm_Wrap_Type wrap) { - Elm_Wrap_Type wrap = va_arg(*list, Elm_Wrap_Type); - Elm_Popup_Smart_Data *sd = _pd; - //Need to wrap the content text, so not allowing ELM_WRAP_NONE if (sd->content_text_wrap_type == ELM_WRAP_NONE) return; @@ -1661,22 +1591,10 @@ _content_text_wrap_type_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) elm_label_line_wrap_set(sd->text_content_obj, wrap); } -EAPI Elm_Wrap_Type -elm_popup_content_text_wrap_type_get(const Evas_Object *obj) +EOLIAN static Elm_Wrap_Type +_elc_popup_content_text_wrap_type_get(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd) { - ELM_POPUP_CHECK(obj) ELM_WRAP_LAST; - Elm_Wrap_Type ret = ELM_WRAP_LAST; - eo_do((Eo *) obj, elm_obj_popup_content_text_wrap_type_get(&ret)); - return ret; -} - -static void -_content_text_wrap_type_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - Elm_Wrap_Type *ret = va_arg(*list, Elm_Wrap_Type *); - Elm_Popup_Smart_Data *sd = _pd; - - *ret = sd->content_text_wrap_type; + return sd->content_text_wrap_type; } /* keeping old externals orient api for notify, but taking away the @@ -1764,178 +1682,66 @@ _elm_notify_orient_set(Evas_Object *obj, elm_notify_align_set(obj, horizontal, vertical); } -EAPI void -elm_popup_orient_set(Evas_Object *obj, - Elm_Popup_Orient orient) -{ - ELM_POPUP_CHECK(obj); - eo_do(obj, elm_obj_popup_orient_set(orient)); -} - -static void -_orient_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void +_elc_popup_orient_set(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd, Elm_Popup_Orient orient) { - Elm_Popup_Orient orient = va_arg(*list, Elm_Popup_Orient); - Elm_Popup_Smart_Data *sd = _pd; - if (orient >= ELM_POPUP_ORIENT_LAST) return; _elm_notify_orient_set(sd->notify, (Elm_Notify_Orient)orient); } -EAPI Elm_Popup_Orient -elm_popup_orient_get(const Evas_Object *obj) -{ - ELM_POPUP_CHECK(obj) - 1; - Elm_Popup_Orient ret = -1; - eo_do((Eo *) obj, elm_obj_popup_orient_get(&ret)); - return ret; -} - -static void -_orient_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - Elm_Popup_Orient *ret = va_arg(*list, Elm_Popup_Orient *); - Elm_Popup_Smart_Data *sd = _pd; - - *ret = (Elm_Popup_Orient)_elm_notify_orient_get(sd->notify); -} - -EAPI void -elm_popup_align_set(Evas_Object *obj, double horizontal, double vertical) +EOLIAN static Elm_Popup_Orient +_elc_popup_orient_get(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd) { - ELM_POPUP_CHECK(obj); - eo_do(obj, elm_obj_popup_align_set(horizontal, vertical)); + return (Elm_Popup_Orient)_elm_notify_orient_get(sd->notify); } -static void -_align_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void +_elc_popup_align_set(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd, double horizontal, double vertical) { - double horizontal = va_arg(*list, double); - double vertical = va_arg(*list, double); - Elm_Popup_Smart_Data *sd = _pd; - elm_notify_align_set(sd->notify, horizontal, vertical); } -EAPI void -elm_popup_align_get(const Evas_Object *obj, double *horizontal, double *vertical) -{ - ELM_POPUP_CHECK(obj); - eo_do((Eo *) obj, elm_obj_popup_align_get(horizontal, vertical)); -} - -static void -_align_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void +_elc_popup_align_get(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd, double *horizontal, double *vertical) { - double *horizontal = va_arg(*list, double *); - double *vertical = va_arg(*list, double *); - Elm_Popup_Smart_Data *sd = _pd; - elm_notify_align_get(sd->notify, horizontal, vertical); } -EAPI void -elm_popup_timeout_set(Evas_Object *obj, - double timeout) +EOLIAN static void +_elc_popup_timeout_set(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd, double timeout) { - ELM_POPUP_CHECK(obj); - eo_do(obj, elm_obj_popup_timeout_set(timeout)); -} - -static void -_timeout_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - double timeout = va_arg(*list, double); - Elm_Popup_Smart_Data *sd = _pd; - elm_notify_timeout_set(sd->notify, timeout); } -EAPI double -elm_popup_timeout_get(const Evas_Object *obj) -{ - ELM_POPUP_CHECK(obj) 0.0; - double ret = 0.0; - eo_do((Eo *) obj, elm_obj_popup_timeout_get(&ret)); - return ret; -} - -static void -_timeout_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - double *ret = va_arg(*list, double *); - Elm_Popup_Smart_Data *sd = _pd; - - *ret = elm_notify_timeout_get(sd->notify); -} - -EAPI void -elm_popup_allow_events_set(Evas_Object *obj, - Eina_Bool allow) +EOLIAN static double +_elc_popup_timeout_get(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd) { - ELM_POPUP_CHECK(obj); - eo_do(obj, elm_obj_popup_allow_events_set(allow)); + return elm_notify_timeout_get(sd->notify); } -static void -_allow_events_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void +_elc_popup_allow_events_set(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd, Eina_Bool allow) { - Eina_Bool allow = va_arg(*list, int); - Eina_Bool allow_events = !!allow; - Elm_Popup_Smart_Data *sd = _pd; elm_notify_allow_events_set(sd->notify, allow_events); } -EAPI Eina_Bool -elm_popup_allow_events_get(const Evas_Object *obj) +EOLIAN static Eina_Bool +_elc_popup_allow_events_get(Eo *obj EINA_UNUSED, Elc_Popup_Data *sd) { - ELM_POPUP_CHECK(obj) EINA_FALSE; - Eina_Bool ret = EINA_FALSE; - eo_do((Eo *) obj, elm_obj_popup_allow_events_get(&ret)); - return ret; + return elm_notify_allow_events_get(sd->notify); } -static void -_allow_events_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static Elm_Object_Item* +_elc_popup_item_append(Eo *obj, Elc_Popup_Data *sd, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data) { - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - Elm_Popup_Smart_Data *sd = _pd; - - *ret = elm_notify_allow_events_get(sd->notify); -} - -EAPI Elm_Object_Item * -elm_popup_item_append(Evas_Object *obj, - const char *label, - Evas_Object *icon, - Evas_Smart_Cb func, - const void *data) -{ - ELM_POPUP_CHECK(obj) NULL; - Elm_Object_Item *ret = NULL; - eo_do(obj, elm_obj_popup_item_append(label, icon, func, data, &ret)); - return ret; -} - -static void -_item_append(Eo *obj, void *_pd, va_list *list) -{ - const char *label = va_arg(*list, const char *); - Evas_Object *icon = va_arg(*list, Evas_Object *); - Evas_Smart_Cb func = va_arg(*list, Evas_Smart_Cb); - const void *data = va_arg(*list, const void *); - Elm_Object_Item **ret = va_arg(*list, Elm_Object_Item **); - if (ret) *ret = NULL; - Evas_Object *prev_content; Elm_Popup_Item *it; - Elm_Popup_Smart_Data *sd = _pd; it = elm_widget_item_new(obj, Elm_Popup_Item); - if (!it) return; + if (!it) return NULL; if (sd->content || sd->text_content_obj) { prev_content = elm_layout_content_get @@ -1960,76 +1766,13 @@ _item_append(Eo *obj, void *_pd, va_list *list) _scroller_size_calc(obj); elm_layout_sizing_eval(obj); - if (ret) *ret = (Elm_Object_Item *)it; + return (Elm_Object_Item *)it; } static void -_class_constructor(Eo_Class *klass) -{ - const Eo_Op_Func_Description func_desc[] = { - EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor), - - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_popup_smart_add), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _elm_popup_smart_del), - - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_PARENT_SET), _elm_popup_smart_parent_set), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_EVENT), _elm_popup_smart_event), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_THEME_APPLY), _elm_popup_smart_theme), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_TRANSLATE), _elm_popup_smart_translate), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_popup_smart_focus_next_manager_is), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_NEXT), _elm_popup_smart_focus_next), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_ACCESS), _elm_popup_smart_access), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_popup_smart_focus_direction_manager_is), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_DIRECTION), _elm_popup_smart_focus_direction), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_SUB_OBJECT_DEL), _elm_popup_smart_sub_object_del), - - EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SET), _elm_popup_smart_content_set), - EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_GET), _elm_popup_smart_content_get), - EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_UNSET), _elm_popup_smart_content_unset), - - EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_TEXT_SET), _elm_popup_smart_text_set), - EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_TEXT_GET), _elm_popup_smart_text_get), - EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SIZING_EVAL), _elm_popup_smart_sizing_eval), - - EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_CONTENT_TEXT_WRAP_TYPE_SET), _content_text_wrap_type_set), - EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_CONTENT_TEXT_WRAP_TYPE_GET), _content_text_wrap_type_get), - EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ORIENT_SET), _orient_set), - EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ORIENT_GET), _orient_get), - EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_TIMEOUT_SET), _timeout_set), - EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_TIMEOUT_GET), _timeout_get), - EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_SET), _allow_events_set), - EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_GET), _allow_events_get), - EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND), _item_append), - EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALIGN_SET), _align_set), - EO_OP_FUNC(ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALIGN_GET), _align_get), - EO_OP_FUNC_SENTINEL - }; - eo_class_funcs_set(klass, func_desc); - +_elc_popup_class_constructor(Eo_Class *klass) +{ evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); } -static const Eo_Op_Description op_desc[] = { - EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_CONTENT_TEXT_WRAP_TYPE_SET, "Sets the wrapping type of content text packed in content."), - EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_CONTENT_TEXT_WRAP_TYPE_GET, "Returns the wrapping type of content text packed in content area of."), - EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ORIENT_SET, "Sets the orientation of the popup in the parent region."), - EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ORIENT_GET, "Returns the orientation of Popup."), - EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_TIMEOUT_SET, "Sets a timeout to hide popup automatically."), - EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_TIMEOUT_GET, "Returns the timeout value set to the popup (in seconds)."), - EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_SET, "Sets whether events should be passed to by a click outside."), - EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ALLOW_EVENTS_GET, "Returns value indicating whether allow event is enabled or not."), - EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ITEM_APPEND, "Add a new item to a Popup object."), - EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ALIGN_SET, "Set the popup alignment relative to its parent."), - EO_OP_DESCRIPTION(ELM_OBJ_POPUP_SUB_ID_ALIGN_GET, "Return the popup alignment relative to its parent."), - EO_OP_DESCRIPTION_SENTINEL -}; -static const Eo_Class_Description class_desc = { - EO_VERSION, - MY_CLASS_NAME, - EO_CLASS_TYPE_REGULAR, - EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_POPUP_BASE_ID, op_desc, ELM_OBJ_POPUP_SUB_ID_LAST), - NULL, - sizeof(Elm_Popup_Smart_Data), - _class_constructor, - NULL -}; -EO_DEFINE_CLASS(elm_obj_popup_class_get, &class_desc, ELM_OBJ_LAYOUT_CLASS, NULL); + +#include "elc_popup.eo.c" diff --git a/src/lib/elc_popup.eo b/src/lib/elc_popup.eo new file mode 100644 index 0000000..fdb189b --- /dev/null +++ b/src/lib/elc_popup.eo @@ -0,0 +1,193 @@ +class Elc_Popup (Elm_Layout) +{ + eo_prefix: elm_obj_popup; + legacy_prefix: elm_popup; + properties { + align { + set { + /*@ + @brief Set the alignment of the popup object + Sets the alignment in which the popup will appear in its parent. + + @see elm_popup_align_get() + + @since 1.9 + @ingroup Popup */ + } + get { + /*@ + @brief Get the alignment of the popup object + @see elm_popup_align_set() + + @since 1.9 + @ingroup Popup */ + } + values { + double horizontal; /*@ The horizontal alignment of the popup */ + double vertical; /*@ The vertical alignment of the popup */ + } + } + allow_events { + set { + /*@ + @brief Sets whether events should be passed to by a click outside. + + Enabling allow event will remove the Blocked event area and events will + pass to the lower layer objects otherwise they are blocked. + + @ingroup Popup + @see elm_popup_allow_events_get() + @note The default value is EINA_FALSE. */ + } + get { + /*@ + @brief Returns value indicating whether allow event is enabled or not + + @return @c EINA_FALSE if Blocked event area is present else @c EINA_TRUE + + @ingroup Popup + @see elm_popup_allow_events_set() + @note By default the Blocked event area is present */ + } + values { + Eina_Bool allow; /*@ @c EINA_TRUE Events are passed to lower objects, else not */ + } + } + content_text_wrap_type { + set { + /*@ + @brief Sets the wrapping type of content text packed in content + area of popup object. + + @ingroup Popup + @see elm_popup_content_text_wrap_type_get() */ + } + get { + /*@ + @brief Returns the wrapping type of content text packed in content area of + popup object. + + @return wrap type of the content text + + @ingroup Popup + @see elm_popup_content_text_wrap_type_set */ + } + values { + Elm_Wrap_Type wrap; /*@ wrapping type of type Elm_Wrap_Type */ + } + } + orient { + set { + /*@ + @brief Sets the orientation of the popup in the parent region + + Sets the position in which popup will appear in its parent. By default, + #ELM_POPUP_ORIENT_CENTER is set. + + @ingroup Popup + @see @ref Elm_Popup_Orient for possible values. */ + } + get { + /*@ + @brief Returns the orientation of Popup + + @return the orientation of the popup + + @ingroup Popup + @see elm_popup_orient_set() + @see Elm_Popup_Orient */ + } + values { + Elm_Popup_Orient orient; /*@ the orientation of the popup */ + } + } + timeout { + set { + /*@ + @brief Sets a timeout to hide popup automatically + + This function sets a timeout and starts the timer controlling when the + popup is hidden. Since calling evas_object_show() on a popup restarts + the timer controlling when it is hidden, setting this before the + popup is shown will in effect mean starting the timer when the popup is + shown. Smart signal "timeout" is called afterwards which can be handled + if needed. + + @note Set a value <= 0.0 to disable a running timer. + + @note If the value > 0.0 and the popup is previously visible, the + timer will be started with this value, canceling any running timer. + @ingroup Popup */ + } + get { + /*@ + @brief Returns the timeout value set to the popup (in seconds) + + @return the timeout value + + @ingroup Popup + @see elm_popup_timeout_set() */ + } + values { + double timeout; /*@ The timeout in seconds */ + } + } + } + methods { + item_append { + /*@ + @brief Add a new item to a Popup object + + Both an item list and a content could not be set at the same time! + once you add an item, the previous content will be removed. + + @return A handle to the item added or @c NULL, on errors + + @ingroup Popup + @warning When the first item is appended to popup object, any previous content + of the content area is deleted. At a time, only one of content, content-text + and item(s) can be there in a popup content area. */ + + return Elm_Object_Item *; + params { + @in const char *label; /*@ The Label of the new item */ + @in Evas_Object *icon; /*@ Icon to be set on new item */ + @in Evas_Smart_Cb func; /*@ Convenience function called when item selected */ + @in const void *data; /*@ Data passed to @p func above */ + } + } + } + implements { + class::constructor; + Eo_Base::constructor; + Evas_Smart::del; + Evas_Smart::add; + Elm_Widget::focus_direction; + Elm_Widget::focus_next_manager_is; + Elm_Widget::theme_apply; + Elm_Widget::focus_direction_manager_is; + Elm_Widget::access; + Elm_Widget::focus_next; + Elm_Widget::parent::set; + Elm_Widget::translate; + Elm_Widget::sub_object_del; + Elm_Widget::event; + Elm_Container::content_get; + Elm_Container::content_set; + Elm_Container::content_unset; + Elm_Layout::text_set; + Elm_Layout::text_get; + Elm_Layout::sizing_eval; + } + events { + block,clicked; + timeout; + item,focused; + item,unfocused; + language,changed; + access,changed; + focused; + unfocused; + } + +} diff --git a/src/lib/elc_popup_eo.h b/src/lib/elc_popup_eo.h index f1c8b1f..d552e0e 100644 --- a/src/lib/elc_popup_eo.h +++ b/src/lib/elc_popup_eo.h @@ -3,6 +3,8 @@ * * @{ */ +#include "elc_popup.eo.h" +#if 0 #define ELM_OBJ_POPUP_CLASS elm_obj_popup_class_get() const Eo_Class *elm_obj_popup_class_get(void) EINA_CONST; @@ -166,6 +168,7 @@ enum * @see elm_popup_align_get */ #define elm_obj_popup_align_get(horizontal, vertical) ELM_OBJ_POPUP_ID(ELM_OBJ_POPUP_SUB_ID_ALIGN_GET), EO_TYPECHECK(double *, horizontal), EO_TYPECHECK(double *, vertical) +#endif /** * @} */ diff --git a/src/lib/elm_widget_popup.h b/src/lib/elm_widget_popup.h index 5510ca9..7d374ad 100644 --- a/src/lib/elm_widget_popup.h +++ b/src/lib/elm_widget_popup.h @@ -22,8 +22,8 @@ typedef struct _Action_Area_Data Action_Area_Data; /** * Base layout smart data extended with popup instance data. */ -typedef struct _Elm_Popup_Smart_Data Elm_Popup_Smart_Data; -struct _Elm_Popup_Smart_Data +typedef struct _Elc_Popup_Data Elc_Popup_Data; +struct _Elc_Popup_Data { Evas_Object *notify; Evas_Object *title_icon; @@ -70,7 +70,7 @@ struct _Action_Area_Data */ #define ELM_POPUP_DATA_GET(o, sd) \ - Elm_Popup_Smart_Data * sd = eo_data_scope_get(o, ELM_OBJ_POPUP_CLASS) + Elc_Popup_Data * sd = eo_data_scope_get(o, ELM_OBJ_POPUP_CLASS) #define ELM_POPUP_DATA_GET_OR_RETURN(o, ptr) \ ELM_POPUP_DATA_GET(o, ptr); \ --