summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-08-09 22:36:29 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-08-10 14:42:08 +0900
commitb1488b98ded09ff510b56b4fe18a7a30f146167b (patch)
tree088addb73bd605d13bdb3e4a218f5d860b8d1635 /src/lib
parentd4b4ee867be2819eea69ec7b92cd2843ae33c7c7 (diff)
efl.ui.box: Switch to Efl.Ui.Dir (EO)
This makes the default box vertical, just like in legacy. The flow box is horizontal by default. Ref T5870
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/efl_ui_box.c26
-rw-r--r--src/lib/elementary/efl_ui_box.eo19
-rw-r--r--src/lib/elementary/efl_ui_box_flow.c3
-rw-r--r--src/lib/elementary/efl_ui_box_layout.c3
-rw-r--r--src/lib/elementary/efl_ui_box_private.h8
-rw-r--r--src/lib/elementary/elm_priv.h15
6 files changed, 51 insertions, 23 deletions
diff --git a/src/lib/elementary/efl_ui_box.c b/src/lib/elementary/efl_ui_box.c
index e18a706c52..07e3a1bd81 100644
--- a/src/lib/elementary/efl_ui_box.c
+++ b/src/lib/elementary/efl_ui_box.c
@@ -232,7 +232,6 @@ _efl_ui_box_efl_object_constructor(Eo *obj, Efl_Ui_Box_Data *pd)
232 evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); 232 evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
233 elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_FILLER); 233 elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_FILLER);
234 234
235 pd->orient = EFL_ORIENT_RIGHT;
236 pd->align.h = 0.5; 235 pd->align.h = 0.5;
237 pd->align.v = 0.5; 236 pd->align.v = 0.5;
238 237
@@ -532,29 +531,34 @@ _efl_ui_box_efl_container_content_iterate(Eo *obj, Efl_Ui_Box_Data *pd EINA_UNUS
532} 531}
533 532
534EOLIAN static void 533EOLIAN static void
535_efl_ui_box_efl_orientation_orientation_set(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Orient dir) 534_efl_ui_box_efl_ui_direction_direction_set(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Ui_Dir dir)
536{ 535{
537 switch (dir) 536 switch (dir)
538 { 537 {
539 case EFL_ORIENT_UP: 538 case EFL_UI_DIR_RTL:
540 case EFL_ORIENT_DOWN: 539 // FIXME: Should be inverted!
541 pd->orient = EFL_ORIENT_DOWN; 540 case EFL_UI_DIR_HORIZONTAL:
541 case EFL_UI_DIR_LTR:
542 pd->dir = EFL_UI_DIR_HORIZONTAL;
542 break; 543 break;
543 544
544 case EFL_ORIENT_RIGHT: 545 case EFL_UI_DIR_UP:
545 case EFL_ORIENT_LEFT: 546 // FIXME: Should be inverted!
547 case EFL_UI_DIR_DOWN:
548 case EFL_UI_DIR_VERTICAL:
549 case EFL_UI_DIR_DEFAULT:
546 default: 550 default:
547 pd->orient = EFL_ORIENT_RIGHT; 551 pd->dir = EFL_UI_DIR_VERTICAL;
548 break; 552 break;
549 } 553 }
550 554
551 efl_pack_layout_request(obj); 555 efl_pack_layout_request(obj);
552} 556}
553 557
554EOLIAN static Efl_Orient 558EOLIAN static Efl_Ui_Dir
555_efl_ui_box_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd) 559_efl_ui_box_efl_ui_direction_direction_get(Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd)
556{ 560{
557 return pd->orient; 561 return pd->dir;
558} 562}
559 563
560EOLIAN static void 564EOLIAN static void
diff --git a/src/lib/elementary/efl_ui_box.eo b/src/lib/elementary/efl_ui_box.eo
index 71d963af3a..b3440ac86e 100644
--- a/src/lib/elementary/efl_ui_box.eo
+++ b/src/lib/elementary/efl_ui_box.eo
@@ -1,7 +1,20 @@
1class Efl.Ui.Box (Elm.Widget, Efl.Pack.Linear, Efl.Pack.Layout, 1class Efl.Ui.Box (Elm.Widget, Efl.Pack.Linear, Efl.Pack.Layout,
2 Efl.Orientation) 2 Efl.Ui.Direction)
3{ 3{
4 [[Efl UI box class]] 4 [[The box widget.
5
6 A box arranges objects in a linear fashion, governed by a layout function
7 that defines the details of this arrangement.
8
9 By default, the box will use an internal function to set the layout to
10 a single row, either vertical or horizontal. This layout is affected
11 by a number of parameters. The values given by @Efl.Pack.pack_padding.set
12 and @Efl.Pack.pack_align.set and the hints set to each object in the box.
13
14 FIXME:
15 THIS CLASS NEEDS GOOD UP TO DATE DOCUMENTATION. LEGACY BOX AND UI BOX
16 BEHAVE SLIGHTLY DIFFERENTLY AND USE VASTLY DIFFERENT APIS.
17 ]]
5 implements { 18 implements {
6 Efl.Object.constructor; 19 Efl.Object.constructor;
7 Efl.Canvas.Group.group_calculate; 20 Efl.Canvas.Group.group_calculate;
@@ -11,7 +24,7 @@ class Efl.Ui.Box (Elm.Widget, Efl.Pack.Linear, Efl.Pack.Layout,
11 Elm.Widget.focus_next; 24 Elm.Widget.focus_next;
12 Efl.Container.content_iterate; 25 Efl.Container.content_iterate;
13 Efl.Container.content_count; 26 Efl.Container.content_count;
14 Efl.Orientation.orientation { get; set; } 27 Efl.Ui.Direction.direction { get; set; }
15 Efl.Pack.pack_clear; 28 Efl.Pack.pack_clear;
16 Efl.Pack.unpack_all; 29 Efl.Pack.unpack_all;
17 Efl.Pack.unpack; 30 Efl.Pack.unpack;
diff --git a/src/lib/elementary/efl_ui_box_flow.c b/src/lib/elementary/efl_ui_box_flow.c
index 5e38119390..4f69a3d290 100644
--- a/src/lib/elementary/efl_ui_box_flow.c
+++ b/src/lib/elementary/efl_ui_box_flow.c
@@ -48,7 +48,8 @@ _efl_ui_box_flow_efl_pack_layout_layout_update(Eo *obj, Efl_Ui_Box_Flow_Data *pd
48 homo = pd->homogenous; 48 homo = pd->homogenous;
49 maxsize = pd->max_size; 49 maxsize = pd->max_size;
50 50
51 if (_horiz(efl_orientation_get(obj))) 51 // This makes it horizontal by default, as opposed to the standard box.
52 if (efl_ui_dir_is_horizontal(efl_ui_direction_get(obj), EINA_TRUE))
52 { 53 {
53 if (homo) 54 if (homo)
54 { 55 {
diff --git a/src/lib/elementary/efl_ui_box_layout.c b/src/lib/elementary/efl_ui_box_layout.c
index bb41a8d268..aa0e5e5c69 100644
--- a/src/lib/elementary/efl_ui_box_layout.c
+++ b/src/lib/elementary/efl_ui_box_layout.c
@@ -28,7 +28,8 @@ _efl_ui_box_custom_layout(Efl_Ui_Box *ui_box, Evas_Object_Box_Data *bd)
28 int wantw = 0, wanth = 0; // requested size 28 int wantw = 0, wanth = 0; // requested size
29 int boxx, boxy, boxw, boxh; 29 int boxx, boxy, boxw, boxh;
30 Item_Calc *items, *item; 30 Item_Calc *items, *item;
31 Eina_Bool horiz = _horiz(pd->orient), zeroweight = EINA_FALSE; 31 Eina_Bool horiz = efl_ui_dir_is_horizontal(pd->dir, EINA_FALSE);
32 Eina_Bool zeroweight = EINA_FALSE;
32 int id = 0, count, boxl = 0, boxr = 0, boxt = 0, boxb = 0; 33 int id = 0, count, boxl = 0, boxr = 0, boxt = 0, boxb = 0;
33 int length, want, pad, extra = 0, rounding = 0; 34 int length, want, pad, extra = 0, rounding = 0;
34 double cur_pos = 0, weight[2] = { 0, 0 }, scale; 35 double cur_pos = 0, weight[2] = { 0, 0 }, scale;
diff --git a/src/lib/elementary/efl_ui_box_private.h b/src/lib/elementary/efl_ui_box_private.h
index 57acf1a3e9..2bd12c9fe8 100644
--- a/src/lib/elementary/efl_ui_box_private.h
+++ b/src/lib/elementary/efl_ui_box_private.h
@@ -21,7 +21,7 @@ typedef struct _Box_Item_Iterator Box_Item_Iterator;
21 21
22struct _Efl_Ui_Box_Data 22struct _Efl_Ui_Box_Data
23{ 23{
24 Efl_Orient orient; 24 Efl_Ui_Dir dir;
25 Eina_Bool homogeneous : 1; 25 Eina_Bool homogeneous : 1;
26 Eina_Bool delete_me : 1; 26 Eina_Bool delete_me : 1;
27 Eina_Bool recalc : 1; 27 Eina_Bool recalc : 1;
@@ -44,10 +44,4 @@ struct _Box_Item_Iterator
44 Efl_Ui_Box *object; 44 Efl_Ui_Box *object;
45}; 45};
46 46
47static inline Eina_Bool
48_horiz(Efl_Orient dir)
49{
50 return dir % 180 == EFL_ORIENT_RIGHT;
51}
52
53#endif 47#endif
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index 763b2ba8c5..09cb28533f 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -641,6 +641,21 @@ const Elm_Layout_Part_Alias_Description *elm_layout_text_aliases_get(const Eo *o
641#define ELM_LAYOUT_SIZING_EVAL_OPS(_pfx) \ 641#define ELM_LAYOUT_SIZING_EVAL_OPS(_pfx) \
642 EFL_OBJECT_OP_FUNC(elm_layout_sizing_eval, _##_pfx##_elm_layout_sizing_eval) 642 EFL_OBJECT_OP_FUNC(elm_layout_sizing_eval, _##_pfx##_elm_layout_sizing_eval)
643 643
644static inline Eina_Bool
645efl_ui_dir_is_horizontal(Efl_Ui_Dir dir, Eina_Bool def_val)
646{
647 switch (dir)
648 {
649 case EFL_UI_DIR_DEFAULT: return !!def_val;
650 case EFL_UI_DIR_HORIZONTAL: return EINA_TRUE;
651 case EFL_UI_DIR_VERTICAL: return EINA_FALSE;
652 case EFL_UI_DIR_LTR: return EINA_TRUE;
653 case EFL_UI_DIR_RTL: return EINA_TRUE;
654 case EFL_UI_DIR_DOWN: return EINA_FALSE;
655 case EFL_UI_DIR_UP: return EINA_FALSE;
656 }
657}
658
644#undef EAPI 659#undef EAPI
645#define EAPI 660#define EAPI
646 661