Fix conflicts: Map, Hover, Hoversel, Menu, Web
[framework/uifw/elementary.git] / src / lib / elm_hover.c
index 5b613d6..b3aea0d 100644 (file)
@@ -1,18 +1,6 @@
 #include <Elementary.h>
 #include "elm_priv.h"
 
-/**
- * @defgroup Hover Hover
- *
- * A Hover object will over its @p parent object at the @p target
- * location. Anything in the background will be given a darker
- * coloring to indicate that the hover object is on top (at the
- * default theme).
- *
- * @note The hover object will take up the entire space of @p target
- * object.
- */
-
 typedef struct _Widget_Data Widget_Data;
 typedef struct _Content_Info Content_Info;
 
@@ -76,13 +64,16 @@ 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";
 static const Evas_Smart_Cb_Description _signals[] = {
-  {SIG_CLICKED, ""},
-  {SIG_SMART_LOCATION_CHANGED, ""},
-  {NULL, NULL}
+       {SIG_CLICKED, ""},
+       {SIG_SMART_LOCATION_CHANGED, ""},
+       {NULL, NULL}
 };
 
 static void
@@ -117,13 +108,13 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
    if (!wd) return;
    if (elm_widget_focus_get(obj))
      {
-       edje_object_signal_emit(wd->cov, "elm,action,focus", "elm");
-       evas_object_focus_set(wd->cov, EINA_TRUE);
+        edje_object_signal_emit(wd->cov, "elm,action,focus", "elm");
+        evas_object_focus_set(wd->cov, EINA_TRUE);
      }
    else
      {
-       edje_object_signal_emit(wd->cov, "elm,action,unfocus", "elm");
-       evas_object_focus_set(wd->cov, EINA_FALSE);
+        edje_object_signal_emit(wd->cov, "elm,action,unfocus", "elm");
+        evas_object_focus_set(wd->cov, EINA_FALSE);
      }
 }
 
@@ -140,6 +131,7 @@ _theme_hook(Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return;
+   _elm_widget_mirrored_reload(obj);
    _mirrored_set(obj, elm_widget_mirrored_get(obj));
    // FIXME: hover contents doesn't seem to propagate resizes properly
    _elm_theme_object_set(obj, wd->cov, "hover", "base", elm_widget_style_get(obj));
@@ -147,9 +139,9 @@ _theme_hook(Evas_Object *obj)
                          _elm_config->scale);
 
    if (wd->smt_sub)
-      _elm_hover_sub_obj_placement_eval(obj);
+     _elm_hover_sub_obj_placement_eval(obj);
    else
-      _reval_content(obj);
+     _reval_content(obj);
    _sizing_eval(obj);
    if (evas_object_visible_get(wd->cov)) _hov_show_do(obj);
 }
@@ -167,7 +159,7 @@ _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
 }
 
 static void
-_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)
+_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
 {
    Widget_Data *wd;
 
@@ -179,7 +171,7 @@ _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *so
 }
 
 static void
-_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)
+_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
 {
    Widget_Data *wd;
 
@@ -332,7 +324,7 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
    if (wd->smt_sub)
      {
         if (wd->smt_sub == sub)
-           wd->smt_sub = NULL;
+          wd->smt_sub = NULL;
      }
    else
      {
@@ -356,20 +348,20 @@ _hov_show_do(Evas_Object *obj)
 
    if (wd->cov)
      {
-       evas_object_show(wd->cov);
-       edje_object_signal_emit(wd->cov, "elm,action,show", "elm");
+        evas_object_show(wd->cov);
+        edje_object_signal_emit(wd->cov, "elm,action,show", "elm");
      }
 
    ELM_HOVER_PARTS_FOREACH
      {
-       char buf[1024];
-
-       if (wd->subs[i].obj)
-         {
-            snprintf(buf, sizeof(buf), "elm,action,slot,%s,show",
-                     wd->subs[i].swallow);
-            edje_object_signal_emit(wd->cov, buf, "elm");
-         }
+        char buf[1024];
+
+        if (wd->subs[i].obj)
+          {
+             snprintf(buf, sizeof(buf), "elm,action,slot,%s,show",
+                      wd->subs[i].swallow);
+             edje_object_signal_emit(wd->cov, buf, "elm");
+          }
      }
 }
 
@@ -398,20 +390,20 @@ _hov_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
    if (!wd) return;
    if (wd->cov)
      {
-       edje_object_signal_emit(wd->cov, "elm,action,hide", "elm");
-       evas_object_hide(wd->cov);
+        edje_object_signal_emit(wd->cov, "elm,action,hide", "elm");
+        evas_object_hide(wd->cov);
      }
 
    ELM_HOVER_PARTS_FOREACH
      {
-       char buf[1024];
-
-       if (wd->subs[i].obj)
-         {
-            snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide",
-                     wd->subs[i].swallow);
-            edje_object_signal_emit(wd->cov, buf, "elm");
-         }
+        char buf[1024];
+
+        if (wd->subs[i].obj)
+          {
+             snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide",
+                      wd->subs[i].swallow);
+             edje_object_signal_emit(wd->cov, buf, "elm");
+          }
      }
 }
 
