summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2017-08-09 20:45:02 +0900
committerAmitesh Singh <amitesh.sh@samsung.com>2017-08-10 15:15:50 +0900
commit599bb616ec501bacd5af8cae3c9e5226509b3303 (patch)
treedaec1bd9cbb69fe5a4339d54c26938eb41070e48 /src/lib
parentaaaf1a282a82f2f10b01f561ea210d5643707a1a (diff)
Efl.Ui.Panes: rename left/right_size_set to split_ratio
This name makes more sense and one api does the job of two. We never needed two apis at first place though. Mark left/right_size_set as legacy apis too. This patch also implements min_split_ratio on parts. @feature refer T5359
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/efl_ui_panes.c162
-rw-r--r--src/lib/elementary/efl_ui_panes.eo80
-rw-r--r--src/lib/elementary/efl_ui_panes_internal_part.eo11
-rw-r--r--src/lib/elementary/efl_ui_panes_private.h2
-rw-r--r--src/lib/elementary/elm_panes_legacy.h139
5 files changed, 278 insertions, 116 deletions
diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c
index fa9d706eef..56093bcce3 100644
--- a/src/lib/elementary/efl_ui_panes.c
+++ b/src/lib/elementary/efl_ui_panes.c
@@ -251,6 +251,10 @@ _set_min_size_new(void *data)
251 second_min_relative_size = second_minh/(double)h; 251 second_min_relative_size = second_minh/(double)h;
252 } 252 }
253 } 253 }
254
255 first_min_relative_size = MAX(sd->first_min_split_ratio, first_min_relative_size);
256 second_min_relative_size = MAX(sd->second_min_split_ratio, second_min_relative_size);
257
254 edje_object_part_drag_value_set(wd->resize_obj, "right_constraint", 258 edje_object_part_drag_value_set(wd->resize_obj, "right_constraint",
255 0.0, 1.0 - second_min_relative_size); 259 0.0, 1.0 - second_min_relative_size);
256 edje_object_part_drag_value_set(wd->resize_obj, "left_constraint", 260 edje_object_part_drag_value_set(wd->resize_obj, "left_constraint",
@@ -271,6 +275,10 @@ _set_min_size_new(void *data)
271 second_min_relative_size = second_minw/(double)w; 275 second_min_relative_size = second_minw/(double)w;
272 } 276 }
273 } 277 }
278
279 first_min_relative_size = MAX(sd->first_min_split_ratio, first_min_relative_size);
280 second_min_relative_size = MAX(sd->second_min_split_ratio, second_min_relative_size);
281
274 edje_object_part_drag_value_set(wd->resize_obj, "right_constraint", 282 edje_object_part_drag_value_set(wd->resize_obj, "right_constraint",
275 1.0 - second_min_relative_size, 0.0); 283 1.0 - second_min_relative_size, 0.0);
276 edje_object_part_drag_value_set(wd->resize_obj, "left_constraint", 284 edje_object_part_drag_value_set(wd->resize_obj, "left_constraint",
@@ -484,14 +492,12 @@ elm_panes_content_right_unset(Evas_Object *obj)
484} 492}
485 493
486EOLIAN static double 494EOLIAN static double
487_efl_ui_panes_content_left_size_get(Eo *obj, Efl_Ui_Panes_Data *sd) 495_efl_ui_panes_split_ratio_get(Eo *obj, Efl_Ui_Panes_Data *sd)
488{ 496{
489 double w, h; 497 double w, h;
490
491 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, 0.0); 498 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, 0.0);
492 499
493 edje_object_part_drag_value_get 500 edje_object_part_drag_value_get(wd->resize_obj, "elm.bar", &w, &h);
494 (wd->resize_obj, "elm.bar", &w, &h);
495 501
496 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 502 if (sd->orientation == EFL_ORIENT_HORIZONTAL)
497 return h; 503 return h;
@@ -499,31 +505,17 @@ _efl_ui_panes_content_left_size_get(Eo *obj, Efl_Ui_Panes_Data *sd)
499} 505}
500 506
501EOLIAN static void 507EOLIAN static void
502_efl_ui_panes_content_left_size_set(Eo *obj, Efl_Ui_Panes_Data *sd, double size) 508_efl_ui_panes_split_ratio_set(Eo *obj, Efl_Ui_Panes_Data *sd, double ratio)
503{ 509{
504 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 510 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
505 511
506 if (size < 0.0) size = 0.0; 512 if (ratio < 0.0) ratio = 0.0;
507 else if (size > 1.0) size = 1.0; 513 else if (ratio > 1.0) ratio = 1.0;
508 514
509 if (sd->orientation == EFL_ORIENT_HORIZONTAL) 515 if (sd->orientation == EFL_ORIENT_HORIZONTAL)
510 edje_object_part_drag_value_set 516 edje_object_part_drag_value_set(wd->resize_obj, "elm.bar", 0.0, ratio);
511 (wd->resize_obj, "elm.bar", 0.0, size);
512 else 517 else
513 edje_object_part_drag_value_set 518 edje_object_part_drag_value_set(wd->resize_obj, "elm.bar", ratio, 0.0);
514 (wd->resize_obj, "elm.bar", size, 0.0);
515}
516
517EOLIAN static double
518_efl_ui_panes_content_right_size_get(Eo *obj, Efl_Ui_Panes_Data *_pd EINA_UNUSED)
519{
520 return 1.0 - elm_panes_content_left_size_get(obj);
521}
522
523EOLIAN static void
524_efl_ui_panes_content_right_size_set(Eo *obj, Efl_Ui_Panes_Data *_pd EINA_UNUSED, double size)
525{
526 elm_panes_content_left_size_set(obj, (1.0 - size));
527} 519}
528 520
529EOLIAN static void 521EOLIAN static void
@@ -600,36 +592,6 @@ _efl_ui_panes_fixed_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *sd)
600 return sd->fixed; 592 return sd->fixed;
601} 593}
602 594
603EOLIAN static void
604_efl_ui_panes_content_left_min_relative_size_set(Eo *obj, Efl_Ui_Panes_Data *_pd, double size)
605{
606 _pd->left_min_relative_size = size;
607 if (_pd->left_min_relative_size < 0) _pd->left_min_relative_size = 0;
608 _pd->left_min_size_is_relative = EINA_TRUE;
609 _update_fixed_sides(obj);
610}
611
612EOLIAN static double
613_efl_ui_panes_content_left_min_relative_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd)
614{
615 return _pd->left_min_relative_size;
616}
617
618EOLIAN static void
619_efl_ui_panes_content_right_min_relative_size_set(Eo *obj, Efl_Ui_Panes_Data *_pd, double size)
620{
621 _pd->right_min_relative_size = size;
622 if (_pd->right_min_relative_size < 0) _pd->right_min_relative_size = 0;
623 _pd->right_min_size_is_relative = EINA_TRUE;
624 _update_fixed_sides(obj);
625}
626
627EOLIAN static double
628_efl_ui_panes_content_right_min_relative_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd)
629{
630 return _pd->right_min_relative_size;
631}
632
633EOLIAN static Eina_Bool 595EOLIAN static Eina_Bool
634_efl_ui_panes_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd EINA_UNUSED) 596_efl_ui_panes_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Panes_Data *_pd EINA_UNUSED)
635{ 597{
@@ -685,6 +647,41 @@ _efl_ui_panes_internal_part_allow_user_size_hints_get(Eo *obj, Elm_Part_Data *_p
685 return ret; 647 return ret;
686} 648}
687 649
650EOLIAN static double
651_efl_ui_panes_internal_part_min_split_ratio_get(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED)
652{
653 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_LAYOUT_INTERNAL_PART_CLASS);
654 Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);
655 double ret = 0.0;
656
657 if (!strcmp(pd->part, "first"))
658 ret = sd->first_min_split_ratio;
659 else if (!strcmp(pd->part, "second"))
660 ret = sd->second_min_split_ratio;
661
662 return ret;
663}
664
665EOLIAN static void
666_efl_ui_panes_internal_part_min_split_ratio_set(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED, double ratio)
667{
668 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_LAYOUT_INTERNAL_PART_CLASS);
669 Efl_Ui_Panes_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PANES_CLASS);
670
671 if (!strcmp(pd->part, "first"))
672 {
673 sd->first_min_split_ratio = ratio;
674 if (sd->first_min_split_ratio < 0) sd->first_min_split_ratio = 0;
675 _set_min_size_new(pd->obj);
676 }
677 else if (!strcmp(pd->part, "second"))
678 {
679 sd->second_min_split_ratio = ratio;
680 if (sd->second_min_split_ratio < 0) sd->second_min_split_ratio = 0;
681 _set_min_size_new(pd->obj);
682 }
683}
684
688#include "efl_ui_panes_internal_part.eo.c" 685#include "efl_ui_panes_internal_part.eo.c"
689 686
690/* Efl.Part end */ 687/* Efl.Part end */
@@ -735,6 +732,65 @@ elm_panes_content_right_min_size_get(const Evas_Object *obj)
735 return sd->right_min_size; 732 return sd->right_min_size;
736} 733}
737 734
735EAPI double
736elm_panes_content_left_size_get(const Evas_Object *obj)
737{
738 return efl_ui_panes_split_ratio_get(obj);
739}
740
741EAPI void
742elm_panes_content_left_size_set(Evas_Object *obj, double size)
743{
744 efl_ui_panes_split_ratio_set(obj, size);
745}
746
747EAPI double
748elm_panes_content_right_size_get(const Evas_Object *obj)
749{
750 return 1.0 - elm_panes_content_left_size_get(obj);
751}
752
753EAPI void
754elm_panes_content_right_size_set(Evas_Object *obj, double size)
755{
756 elm_panes_content_left_size_set(obj, (1.0 - size));
757}
758
759EAPI void
760elm_panes_content_left_min_relative_size_set(Evas_Object *obj, double size)
761{
762 EFL_UI_PANES_DATA_GET(obj, sd);
763 sd->left_min_relative_size = size;
764 if (sd->left_min_relative_size < 0) sd->left_min_relative_size = 0;
765 sd->left_min_size_is_relative = EINA_TRUE;
766 _update_fixed_sides(obj);
767}
768
769EAPI double
770elm_panes_content_left_min_relative_size_get(const Evas_Object *obj)
771{
772 EFL_UI_PANES_DATA_GET(obj, sd);
773 return sd->left_min_relative_size;
774}
775
776EAPI void
777elm_panes_content_right_min_relative_size_set(Evas_Object *obj, double size)
778{
779 EFL_UI_PANES_DATA_GET(obj, sd);
780
781 sd->right_min_relative_size = size;
782 if (sd->right_min_relative_size < 0) sd->right_min_relative_size = 0;
783 sd->right_min_size_is_relative = EINA_TRUE;
784 _update_fixed_sides(obj);
785}
786
787EAPI double
788elm_panes_content_right_min_relative_size_get(const Evas_Object *obj)
789{
790 EFL_UI_PANES_DATA_GET(obj, sd);
791 return sd->right_min_relative_size;
792}
793
738/* Legacy APIs end */ 794/* Legacy APIs end */
739 795
740#include "efl_ui_panes.eo.c" 796#include "efl_ui_panes.eo.c"
diff --git a/src/lib/elementary/efl_ui_panes.eo b/src/lib/elementary/efl_ui_panes.eo
index 6c1300868e..79a4fa6b9b 100644
--- a/src/lib/elementary/efl_ui_panes.eo
+++ b/src/lib/elementary/efl_ui_panes.eo
@@ -5,26 +5,28 @@ class Efl.Ui.Panes (Efl.Ui.Layout, Efl.Orientation,
5 legacy_prefix: elm_panes; 5 legacy_prefix: elm_panes;
6 event_prefix: elm_panes; 6 event_prefix: elm_panes;
7 methods { 7 methods {
8 @property content_left_size { 8 @property split_ratio {
9 [[Set the size proportion of panes widget's left side. 9 [[Set the split ratio between panes widget first and second parts.
10 10
11 By default it's homogeneous, i.e., both sides have the same size. 11 By default it's homogeneous, i.e., both sides have the same size.
12 12
13 If something different is required, it can be set with this function. 13 If something different is required, it can be set with this function.
14 For example, if the left content should be displayed over 14 For example, if the first content should be displayed over
15 75% of the panes size, $size should be passed as 0.75. 15 75% of the panes size, $ratio should be passed as 0.75.
16 This way, right content will be resized to 25% of panes size. 16 This way, second content will be resized to 25% of panes size.
17 17
18 If displayed vertically, left content is displayed at top, and 18 If displayed vertically, first content is displayed at top, and
19 right content at bottom. 19 second content at bottom.
20 20
21 Note: This proportion will change when user drags the panes bar.]] 21 Note: This ratio will change when user drags the panes bar.]]
22 set { 22 set {
23 } 23 legacy: null;
24 get { 24 }
25 } 25 get {
26 legacy: null;
27 }
26 values { 28 values {
27 size: double; [[Value between 0.0 and 1.0 representing size proportion of left side.]] 29 ratio: double; [[Value between 0.0 and 1.0 representing split ratio between panes first and second parts.]]
28 } 30 }
29 } 31 }
30 @property fixed { 32 @property fixed {
@@ -41,54 +43,6 @@ class Efl.Ui.Panes (Efl.Ui.Layout, Efl.Orientation,
41 resizable.]] 43 resizable.]]
42 } 44 }
43 } 45 }
44 @property content_right_size {
45 [[Set the size proportion of panes widget's right side.
46
47 By default it's homogeneous, i.e., both sides have the same size.
48
49 If something different is required, it can be set with this function.
50 For example, if the right content should be displayed over
51 75% of the panes size, $size should be passed as 0.75.
52 This way, left content will be resized to 25% of panes size.
53
54 If displayed vertically, left content is displayed at top, and
55 right content at bottom.
56
57 Note: This proportion will change when user drags the panes bar.]]
58 set {
59 }
60 get {
61 }
62 values {
63 size: double; [[Value between 0.0 and 1.0 representing size proportion of right side.]]
64 }
65 }
66 @property content_left_min_relative_size {
67 [[Controls the relative minimum size of panes widget's left side.
68
69 proportion of minimum size of left side.
70
71 Note: If displayed vertically, left content is displayed at top.]]
72 set {
73 }
74 get {
75 }
76 values {
77 size: double; [[Value between 0.0 and 1.0 representing size proportion of minimum size of left side.]]
78 }
79 }
80 @property content_right_min_relative_size {
81 [[Set the relative minimum size of panes widget's right side.
82
83 Note: If displayed vertically, right content is displayed at bottom.]]
84 set {
85 }
86 get {
87 }
88 values {
89 size: double; [[Value between 0.0 and 1.0 representing size proportion of minimum size of right side.]]
90 }
91 }
92 } 46 }
93 implements { 47 implements {
94 class.constructor; 48 class.constructor;
diff --git a/src/lib/elementary/efl_ui_panes_internal_part.eo b/src/lib/elementary/efl_ui_panes_internal_part.eo
index 320d51e3d4..bb07c84070 100644
--- a/src/lib/elementary/efl_ui_panes_internal_part.eo
+++ b/src/lib/elementary/efl_ui_panes_internal_part.eo
@@ -11,6 +11,17 @@ class Efl.Ui.Panes.Internal.Part (Efl.Ui.Layout.Internal.Part)
11 allow: bool; 11 allow: bool;
12 } 12 }
13 } 13 }
14 @property min_split_ratio {
15 [[Controls the relative minimum size of panes widget's part.
16
17 If @Efl.Gfx.Size.Hint.hint_min.set is also used along with @.min_split_ratio.set, maximum value is set as
18 minimum size to part.
19
20 ]]
21 values {
22 size: double; [[Value between 0.0 and 1.0 representing size proportion of first part's minimum size.]]
23 }
24 }
14 } 25 }
15 implements { 26 implements {
16 } 27 }
diff --git a/src/lib/elementary/efl_ui_panes_private.h b/src/lib/elementary/efl_ui_panes_private.h
index b2242c7fcf..69e06246b0 100644
--- a/src/lib/elementary/efl_ui_panes_private.h
+++ b/src/lib/elementary/efl_ui_panes_private.h
@@ -39,6 +39,8 @@ struct _Efl_Ui_Panes_Data
39 double right_min_relative_size; 39 double right_min_relative_size;
40 int first_minw, first_minh; 40 int first_minw, first_minh;
41 int second_minw, second_minh; 41 int second_minw, second_minh;
42 double first_min_split_ratio, second_min_split_ratio;
43
42 Evas_Coord left_min_size; 44 Evas_Coord left_min_size;
43 Evas_Coord right_min_size; 45 Evas_Coord right_min_size;
44 Eina_Bool double_clicked : 1; 46 Eina_Bool double_clicked : 1;
diff --git a/src/lib/elementary/elm_panes_legacy.h b/src/lib/elementary/elm_panes_legacy.h
index 36502a1fac..251c6ff5b3 100644
--- a/src/lib/elementary/elm_panes_legacy.h
+++ b/src/lib/elementary/elm_panes_legacy.h
@@ -89,4 +89,143 @@ EAPI void elm_panes_content_right_min_size_set(Evas_Object *obj, int size);
89 */ 89 */
90EAPI int elm_panes_content_right_min_size_get(const Evas_Object *obj); 90EAPI int elm_panes_content_right_min_size_get(const Evas_Object *obj);
91 91
92/**
93 * @brief Set the size proportion of panes widget's right side.
94 *
95 * By default it's homogeneous, i.e., both sides have the same size.
96 *
97 * If something different is required, it can be set with this function. For
98 * example, if the right content should be displayed over 75% of the panes
99 * size, @c size should be passed as 0.75. This way, left content will be
100 * resized to 25% of panes size.
101 *
102 * If displayed vertically, left content is displayed at top, and right content
103 * at bottom.
104 *
105 * @note This proportion will change when user drags the panes bar.
106 *
107 * @param[in] size Value between 0.0 and 1.0 representing size proportion of
108 * right side.
109 *
110 * @ingroup Efl_Ui_Panes
111 */
112EAPI void elm_panes_content_right_size_set(Evas_Object *obj, double size);
113
114/**
115 * @brief Set the size proportion of panes widget's right side.
116 *
117 * By default it's homogeneous, i.e., both sides have the same size.
118 *
119 * If something different is required, it can be set with this function. For
120 * example, if the right content should be displayed over 75% of the panes
121 * size, @c size should be passed as 0.75. This way, left content will be
122 * resized to 25% of panes size.
123 *
124 * If displayed vertically, left content is displayed at top, and right content
125 * at bottom.
126 *
127 * @note This proportion will change when user drags the panes bar.
128 *
129 * @return Value between 0.0 and 1.0 representing size proportion of right
130 * side.
131 *
132 * @ingroup Efl_Ui_Panes
133 */
134EAPI double elm_panes_content_right_size_get(const Evas_Object *obj);
135
136/**
137 * @brief Set the size proportion of panes widget's left side.
138 *
139 * By default it's homogeneous, i.e., both sides have the same size.
140 *
141 * If something different is required, it can be set with this function. For
142 * example, if the left content should be displayed over 75% of the panes size,
143 * @c size should be passed as 0.75. This way, right content will be resized to
144 * 25% of panes size.
145 *
146 * If displayed vertically, left content is displayed at top, and right content
147 * at bottom.
148 *
149 * @note This proportion will change when user drags the panes bar.
150 *
151 * @param[in] size Value between 0.0 and 1.0 representing size proportion of
152 * left side.
153 *
154 * @ingroup Efl_Ui_Panes
155 */
156EAPI void elm_panes_content_left_size_set(Evas_Object *obj, double size);
157
158/**
159 * @brief Set the size proportion of panes widget's left side.
160 *
161 * By default it's homogeneous, i.e., both sides have the same size.
162 *
163 * If something different is required, it can be set with this function. For
164 * example, if the left content should be displayed over 75% of the panes size,
165 * @c size should be passed as 0.75. This way, right content will be resized to
166 * 25% of panes size.
167 *
168 * If displayed vertically, left content is displayed at top, and right content
169 * at bottom.
170 *
171 * @note This proportion will change when user drags the panes bar.
172 *
173 * @return Value between 0.0 and 1.0 representing size proportion of left side.
174 *
175 * @ingroup Efl_Ui_Panes
176 */
177EAPI double elm_panes_content_left_size_get(const Evas_Object *obj);
178
179/**
180 * @brief Controls the relative minimum size of panes widget's left side.
181 *
182 * proportion of minimum size of left side.
183 *
184 * @note If displayed vertically, left content is displayed at top.
185 *
186 * @param[in] size Value between 0.0 and 1.0 representing size proportion of
187 * minimum size of left side.
188 *
189 * @ingroup Efl_Ui_Panes
190 */
191EAPI void elm_panes_content_left_min_relative_size_set(Evas_Object *obj, double size);
192
193/**
194 * @brief Controls the relative minimum size of panes widget's left side.
195 *
196 * proportion of minimum size of left side.
197 *
198 * @note If displayed vertically, left content is displayed at top.
199 *
200 * @return Value between 0.0 and 1.0 representing size proportion of minimum
201 * size of left side.
202 *
203 * @ingroup Efl_Ui_Panes
204 */
205EAPI double elm_panes_content_left_min_relative_size_get(const Evas_Object *obj);
206
207/**
208 * @brief Set the relative minimum size of panes widget's right side.
209 *
210 * @note If displayed vertically, right content is displayed at bottom.
211 *
212 * @param[in] size Value between 0.0 and 1.0 representing size proportion of
213 * minimum size of right side.
214 *
215 * @ingroup Efl_Ui_Panes
216 */
217EAPI void elm_panes_content_right_min_relative_size_set(Evas_Object *obj, double size);
218
219/**
220 * @brief Set the relative minimum size of panes widget's right side.
221 *
222 * @note If displayed vertically, right content is displayed at bottom.
223 *
224 * @return Value between 0.0 and 1.0 representing size proportion of minimum
225 * size of right side.
226 *
227 * @ingroup Efl_Ui_Panes
228 */
229EAPI double elm_panes_content_right_min_relative_size_get(const Evas_Object *obj);
230
92#include "efl_ui_panes.eo.legacy.h" 231#include "efl_ui_panes.eo.legacy.h"