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 _theme_hook(Evas_Object *obj);
67 static void _sizing_eval(Evas_Object *obj);
68 static void _reval_content(Evas_Object *obj);
69 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
70 static void _hov_show_do(Evas_Object *obj);
71 static void _hov_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
72 static void _hov_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
73 static void _hov_show(void *data, Evas *e, Evas_Object *obj, void *event_info);
74 static void _hov_hide(void *data, Evas *e, Evas_Object *obj, void *event_info);
75 static void _on_focus_hook(void *data, Evas_Object *obj);
76 static void _elm_hover_sub_obj_placement_eval_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
77 static void _elm_hover_sub_obj_placement_eval(Evas_Object *obj);
79 static const char SIG_CLICKED[] = "clicked";
80 static const char SIG_SMART_LOCATION_CHANGED[] = "smart,changed";
81 static const Evas_Smart_Cb_Description _signals[] = {
83 {SIG_SMART_LOCATION_CHANGED, ""},
88 _del_pre_hook(Evas_Object *obj)
90 Widget_Data *wd = elm_widget_data_get(obj);
94 if (evas_object_visible_get(obj))
95 evas_object_smart_callback_call(obj, SIG_CLICKED, NULL);
96 elm_hover_target_set(obj, NULL);
97 elm_hover_parent_set(obj, NULL);
98 evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_MOVE, _hov_move, obj);
99 evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_RESIZE, _hov_resize, obj);
100 evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_SHOW, _hov_show, obj);
101 evas_object_event_callback_del_full(wd->hov, EVAS_CALLBACK_HIDE, _hov_hide, obj);
105 _del_hook(Evas_Object *obj)
107 Widget_Data *wd = elm_widget_data_get(obj);
113 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
115 Widget_Data *wd = elm_widget_data_get(obj);
117 if (elm_widget_focus_get(obj))
119 edje_object_signal_emit(wd->cov, "elm,action,focus", "elm");
120 evas_object_focus_set(wd->cov, EINA_TRUE);
124 edje_object_signal_emit(wd->cov, "elm,action,unfocus", "elm");
125 evas_object_focus_set(wd->cov, EINA_FALSE);
130 _theme_hook(Evas_Object *obj)
132 Widget_Data *wd = elm_widget_data_get(obj);
134 // FIXME: hover contents doesn't seem to propagate resizes properly
135 _elm_theme_object_set(obj, wd->cov, "hover", "base", elm_widget_style_get(obj));
136 edje_object_scale_set(wd->cov, elm_widget_scale_get(obj) *
140 _elm_hover_sub_obj_placement_eval(obj);
144 if (evas_object_visible_get(wd->cov)) _hov_show_do(obj);
148 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
152 wd = elm_widget_data_get(obj);
156 edje_object_signal_emit(wd->cov, emission, source);
160 _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)
164 wd = elm_widget_data_get(obj);
168 edje_object_signal_callback_add(wd->hov, emission, source, func_cb, data);
172 _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)
176 wd = elm_widget_data_get(obj);
178 edje_object_signal_callback_del_full(wd->hov, emission, source, func_cb,
183 _elm_hover_left_space_calc(Widget_Data *wd, Evas_Coord *spc_l, Evas_Coord *spc_t, Evas_Coord *spc_r, Evas_Coord *spc_b)
185 Evas_Coord x = 0, y = 0, w = 0, h = 0, x2 = 0, y2 = 0, w2 = 0, h2 = 0;
188 evas_object_geometry_get(wd->parent, &x, &y, &w, &h);
190 evas_object_geometry_get(wd->target, &x2, &y2, &w2, &h2);
193 *spc_r = (x + w) - (x2 + w2);
200 *spc_b = (y + h) - (y2 + h2);
208 _sizing_eval(Evas_Object *obj)
210 Widget_Data *wd = elm_widget_data_get(obj);
211 Evas_Coord x = 0, y = 0, w = 0, h = 0, x2 = 0, y2 = 0, w2 = 0, h2 = 0;
213 if (wd->parent) evas_object_geometry_get(wd->parent, &x, &y, &w, &h);
214 if (wd->hov) evas_object_geometry_get(wd->hov, &x2, &y2, &w2, &h2);
215 evas_object_move(wd->cov, x, y);
216 evas_object_resize(wd->cov, w, h);
217 evas_object_size_hint_min_set(wd->offset, x2 - x, y2 - y);
218 evas_object_size_hint_min_set(wd->size, w2, h2);
219 edje_object_part_swallow(wd->cov, "elm.swallow.offset", wd->offset);
220 edje_object_part_swallow(wd->cov, "elm.swallow.size", wd->size);
224 _reval_content(Evas_Object *obj)
226 Widget_Data *wd = elm_widget_data_get(obj);
230 ELM_HOVER_PARTS_FOREACH
233 snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", wd->subs[i].swallow);
234 edje_object_part_swallow(wd->cov, buf, wd->subs[i].obj);
239 _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)
241 Evas_Coord c_w = 0, c_h = 0, mid_w, mid_h;
244 evas_object_size_hint_min_get(wd->smt_sub, &c_w, &c_h);
251 max = MAX(spc_t, spc_r);
252 max = MAX(max, spc_b);
257 return _HOV_TOP_RIGHT;
265 return _HOV_BOTTOM_RIGHT;
266 else if (mid_h > spc_b)
267 return _HOV_TOP_RIGHT;
273 return _HOV_BOTTOM_RIGHT;
278 max = MAX(spc_t, spc_l);
279 max = MAX(max, spc_b);
284 return _HOV_TOP_LEFT;
292 return _HOV_BOTTOM_LEFT;
293 else if (mid_h > spc_b)
294 return _HOV_TOP_LEFT;
300 return _HOV_BOTTOM_LEFT;
306 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
312 wd = elm_widget_data_get(obj);
318 if (wd->smt_sub == sub)
323 ELM_HOVER_PARTS_FOREACH
325 if (wd->subs[i].obj == sub)
327 wd->subs[i].obj = NULL;
335 _hov_show_do(Evas_Object *obj)
337 Widget_Data *wd = elm_widget_data_get(obj);
343 evas_object_show(wd->cov);
344 edje_object_signal_emit(wd->cov, "elm,action,show", "elm");
347 ELM_HOVER_PARTS_FOREACH
353 snprintf(buf, sizeof(buf), "elm,action,slot,%s,show",
354 wd->subs[i].swallow);
355 edje_object_signal_emit(wd->cov, buf, "elm");
361 _hov_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
367 _hov_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
373 _hov_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
379 _hov_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
381 Widget_Data *wd = elm_widget_data_get(data);
385 edje_object_signal_emit(wd->cov, "elm,action,hide", "elm");
386 evas_object_hide(wd->cov);
389 ELM_HOVER_PARTS_FOREACH
395 snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide",
396 wd->subs[i].swallow);
397 edje_object_signal_emit(wd->cov, buf, "elm");
403 _target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
405 Widget_Data *wd = elm_widget_data_get(data);
411 _target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
413 Widget_Data *wd = elm_widget_data_get(data);
418 _elm_hover_sub_obj_placement_eval(data);
422 _signal_dismiss(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
424 Widget_Data *wd = elm_widget_data_get(data);
426 evas_object_hide(data);
427 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
431 _parent_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
437 _parent_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
443 _parent_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
448 _parent_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
450 Widget_Data *wd = elm_widget_data_get(data);
452 evas_object_hide(wd->cov);
456 _parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
458 Widget_Data *wd = elm_widget_data_get(data);
460 elm_hover_parent_set(data, NULL);
465 * Adds a hover object to @p parent
467 * @param parent The parent object
468 * @return The hover object or NULL if one could not be created
473 elm_hover_add(Evas_Object *parent)
479 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
481 wd = ELM_NEW(Widget_Data);
483 ELM_HOVER_PARTS_FOREACH
484 wd->subs[i].swallow = _directions[i];
486 e = evas_object_evas_get(parent);
488 obj = elm_widget_add(e);
489 ELM_SET_WIDTYPE(widtype, "hover");
490 elm_widget_type_set(obj, "hover");
491 elm_widget_sub_object_add(parent, obj);
492 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
493 elm_widget_data_set(obj, wd);
494 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
495 elm_widget_theme_hook_set(obj, _theme_hook);
496 elm_widget_del_hook_set(obj, _del_hook);
497 elm_widget_can_focus_set(obj, EINA_TRUE);
498 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
499 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
500 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
502 wd->hov = evas_object_rectangle_add(e);
503 evas_object_pass_events_set(wd->hov, EINA_TRUE);
504 evas_object_color_set(wd->hov, 0, 0, 0, 0);
505 elm_widget_resize_object_set(obj, wd->hov);
506 evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_MOVE, _hov_move, obj);
507 evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_RESIZE, _hov_resize, obj);
508 evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_SHOW, _hov_show, obj);
509 evas_object_event_callback_add(wd->hov, EVAS_CALLBACK_HIDE, _hov_hide, obj);
511 wd->cov = edje_object_add(e);
512 _elm_theme_object_set(obj, wd->cov, "hover", "base", "default");
513 elm_widget_sub_object_add(obj, wd->cov);
514 edje_object_signal_callback_add(wd->cov, "elm,action,dismiss", "",
515 _signal_dismiss, obj);
517 wd->offset = evas_object_rectangle_add(e);
518 evas_object_pass_events_set(wd->offset, EINA_TRUE);
519 evas_object_color_set(wd->offset, 0, 0, 0, 0);
520 elm_widget_sub_object_add(obj, wd->offset);
522 wd->size = evas_object_rectangle_add(e);
523 evas_object_pass_events_set(wd->size, EINA_TRUE);
524 evas_object_color_set(wd->size, 0, 0, 0, 0);
525 elm_widget_sub_object_add(obj, wd->size);
527 edje_object_part_swallow(wd->cov, "elm.swallow.offset", wd->offset);
528 edje_object_part_swallow(wd->cov, "elm.swallow.size", wd->size);
530 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
532 elm_hover_parent_set(obj, parent);
533 evas_object_smart_callbacks_descriptions_set(obj, _signals);
540 * Sets the target object for the hover.
542 * @param obj The hover object
543 * @param target The object to center the hover onto. The hover
544 * will take up the entire space that the target object fills.
549 elm_hover_target_set(Evas_Object *obj, Evas_Object *target)
551 ELM_CHECK_WIDTYPE(obj, widtype);
552 Widget_Data *wd = elm_widget_data_get(obj);
556 evas_object_event_callback_del_full(wd->target, EVAS_CALLBACK_DEL,
558 evas_object_event_callback_del_full(wd->target, EVAS_CALLBACK_MOVE,
564 evas_object_event_callback_add(wd->target, EVAS_CALLBACK_DEL,
566 evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MOVE,
568 elm_widget_hover_object_set(target, obj);
575 * Sets the parent object for the hover.
577 * @param obj The hover object
578 * @param parent The object to locate the hover over.
583 elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
585 ELM_CHECK_WIDTYPE(obj, widtype);
586 Widget_Data *wd = elm_widget_data_get(obj);
590 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_MOVE,
592 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE,
593 _parent_resize, obj);
594 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_SHOW,
596 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_HIDE,
598 evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_DEL,
604 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_MOVE,
606 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_RESIZE,
607 _parent_resize, obj);
608 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_SHOW,
610 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_HIDE,
612 evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_DEL,
614 // elm_widget_sub_object_add(parent, obj);
620 * Gets the target object for the hover.
622 * @param obj The hover object
623 * @return The target object of the hover.
628 elm_hover_target_get(const Evas_Object *obj)
630 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
631 Widget_Data *wd = elm_widget_data_get(obj);
632 if (!wd) return NULL;
638 * Gets the parent object for the hover.
640 * @param obj The hover object
641 * @return The parent object to locate the hover over.
646 elm_hover_parent_get(const Evas_Object *obj)
648 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
649 Widget_Data *wd = elm_widget_data_get(obj);
650 if (!wd) return NULL;
656 _elm_hover_subs_del(Widget_Data *wd)
658 ELM_HOVER_PARTS_FOREACH
662 evas_object_del(wd->subs[i].obj);
663 wd->subs[i].obj = NULL;
669 _elm_hover_sub_obj_placement_eval(Evas_Object *obj)
671 Evas_Coord spc_l, spc_r, spc_t, spc_b;
672 const char *smart_dir;
676 wd = elm_widget_data_get(obj);
680 _elm_hover_left_space_calc(wd, &spc_l, &spc_t, &spc_r, &spc_b);
682 edje_object_part_unswallow(wd->cov, wd->smt_sub);
684 smart_dir = _elm_hover_smart_content_location_get(wd, spc_l, spc_t, spc_r,
686 evas_object_smart_callback_call(obj, SIG_SMART_LOCATION_CHANGED,
689 snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", smart_dir);
690 edje_object_part_swallow(wd->cov, buf, wd->smt_sub);
694 _elm_hover_sub_obj_placement_eval_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
696 _elm_hover_sub_obj_placement_eval(data);
700 * Sets the content of the hover object and the direction in which
703 * Once the content object is set for a given direction, a previously
704 * set one (on the same direction) will be deleted. If you want to
705 * keep that old content object, use the elm_hover_content_unset()
708 * @param obj The hover object
709 * @param swallow The direction that the object will be displayed
710 * at. Accepted values are "left", "top-left", "top", "top-right",
711 * "right", "bottom-right", "bottom", "bottom-left", "middle" and
713 * @param content The content to place at @p swallow
715 * All directions may have contents at the same time, except for
716 * "smart". This is a special placement hint and its use case
717 * independs of the calculations coming from
718 * elm_hover_best_content_location_get(). Its use is for cases when
719 * one desires only one hover content, but with a dinamic special
720 * placement within the hover area. The content's geometry, whenever
721 * it changes, will be used to decide on a best location not
722 * extrapolating the hover's parent object view to show it in (still
723 * being the hover's target determinant of its medium part -- move and
724 * resize it to simulate finger sizes, for example). If one of the
725 * directions other than "smart" are used, a previously content set
726 * using it will be deleted, and vice-versa.
731 elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content)
733 ELM_CHECK_WIDTYPE(obj, widtype);
737 wd = elm_widget_data_get(obj);
741 if (!strcmp(swallow, "smart"))
743 if (wd->smt_sub != content)
745 _elm_hover_subs_del(wd);
746 wd->smt_sub = content;
751 elm_widget_sub_object_add(obj, content);
752 evas_object_event_callback_add(wd->smt_sub,
753 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
754 _elm_hover_sub_obj_placement_eval_cb,
757 _elm_hover_sub_obj_placement_eval(obj);
765 evas_object_del(wd->smt_sub);
769 ELM_HOVER_PARTS_FOREACH
771 if (!strcmp(swallow, wd->subs[i].swallow))
773 if (content == wd->subs[i].obj)
775 evas_object_del(wd->subs[i].obj);
776 wd->subs[i].obj = NULL;
782 snprintf(buf, sizeof(buf), "elm.swallow.slot.%s", swallow);
783 elm_widget_sub_object_add(obj, content);
784 edje_object_part_swallow(wd->cov, buf, content);
785 wd->subs[i].obj = content;
796 * Get the content of the hover object, in a given direction.
798 * Return the content object which was set for this widget in the
801 * @param obj The hover object
802 * @param swallow The direction that the object was display at.
803 * @return The content that was being used
805 * @note See elm_hover_content_set() for more information.
810 elm_hover_content_get(const Evas_Object *obj, const char *swallow)
812 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
816 wd = elm_widget_data_get(obj);
820 if (!strcmp(swallow, "smart"))
823 ELM_HOVER_PARTS_FOREACH
824 if (!strcmp(swallow, wd->subs[i].swallow))
825 return wd->subs[i].obj;
831 _elm_hover_sub_obj_unparent(Evas_Object *obj)
835 wd = elm_widget_data_get(obj);
837 elm_widget_sub_object_del(obj, wd->smt_sub);
838 evas_object_event_callback_del_full(wd->smt_sub,
839 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
840 _elm_hover_sub_obj_placement_eval_cb,
842 edje_object_part_unswallow(wd->cov, wd->smt_sub);
847 * Unset the content of the hover object, in a given direction.
849 * Unparent and return the content object set at that direction.
851 * @param obj The hover object
852 * @param swallow The direction that the object was display at.
853 * @return The content that was being used.
855 * @note See elm_hover_content_set() for more information.
860 elm_hover_content_unset(Evas_Object *obj, const char *swallow)
862 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
866 wd = elm_widget_data_get(obj);
870 if (!strcmp(swallow, "smart"))
872 Evas_Object *content;
877 content = wd->smt_sub;
878 _elm_hover_sub_obj_unparent(obj);
882 ELM_HOVER_PARTS_FOREACH
884 if (!strcmp(swallow, wd->subs[i].swallow))
886 Evas_Object *content;
888 if (!wd->subs[i].obj)
891 content = wd->subs[i].obj;
892 elm_widget_sub_object_del(obj, wd->subs[i].obj);
893 edje_object_part_unswallow(wd->cov, wd->subs[i].obj);
894 wd->subs[i].obj = NULL;
904 * Returns the best swallow location for content in the hover.
906 * @param obj The hover object
907 * @param pref_axis The preferred orientation axis for the hover object to use
908 * @return The edje location to place content into the hover or @c
911 * @p pref_axis may be one of
913 * - @c ELM_HOVER_AXIS_NONE -- no prefered orientation
914 * - @c ELM_HOVER_AXIS_HORIZONTAL -- horizontal
915 * - @c ELM_HOVER_AXIS_VERTICAL -- vertical
916 * - @c ELM_HOVER_AXIS_BOTH -- both
919 * See also elm_hover_content_set().
924 elm_hover_best_content_location_get(const Evas_Object *obj, Elm_Hover_Axis pref_axis)
926 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
928 Evas_Coord spc_l, spc_r, spc_t, spc_b;
931 wd = elm_widget_data_get(obj);
935 _elm_hover_left_space_calc(wd, &spc_l, &spc_t, &spc_r, &spc_b);
937 if (pref_axis == ELM_HOVER_AXIS_HORIZONTAL)
939 if (spc_l < spc_r) return _HOV_RIGHT;
940 else return _HOV_LEFT;
942 else if (pref_axis == ELM_HOVER_AXIS_VERTICAL)
944 if (spc_t < spc_b) return _HOV_BOTTOM;
945 else return _HOV_TOP;
950 if (spc_t > spc_r) return _HOV_TOP;
951 else if (spc_b > spc_r) return _HOV_BOTTOM;
954 if (spc_t > spc_r) return _HOV_TOP;
955 else if (spc_b > spc_r) return _HOV_BOTTOM;