jpeg pushed a commit to branch master.

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

commit a28b89304e51d6f857f90654f2cd40bb2d264196
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Thu Aug 10 13:54:05 2017 +0900

    toolbar: Switch to Efl.Ui.Dir (EO)
    
    Ref T5870
---
 src/lib/elementary/elm_toolbar.c        | 95 +++++++++++++++++----------------
 src/lib/elementary/elm_toolbar.eo       |  4 +-
 src/lib/elementary/elm_widget_toolbar.h |  2 +-
 3 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c
index efa8be816c..f01d888be7 100644
--- a/src/lib/elementary/elm_toolbar.c
+++ b/src/lib/elementary/elm_toolbar.c
@@ -168,7 +168,7 @@ _items_visibility_fix(Elm_Toolbar_Data *sd,
    if (sd->more_item)
      {
         evas_object_geometry_get(sd->VIEW(more_item), NULL, NULL, &ciw, &cih);
-        if (sd->orientation == EFL_ORIENT_VERTICAL) *iw += cih;
+        if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE)) *iw += cih;
         else *iw += ciw;
      }
 
@@ -177,7 +177,7 @@ _items_visibility_fix(Elm_Toolbar_Data *sd,
         if (it->prio.priority > sd->standard_priority)
           {
              evas_object_geometry_get(VIEW(it), NULL, NULL, &ciw, &cih);
-             if (sd->orientation == EFL_ORIENT_VERTICAL) *iw += cih;
+             if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE)) *iw += cih;
              else *iw += ciw;
              it->prio.visible = (*iw <= vw);
              it->in_box = sd->bx;
@@ -335,7 +335,7 @@ _items_size_fit(Evas_Object *obj, Evas_Coord *bl, 
Evas_Coord view)
 
         if (mw != -1 || mh != -1)
           {
-             if (sd->orientation == EFL_ORIENT_VERTICAL) min = mh;
+             if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE)) min = mh;
              else min = mw;
 
              if ((!full) && ((sumf + min) > view))
