ctxpopup: Remove use of Orientation API (EO)
authorJean-Philippe Andre <jp.andre@samsung.com>
Thu, 10 Aug 2017 05:55:30 +0000 (14:55 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Thu, 10 Aug 2017 05:58:25 +0000 (14:58 +0900)
ctxpopup belongs to legacy, some work is ongoing to provide a cleaner EO
based API for popups, etc... See T5326

Revert "ctxpopup: implement Efl.Orientation interface functions"

This reverts commit 736fb9d4980a7dee83ca0721d8b9b58c6c12a39d.

Ref T5870

src/lib/elementary/elc_ctxpopup.c
src/lib/elementary/elc_ctxpopup_legacy.h
src/lib/elementary/elm_ctxpopup.eo
src/lib/elementary/elm_widget_ctxpopup.h

index f2010b5..234a9be 100644 (file)
@@ -310,7 +310,7 @@ _base_geometry_calc(Evas_Object *obj,
      {
         Evas_Coord length[2];
 
-        if (sd->orient == EFL_ORIENT_VERTICAL)
+        if (!sd->horizontal)
           {
              length[0] = pos.y - hover_area.y;
              length[1] = (hover_area.y + hover_area.h) - pos.y;
@@ -1157,8 +1157,6 @@ _elm_ctxpopup_efl_canvas_group_group_add(Eo *obj, Elm_Ctxpopup_Data *priv)
    priv->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
    priv->auto_hide = EINA_TRUE;
 
-   priv->orient = EFL_ORIENT_VERTICAL;
-
    priv->box = elm_box_add(obj);
    evas_object_size_hint_weight_set
      (priv->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -1268,18 +1266,24 @@ _elm_ctxpopup_clear(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
    sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 }
 
-EAPI void
-elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
+EOLIAN static void
+_elm_ctxpopup_horizontal_set(Eo *obj, Elm_Ctxpopup_Data *sd, Eina_Bool horizontal)
 {
-   efl_orientation_set(obj, horizontal ? EFL_ORIENT_HORIZONTAL : EFL_ORIENT_VERTICAL);
+   sd->horizontal = !!horizontal;
+
+   if (!sd->list) return;
+
+   elm_list_horizontal_set(sd->list, sd->horizontal);
+
+   sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+
+   if (sd->visible) elm_layout_sizing_eval(obj);
 }
 
-EAPI Eina_Bool
-elm_ctxpopup_horizontal_get(const Evas_Object *obj)
+EOLIAN static Eina_Bool
+_elm_ctxpopup_horizontal_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
 {
-   ELM_CTXPOPUP_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
-
-   return sd->orient == EFL_ORIENT_HORIZONTAL ? EINA_TRUE : EINA_FALSE;
+   return sd->horizontal;
 }
 
 EAPI const Eina_List *
@@ -1605,8 +1609,7 @@ _elm_ctxpopup_item_init(Eo *eo_item,
           elm_object_style_set(sd->list, "ctxpopup");
         else elm_object_style_set(sd->list, elm_object_style_get(obj));
         elm_list_mode_set(sd->list, ELM_LIST_EXPAND);
-        //TODO: use orient interface API on list when implemented
-        elm_list_horizontal_set(sd->list, sd->orient == EFL_ORIENT_VERTICAL ? EINA_FALSE : EINA_TRUE);
+        elm_list_horizontal_set(sd->list, sd->horizontal);
         evas_object_event_callback_add
           (sd->list, EVAS_CALLBACK_RESIZE, _list_resize_cb, obj);
         elm_layout_content_set(obj, "default", sd->list);
@@ -1619,25 +1622,6 @@ _elm_ctxpopup_item_init(Eo *eo_item,
    sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 }
 
-EOLIAN static Efl_Orient
-_elm_ctxpopup_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *pd)
-{
-   return pd->orient;
-}
-
-EOLIAN static void
-_elm_ctxpopup_efl_orientation_orientation_set(Eo *obj, Elm_Ctxpopup_Data *pd, Efl_Orient orient)
-{
-   if (pd->orient == orient) return;
-   if (pd->orient != EFL_ORIENT_HORIZONTAL && pd->orient != EFL_ORIENT_VERTICAL) return;
-
-   pd->orient = orient;
-   //TODO: use orient API on list when its implemented
-   elm_list_horizontal_set(pd->list, pd->orient == EFL_ORIENT_HORIZONTAL ? EINA_TRUE : EINA_FALSE);
-   pd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
-   if (pd->visible) elm_layout_sizing_eval(obj);
-}
-
 EOLIAN static const Elm_Atspi_Action*
 _elm_ctxpopup_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd EINA_UNUSED)
 {
index 629401f..caf95a8 100644 (file)
@@ -9,27 +9,6 @@
 EAPI Evas_Object                 *elm_ctxpopup_add(Evas_Object *parent);
 
 /**
- * @brief Change the ctxpopup's orientation to horizontal or vertical.
- *
- * @param obj Elm Ctxpopup object
- * @param horizontal @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical.
- *
- * @ingroup Elm_Ctxpopup
- */
-EAPI void                         elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
-
-/**
- * @brief Get the value of current ctxpopup object's orientation.
- *
- * @param obj Elm Ctxpopup object
- * return @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical.
- * See also @ref elm_ctxpopup_horizontal_set
- *
- * @ingroup Elm_Ctxpopup
- */
-EAPI Eina_Bool                    elm_ctxpopup_horizontal_get(const Evas_Object *obj);
-
-/**
  * @brief Get the internal list of items in a given ctxpopup widget.
  *
  * This list is not to be modified in any way and must not be freed. Use the
index 69615ee..2f3740f 100644 (file)
@@ -9,13 +9,27 @@ enum Elm.Ctxpopup.Direction
 }
 
 class Elm.Ctxpopup (Efl.Ui.Layout, Elm.Interface.Atspi_Widget_Action,
-                    Efl.Orientation, Efl.Ui.Menu)
+                    Efl.Ui.Menu)
 {
    [[Elementary context popup class]]
    legacy_prefix: elm_ctxpopup;
    eo_prefix: elm_obj_ctxpopup;
    event_prefix: elm_ctxpopup;
    methods {
+      @property horizontal {
+         set {
+            [[Change the ctxpopup's orientation to horizontal or vertical.]]
+         }
+         get {
+            [[Get the value of current ctxpopup object's orientation.
+
+              See also @.horizontal.set.
+            ]]
+         }
+         values {
+            horizontal: bool; [[$true for horizontal mode, $false for vertical.]]
+         }
+      }
       @property auto_hide_disabled {
          set {
             [[Set ctxpopup auto hide mode triggered by ctxpopup policy.
@@ -203,7 +217,6 @@ class Elm.Ctxpopup (Efl.Ui.Layout, Elm.Interface.Atspi_Widget_Action,
       Efl.Ui.Menu.items { get; }
       Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
       Elm.Interface.Atspi_Accessible.state_set { get; }
-      Efl.Orientation.orientation { get; set; }
       Efl.Part.part;
    }
    events {
index b9342e1..aa50b29 100644 (file)
@@ -55,9 +55,9 @@ struct _Elm_Ctxpopup_Data
 
    Elm_Ctxpopup_Direction dir;
    Elm_Ctxpopup_Direction dir_priority[4];
-   Efl_Orient             orient;
 
    Eina_Bool              list_visible : 1;
+   Eina_Bool              horizontal : 1;
    Eina_Bool              finished : 1;
    Eina_Bool              emitted : 1;
    Eina_Bool              visible : 1;