summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-08-10 12:19:34 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-08-10 14:42:08 +0900
commit3c390b3969a711c6853f4939fc6cc8697df9791d (patch)
tree114d73a192b128b5d3e664a973516a56c2e1525f
parent5edb69f4aec8b7ccd55815de97f87bf511be4ac4 (diff)
index: Switch to Efl.Ui.Dir (EO)
Ref T5870
-rw-r--r--src/lib/elementary/elm_index.c57
-rw-r--r--src/lib/elementary/elm_index.eo28
-rw-r--r--src/lib/elementary/elm_widget_index.h2
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)
54} 54}
55 55
56static void 56static void
57_box_custom_layout(Evas_Object *o, 57_box_custom_layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data)
58 Evas_Object_Box_Data *priv,
59 void *data)
60{ 58{
61 ELM_INDEX_DATA_GET(data, sd); 59 ELM_INDEX_DATA_GET(data, sd);
62 Eina_Bool horizontal; 60 Eina_Bool horizontal;
63 61
64 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 62 horizontal = efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE);
65 horizontal = EINA_TRUE;
66 else
67 horizontal = EINA_FALSE;
68
69 _els_box_layout(o, priv, horizontal, EINA_TRUE, efl_ui_mirrored_get(data)); 63 _els_box_layout(o, priv, horizontal, EINA_TRUE, efl_ui_mirrored_get(data));
70} 64}
71 65
72static void 66static void
73_index_box_clear(Evas_Object *obj, 67_index_box_clear(Evas_Object *obj, int level)
74 int level)
75{ 68{
76 Eina_List *l; 69 Eina_List *l;
77 Elm_Object_Item *eo_item; 70 Elm_Object_Item *eo_item;
@@ -249,7 +242,7 @@ _index_box_auto_fill(Evas_Object *obj,
249 if (sd->omit_enabled) 242 if (sd->omit_enabled)
250 { 243 {
251 o = edje_object_add(evas_object_evas_get(obj)); 244 o = edje_object_add(evas_object_evas_get(obj));
252 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 245 if (efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE))
253 { 246 {
254 elm_widget_theme_object_set 247 elm_widget_theme_object_set
255 (obj, o, "index", "item/horizontal", style); 248 (obj, o, "index", "item/horizontal", style);
@@ -340,7 +333,7 @@ _index_box_auto_fill(Evas_Object *obj,
340 edje_object_mirrored_set(VIEW(it), rtl); 333 edje_object_mirrored_set(VIEW(it), rtl);
341 o = VIEW(it); 334 o = VIEW(it);
342 335
343 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 336 if (efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE))
344 { 337 {
345 if (i & 0x1) 338 if (i & 0x1)
346 elm_widget_theme_object_set 339 elm_widget_theme_object_set
@@ -453,7 +446,7 @@ _elm_index_elm_widget_theme_apply(Eo *obj, Elm_Index_Data *sd)
453 _index_box_clear(obj, 0); 446 _index_box_clear(obj, 0);
454 _index_box_clear(obj, 1); 447 _index_box_clear(obj, 1);
455 448
456 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 449 if (efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE))
457 eina_stringshare_replace(&ld->group, "base/horizontal"); 450 eina_stringshare_replace(&ld->group, "base/horizontal");
458 else 451 else
459 eina_stringshare_replace(&ld->group, "base/vertical"); 452 eina_stringshare_replace(&ld->group, "base/vertical");
@@ -670,7 +663,7 @@ _sel_eval(Evas_Object *obj,
670 x = (x * x) + (y * y); 663 x = (x * x) + (y * y);
671 if ((x < dist) || (!it_closest)) 664 if ((x < dist) || (!it_closest))
672 { 665 {
673 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 666 if (efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE))
674 cdv = (double)(xx - bx) / (double)bw; 667 cdv = (double)(xx - bx) / (double)bw;
675 else 668 else
676 cdv = (double)(yy - by) / (double)bh; 669 cdv = (double)(yy - by) / (double)bh;
@@ -911,7 +904,7 @@ _on_mouse_move(void *data,
911 (wd->resize_obj, "elm.dragable.pointer", 904 (wd->resize_obj, "elm.dragable.pointer",
912 (!edje_object_mirrored_get(wd->resize_obj)) ? 905 (!edje_object_mirrored_get(wd->resize_obj)) ?
913 x : (x - w), y); 906 x : (x - w), y);
914 if ((sd->orientation == EFL_ORIENT_VERTICAL) && (sd->event_rect[1])) 907 if (!efl_ui_dir_is_horizontal(sd->dir, EINA_FALSE) && (sd->event_rect[1]))
915 { 908 {
916 if (adx > minw) 909 if (adx > minw)
917 { 910 {
@@ -1103,6 +1096,7 @@ _elm_index_efl_canvas_group_group_add(Eo *obj, Elm_Index_Data *priv)
1103 evas_object_show(priv->bx[0]); 1096 evas_object_show(priv->bx[0]);
1104 1097
1105 priv->delay_change_time = INDEX_DELAY_CHANGE_TIME; 1098 priv->delay_change_time = INDEX_DELAY_CHANGE_TIME;
1099 priv->dir = EFL_UI_DIR_VERTICAL;
1106 1100
1107 if (edje_object_part_exists 1101 if (edje_object_part_exists
1108 (wd->resize_obj, "elm.swallow.index.1")) 1102 (wd->resize_obj, "elm.swallow.index.1"))
@@ -1249,24 +1243,16 @@ elm_index_add(Evas_Object *parent)
1249 1243
1250EAPI void elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) 1244EAPI void elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
1251{ 1245{
1252 Efl_Orient orient; 1246 Efl_Ui_Dir dir = horizontal ? EFL_UI_DIR_HORIZONTAL : EFL_UI_DIR_VERTICAL;
1253
1254 if (horizontal)
1255 orient = EFL_ORIENT_HORIZONTAL;
1256 else
1257 orient = EFL_ORIENT_VERTICAL;
1258 1247
1259 efl_orientation_set(obj, orient); 1248 efl_ui_direction_set(obj, dir);
1260} 1249}
1261 1250
1262EAPI Eina_Bool elm_index_horizontal_get(const Evas_Object *obj) 1251EAPI Eina_Bool elm_index_horizontal_get(const Evas_Object *obj)
1263{ 1252{
1264 Efl_Orient orient = efl_orientation_get(obj); 1253 Efl_Ui_Dir dir = efl_ui_direction_get(obj);
1265 1254
1266 if (orient == EFL_ORIENT_HORIZONTAL) 1255 return efl_ui_dir_is_horizontal(dir, EINA_FALSE);
1267 return EINA_TRUE;
1268
1269 return EINA_FALSE;
1270} 1256}
1271 1257
1272EOLIAN static Eo * 1258EOLIAN static Eo *
@@ -1636,20 +1622,23 @@ _elm_index_item_letter_get(const Eo *item EINA_UNUSED, Elm_Index_Item_Data *it)
1636} 1622}
1637 1623
1638EOLIAN static void 1624EOLIAN static void
1639_elm_index_efl_orientation_orientation_set(Eo *obj, Elm_Index_Data *sd, Efl_Orient dir) 1625_elm_index_efl_ui_direction_direction_set(Eo *obj, Elm_Index_Data *sd, Efl_Ui_Dir dir)
1640{ 1626{
1641 if ((dir != EFL_ORIENT_HORIZONTAL) && (dir != EFL_ORIENT_VERTICAL)) 1627 // Adjust direction to be either horizontal or vertical.
1642 return; 1628 if (efl_ui_dir_is_horizontal(dir, EINA_FALSE))
1629 dir = EFL_UI_DIR_HORIZONTAL;
1630 else
1631 dir = EFL_UI_DIR_VERTICAL;
1643 1632
1644 sd->orientation = dir; 1633 sd->dir = dir;
1645 1634
1646 elm_obj_widget_theme_apply(obj); 1635 elm_obj_widget_theme_apply(obj);
1647} 1636}
1648 1637
1649EOLIAN static Efl_Orient 1638EOLIAN static Efl_Ui_Dir
1650_elm_index_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Elm_Index_Data *sd) 1639_elm_index_efl_ui_direction_direction_get(Eo *obj EINA_UNUSED, Elm_Index_Data *sd)
1651{ 1640{
1652 return sd->orientation; 1641 return sd->dir;
1653} 1642}
1654 1643
1655EOLIAN static void 1644EOLIAN 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 @@
1class Elm.Index (Efl.Ui.Layout, Efl.Orientation, 1class Elm.Index (Efl.Ui.Layout, Efl.Ui.Direction,
2 Efl.Ui.Clickable, Efl.Ui.Selectable) 2 Efl.Ui.Clickable, Efl.Ui.Selectable)
3{ 3{
4 [[elementary index class]] 4 [[elementary index class]]
@@ -8,10 +8,6 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
8 methods { 8 methods {
9 @property autohide_disabled { 9 @property autohide_disabled {
10 [[Enable or disable auto hiding feature for a given index widget.]] 10 [[Enable or disable auto hiding feature for a given index widget.]]
11 set {
12 }
13 get {
14 }
15 values { 11 values {
16 disabled: bool; [[$true to disable auto hiding, $false to enable]] 12 disabled: bool; [[$true to disable auto hiding, $false to enable]]
17 } 13 }
@@ -20,10 +16,6 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
20 [[Enable or disable omit feature for a given index widget. 16 [[Enable or disable omit feature for a given index widget.
21 17
22 @since 1.8]] 18 @since 1.8]]
23 set {
24 }
25 get {
26 }
27 values { 19 values {
28 enabled: bool; [[$true to enable omit feature, $false to disable]] 20 enabled: bool; [[$true to enable omit feature, $false to disable]]
29 } 21 }
@@ -32,10 +24,6 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
32 [[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. 24 [[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.
33 25
34 @since 1.16]] 26 @since 1.16]]
35 set {
36 }
37 get {
38 }
39 values { 27 values {
40 priority: int; [[$priority target priority value in index]] 28 priority: int; [[$priority target priority value in index]]
41 } 29 }
@@ -44,10 +32,6 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
44 [[Set a delay change time for index object. 32 [[Set a delay change time for index object.
45 33
46 Note: delay time is 0.2 sec by default.]] 34 Note: delay time is 0.2 sec by default.]]
47 set {
48 }
49 get {
50 }
51 values { 35 values {
52 dtime: double; [[The delay change time to set.]] 36 dtime: double; [[The delay change time to set.]]
53 } 37 }
@@ -56,10 +40,6 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
56 [[Control the indicator as to be disabled. 40 [[Control the indicator as to be disabled.
57 41
58 In Index widget, Indicator notes popup text, which shows a letter has been selecting.]] 42 In Index widget, Indicator notes popup text, which shows a letter has been selecting.]]
59 set {
60 }
61 get {
62 }
63 values { 43 values {
64 disabled: bool; [[$true to disable it, $false to enable it]] 44 disabled: bool; [[$true to disable it, $false to enable it]]
65 } 45 }
@@ -68,10 +48,6 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
68 [[Set the items level for a given index widget. 48 [[Set the items level for a given index widget.
69 49
70 See: elm_index_item_level_get()]] 50 See: elm_index_item_level_get()]]
71 set {
72 }
73 get {
74 }
75 values { 51 values {
76 level: int; [[$0 or $1, the currently implemented levels.]] 52 level: int; [[$0 or $1, the currently implemented levels.]]
77 } 53 }
@@ -226,7 +202,7 @@ class Elm.Index (Efl.Ui.Layout, Efl.Orientation,
226 Elm.Widget.focus_direction_manager_is; 202 Elm.Widget.focus_direction_manager_is;
227 Elm.Widget.access; 203 Elm.Widget.access;
228 Elm.Widget.focus_next; 204 Elm.Widget.focus_next;
229 Efl.Orientation.orientation { get; set; } 205 Efl.Ui.Direction.direction { get; set; [[Only supports $vertical and $horizontal. Default is $vertical.]] }
230 Elm.Interface.Atspi_Accessible.children { get; } 206 Elm.Interface.Atspi_Accessible.children { get; }
231 } 207 }
232 events { 208 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
33 * small */ 33 * small */
34 Eina_List *omit; 34 Eina_List *omit;
35 35
36 Efl_Orient orientation; 36 Efl_Ui_Dir dir;
37 int level; 37 int level;
38 Evas_Coord dx, dy; 38 Evas_Coord dx, dy;
39 Ecore_Timer *delay; 39 Ecore_Timer *delay;