summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/elementary/test.c3
-rw-r--r--src/bin/elementary/test_panes.c41
-rw-r--r--src/lib/elementary/efl_ui_panes.c104
-rw-r--r--src/lib/elementary/efl_ui_panes_private.h2
4 files changed, 147 insertions, 3 deletions
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index ddfa3a70b4..579387ff48 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -194,6 +194,7 @@ void test_menu2(void *data, Evas_Object *obj, void *event_info);
194void test_panel(void *data, Evas_Object *obj, void *event_info); 194void test_panel(void *data, Evas_Object *obj, void *event_info);
195void test_panel2(void *data, Evas_Object *obj, void *event_info); 195void test_panel2(void *data, Evas_Object *obj, void *event_info);
196void test_panes(void *data, Evas_Object *obj, void *event_info); 196void test_panes(void *data, Evas_Object *obj, void *event_info);
197void test_panes_minsize(void *data, Evas_Object *obj, void *event_info);
197void test_calendar(void *data, Evas_Object *obj, void *event_info); 198void test_calendar(void *data, Evas_Object *obj, void *event_info);
198void test_calendar2(void *data, Evas_Object *obj, void *event_info); 199void test_calendar2(void *data, Evas_Object *obj, void *event_info);
199void test_calendar3(void *data, Evas_Object *obj, void *event_info); 200void test_calendar3(void *data, Evas_Object *obj, void *event_info);
@@ -1000,7 +1001,7 @@ add_tests:
1000 ADD_TEST(NULL, "Dividers", "Panel", test_panel); 1001 ADD_TEST(NULL, "Dividers", "Panel", test_panel);
1001 ADD_TEST(NULL, "Dividers", "Panel Scrollable", test_panel2); 1002 ADD_TEST(NULL, "Dividers", "Panel Scrollable", test_panel2);
1002 ADD_TEST(NULL, "Dividers", "Panes", test_panes); 1003 ADD_TEST(NULL, "Dividers", "Panes", test_panes);
1003 1004 ADD_TEST(NULL, "Dividers", "Panes minsize", test_panes_minsize);
1004 //------------------------------// 1005 //------------------------------//
1005 ADD_TEST(NULL, "Standardization", "Conformant", test_conformant); 1006 ADD_TEST(NULL, "Standardization", "Conformant", test_conformant);
1006 ADD_TEST(NULL, "Standardization", "Conformant 2", test_conformant2); 1007 ADD_TEST(NULL, "Standardization", "Conformant 2", test_conformant2);
diff --git a/src/bin/elementary/test_panes.c b/src/bin/elementary/test_panes.c
index 27d9535045..da7255c15b 100644
--- a/src/bin/elementary/test_panes.c
+++ b/src/bin/elementary/test_panes.c
@@ -103,3 +103,44 @@ test_panes(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_inf
103 evas_object_resize(win, 320, 400); 103 evas_object_resize(win, 320, 400);
104 evas_object_show(win); 104 evas_object_show(win);
105} 105}
106
107void
108test_panes_minsize(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
109{
110 Eo *win, *panes, *panes_h;
111
112 win = efl_add(EFL_UI_WIN_CLASS, NULL,
113 efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
114 efl_text_set(efl_added, "Panes Minsize"),
115 efl_ui_win_autodel_set(efl_added, EINA_TRUE)
116 );
117
118 panes = efl_add(EFL_UI_PANES_CLASS, win,
119 efl_gfx_size_hint_weight_set(efl_added, EFL_GFX_SIZE_HINT_EXPAND, EFL_GFX_SIZE_HINT_EXPAND),
120 efl_content_set(win, efl_added)
121 );
122
123 efl_add(EFL_UI_BUTTON_CLASS, win,
124 efl_text_set(efl_added, "Left - min size 110, 110"),
125 efl_gfx_size_hint_min_set(efl_added, 110, 110),
126 efl_content_set(efl_part(panes, "first"), efl_added)
127 );
128
129 panes_h = efl_add(EFL_UI_PANES_CLASS, win,
130 efl_orientation_set(efl_added, EFL_ORIENT_HORIZONTAL),
131 efl_content_set(efl_part(panes, "second"), efl_added)
132 );
133 efl_add(EFL_UI_BUTTON_CLASS, win,
134 efl_text_set(efl_added, "Up - no min size"),
135 efl_content_set(efl_part(panes_h, "first"), efl_added)
136 );
137
138 efl_add(EFL_UI_BUTTON_CLASS, win,
139 efl_text_set(efl_added, "Down - min size 50 40"),
140 efl_gfx_size_hint_min_set(efl_added, 50, 40),
141 efl_content_set(efl_part(panes_h, "second"), efl_added)
142 );
143
144 efl_gfx_size_set(win, 320, 400);
145}
146
diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c
index dde24ce678..3e7954fcfd 100644
--- a/src/lib/elementary/efl_ui_panes.c
+++ b/src/lib/elementary/efl_ui_panes.c
@@ -47,6 +47,8 @@ static const Elm_Layout_Part_Alias_Description _content_aliases[] =
47 {NULL, NULL} 47 {NULL, NULL}
48}; 48};
49 49
50static void _set_min_size_new(void *data);
51
50EOLIAN static Efl_Ui_Theme_Apply 52EOLIAN static Efl_Ui_Theme_Apply
51_efl_ui_panes_elm_widget_theme_apply(Eo *obj, Efl_Ui_Panes_Data *sd) 53_efl_ui_panes_elm_widget_theme_apply(Eo *obj, Efl_Ui_Panes_Data *sd)
52{ 54{
@@ -173,6 +175,99 @@ _on_unpressed(void *data,
173 } 175 }
174} 176}
175 177
178EOLIAN static void
179_efl_ui_panes_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Panes_Data *sd)
180{
181 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
182
183 Eo *first_content, *second_content;
184 int minw, minh;
185
186 first_content = efl_content_get(efl_part(obj, "first"));
187 second_content = efl_content_get(efl_part(obj, "second"));
188
189 if (first_content)
190 efl_gfx_size_hint_combined_min_get(first_content, &sd->first_minw, &sd->first_minh);
191 //TODO: use this for allow cropping?
192 //efl_gfx_size_hint_min_get(first_content, &sd->first_minw, &sd->first_minh);
193 if (second_content)
194 efl_gfx_size_hint_combined_min_get(second_content, &sd->second_minw, &sd->second_minh);
195 //TODO: use this for allow cropping
196 //efl_gfx_size_hint_min_get(second_content, &sd->second_minw, &sd->second_minh);
197
198 if (sd->orientation == EFL_ORIENT_HORIZONTAL)
199 {
200 edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh,
201 MAX(sd->first_minw, sd->second_minw),
202 sd->first_minh + sd->second_minh);
203 }
204 else
205 {
206 edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh,
207 sd->first_minw + sd->second_minw,
208 MAX(sd->first_minh, sd->second_minh));
209 }
210
211 efl_gfx_size_hint_min_set(obj, minw, minh);
212 _set_min_size_new(obj);
213}
214
215static void
216_set_min_size_new(void *data)
217{
218 Eo *obj = data;
219 EFL_UI_PANES_DATA_GET(obj, sd);
220 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
221
222 int first_minw = sd->first_minw, first_minh = sd->first_minh;
223 int second_minw = sd->second_minw, second_minh = sd->second_minh;
224 int w, h;
225 double first_min_relative_size = 0.0, second_min_relative_size = 0.0;
226
227 evas_object_geometry_get(wd->resize_obj, NULL, NULL, &w, &h);
228
229 if (sd->orientation == EFL_ORIENT_HORIZONTAL)
230 {
231 if (first_minh + second_minh > h)
232 {
233 first_min_relative_size = first_minh/(first_minh + second_minh);
234 second_min_relative_size = second_minh/(first_minh + second_minh);
235 }
236 else
237 {
238 if (h > 0)
239 {
240 first_min_relative_size = first_minh/(double)h;
241 second_min_relative_size = second_minh/(double)h;
242 }
243 }
244 edje_object_part_drag_value_set(wd->resize_obj, "right_constraint",
245 0.0, 1.0 - second_min_relative_size);
246 edje_object_part_drag_value_set(wd->resize_obj, "left_constraint",
247 0.0, first_min_relative_size);
248 }
249 else
250 {
251 if (first_minw + second_minw > w)
252 {
253 first_min_relative_size = first_minw/(first_minw + second_minw);
254 second_min_relative_size = second_minw/(first_minw + second_minw);
255 }
256 else
257 {
258 if (w > 0)
259 {
260 first_min_relative_size = first_minw/(double)w;
261 second_min_relative_size = second_minw/(double)w;
262 }
263 }
264 edje_object_part_drag_value_set(wd->resize_obj, "right_constraint",
265 1.0 - second_min_relative_size, 0.0);
266 edje_object_part_drag_value_set(wd->resize_obj, "left_constraint",
267 first_min_relative_size, 0.0);
268 }
269}
270
176static void 271static void
177_set_min_size(void *data) 272_set_min_size(void *data)
178{ 273{
@@ -203,6 +298,7 @@ _set_min_size(void *data)
203 } 298 }
204} 299}
205 300
301//TODO: call this in legacy api implementation
206static void 302static void
207_update_fixed_sides(void *data) 303_update_fixed_sides(void *data)
208{ 304{
@@ -242,6 +338,7 @@ _update_fixed_sides(void *data)
242 if (sd->orientation == EFL_ORIENT_VERTICAL && (w > 0)) 338 if (sd->orientation == EFL_ORIENT_VERTICAL && (w > 0))
243 sd->left_min_relative_size = sd->left_min_size / (double)w; 339 sd->left_min_relative_size = sd->left_min_size / (double)w;
244 } 340 }
341
245 _set_min_size(data); 342 _set_min_size(data);
246} 343}
247 344
@@ -251,7 +348,9 @@ _on_resize(void *data,
251 Evas_Object *obj EINA_UNUSED, 348 Evas_Object *obj EINA_UNUSED,
252 void *event_info EINA_UNUSED) 349 void *event_info EINA_UNUSED)
253{ 350{
254 _update_fixed_sides(data); 351 //TODO: needs a flag to enable the old behaviour
352 //_update_fixed_sides(data);
353 _set_min_size_new(data);
255} 354}
256 355
257EOLIAN static void 356EOLIAN static void
@@ -562,7 +661,8 @@ ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX);
562 661
563#define EFL_UI_PANES_EXTRA_OPS \ 662#define EFL_UI_PANES_EXTRA_OPS \
564 EFL_CANVAS_GROUP_ADD_OPS(efl_ui_panes), \ 663 EFL_CANVAS_GROUP_ADD_OPS(efl_ui_panes), \
565 ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX) 664 ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \
665 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_panes)
566 666
567 667
568#include "efl_ui_panes.eo.c" 668#include "efl_ui_panes.eo.c"
diff --git a/src/lib/elementary/efl_ui_panes_private.h b/src/lib/elementary/efl_ui_panes_private.h
index d82bdc48a4..f8822f4cd6 100644
--- a/src/lib/elementary/efl_ui_panes_private.h
+++ b/src/lib/elementary/efl_ui_panes_private.h
@@ -37,6 +37,8 @@ struct _Efl_Ui_Panes_Data
37 Efl_Orient orientation; 37 Efl_Orient orientation;
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;
41 int second_minw, second_minh;
40 Evas_Coord left_min_size; 42 Evas_Coord left_min_size;
41 Evas_Coord right_min_size; 43 Evas_Coord right_min_size;
42 Eina_Bool double_clicked : 1; 44 Eina_Bool double_clicked : 1;