@@ -477,14 +469,6 @@ _parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *e
    _sizing_eval(data);
 }
 
-/**
- * Adds a hover object to @p parent
- *
- * @param parent The parent object
- * @return The hover object or NULL if one could not be created
- *
- * @ingroup Hover
- */
 EAPI Evas_Object *
 elm_hover_add(Evas_Object *parent)
 {
@@ -492,16 +476,8 @@ elm_hover_add(Evas_Object *parent)
    Evas *e;
    Widget_Data *wd;
 
-   EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
-   wd = ELM_NEW(Widget_Data);
+   ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
 
-   ELM_HOVER_PARTS_FOREACH
-     wd->subs[i].swallow = _directions[i];
-
-   e = evas_object_evas_get(parent);
-   if (!e) return NULL;
-   obj = elm_widget_add(e);
    ELM_SET_WIDTYPE(widtype, "hover");
    elm_widget_type_set(obj, "hover");
    elm_widget_sub_object_add(parent, obj);
@@ -514,6 +490,12 @@ 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];
 
    wd->hov = evas_object_rectangle_add(e);
    evas_object_pass_events_set(wd->hov, EINA_TRUE);
@@ -553,15 +535,6 @@ elm_hover_add(Evas_Object *parent)
    return obj;
 }
 
-/**
- * Sets the target object for the hover.
- *
- * @param obj The hover object
- * @param target The object to center the hover onto. The hover
- * will take up the entire space that the target object fills.
- *
- * @ingroup Hover
- */
 EAPI void
 elm_hover_target_set(Evas_Object *obj, Evas_Object *target)
 {
@@ -578,24 +551,16 @@ elm_hover_target_set(Evas_Object *obj, Evas_Object *target)
    wd->target = target;
    if (wd->target)
      {
-       evas_object_event_callback_add(wd->target, EVAS_CALLBACK_DEL,
+        evas_object_event_callback_add(wd->target, EVAS_CALLBACK_DEL,
                                        _target_del, obj);
-       evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MOVE,
+        evas_object_event_callback_add(wd->target, EVAS_CALLBACK_MOVE,
                                        _target_move, obj);
-       elm_widget_hover_object_set(target, obj);
-       _sizing_eval(obj);
+        elm_widget_hover_object_set(target, obj);
+        _sizing_eval(obj);
      }
 }
 
 
-/**
- * Sets the parent object for the hover.
- *
- * @param obj The hover object
- * @param parent The object to locate the hover over.
- *
- * @ingroup Hover
- */
 EAPI void
 elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
 {
@@ -604,43 +569,35 @@ elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
    if (!wd) return;
    if (wd->parent)
      {
-       evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_MOVE,
-                                       _parent_move, obj);
-       evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE,
-                                       _parent_resize, obj);
-       evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_SHOW,
-                                       _parent_show, obj);
-       evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_HIDE,
-                                       _parent_hide, obj);
-       evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_DEL,
-                                       _parent_del, obj);
+        evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_MOVE,
+                                            _parent_move, obj);
+        evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE,
+                                            _parent_resize, obj);
+        evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_SHOW,
+                                            _parent_show, obj);
+        evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_HIDE,
+                                            _parent_hide, obj);
+        evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_DEL,
+                                            _parent_del, obj);
      }
    wd->parent = parent;
    if (wd->parent)
      {
-       evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_MOVE,
+        evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_MOVE,
                                        _parent_move, obj);
-       evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_RESIZE,
+        evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_RESIZE,
                                        _parent_resize, obj);
-       evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_SHOW,
+        evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_SHOW,
                                        _parent_show, obj);
-       evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_HIDE,
+        evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_HIDE,
                                        _parent_hide, obj);
-       evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_DEL,
+        evas_object_event_callback_add(wd->parent, EVAS_CALLBACK_DEL,
                                        _parent_del, obj);
