1 #include <Elementary.h>
5 * @defgroup Hover Hover
7 * A Hover object will over its @p parent object at the @p target
8 * location. Anything in the background will be given a darker
9 * coloring to indicate that the hover object is on top (at the
12 * @note The hover object will take up the entire space of @p target
16 typedef struct _Widget_Data Widget_Data;
17 typedef struct _Content_Info Content_Info;
20 # define MAX(a, b) (((a) > (b)) ? (a) : (b))
23 #define ELM_HOVER_PARTS_FOREACH unsigned int i = 0; \
24 for (i = 0; i < sizeof(wd->subs) / sizeof(wd->subs[0]); i++)
26 static const char *_directions[] = {
38 #define _HOV_LEFT (_directions[0])
39 #define _HOV_TOP_LEFT (_directions[1])
40 #define _HOV_TOP (_directions[2])
41 #define _HOV_TOP_RIGHT (_directions[2])
42 #define _HOV_RIGHT (_directions[4])
43 #define _HOV_BOTTOM_RIGHT (_directions[5])
44 #define _HOV_BOTTOM (_directions[6])
45 #define _HOV_BOTTOM_LEFT (_directions[7])
46 #define _HOV_MIDDLE (_directions[8])
56 Evas_Object *hov, *cov;
57 Evas_Object *offset, *size;
58 Evas_Object *parent, *target;
60 Content_Info subs[sizeof(_directions)/sizeof(_directions[0])];
63 static const char *widtype = NULL;
64 static void _del_pre_hook(Evas_Object *obj);
65 static void _del_hook(Evas_Object *obj);
66 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
67 static void _theme_hook(Evas_Object *obj);
68 static void _sizing_eval(Evas_Object *obj);
69 static void _reval_content(Evas_Object *obj);
70 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
71 static void _hov_show_do(Evas_Object *obj);
72 static void _hov_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
73 static void _hov_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
74 static void _hov_show(void *data, Evas *e, Evas_Object *obj, void *event_info);
75 static void _hov_hide(void *data, Evas *e, Evas_Object *obj, void *event_info);
76 static void _on_focus_hook(void *data, Evas_Object *obj);
77 static void _elm_hover_sub_obj_placement_eval_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
78 static void _elm_hover_sub_obj_placement_eval(Evas_Object *obj);
80 static const char SIG_CLICKED[] = "clicked";
81 static const char SIG_SMART_LOCATION_CHANGED[] = "smart,changed";
82 static const Evas_Smart_Cb_Description _signals[] = {
84 {SIG_SMART_LOCATION_CHANGED, ""},
89 _del_pre_hook(Evas_Object *obj)
91 Widget_Data *wd = elm_widget_data_get(obj);
95 if (evas_object_visible_get(obj))
96 evas_object_smart_callback_call(obj, SIG_CLICKED, NULL);
97 elm_hover_target_set(obj, NULL);
98 elm_hover_parent_set(obj, NULL);
99 evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_MOVE, _hov_move, obj);
100 evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_RESIZE, _hov_resize, obj);
101 evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_SHOW, _hov_show, obj);
102 evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_HIDE, _hov_hide, obj);
106 _del_hook(Evas_Object *obj)
108 Widget_Data *wd = elm_widget_data_get(obj);
114 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
116 Widget_Data *wd = elm_widget_data_get(obj);
118 if (elm_widget_focus_get(obj))
120 edje_object_signal_emit(wd->cov, "elm,action,focus", "elm");
121 evas_object_focus_set(wd->cov, EINA_TRUE);
125 edje_object_signal_emit(wd->cov, "elm,action,unfocus", "elm");
126 evas_object_focus_set(wd->cov, EINA_FALSE);
131 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
133 Widget_Data *wd = elm_widget_data_get(obj);
135 edje_object_mirrored_set(wd->cov, rtl);
139 _theme_hook(Evas_Object *obj)
141 Widget_Data *wd = elm_widget_data_get(obj);
143 _elm_widget_mirrored_reload(obj);
144 _mirrored_set(obj, elm_widget_mirrored_get(obj));
145 // FIXME: hover contents doesn't seem to propagate resizes properly
146 _elm_theme_object_set(obj, wd->cov, "hover", "base", elm_widget_style_get(obj));
147 edje_object_scale_set(wd->cov, elm_widget_scale_get(obj) *
151 _elm_hover_sub_obj_placement_eval(obj);
155 if (evas_object_visible_get(wd->cov)) _hov_show_do(obj);
159 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
163 wd = elm_widget_data_get(obj);
167 edje_object_signal_emit(wd->cov, emission, source);
171 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
175 wd = elm_widget_data_get(obj);
179 edje_object_signal_callback_add(wd->hov, emission, source, func_cb, data);
183 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
187 wd = elm_widget_data_get(obj);
189 edje_object_signal_callback_del_full(wd->hov, emission, source, func_cb,
194 _elm_hover_left_space_calc(Widget_Data *wd, Evas_Coord *spc_l, Evas_Coord *spc_t, Evas_Coord *spc_r, Evas_Coord *spc_b)
196 Evas_Coord x = 0, y = 0, w = 0, h = 0, x2 = 0, y2 = 0, w2 = 0, h2 = 0;
199 evas_object_geometry_get(wd->parent, &x, &y, &w, &h);
201 evas_object_geometry_get(wd->target, &x2, &y2, &w2, &h2);
204 *spc_r = (x + w) - (x2 + w2);
211 *spc_b = (y + h) - (y2 + h2);
219 _sizing_eval(Evas_Object *obj)
221 Widget_Data *wd = elm_widget_data_get(obj);
222 Evas_Coord ofs_x, x = 0, y = 0, w = 0, h = 0, x2 = 0, y2 = 0, w2 = 0, h2 = 0;
224 if (wd->parent) evas_object_geometry_get(wd->parent, &x, &y, &w, &h);
225 if (wd->hov) evas_object_geometry_get(wd->hov, &x2, &y2, &w2, &h2);
227 if (elm_widget_mirrored_get(obj))
228 ofs_x = w - (x2 - x) - w2;
232 evas_object_move(wd->cov, x, y);
233 evas_object_resize(wd->cov, w, h);
234 evas_object_size_hint_min_set(wd->offset, ofs_x, y2 - y);
235 evas_object_size_hint_min_set(wd->size, w2, h2);
236 edje_object_part_swallow(wd->cov, "elm.swallow.offset", wd->offset);
237 edje_object_part_swallow(wd->cov, "elm.swallow.size", wd->size);
241 _reval_content(Evas_Object *obj)
243 Widget_Data *wd = elm_widget_data_get(obj);
247 ELM_HOVER_PARTS_FOREACH
250 snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", wd->subs[i].swallow);
251 edje_object_part_swallow(wd->cov, buf, wd->subs[i].obj);
256 _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)
258 Evas_Coord c_w = 0, c_h = 0, mid_w, mid_h;
261 evas_object_size_hint_min_get(wd->smt_sub, &c_w, &c_h);
268 max = MAX(spc_t, spc_r);
269 max = MAX(max, spc_b);
274 return _HOV_TOP_RIGHT;
282 return _HOV_BOTTOM_RIGHT;
283 else if (mid_h > spc_b)
284 return _HOV_TOP_RIGHT;
290 return _HOV_BOTTOM_RIGHT;
295 max = MAX(spc_t, spc_l);
296 max = MAX(max, spc_b);
301 return _HOV_TOP_LEFT;
309 return _HOV_BOTTOM_LEFT;
310 else if (mid_h > spc_b)
311 return _HOV_TOP_LEFT;
317 return _HOV_BOTTOM_LEFT;
323 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
329 wd = elm_widget_data_get(obj);
335 if (wd->smt_sub == sub)
340 ELM_HOVER_PARTS_FOREACH
342 if (wd->subs[i].obj == sub)
344 wd->subs[i].obj = NULL;
352 _hov_show_do(Evas_Object *obj)
354 Widget_Data *wd = elm_widget_data_get(obj);
360 evas_object_show(wd->cov);
361 edje_object_signal_emit(wd->cov, "elm,action,show", "elm");
364 ELM_HOVER_PARTS_FOREACH
370 snprintf(buf, sizeof(buf), "elm,action,slot,%s,show",
371 wd->subs[i].swallow);
372 edje_object_signal_emit(wd->cov, buf, "elm");
378 _hov_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
384 _hov_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
390 _hov_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
396 _hov_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
398 Widget_Data *wd = elm_widget_data_get(data);
402 edje_object_signal_emit(wd->cov, "elm,action,hide", "elm");
403 evas_object_hide(wd->cov);
406 ELM_HOVER_PARTS_FOREACH
412 snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide",
413 wd->subs[i].swallow);
414 edje_object_signal_emit(wd->cov, buf, "elm");
420 _target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
422 Widget_Data *wd = elm_widget_data_get(data);
428 _target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
430 Widget_Data *wd = elm_widget_data_get(data);
435 _elm_hover_sub_obj_placement_eval(data);
439 _signal_dismiss(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
441 Widget_Data *wd = elm_widget_data_get(data);
443 evas_object_hide(data);
444 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
448 _parent_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
454 _parent_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
460 _parent_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
465 _parent_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
467 Widget_Data *wd = elm_widget_data_get(data);
469 evas_object_hide(wd->cov);
473 _parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
475 Widget_Data *wd = elm_widget_data_get(data);
477 elm_hover_parent_set(data, NULL);
482 * Adds a hover object to @p parent
484 * @param parent The parent object
485 * @return The hover object or NULL if one could not be created
490 elm_hover_add(Evas_Object *parent)
496 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
498 ELM_SET_WIDTYPE(widtype, "hover");
499 elm_widget_type_set(obj, "hover");
500 elm_widget_sub_object_add(parent, obj);
501 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
502 elm_widget_data_set(obj, wd);
503 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
504 elm_widget_theme_hook_set(obj, _theme_hook);
505 elm_widget_del_hook_set(obj, _del_hook);
506 elm_widget_can_focus_set(obj, EINA_TRUE);
507 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
508 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
509 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
511 ELM_HOVER_PARTS_FOREACH
512 wd->subs[i].swallow = _directions[i];
514 wd->hov = evas_object_rectangle_add(e);
515 evas_object_pass_events_set(wd->hov, EINA_TRUE);
516 evas_object_color_set(wd->hov, 0, 0, 0, 0);
517 elm_widget_resize_object_set(obj, wd->hov);
518 evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_MOVE, _hov_move, obj);
519 evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_RESIZE, _hov_resize, obj);
520 evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_SHOW, _hov_show, obj);
521 evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_HIDE, _hov_hide, obj);
523 wd->cov = edje_object_add(e);
524 _elm_theme_object_set(obj, wd->cov, "hover", "base", "default");
525 elm_widget_sub_object_add(obj, wd->cov);
526 edje_object_signal_callback_add(wd->cov, "elm,action,dismiss", "",
527 _signal_dismiss, obj);
529 wd->offset = evas_object_rectangle_add(e);
530 evas_object_pass_events_set(wd->offset, EINA_TRUE);
531 evas_object_color_set(wd->offset, 0, 0, 0, 0);
532 elm_widget_sub_object_add(obj, wd->offset);
534 wd->size = evas_object_rectangle_add(e);
535 evas_object_pass_events_set(wd->size, EINA_TRUE);
536 evas_object_color_set(wd->size, 0, 0, 0, 0);
537 elm_widget_sub_object_add(obj, wd->size);
539 edje_object_part_swallow(wd->cov, "elm.swallow.offset", wd->offset);
540 edje_object_part_swallow(wd->cov, "elm.swallow.size", wd->size);
542 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
544 elm_hover_parent_set(obj, parent);
545 evas_object_smart_callbacks_descriptions_set(obj, _signals);
547 _mirrored_set(obj, elm_widget_mirrored_get(obj));
553 * Sets the target object for the hover.
555 * @param obj The hover object
556 * @param target The object to center the hover onto. The hover
557 * will take up the entire space that the target object fills.
562 elm_hover_target_set(Evas_Object *obj, Evas_Object *target)
564 ELM_CHECK_WIDTYPE(obj, widtype);
565 Widget_Data *wd = elm_widget_data_get(obj);
569 evas_object_event_callback_del_full(wd->target, EVAS_CALLBACK_DEL,
571 evas_object_event_callback_del_full(wd->target, EVAS_CALLBACK_MOVE,
577 evas_object_event_callback_add(wd->target, EVAS_CALLBACK_DEL,
579 evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MOVE,
581 elm_widget_hover_object_set(target, obj);
588 * Sets the parent object for the hover.
590 * @param obj The hover object
591 * @param parent The object to locate the hover over.
596 elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
598 ELM_CHECK_WIDTYPE(obj, widtype);
599 Widget_Data *wd = elm_widget_data_get(obj);
603 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_MOVE,
605 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE,
606 _parent_resize, obj);
607 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_SHOW,
609 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_HIDE,
611 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_DEL,
617 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_MOVE,
619 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_RESIZE,
620 _parent_resize, obj);
621 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_SHOW,
623 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_HIDE,
625 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_DEL,
627 // elm_widget_sub_object_add(parent, obj);
633 * Gets the target object for the hover.
635 * @param obj The hover object
636 * @return The target object of the hover.
641 elm_hover_target_get(const Evas_Object *obj)
643 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
644 Widget_Data *wd = elm_widget_data_get(obj);
645 if (!wd) return NULL;
651 * Gets the parent object for the hover.
653 * @param obj The hover object
654 * @return The parent object to locate the hover over.
659 elm_hover_parent_get(const Evas_Object *obj)
661 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
662 Widget_Data *wd = elm_widget_data_get(obj);
663 if (!wd) return NULL;
669 _elm_hover_subs_del(Widget_Data *wd)
671 ELM_HOVER_PARTS_FOREACH
675 evas_object_del(wd->subs[i].obj);
676 wd->subs[i].obj = NULL;
682 _elm_hover_sub_obj_placement_eval(Evas_Object *obj)
684 Evas_Coord spc_l, spc_r, spc_t, spc_b;
685 const char *smart_dir;
689 wd = elm_widget_data_get(obj);
693 _elm_hover_left_space_calc(wd, &spc_l, &spc_t, &spc_r, &spc_b);
695 edje_object_part_unswallow(wd->cov, wd->smt_sub);
697 smart_dir = _elm_hover_smart_content_location_get(wd, spc_l, spc_t, spc_r,
699 evas_object_smart_callback_call(obj, SIG_SMART_LOCATION_CHANGED,
702 if (elm_widget_mirrored_get(obj))
704 if (smart_dir == _HOV_BOTTOM_LEFT)
705 smart_dir = _HOV_BOTTOM_RIGHT;
706 else if (smart_dir == _HOV_BOTTOM_RIGHT)
707 smart_dir = _HOV_BOTTOM_LEFT;
708 else if (smart_dir == _HOV_RIGHT)
709 smart_dir = _HOV_LEFT;
710 else if (smart_dir == _HOV_LEFT)
711 smart_dir = _HOV_RIGHT;
712 else if (smart_dir == _HOV_TOP_RIGHT)
713 smart_dir = _HOV_TOP_LEFT;
714 else if (smart_dir == _HOV_TOP_LEFT)
715 smart_dir = _HOV_TOP_RIGHT;
717 snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", smart_dir);
718 edje_object_part_swallow(wd->cov, buf, wd->smt_sub);
722 _elm_hover_sub_obj_placement_eval_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
724 _elm_hover_sub_obj_placement_eval(data);
728 * Sets the content of the hover object and the direction in which
731 * Once the content object is set for a given direction, a previously
732 * set one (on the same direction) will be deleted. If you want to
733 * keep that old content object, use the elm_hover_content_unset()
736 * @param obj The hover object
737 * @param swallow The direction that the object will be displayed
738 * at. Accepted values are "left", "top-left", "top", "top-right",
739 * "right", "bottom-right", "bottom", "bottom-left", "middle" and
741 * @param content The content to place at @p swallow
743 * All directions may have contents at the same time, except for
744 * "smart". This is a special placement hint and its use case
745 * independs of the calculations coming from
746 * elm_hover_best_content_location_get(). Its use is for cases when
747 * one desires only one hover content, but with a dinamic special
748 * placement within the hover area. The content's geometry, whenever
749 * it changes, will be used to decide on a best location not
750 * extrapolating the hover's parent object view to show it in (still
751 * being the hover's target determinant of its medium part -- move and
752 * resize it to simulate finger sizes, for example). If one of the
753 * directions other than "smart" are used, a previously content set
754 * using it will be deleted, and vice-versa.
759 elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content)
761 ELM_CHECK_WIDTYPE(obj, widtype);
765 wd = elm_widget_data_get(obj);
769 if (!strcmp(swallow, "smart"))
771 if (wd->smt_sub != content)
773 _elm_hover_subs_del(wd);
774 wd->smt_sub = content;
779 elm_widget_sub_object_add(obj, content);
780 evas_object_event_callback_add(wd->smt_sub,
781 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
782 _elm_hover_sub_obj_placement_eval_cb,
785 _elm_hover_sub_obj_placement_eval(obj);
793 evas_object_del(wd->smt_sub);
797 ELM_HOVER_PARTS_FOREACH
799 if (!strcmp(swallow, wd->subs[i].swallow))
801 if (content == wd->subs[i].obj)
803 evas_object_del(wd->subs[i].obj);
804 wd->subs[i].obj = NULL;
810 snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", swallow);
811 elm_widget_sub_object_add(obj, content);
812 edje_object_part_swallow(wd->cov, buf, content);
813 wd->subs[i].obj = content;
824 * Get the content of the hover object, in a given direction.
826 * Return the content object which was set for this widget in the
829 * @param obj The hover object
830 * @param swallow The direction that the object was display at.
831 * @return The content that was being used
833 * @note See elm_hover_content_set() for more information.
838 elm_hover_content_get(const Evas_Object *obj, const char *swallow)
840 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
844 wd = elm_widget_data_get(obj);
848 if (!strcmp(swallow, "smart"))
851 ELM_HOVER_PARTS_FOREACH
852 if (!strcmp(swallow, wd->subs[i].swallow))
853 return wd->subs[i].obj;
859 _elm_hover_sub_obj_unparent(Evas_Object *obj)
863 wd = elm_widget_data_get(obj);
865 elm_widget_sub_object_del(obj, wd->smt_sub);
866 evas_object_event_callback_del_full(wd->smt_sub,
867 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
868 _elm_hover_sub_obj_placement_eval_cb,
870 edje_object_part_unswallow(wd->cov, wd->smt_sub);
875 * Unset the content of the hover object, in a given direction.
877 * Unparent and return the content object set at that direction.
879 * @param obj The hover object
880 * @param swallow The direction that the object was display at.
881 * @return The content that was being used.
883 * @note See elm_hover_content_set() for more information.
888 elm_hover_content_unset(Evas_Object *obj, const char *swallow)
890 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
894 wd = elm_widget_data_get(obj);
898 if (!strcmp(swallow, "smart"))
900 Evas_Object *content;
905 content = wd->smt_sub;
906 _elm_hover_sub_obj_unparent(obj);
910 ELM_HOVER_PARTS_FOREACH
912 if (!strcmp(swallow, wd->subs[i].swallow))
914 Evas_Object *content;
916 if (!wd->subs[i].obj)
919 content = wd->subs[i].obj;
920 elm_widget_sub_object_del(obj, wd->subs[i].obj);
921 edje_object_part_unswallow(wd->cov, wd->subs[i].obj);
922 wd->subs[i].obj = NULL;
932 * Returns the best swallow location for content in the hover.
934 * @param obj The hover object
935 * @param pref_axis The preferred orientation axis for the hover object to use
936 * @return The edje location to place content into the hover or @c
939 * @p pref_axis may be one of
941 * - @c ELM_HOVER_AXIS_NONE -- no prefered orientation
942 * - @c ELM_HOVER_AXIS_HORIZONTAL -- horizontal
943 * - @c ELM_HOVER_AXIS_VERTICAL -- vertical
944 * - @c ELM_HOVER_AXIS_BOTH -- both
947 * See also elm_hover_content_set().
952 elm_hover_best_content_location_get(const Evas_Object *obj, Elm_Hover_Axis pref_axis)
954 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
956 Evas_Coord spc_l, spc_r, spc_t, spc_b;
959 wd = elm_widget_data_get(obj);
963 _elm_hover_left_space_calc(wd, &spc_l, &spc_t, &spc_r, &spc_b);
965 if (pref_axis == ELM_HOVER_AXIS_HORIZONTAL)
967 if (spc_l < spc_r) return _HOV_RIGHT;
968 else return _HOV_LEFT;
970 else if (pref_axis == ELM_HOVER_AXIS_VERTICAL)
972 if (spc_t < spc_b) return _HOV_BOTTOM;
973 else return _HOV_TOP;
978 if (spc_t > spc_r) return _HOV_TOP;
979 else if (spc_b > spc_r) return _HOV_BOTTOM;
982 if (spc_t > spc_r) return _HOV_TOP;
983 else if (spc_b > spc_r) return _HOV_BOTTOM;