@@ -433,7 +433,7 @@ _resize_job(void *data)
      {
         Evas_Coord iw = 0, ih = 0, more_w = 0, more_h = 0;
 
-        if (sd->orientation == EFL_ORIENT_VERTICAL)
+        if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
           {
              h = vh;
              _items_visibility_fix(sd, &ih, vh, &more);
@@ -446,7 +446,7 @@ _resize_job(void *data)
         evas_object_geometry_get
           (sd->VIEW(more_item), NULL, NULL, &more_w, &more_h);
 
-        if (sd->orientation == EFL_ORIENT_VERTICAL)
+        if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
           {
              if ((ih - more_h) <= vh) ih -= more_h;
           }
@@ -459,8 +459,9 @@ _resize_job(void *data)
          * individual items won't trigger a resize. Items are be
          * readded below. */
         evas_object_box_remove_all(sd->bx, EINA_FALSE);
-        if (((sd->orientation == EFL_ORIENT_VERTICAL) && (ih > vh)) ||
-            ((sd->orientation == EFL_ORIENT_HORIZONTAL) && (iw > vw)) || more)
+        if ((!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE) && (ih > vh)) ||
+            ( efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE) && (iw > vw)) ||
+            more)
           {
              Evas_Object *menu;
 
@@ -513,7 +514,7 @@ _resize_job(void *data)
      {
         Evas_Coord iw = 0, ih = 0;
 
-        if (sd->orientation == EFL_ORIENT_VERTICAL)
+        if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
           {
              h = vh;
              _items_visibility_fix(sd, &ih, vh, &more);
@@ -524,8 +525,9 @@ _resize_job(void *data)
              _items_visibility_fix(sd, &iw, vw, &more);
           }
         evas_object_box_remove_all(sd->bx, EINA_FALSE);
-        if (((sd->orientation == EFL_ORIENT_VERTICAL) && (ih > vh)) ||
-            ((sd->orientation == EFL_ORIENT_HORIZONTAL) && (iw > vw)) || more)
+        if ((!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE) && (ih > vh)) ||
+            ( efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE) && (iw > vw)) ||
+            more)
           {
              EINA_INLIST_FOREACH(sd->items, it)
                {
@@ -552,12 +554,12 @@ _resize_job(void *data)
      {
         Evas_Coord iw = 0, ih = 0;
 
-        if (sd->orientation == EFL_ORIENT_VERTICAL)
+        if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
           h = (vh >= mh) ? vh : mh;
         else
           w = (vw >= mw) ? vw : mw;
 
-        if (sd->orientation == EFL_ORIENT_VERTICAL)
+        if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
           _items_visibility_fix(sd, &ih, vh, &more);
         else
           _items_visibility_fix(sd, &iw, vw, &more);
@@ -582,7 +584,7 @@ _resize_job(void *data)
         else
           evas_object_hide(sd->VIEW(more_item));
 
-        if (sd->orientation == EFL_ORIENT_VERTICAL)
+        if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
           {
              if (h > vh) _items_size_fit(obj, &h, vh);
              if (sd->item_count - sd->separator_count > 0)
@@ -599,7 +601,7 @@ _resize_job(void *data)
      }
    else
      {
-        if (sd->orientation == EFL_ORIENT_VERTICAL)
+        if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
           h = (vh >= mh) ? vh : mh;
         else
           w = (vw >= mw) ? vw : mw;
@@ -613,7 +615,7 @@ _resize_job(void *data)
 
    if (sd->transverse_expanded)
      {
-        if (sd->orientation == EFL_ORIENT_VERTICAL)
+        if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
           w = vw;
         else
           h = vh;
@@ -758,8 +760,8 @@ _elm_toolbar_nearest_visible_item_get(Evas_Object *obj, 
Elm_Object_Item *eo_it)
 
    item_list = evas_object_box_children_get(sd->bx);
 
-   if ((sd->orientation == EFL_ORIENT_VERTICAL && (iy < vy)) ||
-       (sd->orientation == EFL_ORIENT_HORIZONTAL && (iw < vw)) ||
+   if ((!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE) && (iy < vy)) ||
+       ( efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE) && (iw < vw)) ||
        search_next)
      {
         while ((item_list = eina_list_next(item_list)))
@@ -1368,7 +1370,7 @@ _item_theme_hook(Evas_Object *obj,
 
    _item_shrink_signal_emit(view, sd->shrink_mode);
 
-   if (sd->orientation == EFL_ORIENT_VERTICAL)
+   if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
      elm_layout_signal_emit(view, "elm,orient,vertical", "elm");
    else
      elm_layout_signal_emit(view, "elm,orient,horizontal", "elm");
@@ -1378,7 +1380,7 @@ _item_theme_hook(Evas_Object *obj,
       elm_coords_finger_size_adjust(1, &mw, 1, &mh);
     if (sd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND)
       {
-         if (sd->orientation == EFL_ORIENT_VERTICAL)
+         if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
            {
               evas_object_size_hint_weight_set(view, EVAS_HINT_EXPAND, -1.0);
               evas_object_size_hint_align_set
@@ -1470,7 +1472,7 @@ _sizing_eval(Evas_Object *obj)
      }
    else if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
      {
-        if (sd->orientation == EFL_ORIENT_VERTICAL)
+        if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
           {
              minw = minw_bx + (w - vw);
              if (minh_bx <= vh) minh_bx = vh;
@@ -1485,7 +1487,7 @@ _sizing_eval(Evas_Object *obj)
      }
    else
      {
-        if (sd->orientation == EFL_ORIENT_VERTICAL)
+        if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
           {
              minw = minw_bx + (w - vw);
              minh = h - vh;
@@ -1499,7 +1501,7 @@ _sizing_eval(Evas_Object *obj)
 
    if (sd->transverse_expanded)
      {
-        if (sd->orientation == EFL_ORIENT_VERTICAL)
+        if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
           minw_bx = vw;
         else
           minh_bx = vh;
@@ -1546,7 +1548,7 @@ _elm_toolbar_elm_widget_theme_apply(Eo *obj, 
Elm_Toolbar_Data *sd)
    elm_widget_theme_object_set
      (obj, wd->resize_obj, "toolbar", "base",
      elm_widget_style_get(obj));
-   if (sd->orientation == EFL_ORIENT_VERTICAL)
+   if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
      edje_object_signal_emit(wd->resize_obj, "elm,orient,vertical", "elm");
    else
      edje_object_signal_emit(wd->resize_obj, "elm,orient,horizontal", "elm");
@@ -1554,7 +1556,7 @@ _elm_toolbar_elm_widget_theme_apply(Eo *obj, 
Elm_Toolbar_Data *sd)
    if (!elm_layout_theme_set
        (sd->more, "toolbar", "more", elm_widget_style_get(obj)))
      CRI("Failed to set layout!");
-   if (sd->orientation == EFL_ORIENT_VERTICAL)
+   if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
      elm_object_signal_emit(sd->more, "elm,orient,vertical", "elm");
    else
      elm_object_signal_emit(sd->more, "elm,orient,horizontal", "elm");
@@ -2039,7 +2041,7 @@ _mouse_move_reorder(Elm_Toolbar_Item_Data *item,
    ELM_TOOLBAR_DATA_GET(WIDGET(item), sd);
 
    evas_object_geometry_get(VIEW(item), &x, &y, &w, &h);
-   if (sd->orientation == EFL_ORIENT_VERTICAL)
+   if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
      evas_object_move(item->proxy, x, ev->cur.canvas.y - (h / 2));
    else
      evas_object_move(item->proxy, ev->cur.canvas.x - (w / 2), y);
@@ -2318,7 +2320,7 @@ _layout(Evas_Object *o,
 
    ELM_TOOLBAR_DATA_GET(obj, sd);
 
-   horizontal = sd->orientation ? EINA_TRUE : EINA_FALSE;
+   horizontal = efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE);
 
    _els_box_layout
      (o, priv, horizontal, sd->homogeneous, efl_ui_mirrored_get(obj));
@@ -2819,7 +2821,7 @@ _elm_toolbar_efl_canvas_group_group_add(Eo *obj, 
Elm_Toolbar_Data *priv)
    elm_interface_scrollable_objects_set(obj, edje, priv->hit_rect);
 
    priv->standard_priority = -99999;
-   priv->orientation = EFL_ORIENT_HORIZONTAL;
+   priv->dir = EFL_UI_DIR_HORIZONTAL;
 
    elm_interface_scrollable_bounce_allow_set
          (obj, _elm_config->thumbscroll_bounce_enable, EINA_FALSE);
@@ -2857,7 +2859,7 @@ _elm_toolbar_efl_canvas_group_group_add(Eo *obj, 
Elm_Toolbar_Data *priv)
    priv->more = elm_layout_add(obj);
    if (!elm_layout_theme_set(priv->more, "toolbar", "more", "default"))
      CRI("Failed to set layout!");
-   if (priv->orientation == EFL_ORIENT_VERTICAL)
+   if (!efl_ui_dir_is_horizontal(priv->dir, EINA_TRUE))
      elm_object_signal_emit(priv->more, "elm,orient,vertical", "elm");
    else
      elm_object_signal_emit(priv->more, "elm,orient,horizontal", "elm");
@@ -3039,7 +3041,7 @@ _elm_toolbar_coordinates_adjust(Elm_Toolbar_Item_Data *it,
    *y = iy;
    *w = iw;
    *h = ih;
-   if (sd->orientation == EFL_ORIENT_VERTICAL)
+   if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
      {
         //TODO: Enhance it later.
         if ((ix < vx) || (ix + iw) > (vx + vw) || (iy + ih) > (vy + vh))
@@ -3643,7 +3645,7 @@ _elm_toolbar_menu_parent_get(Eo *obj EINA_UNUSED, 
Elm_Toolbar_Data *sd)
 EOLIAN static void
 _elm_toolbar_align_set(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd, double align)
 {
-   if (sd->orientation == EFL_ORIENT_VERTICAL)
+   if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
      {
         if (sd->align != align)
           evas_object_box_align_set(sd->bx, 0.5, align);
@@ -3872,15 +3874,17 @@ _elm_toolbar_item_state_prev(Eo *eo_item EINA_UNUSED, 
Elm_Toolbar_Item_Data *ite
 }
 
 EOLIAN static void
-_elm_toolbar_efl_orientation_orientation_set(Eo *obj, Elm_Toolbar_Data *sd, 
Efl_Orient dir)
+_elm_toolbar_efl_ui_direction_direction_set(Eo *obj, Elm_Toolbar_Data *sd, 
Efl_Ui_Dir dir)
 {
-   if (dir != EFL_ORIENT_VERTICAL &&
-       dir != EFL_ORIENT_HORIZONTAL)
-     return;
+   // Adjust direction to be either horizontal or vertical.
+   if (efl_ui_dir_is_horizontal(dir, EINA_TRUE))
+     dir = EFL_UI_DIR_HORIZONTAL;
+   else
+     dir = EFL_UI_DIR_VERTICAL;
 
-   sd->orientation = dir;
+   sd->dir = dir;
 
-   if (sd->orientation == EFL_ORIENT_VERTICAL)
+   if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE))
      evas_object_box_align_set(sd->bx, 0.5, sd->align);
    else
      evas_object_box_align_set(sd->bx, sd->align, 0.5);
@@ -3888,23 +3892,23 @@ _elm_toolbar_efl_orientation_orientation_set(Eo *obj, 
Elm_Toolbar_Data *sd, Efl_
    _sizing_eval(obj);
 }
 
-EOLIAN static Efl_Orient
-_elm_toolbar_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, 
Elm_Toolbar_Data *sd)
+EOLIAN static Efl_Ui_Dir
+_elm_toolbar_efl_ui_direction_direction_get(Eo *obj EINA_UNUSED, 
Elm_Toolbar_Data *sd)
 {
-   return sd->orientation;
+   return sd->dir;
 }
 
 EAPI void
 elm_toolbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
 {
-   Efl_Orient orient;
+   Efl_Ui_Dir dir;
 
    if (horizontal)
-     orient = EFL_ORIENT_HORIZONTAL;
+     dir = EFL_UI_DIR_HORIZONTAL;
    else
-     orient = EFL_ORIENT_VERTICAL;
+     dir = EFL_UI_DIR_VERTICAL;
 
-   efl_orientation_set(obj, orient);
+   efl_ui_direction_set(obj, dir);
 }
 
 EAPI Eina_Bool
@@ -3912,10 +3916,7 @@ elm_toolbar_horizontal_get(const Evas_Object *obj)
 {
    ELM_TOOLBAR_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
 
-   if (sd->orientation == EFL_ORIENT_VERTICAL)
-     return EINA_FALSE;
-   else
-     return EINA_TRUE;
+   return efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE);
 }
 
 EOLIAN static unsigned int
diff --git a/src/lib/elementary/elm_toolbar.eo 
b/src/lib/elementary/elm_toolbar.eo
index dca3526780..e70fee6177 100644
--- a/src/lib/elementary/elm_toolbar.eo
+++ b/src/lib/elementary/elm_toolbar.eo
@@ -23,7 +23,7 @@ enum Elm.Toolbar.Shrink_Mode
    last [[Indicates error if returned by elm_toolbar_shrink_mode_get()]]
 }
 
-class Elm.Toolbar (Elm.Widget, Elm.Interface_Scrollable, Efl.Orientation,
+class Elm.Toolbar (Elm.Widget, Elm.Interface_Scrollable, Efl.Ui.Direction,
                    Elm.Interface.Atspi_Widget_Action, 
Elm.Interface.Atspi.Selection,
                    Efl.Ui.Clickable, Efl.Ui.Selectable, Efl.Ui.Menu)
 {
@@ -329,7 +329,7 @@ class Elm.Toolbar (Elm.Widget, Elm.Interface_Scrollable, 
Efl.Orientation,
       Elm.Widget.widget_event;
       Elm.Widget.focus_highlight_geometry_get;
       Elm.Widget.focused_item { get; }
-      Efl.Orientation.orientation { get; set; }
+      Efl.Ui.Direction.direction { get; set; [[Only supports $vertical and 
$horizontal. Default is $horizontal.]] }
       Elm.Widget.focus_register;
       Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
       Elm.Interface.Atspi_Accessible.children { get; }
diff --git a/src/lib/elementary/elm_widget_toolbar.h 
b/src/lib/elementary/elm_widget_toolbar.h
index 3af13ead82..61c110144f 100644
--- a/src/lib/elementary/elm_widget_toolbar.h
+++ b/src/lib/elementary/elm_widget_toolbar.h
@@ -49,7 +49,7 @@ struct _Elm_Toolbar_Data
    Elm_Object_Select_Mode                select_mode;
    Ecore_Timer                          *long_timer;
    Ecore_Job                            *resize_job;
-   Efl_Orient                            orientation;
+   Efl_Ui_Dir                            dir;
 
    Eina_Bool                             long_press : 1;
    Eina_Bool                             homogeneous : 1;

-- 


Reply via email to