jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=3c390b3969a711c6853f4939fc6cc8697df9791d

commit 3c390b3969a711c6853f4939fc6cc8697df9791d
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Thu Aug 10 12:19:34 2017 +0900

    index: Switch to Efl.Ui.Dir (EO)
    
    Ref T5870
---
 src/lib/elementary/elm_index.c        | 57 ++++++++++++++---------------------
 src/lib/elementary/elm_index.eo       | 28 ++---------------
 src/lib/elementary/elm_widget_index.h |  2 +-
 3 files changed, 26 insertions(+), 61 deletions(-)

diff --git a/src/lib/elementary/elm_index.c b/src/lib/elementary/elm_index.c
index 7bc387c062..2e7244c472 100644
--- a/src/lib/elementary/elm_index.c
+++ b/src/lib/elementary/elm_index.c
@@ -54,24 +54,17 @@ _item_free(Elm_Index_Item_Data *it)
 }
 
 static void
-_box_custom_layout(Evas_Object *o,
-                   Evas_Object_Box_Data *priv,
-                   void *data)
+_box_custom_layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data)
 {
    ELM_INDEX_DATA_GET(data, sd);
    Eina_Bool horizontal;
 
-   if (sd->orientation == EFL_ORIENT_HORIZONTAL)
-     horizontal = EINA_TRUE;
-   else
-     horizontal = EINA_FALSE;
-
+   horizontal = efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE);
    _els_box_layout(o, priv, horizontal, EINA_TRUE, efl_ui_mirrored_get(data));
 }
 
 static void
