summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-08-09 23:25:59 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-08-10 14:42:08 +0900
commit43c07afbf1aa08c175f62b27d78433256d3d9e2e (patch)
tree79931225fa7fbcbd5e100cb878c123ed30755310
parentb1488b98ded09ff510b56b4fe18a7a30f146167b (diff)
flip: Switch to Efl.Ui.Dir (EO)
Ref T5870
-rw-r--r--src/lib/efl/interfaces/efl_ui_direction.eo2
-rw-r--r--src/lib/elementary/efl_ui_flip.c93
-rw-r--r--src/lib/elementary/efl_ui_flip.eo8
3 files changed, 54 insertions, 49 deletions
diff --git a/src/lib/efl/interfaces/efl_ui_direction.eo b/src/lib/efl/interfaces/efl_ui_direction.eo
index 4900ed2d5a..ba9759b6b6 100644
--- a/src/lib/efl/interfaces/efl_ui_direction.eo
+++ b/src/lib/efl/interfaces/efl_ui_direction.eo
@@ -19,6 +19,8 @@ enum Efl.Ui.Dir
19 rtl, [[Horizontal, right-to-left direction.]] 19 rtl, [[Horizontal, right-to-left direction.]]
20 down, [[Vertical, top-to-bottom direction.]] 20 down, [[Vertical, top-to-bottom direction.]]
21 up, [[Vertical, bottom-to-top direction.]] 21 up, [[Vertical, bottom-to-top direction.]]
22 right = Efl.Ui.Dir.ltr, [[Right is an alias for LTR.]]
23 left = Efl.Ui.Dir.rtl, [[Left is an alias for RTL.]]
22} 24}
23 25
24interface Efl.Ui.Direction 26interface Efl.Ui.Direction
diff --git a/src/lib/elementary/efl_ui_flip.c b/src/lib/elementary/efl_ui_flip.c
index eb737b8a0c..0e11c8e2d8 100644
--- a/src/lib/elementary/efl_ui_flip.c
+++ b/src/lib/elementary/efl_ui_flip.c
@@ -2092,20 +2092,45 @@ _efl_ui_flip_interaction_get(Eo *obj EINA_UNUSED, Efl_Ui_Flip_Data *sd)
2092 return sd->intmode; 2092 return sd->intmode;
2093} 2093}
2094 2094
2095static int 2095static Efl_Ui_Dir
2096_orient_dir_xlate(Efl_Orient dir) 2096_flip_dir_to_efl_ui_dir(Elm_Flip_Direction dir)
2097{
2098 switch (dir)
2099 {
2100 case ELM_FLIP_DIRECTION_RIGHT: return EFL_UI_DIR_RIGHT;
2101 case ELM_FLIP_DIRECTION_DOWN: return EFL_UI_DIR_DOWN;
2102 case ELM_FLIP_DIRECTION_LEFT: return EFL_UI_DIR_LEFT;
2103 case ELM_FLIP_DIRECTION_UP: return EFL_UI_DIR_UP;
2104 }
2105 ERR("Invalid value for Elm_Flip_Direction: %d", (int) dir);
2106 return EFL_UI_DIR_DEFAULT;
2107}
2108
2109static Elm_Flip_Direction
2110_efl_ui_dir_to_flip_dir(Efl_Ui_Dir dir)
2097{ 2111{
2098 if (dir == EFL_ORIENT_UP) return ELM_FLIP_DIRECTION_UP; 2112 switch (dir)
2099 else if (dir == EFL_ORIENT_DOWN) return ELM_FLIP_DIRECTION_DOWN; 2113 {
2100 else if (dir == EFL_ORIENT_LEFT) return ELM_FLIP_DIRECTION_LEFT; 2114 case EFL_UI_DIR_RIGHT:
2101 else if (dir == EFL_ORIENT_RIGHT) return ELM_FLIP_DIRECTION_RIGHT; 2115 case EFL_UI_DIR_HORIZONTAL:
2102 return 0; 2116 return ELM_FLIP_DIRECTION_RIGHT;
2117 case EFL_UI_DIR_DOWN:
2118 return ELM_FLIP_DIRECTION_DOWN;
2119 case EFL_UI_DIR_LEFT:
2120 return ELM_FLIP_DIRECTION_LEFT;
2121 case EFL_UI_DIR_UP:
2122 case EFL_UI_DIR_VERTICAL:
2123 case EFL_UI_DIR_DEFAULT:
2124 return ELM_FLIP_DIRECTION_UP;
2125 }
2126 ERR("Invalid value for Efl_Ui_Dir: %d", (int) dir);
2127 return ELM_FLIP_DIRECTION_UP;
2103} 2128}
2104 2129
2105EOLIAN static void 2130EOLIAN static void
2106_efl_ui_flip_interaction_direction_enabled_set(Eo *obj, Efl_Ui_Flip_Data *sd, Efl_Orient dir, Eina_Bool enabled) 2131_efl_ui_flip_interaction_direction_enabled_set(Eo *obj, Efl_Ui_Flip_Data *sd, Efl_Ui_Dir dir, Eina_Bool enabled)
2107{ 2132{
2108 int i = _orient_dir_xlate(dir);; 2133 int i = _efl_ui_dir_to_flip_dir(dir);
2109 int area; 2134 int area;
2110 2135
2111 enabled = !!enabled; 2136 enabled = !!enabled;
@@ -2125,15 +2150,15 @@ _efl_ui_flip_interaction_direction_enabled_set(Eo *obj, Efl_Ui_Flip_Data *sd, Ef
2125} 2150}
2126 2151
2127EOLIAN static Eina_Bool 2152EOLIAN static Eina_Bool
2128_efl_ui_flip_interaction_direction_enabled_get(Eo *obj EINA_UNUSED, Efl_Ui_Flip_Data *sd, Efl_Orient dir) 2153_efl_ui_flip_interaction_direction_enabled_get(Eo *obj EINA_UNUSED, Efl_Ui_Flip_Data *sd, Efl_Ui_Dir dir)
2129{ 2154{
2130 return sd->dir_enabled[_orient_dir_xlate(dir)]; 2155 return sd->dir_enabled[_efl_ui_dir_to_flip_dir(dir)];
2131} 2156}
2132 2157
2133EOLIAN static void 2158EOLIAN static void
2134_efl_ui_flip_interaction_direction_hitsize_set(Eo *obj, Efl_Ui_Flip_Data *sd, Efl_Orient dir, double hitsize) 2159_efl_ui_flip_interaction_direction_hitsize_set(Eo *obj, Efl_Ui_Flip_Data *sd, Efl_Ui_Dir dir, double hitsize)
2135{ 2160{
2136 int i = _orient_dir_xlate(dir); 2161 int i = _efl_ui_dir_to_flip_dir(dir);
2137 2162
2138 2163
2139 if (hitsize < 0.0) 2164 if (hitsize < 0.0)
@@ -2229,9 +2254,9 @@ _content_removed(Eo *obj, Efl_Ui_Flip_Data *pd, Efl_Gfx *content)
2229} 2254}
2230 2255
2231EOLIAN static double 2256EOLIAN static double
2232_efl_ui_flip_interaction_direction_hitsize_get(Eo *obj EINA_UNUSED, Efl_Ui_Flip_Data *sd, Efl_Orient dir) 2257_efl_ui_flip_interaction_direction_hitsize_get(Eo *obj EINA_UNUSED, Efl_Ui_Flip_Data *sd, Efl_Ui_Dir dir)
2233{ 2258{
2234 int i = _orient_dir_xlate(dir); 2259 int i = _efl_ui_dir_to_flip_dir(dir);
2235 2260
2236 return sd->dir_hitsize[i]; 2261 return sd->dir_hitsize[i];
2237} 2262}
@@ -2343,54 +2368,32 @@ _efl_ui_flip_class_constructor(Efl_Class *klass)
2343 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); 2368 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
2344} 2369}
2345 2370
2346static Efl_Orient
2347_to_efl_orientation(Elm_Flip_Direction dir)
2348{
2349 Efl_Orient res;
2350 switch (dir)
2351 {
2352 case ELM_FLIP_DIRECTION_RIGHT:
2353 res = EFL_ORIENT_RIGHT;
2354 break;
2355 case ELM_FLIP_DIRECTION_DOWN:
2356 res = EFL_ORIENT_DOWN;
2357 break;
2358 case ELM_FLIP_DIRECTION_LEFT:
2359 res = EFL_ORIENT_LEFT;
2360 break;
2361 default:
2362 res = EFL_ORIENT_UP;
2363 break;
2364 }
2365 return res;
2366}
2367
2368EAPI void 2371EAPI void
2369elm_flip_interaction_direction_hitsize_set(Efl_Ui_Flip *obj, Elm_Flip_Direction dir, double hitsize) 2372elm_flip_interaction_direction_hitsize_set(Efl_Ui_Flip *obj, Elm_Flip_Direction dir, double hitsize)
2370{ 2373{
2371 Efl_Orient orient = _to_efl_orientation(dir); 2374 Efl_Ui_Dir uidir = _flip_dir_to_efl_ui_dir(dir);
2372 efl_ui_flip_interaction_direction_hitsize_set((Efl_Ui_Flip *)obj, orient, hitsize); 2375 efl_ui_flip_interaction_direction_hitsize_set(obj, uidir, hitsize);
2373} 2376}
2374 2377
2375EAPI double 2378EAPI double
2376elm_flip_interaction_direction_hitsize_get(Efl_Ui_Flip *obj, Elm_Flip_Direction dir) 2379elm_flip_interaction_direction_hitsize_get(Efl_Ui_Flip *obj, Elm_Flip_Direction dir)
2377{ 2380{
2378 Efl_Orient orient = _to_efl_orientation(dir); 2381 Efl_Ui_Dir uidir = _flip_dir_to_efl_ui_dir(dir);
2379 return efl_ui_flip_interaction_direction_hitsize_get((Efl_Ui_Flip *)obj, orient); 2382 return efl_ui_flip_interaction_direction_hitsize_get(obj, uidir);
2380} 2383}
2381 2384
2382EOAPI void 2385EOAPI void
2383elm_flip_interaction_direction_enabled_set(Efl_Ui_Flip *obj, Elm_Flip_Direction dir, Eina_Bool enabled) 2386elm_flip_interaction_direction_enabled_set(Efl_Ui_Flip *obj, Elm_Flip_Direction dir, Eina_Bool enabled)
2384{ 2387{
2385 Efl_Orient orient = _to_efl_orientation(dir); 2388 Efl_Ui_Dir uidir = _flip_dir_to_efl_ui_dir(dir);
2386 efl_ui_flip_interaction_direction_enabled_set((Efl_Ui_Flip *)obj, orient, enabled); 2389 efl_ui_flip_interaction_direction_enabled_set(obj, uidir, enabled);
2387} 2390}
2388 2391
2389EOAPI Eina_Bool 2392EOAPI Eina_Bool
2390elm_flip_interaction_direction_enabled_get(Efl_Ui_Flip *obj, Elm_Flip_Direction dir) 2393elm_flip_interaction_direction_enabled_get(Efl_Ui_Flip *obj, Elm_Flip_Direction dir)
2391{ 2394{
2392 Efl_Orient orient = _to_efl_orientation(dir); 2395 Efl_Ui_Dir uidir = _flip_dir_to_efl_ui_dir(dir);
2393 return efl_ui_flip_interaction_direction_enabled_get((Efl_Ui_Flip *)obj, orient); 2396 return efl_ui_flip_interaction_direction_enabled_get(obj, uidir);
2394} 2397}
2395 2398
2396/* Efl.Part begin */ 2399/* Efl.Part begin */
diff --git a/src/lib/elementary/efl_ui_flip.eo b/src/lib/elementary/efl_ui_flip.eo
index f7b728b305..d6af798780 100644
--- a/src/lib/elementary/efl_ui_flip.eo
+++ b/src/lib/elementary/efl_ui_flip.eo
@@ -87,7 +87,7 @@ class Efl.Ui.Flip (Elm.Widget, Efl.Pack.Linear, Efl.Part)
87 ]] 87 ]]
88 legacy: null; 88 legacy: null;
89 params { 89 params {
90 @in dir: Efl.Orient; [[The hit area to set.]] 90 @in dir: Efl.Ui.Dir; [[The hit area to set.]]
91 @in hitsize: double; [[The amount of that dimension (0.0 to 1.0) to use.]] 91 @in hitsize: double; [[The amount of that dimension (0.0 to 1.0) to use.]]
92 } 92 }
93 } 93 }
@@ -96,7 +96,7 @@ class Efl.Ui.Flip (Elm.Widget, Efl.Pack.Linear, Efl.Part)
96 return: double; [[The size set for that direction.]] 96 return: double; [[The size set for that direction.]]
97 legacy: null; 97 legacy: null;
98 params { 98 params {
99 @in dir: Efl.Orient; [[The direction to check.]] 99 @in dir: Efl.Ui.Dir; [[The direction to check.]]
100 } 100 }
101 } 101 }
102 interaction_direction_enabled_set { 102 interaction_direction_enabled_set {
@@ -113,7 +113,7 @@ class Efl.Ui.Flip (Elm.Widget, Efl.Pack.Linear, Efl.Part)
113 ]] 113 ]]
114 legacy: null; 114 legacy: null;
115 params { 115 params {
116 @in dir: Efl.Orient; [[The direction to change.]] 116 @in dir: Efl.Ui.Dir; [[The direction to change.]]
117 @in enabled: bool; [[If that direction is enabled or not.]] 117 @in enabled: bool; [[If that direction is enabled or not.]]
118 } 118 }
119 } 119 }
@@ -122,7 +122,7 @@ class Efl.Ui.Flip (Elm.Widget, Efl.Pack.Linear, Efl.Part)
122 return: bool; [[If that direction is enabled or not.]] 122 return: bool; [[If that direction is enabled or not.]]
123 legacy: null; 123 legacy: null;
124 params { 124 params {
125 @in dir: Efl.Orient; [[The direction to check.]] 125 @in dir: Efl.Ui.Dir; [[The direction to check.]]
126 } 126 }
127 } 127 }
128 go { 128 go {