summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2017-08-10 15:58:34 +0900
committerAmitesh Singh <amitesh.sh@samsung.com>2017-08-10 15:59:00 +0900
commit9abd6445667a05edac267b7ffec23e4a71a4fdee (patch)
tree8aa4d4aa501cd90f4efa4f614ecc086f176bc5c3
parent599bb616ec501bacd5af8cae3c9e5226509b3303 (diff)
Efl.Ui.Panes: switch to Efl.Ui.Dir (EO)
Ref T5870
-rw-r--r--src/bin/elementary/test_panes.c2
-rw-r--r--src/lib/elementary/efl_ui_panes.c53
-rw-r--r--src/lib/elementary/efl_ui_panes.eo4
-rw-r--r--src/lib/elementary/efl_ui_panes_private.h2
4 files changed, 31 insertions, 30 deletions
diff --git a/src/bin/elementary/test_panes.c b/src/bin/elementary/test_panes.c
index 8e5b231a04..f795a8f0fe 100644
--- a/src/bin/elementary/test_panes.c
+++ b/src/bin/elementary/test_panes.c
@@ -128,7 +128,7 @@ test_panes_minsize(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
128 ); 128 );
129 129
130 panes_h = efl_add(EFL_UI_PANES_CLASS, win, 130 panes_h = efl_add(EFL_UI_PANES_CLASS, win,
131 efl_orientation_set(efl_added, EFL_ORIENT_HORIZONTAL), 131 efl_ui_direction_set(efl_added, EFL_UI_DIR_HORIZONTAL),
132 efl_content_set(efl_part(panes, "second"), efl_added) 132 efl_content_set(efl_part(panes, "second"), efl_added)
133 ); 133 );
134 efl_add(EFL_UI_BUTTON_CLASS, win, 134 efl_add(EFL_UI_BUTTON_CLASS, win,
diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c
index 56093bcce3..42516fda3e 100644
--- a/src/lib/elementary/efl_ui_panes.c
+++ b/src/lib/elementary/efl_ui_panes.c
@@ -61,7 +61,7 @@ _efl_ui_panes_elm_widget_theme_apply(Eo *obj, Efl_Ui_Panes_Data *sd)
61 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED; 61 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
62 EFL_UI_LAYOUT_DATA_GET(obj, ld); 62 EFL_UI_LAYOUT_DATA_GET(obj, ld);
63 63
64 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 64 if (sd->dir == EFL_UI_DIR_HORIZONTAL)
65 eina_stringshare_replace(&ld->group, "horizontal"); 65 eina_stringshare_replace(&ld->group, "horizontal");
66 else 66 else
67 eina_stringshare_replace(&ld->group, "vertical"); 67 eina_stringshare_replace(&ld->group, "vertical");
@@ -205,7 +205,7 @@ _efl_ui_panes_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Panes_Data *sd)
205 efl_gfx_size_hint_min_get(second_content, &sd->second_minw, &sd->second_minh); 205 efl_gfx_size_hint_min_get(second_content, &sd->second_minw, &sd->second_minh);
206 } 206 }
207 207
208 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 208 if (sd->dir == EFL_UI_DIR_HORIZONTAL)
209 { 209 {
210 edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh, 210 edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh,
211 MAX(sd->first_minw, sd->second_minw), 211 MAX(sd->first_minw, sd->second_minw),
@@ -236,7 +236,7 @@ _set_min_size_new(void *data)
236 236
237 evas_object_geometry_get(wd->resize_obj, NULL, NULL, &w, &h); 237 evas_object_geometry_get(wd->resize_obj, NULL, NULL, &w, &h);
238 238
239 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 239 if (sd->dir == EFL_UI_DIR_HORIZONTAL)
240 { 240 {
241 if (first_minh + second_minh > h) 241 if (first_minh + second_minh > h)
242 { 242 {
@@ -300,7 +300,7 @@ _set_min_size(void *data)
300 sizer = sizer / sum; 300 sizer = sizer / sum;
301 sizel = sizel / sum; 301 sizel = sizel / sum;
302 } 302 }
303 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 303 if (sd->dir == EFL_UI_DIR_HORIZONTAL)
304 { 304 {
305 edje_object_part_drag_value_set 305 edje_object_part_drag_value_set
306 (wd->resize_obj, "right_constraint", 0.0, (1 - sizer)); 306 (wd->resize_obj, "right_constraint", 0.0, (1 - sizer));
@@ -326,7 +326,7 @@ _update_fixed_sides(void *data)
326 326
327 if (sd->right_min_size_is_relative) 327 if (sd->right_min_size_is_relative)
328 { 328 {
329 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 329 if (sd->dir == EFL_UI_DIR_HORIZONTAL)
330 sd->right_min_size = (int)(h * sd->right_min_relative_size); 330 sd->right_min_size = (int)(h * sd->right_min_relative_size);
331 else 331 else
332 sd->right_min_size =(int)(w * sd->right_min_relative_size); 332 sd->right_min_size =(int)(w * sd->right_min_relative_size);
@@ -334,15 +334,15 @@ _update_fixed_sides(void *data)
334 else 334 else
335 { 335 {
336 sd->right_min_relative_size = 0; 336 sd->right_min_relative_size = 0;
337 if (sd->orientation == EFL_ORIENT_HORIZONTAL && (h > 0)) 337 if (sd->dir == EFL_UI_DIR_HORIZONTAL && (h > 0))
338 sd->right_min_relative_size = sd->right_min_size / (double)h; 338 sd->right_min_relative_size = sd->right_min_size / (double)h;
339 if (sd->orientation == EFL_ORIENT_VERTICAL && (w > 0)) 339 if (sd->dir == EFL_UI_DIR_VERTICAL && (w > 0))
340 sd->right_min_relative_size = sd->right_min_size / (double)w; 340 sd->right_min_relative_size = sd->right_min_size / (double)w;
341 } 341 }
342 342
343 if(sd->left_min_size_is_relative) 343 if(sd->left_min_size_is_relative)
344 { 344 {
345 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 345 if (sd->dir == EFL_UI_DIR_HORIZONTAL)
346 sd->left_min_size = (int)(h * sd->left_min_relative_size); 346 sd->left_min_size = (int)(h * sd->left_min_relative_size);
347 else 347 else
348 sd->left_min_size = (int)(w * sd->left_min_relative_size); 348 sd->left_min_size = (int)(w * sd->left_min_relative_size);
@@ -350,9 +350,9 @@ _update_fixed_sides(void *data)
350 else 350 else
351 { 351 {
352 sd->left_min_relative_size = 0; 352 sd->left_min_relative_size = 0;
353 if (sd->orientation == EFL_ORIENT_HORIZONTAL && (h > 0)) 353 if (sd->dir == EFL_UI_DIR_HORIZONTAL && (h > 0))
354 sd->left_min_relative_size = sd->left_min_size / (double)h; 354 sd->left_min_relative_size = sd->left_min_size / (double)h;
355 if (sd->orientation == EFL_ORIENT_VERTICAL && (w > 0)) 355 if (sd->dir == EFL_UI_DIR_VERTICAL && (w > 0))
356 sd->left_min_relative_size = sd->left_min_size / (double)w; 356 sd->left_min_relative_size = sd->left_min_size / (double)w;
357 } 357 }
358 358
@@ -499,7 +499,7 @@ _efl_ui_panes_split_ratio_get(Eo *obj, Efl_Ui_Panes_Data *sd)
499 499
500 edje_object_part_drag_value_get(wd->resize_obj, "elm.bar", &w, &h); 500 edje_object_part_drag_value_get(wd->resize_obj, "elm.bar", &w, &h);
501 501
502 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 502 if (sd->dir == EFL_UI_DIR_HORIZONTAL)
503 return h; 503 return h;
504 else return w; 504 else return w;
505} 505}
@@ -512,21 +512,22 @@ _efl_ui_panes_split_ratio_set(Eo *obj, Efl_Ui_Panes_Data *sd, double ratio)
512 if (ratio < 0.0) ratio = 0.0; 512 if (ratio < 0.0) ratio = 0.0;
513 else if (ratio > 1.0) ratio = 1.0; 513 else if (ratio > 1.0) ratio = 1.0;
514 514
515 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 515 if (sd->dir == EFL_UI_DIR_HORIZONTAL)
516 edje_object_part_drag_value_set(wd->resize_obj, "elm.bar", 0.0, ratio); 516 edje_object_part_drag_value_set(wd->resize_obj, "elm.bar", 0.0, ratio);
517 else 517 else
518 edje_object_part_drag_value_set(wd->resize_obj, "elm.bar", ratio, 0.0); 518 edje_object_part_drag_value_set(wd->resize_obj, "elm.bar", ratio, 0.0);
519} 519}
520 520
521EOLIAN static void 521EOLIAN static void
522_efl_ui_panes_efl_orientation_orientation_set(Eo *obj, Efl_Ui_Panes_Data *sd, Efl_Orient dir) 522_efl_ui_panes_efl_ui_direction_direction_set(Eo *obj, Efl_Ui_Panes_Data *sd, Efl_Ui_Dir dir)
523{ 523{
524 if ((dir != EFL_ORIENT_HORIZONTAL) && (dir != EFL_ORIENT_VERTICAL))
525 return;
526
527 double size = elm_panes_content_left_size_get(obj); 524 double size = elm_panes_content_left_size_get(obj);
525 if (efl_ui_dir_is_horizontal(dir, EINA_FALSE))
526 dir = EFL_UI_DIR_HORIZONTAL;
527 else
528 dir = EFL_UI_DIR_VERTICAL;
528 529
529 sd->orientation = dir; 530 sd->dir = dir;
530 elm_obj_widget_theme_apply(obj); 531 elm_obj_widget_theme_apply(obj);
531 if (sd->legacy_use) _update_fixed_sides(obj); 532 if (sd->legacy_use) _update_fixed_sides(obj);
532 else _set_min_size_new(obj); 533 else _set_min_size_new(obj);
@@ -534,31 +535,31 @@ _efl_ui_panes_efl_orientation_orientation_set(Eo *obj, Efl_Ui_Panes_Data *sd, Ef
534 elm_panes_content_left_size_set(obj, size); 535 elm_panes_content_left_size_set(obj, size);
535} 536}
536 537
537EOLIAN static Efl_Orient 538EOLIAN static Efl_Ui_Dir
538_efl_ui_panes_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *sd) 539_efl_ui_panes_efl_ui_direction_direction_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *sd)
539{ 540{
540 return sd->orientation; 541 return sd->dir;
541} 542}
542 543
543EAPI void 544EAPI void
544elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) 545elm_panes_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
545{ 546{
546 Efl_Orient orient; 547 Efl_Ui_Dir dir;
547 548
548 if (horizontal) 549 if (horizontal)
549 orient = EFL_ORIENT_HORIZONTAL; 550 dir = EFL_UI_DIR_HORIZONTAL;
550 else 551 else
551 orient = EFL_ORIENT_VERTICAL; 552 dir = EFL_UI_DIR_VERTICAL;
552 553
553 efl_orientation_set(obj, orient); 554 efl_ui_direction_set(obj, dir);
554} 555}
555 556
556EAPI Eina_Bool 557EAPI Eina_Bool
557elm_panes_horizontal_get(const Evas_Object *obj) 558elm_panes_horizontal_get(const Evas_Object *obj)
558{ 559{
559 Efl_Orient orient = efl_orientation_get(obj); 560 Efl_Ui_Dir dir = efl_ui_direction_get(obj);
560 561
561 if (orient == EFL_ORIENT_HORIZONTAL) 562 if (dir == EFL_UI_DIR_HORIZONTAL)
562 return EINA_TRUE; 563 return EINA_TRUE;
563 564
564 return EINA_FALSE; 565 return EINA_FALSE;
diff --git a/src/lib/elementary/efl_ui_panes.eo b/src/lib/elementary/efl_ui_panes.eo
index 79a4fa6b9b..9356210e26 100644
--- a/src/lib/elementary/efl_ui_panes.eo
+++ b/src/lib/elementary/efl_ui_panes.eo
@@ -1,4 +1,4 @@
1class Efl.Ui.Panes (Efl.Ui.Layout, Efl.Orientation, 1class Efl.Ui.Panes (Efl.Ui.Layout, Efl.Ui.Direction,
2 Efl.Ui.Clickable) 2 Efl.Ui.Clickable)
3{ 3{
4 [[Elementary panes class]] 4 [[Elementary panes class]]
@@ -50,7 +50,7 @@ class Efl.Ui.Panes (Efl.Ui.Layout, Efl.Orientation,
50 Elm.Widget.focus_next_manager_is; 50 Elm.Widget.focus_next_manager_is;
51 Elm.Widget.focus_next; 51 Elm.Widget.focus_next;
52 Elm.Widget.theme_apply; 52 Elm.Widget.theme_apply;
53 Efl.Orientation.orientation { get; set; } 53 Efl.Ui.Direction.direction { get; set; [[Only supports $vertical and $horizontal. Default is $vertical.]] }
54 Efl.Part.part; 54 Efl.Part.part;
55 } 55 }
56 events { 56 events {
diff --git a/src/lib/elementary/efl_ui_panes_private.h b/src/lib/elementary/efl_ui_panes_private.h
index 69e06246b0..738eaee069 100644
--- a/src/lib/elementary/efl_ui_panes_private.h
+++ b/src/lib/elementary/efl_ui_panes_private.h
@@ -34,7 +34,7 @@ struct _Efl_Ui_Panes_Data
34 Eina_Bool move; 34 Eina_Bool move;
35 } move; 35 } move;
36 36
37 Efl_Orient orientation; 37 Efl_Ui_Dir dir;
38 double left_min_relative_size; 38 double left_min_relative_size;
39 double right_min_relative_size; 39 double right_min_relative_size;
40 int first_minw, first_minh; 40 int first_minw, first_minh;