-_index_box_clear(Evas_Object *obj,
-                 int level)
+_index_box_clear(Evas_Object *obj, int level)
 {
    Eina_List *l;
    Elm_Object_Item *eo_item;
@@ -249,7 +242,7 @@ _index_box_auto_fill(Evas_Object *obj,
    if (sd->omit_enabled)
      {
         o = edje_object_add(evas_object_evas_get(obj));
-        if (sd->orientation == EFL_ORIENT_HORIZONTAL)
+        if (efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE))
           {
              elm_widget_theme_object_set
                 (obj, o, "index", "item/horizontal", style);
@@ -340,7 +333,7 @@ _index_box_auto_fill(Evas_Object *obj,
         edje_object_mirrored_set(VIEW(it), rtl);
         o = VIEW(it);
 
-        if (sd->orientation == EFL_ORIENT_HORIZONTAL)
+        if (efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE))
           {
              if (i & 0x1)
                elm_widget_theme_object_set
@@ -453,7 +446,7 @@ _elm_index_elm_widget_theme_apply(Eo *obj, Elm_Index_Data 
*sd)
    _index_box_clear(obj, 0);
    _index_box_clear(obj, 1);
 
-   if (sd->orientation == EFL_ORIENT_HORIZONTAL)
+   if (efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE))
      eina_stringshare_replace(&ld->group, "base/horizontal");
    else
      eina_stringshare_replace(&ld->group, "base/vertical");
@@ -670,7 +663,7 @@ _sel_eval(Evas_Object *obj,
                   x = (x * x) + (y * y);
                   if ((x < dist) || (!it_closest))
                     {
-                       if (sd->orientation == EFL_ORIENT_HORIZONTAL)
+                       if (efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE))
                          cdv = (double)(xx - bx) / (double)bw;
                        else
                          cdv = (double)(yy - by) / (double)bh;
@@ -911,7 +904,7 @@ _on_mouse_move(void *data,
      (wd->resize_obj, "elm.dragable.pointer",
      (!edje_object_mirrored_get(wd->resize_obj)) ?
      x : (x - w), y);
-   if ((sd->orientation == EFL_ORIENT_VERTICAL) && (sd->event_rect[1]))
+   if (!efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE) && (sd->event_rect[1]))
      {
         if (adx > minw)
           {
@@ -1103,6 +1096,7 @@ _elm_index_efl_canvas_group_group_add(Eo *obj, 
Elm_Index_Data *priv)
    evas_object_show(priv->bx[0]);
 
    priv->delay_change_time = INDEX_DELAY_CHANGE_TIME;
+   priv->dir = EFL_UI_DIR_VERTICAL;
 
    if (edje_object_part_exists
          (wd->resize_obj, "elm.swallow.index.1"))
@@ -1249,24 +1243,16 @@ elm_index_add(Evas_Object *parent)
 
 EAPI void elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
 {
-   Efl_Orient orient;
-
-   if (horizontal)
-     orient = EFL_ORIENT_HORIZONTAL;
-   else
-     orient = EFL_ORIENT_VERTICAL;
+   Efl_Ui_Dir dir = horizontal ? EFL_UI_DIR_HORIZONTAL : EFL_UI_DIR_VERTICAL;
 
-   efl_orientation_set(obj, orient);
+   efl_ui_direction_set(obj, dir);
 }
 
 EAPI Eina_Bool elm_index_horizontal_get(const Evas_Object *obj)
 {
-   Efl_Orient orient = efl_orientation_get(obj);
+   Efl_Ui_Dir dir = efl_ui_direction_get(obj);
 
-   if (orient == EFL_ORIENT_HORIZONTAL)
-     return EINA_TRUE;
-
-   return EINA_FALSE;
+   return efl_ui_dir_is_horizontal(dir, EINA_FALSE);
 }
 
 EOLIAN static Eo *
@@ -1636,20 +1622,23 @@ _elm_index_item_letter_get(const Eo *item EINA_UNUSED, 
Elm_Index_Item_Data *it)
 }
 
 EOLIAN static void
-_elm_index_efl_orientation_orientation_set(Eo *obj, Elm_Index_Data *sd, 
Efl_Orient dir)
+_elm_index_efl_ui_direction_direction_set(Eo *obj, Elm_Index_Data *sd, 
Efl_Ui_Dir dir)
 {
-   if ((dir != EFL_ORIENT_HORIZONTAL) && (dir != EFL_ORIENT_VERTICAL))
-     return;
+   // Adjust direction to be either horizontal or vertical.
+   if (efl_ui_dir_is_horizontal(dir, EINA_FALSE))
+     dir = EFL_UI_DIR_HORIZONTAL;
+   else
+     dir = EFL_UI_DIR_VERTICAL;
 
-   sd->orientation = dir;
+   sd->dir = dir;
 
    elm_obj_widget_theme_apply(obj);
 }
 
-EOLIAN static Efl_Orient
-_elm_index_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Elm_Index_Data 
*sd)
+EOLIAN static Efl_Ui_Dir
+_elm_index_efl_ui_direction_direction_get(Eo *obj EINA_UNUSED, Elm_Index_Data 
*sd)
 {
-   return sd->orientation;
+   return sd->dir;
 }
 
 EOLIAN static void
diff --git a/src/lib/elementary/elm_index.eo b/src/lib/elementary/elm_index.eo
index 0053d19664..c67b2d7fa0 100644
--- a/src/lib/elementary/elm_index.eo
+++ b/src/lib/elementary/elm_index.eo
@@ -1,4 +1,4 @@
-class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
+class Elm.Index (Efl.Ui.Layout, Efl.Ui.Direction,
                  Efl.Ui.Clickable, Efl.Ui.Selectable)
 {
    [[elementary index class]]
@@ -8,10 +8,6 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
    methods {
       @property autohide_disabled {
          [[Enable or disable auto hiding feature for a given index widget.]]
-         set {
-         }
-         get {
-         }
          values {
             disabled: bool; [[$true to disable auto hiding, $false to enable]]
          }
@@ -20,10 +16,6 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
          [[Enable or disable omit feature for a given index widget.
 
            @since 1.8]]
-         set {
-         }
-         get {
-         }
          values {
             enabled: bool; [[$true to enable omit feature, $false to disable]]
          }
@@ -32,10 +24,6 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
          [[Control standard_priority group of index. Priority group will be 
shown as many items as it can, and other group will be shown one character only.
 
            @since 1.16]]
-         set {
-         }
-         get {
-         }
          values {
             priority: int; [[$priority target priority value in index]]
          }
@@ -44,10 +32,6 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
          [[Set a delay change time for index object.
 
            Note: delay time is 0.2 sec by default.]]
-         set {
-         }
-         get {
-         }
          values {
             dtime: double; [[The delay change time to set.]]
          }
@@ -56,10 +40,6 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
          [[Control the indicator as to be disabled.
 
            In Index widget, Indicator notes popup text, which shows a letter 
has been selecting.]]
-         set {
-         }
-         get {
-         }
          values {
             disabled: bool; [[$true to disable it, $false to enable it]]
          }
@@ -68,10 +48,6 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
          [[Set the items level for a given index widget.
 
            See: elm_index_item_level_get()]]
-         set {
-         }
-         get {
-         }
          values {
             level: int; [[$0 or $1, the currently implemented levels.]]
          }
@@ -226,7 +202,7 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
       Elm.Widget.focus_direction_manager_is;
       Elm.Widget.access;
       Elm.Widget.focus_next;
-      Efl.Orientation.orientation { get; set; }
+      Efl.Ui.Direction.direction { get; set; [[Only supports $vertical and 
$horizontal. Default is $vertical.]] }
       Elm.Interface.Atspi_Accessible.children { get; }
    }
    events {
diff --git a/src/lib/elementary/elm_widget_index.h 
b/src/lib/elementary/elm_widget_index.h
index 5b6befff99..af6cf3717c 100644
--- a/src/lib/elementary/elm_widget_index.h
+++ b/src/lib/elementary/elm_widget_index.h
@@ -33,7 +33,7 @@ struct _Elm_Index_Data
                                   * small */
    Eina_List            *omit;
 
-   Efl_Orient            orientation;
+   Efl_Ui_Dir            dir;
    int                   level;
    Evas_Coord            dx, dy;
    Ecore_Timer          *delay;

-- 


Reply via email to