summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_panes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elementary/efl_ui_panes.c')
-rw-r--r--src/lib/elementary/efl_ui_panes.c104
1 files changed, 102 insertions, 2 deletions
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"