1 #include <Elementary.h>
5 * @defgroup Hover Hover
8 * A Hover object will over its @p parent object at the @p target
9 * location. Anything in the background will be given a darker
10 * coloring to indicate that the hover object is on top (at the
13 * @note The hover object will take up the entire space of @p target
16 * Signals that you can add callbacks for are:
18 * "clicked" - the user clicked the empty space in the hover to dismiss
19 * "smart,changed" - a content object placed under the "smart"
20 * policy was replaced to a new slot direction.
23 typedef struct _Widget_Data Widget_Data;
24 typedef struct _Content_Info Content_Info;
27 # define MAX(a, b) (((a) > (b)) ? (a) : (b))
30 #define ELM_HOVER_PARTS_FOREACH unsigned int i = 0; \
31 for (i = 0; i < sizeof(wd->subs) / sizeof(wd->subs[0]); i++)
33 static const char *_directions[] = {
45 #define _HOV_LEFT (_directions[0])
46 #define _HOV_TOP_LEFT (_directions[1])
47 #define _HOV_TOP (_directions[2])
48 #define _HOV_TOP_RIGHT (_directions[2])
49 #define _HOV_RIGHT (_directions[4])
50 #define _HOV_BOTTOM_RIGHT (_directions[5])
51 #define _HOV_BOTTOM (_directions[6])
52 #define _HOV_BOTTOM_LEFT (_directions[7])
53 #define _HOV_MIDDLE (_directions[8])
63 Evas_Object *hov, *cov;
64 Evas_Object *offset, *size;
65 Evas_Object *parent, *target;
67 Content_Info subs[sizeof(_directions)/sizeof(_directions[0])];
70 static const char *widtype = NULL;
71 static void _del_pre_hook(Evas_Object *obj);
72 static void _del_hook(Evas_Object *obj);
73 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
74 static void _theme_hook(Evas_Object *obj);
75 static void _sizing_eval(Evas_Object *obj);
76 static void _reval_content(Evas_Object *obj);
77 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
78 static void _hov_show_do(Evas_Object *obj);
79 static void _hov_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
80 static void _hov_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
81 static void _hov_show(void *data, Evas *e, Evas_Object *obj, void *event_info);
82 static void _hov_hide(void *data, Evas *e, Evas_Object *obj, void *event_info);
83 static void _on_focus_hook(void *data, Evas_Object *obj);
84 static void _elm_hover_sub_obj_placement_eval_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
85 static void _elm_hover_sub_obj_placement_eval(Evas_Object *obj);
87 static const char SIG_CLICKED[] = "clicked";
88 static const char SIG_SMART_LOCATION_CHANGED[] = "smart,changed";
89 static const Evas_Smart_Cb_Description _signals[] = {
91 {SIG_SMART_LOCATION_CHANGED, ""},
96 _del_pre_hook(Evas_Object *obj)
98 Widget_Data *wd = elm_widget_data_get(obj);
102 if (evas_object_visible_get(obj))
103 evas_object_smart_callback_call(obj, SIG_CLICKED, NULL);
104 elm_hover_target_set(obj, NULL);
105 elm_hover_parent_set(obj, NULL);
106 evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_MOVE, _hov_move, obj);
107 evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_RESIZE, _hov_resize, obj);
108 evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_SHOW, _hov_show, obj);
109 evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_HIDE, _hov_hide, obj);
113 _del_hook(Evas_Object *obj)
115 Widget_Data *wd = elm_widget_data_get(obj);
121 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
123 Widget_Data *wd = elm_widget_data_get(obj);
125 if (elm_widget_focus_get(obj))
127 edje_object_signal_emit(wd->cov, "elm,action,focus", "elm");
128 evas_object_focus_set(wd->cov, EINA_TRUE);
132 edje_object_signal_emit(wd->cov, "elm,action,unfocus", "elm");
133 evas_object_focus_set(wd->cov, EINA_FALSE);
138 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
140 Widget_Data *wd = elm_widget_data_get(obj);
142 edje_object_mirrored_set(wd->cov, rtl);
146 _theme_hook(Evas_Object *obj)
148 Widget_Data *wd = elm_widget_data_get(obj);
150 _elm_widget_mirrored_reload(obj);
151 _mirrored_set(obj, elm_widget_mirrored_get(obj));
152 // FIXME: hover contents doesn't seem to propagate resizes properly
153 _elm_theme_object_set(obj, wd->cov, "hover", "base", elm_widget_style_get(obj));
154 edje_object_scale_set(wd->cov, elm_widget_scale_get(obj) *
158 _elm_hover_sub_obj_placement_eval(obj);
162 if (evas_object_visible_get(wd->cov)) _hov_show_do(obj);
166 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
170 wd = elm_widget_data_get(obj);
174 edje_object_signal_emit(wd->cov, emission, source);
178 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
182 wd = elm_widget_data_get(obj);
186 edje_object_signal_callback_add(wd->hov, emission, source, func_cb, data);
190 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
194 wd = elm_widget_data_get(obj);
196 edje_object_signal_callback_del_full(wd->hov, emission, source, func_cb,
201 _elm_hover_left_space_calc(Widget_Data *wd, Evas_Coord *spc_l, Evas_Coord *spc_t, Evas_Coord *spc_r, Evas_Coord *spc_b)
203 Evas_Coord x = 0, y = 0, w = 0, h = 0, x2 = 0, y2 = 0, w2 = 0, h2 = 0;
206 evas_object_geometry_get(wd->parent, &x, &y, &w, &h);
208 evas_object_geometry_get(wd->target, &x2, &y2, &w2, &h2);
211 *spc_r = (x + w) - (x2 + w2);
218 *spc_b = (y + h) - (y2 + h2);
226 _sizing_eval(Evas_Object *obj)
228 Widget_Data *wd = elm_widget_data_get(obj);
229 Evas_Coord ofs_x, x = 0, y = 0, w = 0, h = 0, x2 = 0, y2 = 0, w2 = 0, h2 = 0;
231 if (wd->parent) evas_object_geometry_get(wd->parent, &x, &y, &w, &h);
232 if (wd->hov) evas_object_geometry_get(wd->hov, &x2, &y2, &w2, &h2);
234 if (elm_widget_mirrored_get(obj))
235 ofs_x = w - (x2 - x) - w2;
239 evas_object_move(wd->cov, x, y);
240 evas_object_resize(wd->cov, w, h);
241 evas_object_size_hint_min_set(wd->offset, ofs_x, y2 - y);
242 evas_object_size_hint_min_set(wd->size, w2, h2);
243 edje_object_part_swallow(wd->cov, "elm.swallow.offset", wd->offset);
244 edje_object_part_swallow(wd->cov, "elm.swallow.size", wd->size);
248 _reval_content(Evas_Object *obj)
250 Widget_Data *wd = elm_widget_data_get(obj);
254 ELM_HOVER_PARTS_FOREACH
257 snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", wd->subs[i].swallow);
258 edje_object_part_swallow(wd->cov, buf, wd->subs[i].obj);
263 _elm_hover_smart_content_location_get(Widget_Data *wd, Evas_Coord spc_l, Evas_Coord spc_t, Evas_Coord spc_r, Evas_Coord spc_b)
265 Evas_Coord c_w = 0, c_h = 0, mid_w, mid_h;
268 evas_object_size_hint_min_get(wd->smt_sub, &c_w, &c_h);
275 max = MAX(spc_t, spc_r);
276 max = MAX(max, spc_b);
281 return _HOV_TOP_RIGHT;
289 return _HOV_BOTTOM_RIGHT;
290 else if (mid_h > spc_b)
291 return _HOV_TOP_RIGHT;
297 return _HOV_BOTTOM_RIGHT;
302 max = MAX(spc_t, spc_l);
303 max = MAX(max, spc_b);
308 return _HOV_TOP_LEFT;
316 return _HOV_BOTTOM_LEFT;
317 else if (mid_h > spc_b)
318 return _HOV_TOP_LEFT;
324 return _HOV_BOTTOM_LEFT;
330 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
336 wd = elm_widget_data_get(obj);
342 if (wd->smt_sub == sub)
347 ELM_HOVER_PARTS_FOREACH
349 if (wd->subs[i].obj == sub)
351 wd->subs[i].obj = NULL;
359 _hov_show_do(Evas_Object *obj)
361 Widget_Data *wd = elm_widget_data_get(obj);
367 evas_object_show(wd->cov);
368 edje_object_signal_emit(wd->cov, "elm,action,show", "elm");
371 ELM_HOVER_PARTS_FOREACH
377 snprintf(buf, sizeof(buf), "elm,action,slot,%s,show",
378 wd->subs[i].swallow);
379 edje_object_signal_emit(wd->cov, buf, "elm");
385 _hov_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
391 _hov_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
397 _hov_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
403 _hov_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
405 Widget_Data *wd = elm_widget_data_get(data);
409 edje_object_signal_emit(wd->cov, "elm,action,hide", "elm");
410 evas_object_hide(wd->cov);
413 ELM_HOVER_PARTS_FOREACH
419 snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide",
420 wd->subs[i].swallow);
421 edje_object_signal_emit(wd->cov, buf, "elm");
427 _target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
429 Widget_Data *wd = elm_widget_data_get(data);
435 _target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
437 Widget_Data *wd = elm_widget_data_get(data);
442 _elm_hover_sub_obj_placement_eval(data);
446 _signal_dismiss(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
448 Widget_Data *wd = elm_widget_data_get(data);
450 evas_object_hide(data);
451 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
455 _parent_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
461 _parent_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
467 _parent_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
472 _parent_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
474 Widget_Data *wd = elm_widget_data_get(data);
476 evas_object_hide(wd->cov);
480 _parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
482 Widget_Data *wd = elm_widget_data_get(data);
484 elm_hover_parent_set(data, NULL);
489 * Adds a hover object to @p parent
491 * @param parent The parent object
492 * @return The hover object or NULL if one could not be created
497 elm_hover_add(Evas_Object *parent)
503 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
505 ELM_SET_WIDTYPE(widtype, "hover");
506 elm_widget_type_set(obj, "hover");
507 elm_widget_sub_object_add(parent, obj);
508 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
509 elm_widget_data_set(obj, wd);
510 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
511 elm_widget_theme_hook_set(obj, _theme_hook);
512 elm_widget_del_hook_set(obj, _del_hook);
513 elm_widget_can_focus_set(obj, EINA_TRUE);
514 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
515 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
516 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
518 ELM_HOVER_PARTS_FOREACH
519 wd->subs[i].swallow = _directions[i];
521 wd->hov = evas_object_rectangle_add(e);
522 evas_object_pass_events_set(wd->hov, EINA_TRUE);
523 evas_object_color_set(wd->hov, 0, 0, 0, 0);
524 elm_widget_resize_object_set(obj, wd->hov);
525 evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_MOVE, _hov_move, obj);
526 evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_RESIZE, _hov_resize, obj);
527 evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_SHOW, _hov_show, obj);
528 evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_HIDE, _hov_hide, obj);
530 wd->cov = edje_object_add(e);
531 _elm_theme_object_set(obj, wd->cov, "hover", "base", "default");
532 elm_widget_sub_object_add(obj, wd->cov);
533 edje_object_signal_callback_add(wd->cov, "elm,action,dismiss", "",
534 _signal_dismiss, obj);
536 wd->offset = evas_object_rectangle_add(e);
537 evas_object_pass_events_set(wd->offset, EINA_TRUE);
538 evas_object_color_set(wd->offset, 0, 0, 0, 0);
539 elm_widget_sub_object_add(obj, wd->offset);
541 wd->size = evas_object_rectangle_add(e);
542 evas_object_pass_events_set(wd->size, EINA_TRUE);
543 evas_object_color_set(wd->size, 0, 0, 0, 0);
544 elm_widget_sub_object_add(obj, wd->size);
546 edje_object_part_swallow(wd->cov, "elm.swallow.offset", wd->offset);
547 edje_object_part_swallow(wd->cov, "elm.swallow.size", wd->size);
549 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
551 elm_hover_parent_set(obj, parent);
552 evas_object_smart_callbacks_descriptions_set(obj, _signals);
554 _mirrored_set(obj, elm_widget_mirrored_get(obj));
560 * Sets the target object for the hover.
562 * @param obj The hover object
563 * @param target The object to center the hover onto. The hover
564 * will take up the entire space that the target object fills.
569 elm_hover_target_set(Evas_Object *obj, Evas_Object *target)
571 ELM_CHECK_WIDTYPE(obj, widtype);
572 Widget_Data *wd = elm_widget_data_get(obj);
576 evas_object_event_callback_del_full(wd->target, EVAS_CALLBACK_DEL,
578 evas_object_event_callback_del_full(wd->target, EVAS_CALLBACK_MOVE,
584 evas_object_event_callback_add(wd->target, EVAS_CALLBACK_DEL,
586 evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MOVE,
588 elm_widget_hover_object_set(target, obj);
595 * Sets the parent object for the hover.
597 * @param obj The hover object
598 * @param parent The object to locate the hover over.
603 elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
605 ELM_CHECK_WIDTYPE(obj, widtype);
606 Widget_Data *wd = elm_widget_data_get(obj);
610 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_MOVE,
612 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE,
613 _parent_resize, obj);
614 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_SHOW,
616 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_HIDE,
618 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_DEL,
624 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_MOVE,
626 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_RESIZE,
627 _parent_resize, obj);
628 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_SHOW,
630 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_HIDE,
632 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_DEL,
634 // elm_widget_sub_object_add(parent, obj);
640 * Gets the target object for the hover.
642 * @param obj The hover object
643 * @return The target object of the hover.
648 elm_hover_target_get(const Evas_Object *obj)
650 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
651 Widget_Data *wd = elm_widget_data_get(obj);
652 if (!wd) return NULL;
658 * Gets the parent object for the hover.
660 * @param obj The hover object
661 * @return The parent object to locate the hover over.
666 elm_hover_parent_get(const Evas_Object *obj)
668 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
669 Widget_Data *wd = elm_widget_data_get(obj);
670 if (!wd) return NULL;
676 _elm_hover_subs_del(Widget_Data *wd)
678 ELM_HOVER_PARTS_FOREACH
682 evas_object_del(wd->subs[i].obj);
683 wd->subs[i].obj = NULL;
689 _elm_hover_sub_obj_placement_eval(Evas_Object *obj)
691 Evas_Coord spc_l, spc_r, spc_t, spc_b;
692 const char *smart_dir;
696 wd = elm_widget_data_get(obj);
700 _elm_hover_left_space_calc(wd, &spc_l, &spc_t, &spc_r, &spc_b);
702 edje_object_part_unswallow(wd->cov, wd->smt_sub);
704 smart_dir = _elm_hover_smart_content_location_get(wd, spc_l, spc_t, spc_r,
706 evas_object_smart_callback_call(obj, SIG_SMART_LOCATION_CHANGED,
709 if (elm_widget_mirrored_get(obj))
711 if (smart_dir == _HOV_BOTTOM_LEFT)
712 smart_dir = _HOV_BOTTOM_RIGHT;
713 else if (smart_dir == _HOV_BOTTOM_RIGHT)
714 smart_dir = _HOV_BOTTOM_LEFT;
715 else if (smart_dir == _HOV_RIGHT)
716 smart_dir = _HOV_LEFT;
717 else if (smart_dir == _HOV_LEFT)
718 smart_dir = _HOV_RIGHT;
719 else if (smart_dir == _HOV_TOP_RIGHT)
720 smart_dir = _HOV_TOP_LEFT;
721 else if (smart_dir == _HOV_TOP_LEFT)
722 smart_dir = _HOV_TOP_RIGHT;
724 snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", smart_dir);
725 edje_object_part_swallow(wd->cov, buf, wd->smt_sub);
729 _elm_hover_sub_obj_placement_eval_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
731 _elm_hover_sub_obj_placement_eval(data);
735 * Sets the content of the hover object and the direction in which
738 * Once the content object is set for a given direction, a previously
739 * set one (on the same direction) will be deleted. If you want to
740 * keep that old content object, use the elm_hover_content_unset()
743 * @param obj The hover object
744 * @param swallow The direction that the object will be displayed
745 * at. Accepted values are "left", "top-left", "top", "top-right",
746 * "right", "bottom-right", "bottom", "bottom-left", "middle" and
748 * @param content The content to place at @p swallow
750 * All directions may have contents at the same time, except for
751 * "smart". This is a special placement hint and its use case
752 * independs of the calculations coming from
753 * elm_hover_best_content_location_get(). Its use is for cases when
754 * one desires only one hover content, but with a dinamic special
755 * placement within the hover area. The content's geometry, whenever
756 * it changes, will be used to decide on a best location not
757 * extrapolating the hover's parent object view to show it in (still
758 * being the hover's target determinant of its medium part -- move and
759 * resize it to simulate finger sizes, for example). If one of the
760 * directions other than "smart" are used, a previously content set
761 * using it will be deleted, and vice-versa.
766 elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content)
768 ELM_CHECK_WIDTYPE(obj, widtype);
772 wd = elm_widget_data_get(obj);
776 if (!strcmp(swallow, "smart"))
778 if (wd->smt_sub != content)
780 _elm_hover_subs_del(wd);
781 wd->smt_sub = content;
786 elm_widget_sub_object_add(obj, content);
787 evas_object_event_callback_add(wd->smt_sub,
788 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
789 _elm_hover_sub_obj_placement_eval_cb,
792 _elm_hover_sub_obj_placement_eval(obj);
800 evas_object_del(wd->smt_sub);
804 ELM_HOVER_PARTS_FOREACH
806 if (!strcmp(swallow, wd->subs[i].swallow))
808 if (content == wd->subs[i].obj)
810 evas_object_del(wd->subs[i].obj);
811 wd->subs[i].obj = NULL;
817 snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", swallow);
818 elm_widget_sub_object_add(obj, content);
819 edje_object_part_swallow(wd->cov, buf, content);
820 wd->subs[i].obj = content;
831 * Get the content of the hover object, in a given direction.
833 * Return the content object which was set for this widget in the
836 * @param obj The hover object
837 * @param swallow The direction that the object was display at.
838 * @return The content that was being used
840 * @note See elm_hover_content_set() for more information.
845 elm_hover_content_get(const Evas_Object *obj, const char *swallow)
847 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
851 wd = elm_widget_data_get(obj);
855 if (!strcmp(swallow, "smart"))
858 ELM_HOVER_PARTS_FOREACH
859 if (!strcmp(swallow, wd->subs[i].swallow))
860 return wd->subs[i].obj;
866 _elm_hover_sub_obj_unparent(Evas_Object *obj)
870 wd = elm_widget_data_get(obj);
872 elm_widget_sub_object_del(obj, wd->smt_sub);
873 evas_object_event_callback_del_full(wd->smt_sub,
874 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
875 _elm_hover_sub_obj_placement_eval_cb,
877 edje_object_part_unswallow(wd->cov, wd->smt_sub);
882 * Unset the content of the hover object, in a given direction.
884 * Unparent and return the content object set at that direction.
886 * @param obj The hover object
887 * @param swallow The direction that the object was display at.
888 * @return The content that was being used.
890 * @note See elm_hover_content_set() for more information.
895 elm_hover_content_unset(Evas_Object *obj, const char *swallow)
897 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
901 wd = elm_widget_data_get(obj);
905 if (!strcmp(swallow, "smart"))
907 Evas_Object *content;
912 content = wd->smt_sub;
913 _elm_hover_sub_obj_unparent(obj);
917 ELM_HOVER_PARTS_FOREACH
919 if (!strcmp(swallow, wd->subs[i].swallow))
921 Evas_Object *content;
923 if (!wd->subs[i].obj)
926 content = wd->subs[i].obj;
927 elm_widget_sub_object_del(obj, wd->subs[i].obj);
928 edje_object_part_unswallow(wd->cov, wd->subs[i].obj);
929 wd->subs[i].obj = NULL;
939 * Returns the best swallow location for content in the hover.
941 * @param obj The hover object
942 * @param pref_axis The preferred orientation axis for the hover object to use
943 * @return The edje location to place content into the hover or @c
946 * @p pref_axis may be one of
947 * - @c ELM_HOVER_AXIS_NONE -- no prefered orientation
948 * - @c ELM_HOVER_AXIS_HORIZONTAL -- horizontal
949 * - @c ELM_HOVER_AXIS_VERTICAL -- vertical
950 * - @c ELM_HOVER_AXIS_BOTH -- both
952 * See also elm_hover_content_set().
957 elm_hover_best_content_location_get(const Evas_Object *obj, Elm_Hover_Axis pref_axis)
959 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
961 Evas_Coord spc_l, spc_r, spc_t, spc_b;
964 wd = elm_widget_data_get(obj);
968 _elm_hover_left_space_calc(wd, &spc_l, &spc_t, &spc_r, &spc_b);
970 if (pref_axis == ELM_HOVER_AXIS_HORIZONTAL)
972 if (spc_l < spc_r) return _HOV_RIGHT;
973 else return _HOV_LEFT;
975 else if (pref_axis == ELM_HOVER_AXIS_VERTICAL)
977 if (spc_t < spc_b) return _HOV_BOTTOM;
978 else return _HOV_TOP;
983 if (spc_t > spc_r) return _HOV_TOP;
984 else if (spc_b > spc_r) return _HOV_BOTTOM;
987 if (spc_t > spc_r) return _HOV_TOP;
988 else if (spc_b > spc_r) return _HOV_BOTTOM;