-//     elm_widget_sub_object_add(parent, obj);
+        //     elm_widget_sub_object_add(parent, obj);
      }
    _sizing_eval(obj);
 }
 
-/**
- * Gets the target object for the hover.
- *
- * @param obj The hover object
- * @return The target object of the hover.
- *
- * @ingroup Hover
- */
 EAPI Evas_Object *
 elm_hover_target_get(const Evas_Object *obj)
 {
@@ -651,14 +608,6 @@ elm_hover_target_get(const Evas_Object *obj)
    return wd->target;
 }
 
-/**
- * Gets the parent object for the hover.
- *
- * @param obj The hover object
- * @return The parent object to locate the hover over.
- *
- * @ingroup Hover
- */
 EAPI Evas_Object *
 elm_hover_parent_get(const Evas_Object *obj)
 {
@@ -674,11 +623,11 @@ _elm_hover_subs_del(Widget_Data *wd)
 {
    ELM_HOVER_PARTS_FOREACH
      {
-       if (wd->subs[i].obj)
-         {
+        if (wd->subs[i].obj)
+          {
              evas_object_del(wd->subs[i].obj);
              wd->subs[i].obj = NULL;
-         }
+          }
      }
 }
 
@@ -728,47 +677,75 @@ _elm_hover_sub_obj_placement_eval_cb(void *data, Evas *e __UNUSED__, Evas_Object
    _elm_hover_sub_obj_placement_eval(data);
 }
 
-/**
- * Sets the content of the hover object and the direction in which
- * it will pop out.
- *
- * 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.
- *
- * @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
- *
- * 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 dinamic 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.
- *
- * @ingroup Hover
- */
-EAPI void
-elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content)
+static void
+_elm_hover_sub_obj_unparent(Evas_Object *obj)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
+   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 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"))
      {
@@ -800,11 +777,11 @@ elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *conten
 
    ELM_HOVER_PARTS_FOREACH
      {
-       if (!strcmp(swallow, wd->subs[i].swallow))
-         {
-            if (content == wd->subs[i].obj)
+        if (!strcmp(swallow, wd->subs[i].swallow))
+          {
+             if (content == wd->subs[i].obj)
                return;
-            evas_object_del(wd->subs[i].obj);
+             evas_object_del(wd->subs[i].obj);
              wd->subs[i].obj = NULL;
 
              if (content)
@@ -816,38 +793,20 @@ elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *conten
                   edje_object_part_swallow(wd->cov, buf, content);
                   wd->subs[i].obj = content;
                }
-            break;
-         }
+             break;
+          }
      }
-
- end:
+end:
    _sizing_eval(obj);
 }
 
-/**
- * Get the content of the hover object, in a given direction.
- *
- * Return the content object which was set for this widget in the
- * given direction.
- *
- * @param obj The hover object
- * @param swallow The direction that the object was display at.
- * @return The content that was being used
- *
- * @note See elm_hover_content_set() for more information.
- *
- * @ingroup Hover
- */
-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;
@@ -859,131 +818,35 @@ elm_hover_content_get(const Evas_Object *obj, const char *swallow)
    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;
-}
-
-/**
- * Unset the content of the hover object, in a given direction.
- *
- * Unparent and return the content object set at that direction.
- *
- * @param obj The hover object
- * @param swallow The direction that the object was display at.
- * @return The content that was being used.
- *
- * @note See elm_hover_content_set() for more information.
- *
- * @ingroup Hover
- */
-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;
      }
 
    ELM_HOVER_PARTS_FOREACH
      {
-       if (!strcmp(swallow, wd->subs[i].swallow))
-         {
-            Evas_Object *content;
-
-            if (!wd->subs[i].obj)
-               return NULL;
-
-            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;
+        if (!strcmp(swallow, wd->subs[i].swallow))
+          {
+             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;
 
-            return content;
-         }
+             return content;
+          }
      }
 
    return NULL;
 }
-
-/**
- * Returns the best swallow location for content in the hover.
- *
- * @param obj The hover object
- * @param pref_axis The preferred orientation axis for the hover object to use
- * @return The edje location to place content into the hover or @c
- *         NULL, on errors.
- *
- * @p pref_axis may be one of
- * <ul>
- * - @c ELM_HOVER_AXIS_NONE -- no prefered orientation
- * - @c ELM_HOVER_AXIS_HORIZONTAL -- horizontal
- * - @c ELM_HOVER_AXIS_VERTICAL -- vertical
- * - @c ELM_HOVER_AXIS_BOTH -- both
- * </ul>
- *
- * See also elm_hover_content_set().
- *
- * @ingroup Hover
- */
-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;
-}