From 103bba48ebd2ae741a191c460c8cbc0f563a2349 Mon Sep 17 00:00:00 2001 From: hermet Date: Mon, 9 Jan 2012 08:37:29 +0000 Subject: [PATCH] elementary/hover - deprecated elm_hover_content_set/get/unset git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@66989 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- doc/widgets/widget_preview_hover.c | 3 +- src/bin/test_anchorblock.c | 10 +- src/bin/test_anchorview.c | 10 +- src/bin/test_hover.c | 20 ++-- src/examples/anchorblock_example_01.c | 12 +-- src/examples/hover_example_01.c | 8 +- src/examples/inwin_example.c | 2 +- src/lib/elc_hoversel.c | 4 +- src/lib/elm_deprecated.h | 62 +++++++++++ src/lib/elm_hover.c | 193 +++++++++++++++++----------------- src/lib/elm_hover.h | 89 ++++++---------- src/lib/elm_menu.c | 4 +- 12 files changed, 228 insertions(+), 189 deletions(-) diff --git a/doc/widgets/widget_preview_hover.c b/doc/widgets/widget_preview_hover.c index dd42336..48596de 100644 --- a/doc/widgets/widget_preview_hover.c +++ b/doc/widgets/widget_preview_hover.c @@ -6,8 +6,7 @@ evas_object_move(o, w/2, h/2); Evas_Object *lbl = elm_label_add(win); evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_text_set(lbl, "hover"); -elm_hover_content_set(o, "middle", lbl); - +elm_object_part_content_set(o, "middle", lbl); evas_object_show(o); diff --git a/src/bin/test_anchorblock.c b/src/bin/test_anchorblock.c index c3aa682..e73fc29 100644 --- a/src/bin/test_anchorblock.c +++ b/src/bin/test_anchorblock.c @@ -26,7 +26,7 @@ my_anchorblock_anchor(void *data, Evas_Object *obj, void *event_info) bt = elm_button_add(obj); elm_object_text_set(bt, ei->name); - elm_hover_content_set(ei->hover, "middle", bt); + elm_object_part_content_set(ei->hover, "middle", bt); evas_object_show(bt); // hints as to where we probably should put hover contents (buttons etc.). @@ -48,14 +48,14 @@ my_anchorblock_anchor(void *data, Evas_Object *obj, void *event_info) elm_box_pack_end(bx, bt); evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av); evas_object_show(bt); - elm_hover_content_set(ei->hover, "top", bx); + elm_object_part_content_set(ei->hover, "top", bx); evas_object_show(bx); } if (ei->hover_bottom) { bt = elm_button_add(obj); elm_object_text_set(bt, "Bot"); - elm_hover_content_set(ei->hover, "bottom", bt); + elm_object_part_content_set(ei->hover, "bottom", bt); evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av); evas_object_show(bt); } @@ -63,7 +63,7 @@ my_anchorblock_anchor(void *data, Evas_Object *obj, void *event_info) { bt = elm_button_add(obj); elm_object_text_set(bt, "Left"); - elm_hover_content_set(ei->hover, "left", bt); + elm_object_part_content_set(ei->hover, "left", bt); evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av); evas_object_show(bt); } @@ -71,7 +71,7 @@ my_anchorblock_anchor(void *data, Evas_Object *obj, void *event_info) { bt = elm_button_add(obj); elm_object_text_set(bt, "Right"); - elm_hover_content_set(ei->hover, "right", bt); + elm_object_part_content_set(ei->hover, "right", bt); evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av); evas_object_show(bt); } diff --git a/src/bin/test_anchorview.c b/src/bin/test_anchorview.c index 784b3ba..e7d709d 100644 --- a/src/bin/test_anchorview.c +++ b/src/bin/test_anchorview.c @@ -19,7 +19,7 @@ my_anchorview_anchor(void *data, Evas_Object *obj, void *event_info) bt = elm_button_add(obj); elm_object_text_set(bt, ei->name); - elm_hover_content_set(ei->hover, "middle", bt); + elm_object_part_content_set(ei->hover, "middle", bt); evas_object_show(bt); // hints as to where we probably should put hover contents (buttons etc.). @@ -41,14 +41,14 @@ my_anchorview_anchor(void *data, Evas_Object *obj, void *event_info) elm_box_pack_end(bx, bt); evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av); evas_object_show(bt); - elm_hover_content_set(ei->hover, "top", bx); + elm_object_part_content_set(ei->hover, "top", bx); evas_object_show(bx); } if (ei->hover_bottom) { bt = elm_button_add(obj); elm_object_text_set(bt, "Bot"); - elm_hover_content_set(ei->hover, "bottom", bt); + elm_object_part_content_set(ei->hover, "bottom", bt); evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av); evas_object_show(bt); } @@ -56,7 +56,7 @@ my_anchorview_anchor(void *data, Evas_Object *obj, void *event_info) { bt = elm_button_add(obj); elm_object_text_set(bt, "Left"); - elm_hover_content_set(ei->hover, "left", bt); + elm_object_part_content_set(ei->hover, "left", bt); evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av); evas_object_show(bt); } @@ -64,7 +64,7 @@ my_anchorview_anchor(void *data, Evas_Object *obj, void *event_info) { bt = elm_button_add(obj); elm_object_text_set(bt, "Right"); - elm_hover_content_set(ei->hover, "right", bt); + elm_object_part_content_set(ei->hover, "right", bt); evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av); evas_object_show(bt); } diff --git a/src/bin/test_hover.c b/src/bin/test_hover.c index be10a31..b7f7de0 100644 --- a/src/bin/test_hover.c +++ b/src/bin/test_hover.c @@ -41,7 +41,7 @@ test_hover(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info bt = elm_button_add(win); elm_object_text_set(bt, "Popup"); - elm_hover_content_set(hv, "middle", bt); + elm_object_part_content_set(hv, "middle", bt); evas_object_show(bt); bx = elm_box_add(win); @@ -67,21 +67,21 @@ test_hover(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info evas_object_show(bt); evas_object_show(bx); - elm_hover_content_set(hv, "top", bx); + elm_object_part_content_set(hv, "top", bx); bt = elm_button_add(win); elm_object_text_set(bt, "Bottom"); - elm_hover_content_set(hv, "bottom", bt); + elm_object_part_content_set(hv, "bottom", bt); evas_object_show(bt); bt = elm_button_add(win); elm_object_text_set(bt, "Left"); - elm_hover_content_set(hv, "left", bt); + elm_object_part_content_set(hv, "left", bt); evas_object_show(bt); bt = elm_button_add(win); elm_object_text_set(bt, "Right"); - elm_hover_content_set(hv, "right", bt); + elm_object_part_content_set(hv, "right", bt); evas_object_show(bt); evas_object_size_hint_min_set(bg, 160, 160); @@ -123,7 +123,7 @@ test_hover2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info bt = elm_button_add(win); elm_object_text_set(bt, "Popup"); - elm_hover_content_set(hv, "middle", bt); + elm_object_part_content_set(hv, "middle", bt); evas_object_show(bt); bx = elm_box_add(win); @@ -147,21 +147,21 @@ test_hover2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info elm_box_pack_end(bx, bt); evas_object_show(bt); evas_object_show(bx); - elm_hover_content_set(hv, "top", bx); + elm_object_part_content_set(hv, "top", bx); bt = elm_button_add(win); elm_object_text_set(bt, "Bot"); - elm_hover_content_set(hv, "bottom", bt); + elm_object_part_content_set(hv, "bottom", bt); evas_object_show(bt); bt = elm_button_add(win); elm_object_text_set(bt, "Left"); - elm_hover_content_set(hv, "left", bt); + elm_object_part_content_set(hv, "left", bt); evas_object_show(bt); bt = elm_button_add(win); elm_object_text_set(bt, "Right"); - elm_hover_content_set(hv, "right", bt); + elm_object_part_content_set(hv, "right", bt); evas_object_show(bt); evas_object_size_hint_min_set(bg, 160, 160); diff --git a/src/examples/anchorblock_example_01.c b/src/examples/anchorblock_example_01.c index 628319e..a7c6a14 100644 --- a/src/examples/anchorblock_example_01.c +++ b/src/examples/anchorblock_example_01.c @@ -138,7 +138,7 @@ _anchor_buttons_create(Evas_Object *ao, Elm_Entry_Anchorblock_Info *info, Evas_S { elm_object_text_set(btn, "Nothing to see here"); evas_object_smart_callback_add(btn, "clicked", btn_end_cb, ao); - elm_hover_content_set(info->hover, "middle", btn); + elm_object_part_content_set(info->hover, "middle", btn); return; } @@ -230,14 +230,14 @@ _anchor_buttons_create(Evas_Object *ao, Elm_Entry_Anchorblock_Info *info, Evas_S evas_object_smart_callback_add(btn, "clicked", btn_end_cb, ao); evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, str); - elm_hover_content_set(info->hover, "middle", btn); + elm_object_part_content_set(info->hover, "middle", btn); if (secondary) { if (info->hover_right) - elm_hover_content_set(info->hover, "right", secondary); + elm_object_part_content_set(info->hover, "right", secondary); else if (info->hover_left) - elm_hover_content_set(info->hover, "left", secondary); + elm_object_part_content_set(info->hover, "left", secondary); else evas_object_del(secondary); } @@ -245,9 +245,9 @@ _anchor_buttons_create(Evas_Object *ao, Elm_Entry_Anchorblock_Info *info, Evas_S if (box) { if (info->hover_bottom) - elm_hover_content_set(info->hover, "bottom", box); + elm_object_part_content_set(info->hover, "bottom", box); else if (info->hover_top) - elm_hover_content_set(info->hover, "top", box); + elm_object_part_content_set(info->hover, "top", box); else evas_object_del(box); } diff --git a/src/examples/hover_example_01.c b/src/examples/hover_example_01.c index 61af7aa..ec40f0b 100644 --- a/src/examples/hover_example_01.c +++ b/src/examples/hover_example_01.c @@ -63,10 +63,10 @@ elm_main(int argc, char **argv) elm_object_style_set(hover, "popout"); - elm_hover_content_set(hover, "left", rect); - elm_hover_content_set(hover, "top", rect2); - elm_hover_content_set(hover, "right", rect3); - elm_hover_content_set(hover, "middle", bt2); + elm_object_part_content_set(hover, "left", rect); + elm_object_part_content_set(hover, "top", rect2); + elm_object_part_content_set(hover, "right", rect3); + elm_object_part_content_set(hover, "middle", bt2); evas_object_smart_callback_add(bt, "clicked", _show_hover, hover); evas_object_smart_callback_add(bt2, "clicked", _hide_hover, hover); diff --git a/src/examples/inwin_example.c b/src/examples/inwin_example.c index 9d464ac..bb9b151 100644 --- a/src/examples/inwin_example.c +++ b/src/examples/inwin_example.c @@ -99,7 +99,7 @@ _win_del_cb(void *data __UNUSED__, Evas_Object *obj, void *event __UNUSED__) inwin = NULL; hover = elm_hover_add(obj); elm_hover_target_set(hover, obj); - elm_hover_content_set(hover, "middle", o); + elm_object_part_content_set(hover, "middle", o); evas_object_show(hover); return; } diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c index 4c1c3d8..0fb3500 100644 --- a/src/lib/elc_hoversel.c +++ b/src/lib/elc_hoversel.c @@ -218,12 +218,12 @@ _activate(Evas_Object *obj) } if (wd->horizontal) - elm_hover_content_set(wd->hover, + elm_object_part_content_set(wd->hover, elm_hover_best_content_location_get(wd->hover, ELM_HOVER_AXIS_HORIZONTAL), bx); else - elm_hover_content_set(wd->hover, + elm_object_part_content_set(wd->hover, elm_hover_best_content_location_get(wd->hover, ELM_HOVER_AXIS_VERTICAL), bx); diff --git a/src/lib/elm_deprecated.h b/src/lib/elm_deprecated.h index 29ef155..f4b4e43 100644 --- a/src/lib/elm_deprecated.h +++ b/src/lib/elm_deprecated.h @@ -560,6 +560,68 @@ EINA_DEPRECATED EAPI Evas_Object *elm_fileselector_entry_button_i EINA_DEPRECATED EAPI Evas_Object *elm_fileselector_entry_button_icon_unset(Evas_Object *obj); /** + * @brief Sets the content of the hover object and the direction in which it + * will pop out. + * + * @param obj The hover object + * @param swallow The direction that the object will be displayed + * at. Accepted values are "left", "top-left", "top", "top-right", + * "right", "bottom-right", "bottom", "bottom-left", "middle" and + * "smart". + * @param content The content to place at @p swallow + * + * Once the content object is set for a given direction, a previously + * set one (on the same direction) will be deleted. If you want to + * keep that old content object, use the elm_hover_content_unset() + * function. + * + * All directions may have contents at the same time, except for + * "smart". This is a special placement hint and its use case + * independs of the calculations coming from + * elm_hover_best_content_location_get(). Its use is for cases when + * one desires only one hover content, but with a dynamic special + * placement within the hover area. The content's geometry, whenever + * it changes, will be used to decide on a best location, not + * extrapolating the hover's parent object view to show it in (still + * being the hover's target determinant of its medium part -- move and + * resize it to simulate finger sizes, for example). If one of the + * directions other than "smart" are used, a previously content set + * using it will be deleted, and vice-versa. + * + * @deprecated Use elm_object_part_content_set() instead + */ +EINA_DEPRECATED EAPI void elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content); + +/** + * @brief Get the content of the hover object, in a given direction. + * + * Return the content object which was set for this widget in the + * @p swallow direction. + * + * @param obj The hover object + * @param swallow The direction that the object was display at. + * @return The content that was being used + * + * @deprecated Use elm_object_part_content_get() instead + * @see elm_hover_content_set() + */ +EINA_DEPRECATED EAPI Evas_Object *elm_hover_content_get(const Evas_Object *obj, const char *swallow); + +/** + * @brief Unset the content of the hover object, in a given direction. + * + * Unparent and return the content object set at @p swallow direction. + * + * @param obj The hover object + * @param swallow The direction that the object was display at. + * @return The content that was being used. + * + * @deprecated Use elm_object_part_content_unset() instead + * @see elm_hover_content_set() + */ +EINA_DEPRECATED EAPI Evas_Object *elm_hover_content_unset(Evas_Object *obj, const char *swallow); + +/** * @brief Set the hoversel button label * * @param obj The hoversel object diff --git a/src/lib/elm_hover.c b/src/lib/elm_hover.c index 61893c9..55cb26c 100644 --- a/src/lib/elm_hover.c +++ b/src/lib/elm_hover.c @@ -64,6 +64,9 @@ static void _hov_hide(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _on_focus_hook(void *data, Evas_Object *obj); static void _elm_hover_sub_obj_placement_eval_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _elm_hover_sub_obj_placement_eval(Evas_Object *obj); +static void _content_set_hook(Evas_Object *obj, const char *swallow, Evas_Object *content); +static Evas_Object * _content_get_hook(const Evas_Object *obj, const char *swallow); +static Evas_Object * _content_unset_hook(Evas_Object *obj, const char *swallow); static const char SIG_CLICKED[] = "clicked"; static const char SIG_SMART_LOCATION_CHANGED[] = "smart,changed"; @@ -487,6 +490,9 @@ elm_hover_add(Evas_Object *parent) elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook); elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); ELM_HOVER_PARTS_FOREACH wd->subs[i].swallow = _directions[i]; @@ -674,13 +680,90 @@ _elm_hover_sub_obj_placement_eval_cb(void *data, Evas *e __UNUSED__, Evas_Object EAPI void elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content) { - ELM_CHECK_WIDTYPE(obj, widtype); + _content_set_hook(obj, swallow, content); +} +EAPI Evas_Object * +elm_hover_content_get(const Evas_Object *obj, const char *swallow) +{ + return _content_get_hook(obj, swallow); +} + +static void +_elm_hover_sub_obj_unparent(Evas_Object *obj) +{ + Widget_Data *wd; + + wd = elm_widget_data_get(obj); + + elm_widget_sub_object_del(obj, wd->smt_sub); + evas_object_event_callback_del_full(wd->smt_sub, + EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _elm_hover_sub_obj_placement_eval_cb, + obj); + edje_object_part_unswallow(wd->cov, wd->smt_sub); + wd->smt_sub = NULL; +} + +EAPI Evas_Object * +elm_hover_content_unset(Evas_Object *obj, const char *swallow) +{ + return _content_unset_hook(obj, swallow); +} + +EAPI const char * +elm_hover_best_content_location_get(const Evas_Object *obj, Elm_Hover_Axis pref_axis) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + + Evas_Coord spc_l, spc_r, spc_t, spc_b; Widget_Data *wd; wd = elm_widget_data_get(obj); if (!wd) - return; + return NULL; + + _elm_hover_left_space_calc(wd, &spc_l, &spc_t, &spc_r, &spc_b); + + if (pref_axis == ELM_HOVER_AXIS_HORIZONTAL) + { + if (spc_l < spc_r) return _HOV_RIGHT; + else return _HOV_LEFT; + } + else if (pref_axis == ELM_HOVER_AXIS_VERTICAL) + { + if (spc_t < spc_b) return _HOV_BOTTOM; + else return _HOV_TOP; + } + + if (spc_l < spc_r) + { + if (spc_t > spc_r) return _HOV_TOP; + else if (spc_b > spc_r) return _HOV_BOTTOM; + return _HOV_RIGHT; + } + if (spc_t > spc_r) return _HOV_TOP; + else if (spc_b > spc_r) return _HOV_BOTTOM; + return _HOV_LEFT; +} + +EAPI void +elm_hover_dismiss(Evas_Object *obj) +{ + Widget_Data *wd; + ELM_CHECK_WIDTYPE(obj, widtype); + wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_signal_emit(wd->cov, "elm,action,dismiss", ""); +} + +static void +_content_set_hook(Evas_Object *obj, const char *swallow, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; if (!strcmp(swallow, "smart")) { @@ -731,67 +814,40 @@ elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *conten break; } } - end: _sizing_eval(obj); } -EAPI Evas_Object * -elm_hover_content_get(const Evas_Object *obj, const char *swallow) +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *swallow) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd; - - wd = elm_widget_data_get(obj); - if (!wd) - return NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; if (!strcmp(swallow, "smart")) return wd->smt_sub; ELM_HOVER_PARTS_FOREACH - if (!strcmp(swallow, wd->subs[i].swallow)) - return wd->subs[i].obj; + if (!strcmp(swallow, wd->subs[i].swallow)) + return wd->subs[i].obj; return NULL; } -static void -_elm_hover_sub_obj_unparent(Evas_Object *obj) -{ - Widget_Data *wd; - - wd = elm_widget_data_get(obj); - - elm_widget_sub_object_del(obj, wd->smt_sub); - evas_object_event_callback_del_full(wd->smt_sub, - EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _elm_hover_sub_obj_placement_eval_cb, - obj); - edje_object_part_unswallow(wd->cov, wd->smt_sub); - wd->smt_sub = NULL; -} - -EAPI Evas_Object * -elm_hover_content_unset(Evas_Object *obj, const char *swallow) +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *swallow) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd; - - wd = elm_widget_data_get(obj); - if (!wd) - return NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; if (!strcmp(swallow, "smart")) { - Evas_Object *content; - - if (!wd->smt_sub) - return NULL; - - content = wd->smt_sub; + if (!wd->smt_sub) return NULL; + Evas_Object *content = wd->smt_sub; _elm_hover_sub_obj_unparent(obj); return content; } @@ -800,12 +856,8 @@ elm_hover_content_unset(Evas_Object *obj, const char *swallow) { if (!strcmp(swallow, wd->subs[i].swallow)) { - Evas_Object *content; - - if (!wd->subs[i].obj) - return NULL; - - content = wd->subs[i].obj; + if (!wd->subs[i].obj) return NULL; + Evas_Object *content = wd->subs[i].obj; elm_widget_sub_object_del(obj, wd->subs[i].obj); edje_object_part_unswallow(wd->cov, wd->subs[i].obj); wd->subs[i].obj = NULL; @@ -816,50 +868,3 @@ elm_hover_content_unset(Evas_Object *obj, const char *swallow) return NULL; } - -EAPI const char * -elm_hover_best_content_location_get(const Evas_Object *obj, Elm_Hover_Axis pref_axis) -{ - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - - Evas_Coord spc_l, spc_r, spc_t, spc_b; - Widget_Data *wd; - - wd = elm_widget_data_get(obj); - if (!wd) - return NULL; - - _elm_hover_left_space_calc(wd, &spc_l, &spc_t, &spc_r, &spc_b); - - if (pref_axis == ELM_HOVER_AXIS_HORIZONTAL) - { - if (spc_l < spc_r) return _HOV_RIGHT; - else return _HOV_LEFT; - } - else if (pref_axis == ELM_HOVER_AXIS_VERTICAL) - { - if (spc_t < spc_b) return _HOV_BOTTOM; - else return _HOV_TOP; - } - - if (spc_l < spc_r) - { - if (spc_t > spc_r) return _HOV_TOP; - else if (spc_b > spc_r) return _HOV_BOTTOM; - return _HOV_RIGHT; - } - if (spc_t > spc_r) return _HOV_TOP; - else if (spc_b > spc_r) return _HOV_BOTTOM; - return _HOV_LEFT; -} - -EAPI void -elm_hover_dismiss(Evas_Object *obj) -{ - Widget_Data *wd; - ELM_CHECK_WIDTYPE(obj, widtype); - wd = elm_widget_data_get(obj); - if (!wd) return; - - edje_object_signal_emit(wd->cov, "elm,action,dismiss", ""); -} diff --git a/src/lib/elm_hover.h b/src/lib/elm_hover.h index 9f8f40a..42443e0 100644 --- a/src/lib/elm_hover.h +++ b/src/lib/elm_hover.h @@ -40,10 +40,41 @@ * @li "smart,changed" - a content object placed under the "smart" * policy was replaced to a new slot direction. * + * Default contents parts of the hover widget that you can use for are: + * @li "left" + * @li "top-left" + * @li "top" + * @li "top-right" + * @li "right" + * @li "bottom-right" + * @li "bottom" + * @li "bottom-left" + * @li "middle" + * @li "smart" + * + * @note These contents parts indicates the direction that the content will be + * displayed + * + * All directions may have contents at the same time, except for + * "smart". This is a special placement hint and its use case + * independs of the calculations coming from + * elm_hover_best_content_location_get(). Its use is for cases when + * one desires only one hover content, but with a dynamic special + * placement within the hover area. The content's geometry, whenever + * it changes, will be used to decide on a best location, not + * extrapolating the hover's parent object view to show it in (still + * being the hover's target determinant of its medium part -- move and + * resize it to simulate finger sizes, for example). If one of the + * directions other than "smart" are used, a previously content set + * using it will be deleted, and vice-versa. + * * Supported elm_object common APIs. * @li elm_object_signal_emit * @li elm_object_signal_callback_add * @li elm_object_signal_callback_del + * @li elm_object_part_content_set + * @li elm_object_part_content_get + * @li elm_object_part_content_unset * * See @ref tutorial_hover for more information. * @@ -107,64 +138,6 @@ EAPI void elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent); EAPI Evas_Object *elm_hover_parent_get(const Evas_Object *obj); /** - * @brief Sets the content of the hover object and the direction in which it - * will pop out. - * - * @param obj The hover object - * @param swallow The direction that the object will be displayed - * at. Accepted values are "left", "top-left", "top", "top-right", - * "right", "bottom-right", "bottom", "bottom-left", "middle" and - * "smart". - * @param content The content to place at @p swallow - * - * Once the content object is set for a given direction, a previously - * set one (on the same direction) will be deleted. If you want to - * keep that old content object, use the elm_hover_content_unset() - * function. - * - * All directions may have contents at the same time, except for - * "smart". This is a special placement hint and its use case - * independs of the calculations coming from - * elm_hover_best_content_location_get(). Its use is for cases when - * one desires only one hover content, but with a dynamic special - * placement within the hover area. The content's geometry, whenever - * it changes, will be used to decide on a best location, not - * extrapolating the hover's parent object view to show it in (still - * being the hover's target determinant of its medium part -- move and - * resize it to simulate finger sizes, for example). If one of the - * directions other than "smart" are used, a previously content set - * using it will be deleted, and vice-versa. - */ -EAPI void elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content); - -/** - * @brief Get the content of the hover object, in a given direction. - * - * Return the content object which was set for this widget in the - * @p swallow direction. - * - * @param obj The hover object - * @param swallow The direction that the object was display at. - * @return The content that was being used - * - * @see elm_hover_content_set() - */ -EAPI Evas_Object *elm_hover_content_get(const Evas_Object *obj, const char *swallow); - -/** - * @brief Unset the content of the hover object, in a given direction. - * - * Unparent and return the content object set at @p swallow direction. - * - * @param obj The hover object - * @param swallow The direction that the object was display at. - * @return The content that was being used. - * - * @see elm_hover_content_set() - */ -EAPI Evas_Object *elm_hover_content_unset(Evas_Object *obj, const char *swallow); - -/** * @brief Returns the best swallow location for content in the hover. * * @param obj The hover object diff --git a/src/lib/elm_menu.c b/src/lib/elm_menu.c index c099990..b189139 100644 --- a/src/lib/elm_menu.c +++ b/src/lib/elm_menu.c @@ -498,7 +498,7 @@ _item_submenu_obj_create(Elm_Menu_Item *item) elm_widget_mirrored_set(item->submenu.bx, EINA_FALSE); evas_object_size_hint_weight_set(item->submenu.bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(item->submenu.bx); - elm_hover_content_set(item->submenu.hv, elm_hover_best_content_location_get(item->submenu.hv, ELM_HOVER_AXIS_VERTICAL), item->submenu.bx); + elm_object_part_content_set(item->submenu.hv, elm_hover_best_content_location_get(item->submenu.hv, ELM_HOVER_AXIS_VERTICAL), item->submenu.bx); edje_object_mirrored_set(VIEW(item), elm_widget_mirrored_get(WIDGET(item))); _elm_theme_object_set(WIDGET(item), VIEW(item), "menu", "item_with_submenu", elm_widget_style_get(WIDGET(item))); @@ -548,7 +548,7 @@ elm_menu_add(Evas_Object *parent) elm_widget_mirrored_set(wd->bx, EINA_FALSE); evas_object_size_hint_weight_set(wd->bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(wd->bx); - elm_hover_content_set(wd->hv, elm_hover_best_content_location_get(wd->hv, ELM_HOVER_AXIS_VERTICAL), wd->bx); + elm_object_part_content_set(wd->hv, elm_hover_best_content_location_get(wd->hv, ELM_HOVER_AXIS_VERTICAL), wd->bx); evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_RESIZE, _parent_resize, wd->obj); evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_DEL, _parent_del, wd); -- 2.7.4