summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2017-12-08 08:54:23 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-12-08 13:43:15 +0900
commit1541d1866c9f4a85c2ccd9085e048287d2ff7d5c (patch)
treeabb721dd9506a7455222816fbba37a72aeb6a7af
parent96a9b137db573a1e645282b32c54a3d98d1a4346 (diff)
efl_ui_popup_alert_scroll: Add expandable propertydevs/jaehyun/efl_popup_alert_scroll
The expandable property allows popup to expand its size up to the given maximum size. So by setting expandable property, popup expands its scrollable content size from the minimum size of the content to the given maximum size.
-rw-r--r--src/bin/elementary/test_ui_popup.c150
-rw-r--r--src/lib/elementary/efl_ui_popup.c23
-rw-r--r--src/lib/elementary/efl_ui_popup.eo1
-rw-r--r--src/lib/elementary/efl_ui_popup_alert.c19
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_scroll.c183
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_scroll.eo25
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_scroll_private.h7
-rw-r--r--src/lib/elementary/efl_ui_popup_private.h1
8 files changed, 373 insertions, 36 deletions
diff --git a/src/bin/elementary/test_ui_popup.c b/src/bin/elementary/test_ui_popup.c
index 1486d49313..f6f751b8b7 100644
--- a/src/bin/elementary/test_ui_popup.c
+++ b/src/bin/elementary/test_ui_popup.c
@@ -325,6 +325,8 @@ efl_ui_popup_alert_clicked_cb(void *data EINA_UNUSED, const Efl_Event *ev)
325 printf("Negative Button is clicked\n"); 325 printf("Negative Button is clicked\n");
326 else if(event->button_type == EFL_UI_POPUP_ALERT_BUTTON_USER) 326 else if(event->button_type == EFL_UI_POPUP_ALERT_BUTTON_USER)
327 printf("User Button is clicked\n"); 327 printf("User Button is clicked\n");
328
329 efl_del(ev->object);
328} 330}
329 331
330void 332void
@@ -356,22 +358,63 @@ test_ui_popup_alert(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
356 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL); 358 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
357} 359}
358 360
359void 361static void
360test_ui_popup_alert_scroll(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 362_alert_scroll_case1_cb(void *data, const Efl_Event *ev EINA_UNUSED)
361{ 363{
362 char buf[PATH_MAX]; 364 char buf[PATH_MAX];
365 Eo *win = data;
366 Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_SCROLL_CLASS, win);
363 367
364 Eo *win = efl_add(EFL_UI_WIN_CLASS, NULL, 368 efl_text_set(efl_part(efl_ui_popup, "title"), "title");
365 efl_text_set(efl_added, "Efl.Ui.Popup.Alert.Scroll"),
366 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
367 369
368 efl_gfx_size_set(win, EINA_SIZE2D(320, 320)); 370 Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup);
371 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
372 efl_file_set(layout, buf, "efl_ui_popup_scroll_content");
369 373
374 efl_content_set(efl_ui_popup, layout);
375
376 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_POSITIVE, "Yes");
377 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
378 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
379
380 efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
381
382 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
383}
384
385static void
386_alert_scroll_case2_cb(void *data, const Efl_Event *ev EINA_UNUSED)
387{
388 char buf[PATH_MAX];
389 Eo *win = data;
370 Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_SCROLL_CLASS, win); 390 Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_SCROLL_CLASS, win);
371 391
372 efl_text_set(efl_part(efl_ui_popup, "title"), "title"); 392 efl_text_set(efl_part(efl_ui_popup, "title"), "title");
373 393
374 efl_gfx_size_set(efl_ui_popup, EINA_SIZE2D(160, 160)); 394 Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup);
395 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
396 efl_file_set(layout, buf, "efl_ui_popup_scroll_content");
397
398 efl_content_set(efl_ui_popup, layout);
399
400 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_POSITIVE, "Yes");
401 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
402 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
403
404 efl_ui_popup_alert_scroll_expandable_set(efl_ui_popup, EINA_SIZE2D(320, -1));
405 efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
406
407 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
408}
409
410static void
411_alert_scroll_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED)
412{
413 char buf[PATH_MAX];
414 Eo *win = data;
415 Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_SCROLL_CLASS, win);
416
417 efl_text_set(efl_part(efl_ui_popup, "title"), "title");
375 418
376 Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup); 419 Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup);
377 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get()); 420 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
@@ -383,9 +426,102 @@ test_ui_popup_alert_scroll(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
383 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No"); 426 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
384 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel"); 427 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
385 428
429 efl_ui_popup_alert_scroll_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 320));
430 efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
431
386 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL); 432 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
387} 433}
388 434
435static void
436_alert_scroll_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED)
437{
438 char buf[PATH_MAX];
439 Eo *win = data;
440 Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_SCROLL_CLASS, win);
441
442 efl_text_set(efl_part(efl_ui_popup, "title"), "title");
443
444 Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup);
445 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
446 efl_file_set(layout, buf, "efl_ui_popup_scroll_content");
447
448 efl_content_set(efl_ui_popup, layout);
449
450 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_POSITIVE, "Yes");
451 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
452 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
453
454 efl_ui_popup_alert_scroll_expandable_set(efl_ui_popup, EINA_SIZE2D(320, 320));
455 efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
456
457 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
458}
459
460static void
461_alert_scroll_case5_cb(void *data, const Efl_Event *ev EINA_UNUSED)
462{
463 char buf[PATH_MAX];
464 Eo *win = data;
465 Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_SCROLL_CLASS, win);
466
467 efl_text_set(efl_part(efl_ui_popup, "title"), "title");
468
469 Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup);
470 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
471 efl_file_set(layout, buf, "efl_ui_popup_scroll_content");
472
473 efl_content_set(efl_ui_popup, layout);
474
475 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_POSITIVE, "Yes");
476 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
477 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
478
479 efl_ui_popup_alert_scroll_expandable_set(efl_ui_popup, EINA_SIZE2D(80, 80));
480 efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
481
482 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
483}
484
485void
486test_ui_popup_alert_scroll(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
487{
488 Eo *win = efl_add(EFL_UI_WIN_CLASS, NULL,
489 efl_text_set(efl_added, "Efl.Ui.Popup.Alert.Scroll"),
490 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
491
492 efl_gfx_size_set(win, EINA_SIZE2D(500, 500));
493
494 Eo *create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
495 efl_text_set(create_btn, "1. size(160,160), content(200, 200), expand(-1, -1)");
496 efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 0));
497 efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
498 efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, _alert_scroll_case1_cb, win);
499
500 create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
501 efl_text_set(create_btn, "2. size(160,160), content(200, 200), expand(320, -1)");
502 efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 50));
503 efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
504 efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, _alert_scroll_case2_cb, win);
505
506 create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
507 efl_text_set(create_btn, "3. size(160,160), content(200, 200), expand(-1, 320)");
508 efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 100));
509 efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
510 efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, _alert_scroll_case3_cb, win);
511
512 create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
513 efl_text_set(create_btn, "4. size(160,160), content(200, 200), expand(320, 320)");
514 efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 150));
515 efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
516 efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, _alert_scroll_case4_cb, win);
517
518 create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
519 efl_text_set(create_btn, "5. size(160,160), content(200, 200), expand(80, 80)");
520 efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 200));
521 efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
522 efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, _alert_scroll_case5_cb, win);
523}
524
389void 525void
390test_ui_popup_alert_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 526test_ui_popup_alert_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
391{ 527{
diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c
index 0302e62da6..9972ce03bb 100644
--- a/src/lib/elementary/efl_ui_popup.c
+++ b/src/lib/elementary/efl_ui_popup.c
@@ -239,8 +239,8 @@ _efl_ui_popup_efl_object_destructor(Eo *obj, Efl_Ui_Popup_Data *pd)
239 efl_destructor(efl_super(obj, MY_CLASS)); 239 efl_destructor(efl_super(obj, MY_CLASS));
240} 240}
241 241
242EOLIAN static void 242static void
243_efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED) 243_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd)
244{ 244{
245 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 245 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
246 Evas_Coord minw = -1, minh = -1; 246 Evas_Coord minw = -1, minh = -1;
@@ -260,6 +260,25 @@ _efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED)
260 _calc_align(obj); 260 _calc_align(obj);
261} 261}
262 262
263EOLIAN static void
264_efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd)
265{
266 if (pd->needs_size_calc) return;
267 pd->needs_size_calc = EINA_TRUE;
268
269 evas_object_smart_changed(obj);
270}
271
272EOLIAN static void
273_efl_ui_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Data *pd)
274{
275 if (pd->needs_size_calc)
276 {
277 _sizing_eval(obj, pd);
278 pd->needs_size_calc = EINA_FALSE;
279 }
280}
281
263/* Standard widget overrides */ 282/* Standard widget overrides */
264 283
265ELM_PART_CONTENT_DEFAULT_SET(efl_ui_popup, "elm.swallow.content") 284ELM_PART_CONTENT_DEFAULT_SET(efl_ui_popup, "elm.swallow.content")
diff --git a/src/lib/elementary/efl_ui_popup.eo b/src/lib/elementary/efl_ui_popup.eo
index dd5032a2e3..8de3202db6 100644
--- a/src/lib/elementary/efl_ui_popup.eo
+++ b/src/lib/elementary/efl_ui_popup.eo
@@ -52,6 +52,7 @@ class Efl.Ui.Popup(Efl.Ui.Layout, Efl.Content)
52 implements { 52 implements {
53 Efl.Object.constructor; 53 Efl.Object.constructor;
54 Efl.Object.destructor; 54 Efl.Object.destructor;
55 Efl.Canvas.Group.group_calculate;
55 Efl.Gfx.position { set; } 56 Efl.Gfx.position { set; }
56 Efl.Gfx.size { set;} 57 Efl.Gfx.size { set;}
57 Efl.Gfx.visible { set; } 58 Efl.Gfx.visible { set; }
diff --git a/src/lib/elementary/efl_ui_popup_alert.c b/src/lib/elementary/efl_ui_popup_alert.c
index 58922b12d8..4bdee95982 100644
--- a/src/lib/elementary/efl_ui_popup_alert.c
+++ b/src/lib/elementary/efl_ui_popup_alert.c
@@ -23,20 +23,6 @@ static const char BUTTON_SWALLOW_NAME[EFL_UI_POPUP_ALERT_BUTTON_COUNT][20] =
23 "elm.swallow.button2", 23 "elm.swallow.button2",
24 "elm.swallow.button3"}; 24 "elm.swallow.button3"};
25 25
26EOLIAN static void
27_efl_ui_popup_alert_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Data *pd EINA_UNUSED)
28{
29 elm_layout_sizing_eval(efl_super(obj, MY_CLASS));
30
31 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
32 Evas_Coord minw = -1, minh = -1;
33
34 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
35 edje_object_size_min_restricted_calc
36 (wd->resize_obj, &minw, &minh, minw, minh);
37 efl_gfx_size_hint_min_set(obj, EINA_SIZE2D(minw, minh));
38}
39
40static Eina_Bool 26static Eina_Bool
41_efl_ui_popup_alert_text_set(Eo *obj, Efl_Ui_Popup_Alert_Data *pd, const char *part, const char *label) 27_efl_ui_popup_alert_text_set(Eo *obj, Efl_Ui_Popup_Alert_Data *pd, const char *part, const char *label)
42{ 28{
@@ -182,6 +168,8 @@ _efl_ui_popup_alert_button_set(Eo *obj, Efl_Ui_Popup_Alert_Data *pd, Efl_Ui_Popu
182 } 168 }
183 169
184 elm_layout_signal_emit(obj, "elm,buttons,show", "elm"); 170 elm_layout_signal_emit(obj, "elm,buttons,show", "elm");
171 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
172 edje_object_message_signal_process(wd->resize_obj);
185 elm_layout_sizing_eval(obj); 173 elm_layout_sizing_eval(obj);
186} 174}
187 175
@@ -223,7 +211,4 @@ ELM_PART_OVERRIDE_TEXT_GET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_
223 211
224/* Efl.Part end */ 212/* Efl.Part end */
225 213
226#define EFL_UI_POPUP_ALERT_EXTRA_OPS \
227 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_popup_alert)
228
229#include "efl_ui_popup_alert.eo.c" 214#include "efl_ui_popup_alert.eo.c"
diff --git a/src/lib/elementary/efl_ui_popup_alert_scroll.c b/src/lib/elementary/efl_ui_popup_alert_scroll.c
index 7a5dd0b61c..a86753da00 100644
--- a/src/lib/elementary/efl_ui_popup_alert_scroll.c
+++ b/src/lib/elementary/efl_ui_popup_alert_scroll.c
@@ -14,18 +14,139 @@
14 14
15static const char PART_NAME_SCROLLER[] = "scroller"; 15static const char PART_NAME_SCROLLER[] = "scroller";
16 16
17EOLIAN static void 17static void
18_efl_ui_popup_alert_scroll_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd EINA_UNUSED) 18_scroller_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd,
19 Eina_Size2D exp_scr_min, Eina_Size2D min)
19{ 20{
20 elm_layout_sizing_eval(efl_super(obj, MY_CLASS)); 21 Eina_Size2D max_size;
22 max_size.w = -1;
23 max_size.h = -1;
24
25 if (pd->max_size.w != -1)
26 max_size.w = (exp_scr_min.w > pd->max_size.w) ? exp_scr_min.w : pd->max_size.w;
27 if (pd->max_size.h != -1)
28 max_size.h = (exp_scr_min.h > pd->max_size.h) ? exp_scr_min.h : pd->max_size.h;
29
30 Eina_Size2D size;
31 size.w = (exp_scr_min.w > pd->size.w) ? exp_scr_min.w : pd->size.w;
32 size.h = (exp_scr_min.h > pd->size.h) ? exp_scr_min.h : pd->size.h;
33
34 Eina_Size2D new_min = exp_scr_min;
35
36 if ((max_size.w == -1) && (max_size.h == -1))
37 {
38 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
39 efl_gfx_size_set(obj, size);
40 }
41 else if ((max_size.w == -1) && (max_size.h != -1))
42 {
43 if (max_size.h < min.h)
44 {
45 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
46 efl_gfx_size_set(obj, EINA_SIZE2D(size.w, max_size.h));
47 }
48 else
49 {
50 new_min.h = min.h;
51 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
52 efl_gfx_size_set(obj, EINA_SIZE2D(size.w, min.h));
53 }
54 }
55 else if ((max_size.w != -1) && (max_size.h == -1))
56 {
57 if (max_size.w < min.w)
58 {
59 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
60 efl_gfx_size_set(obj, EINA_SIZE2D(max_size.w, size.h));
61 }
62 else
63 {
64 new_min.w = min.w;
65 elm_scroller_content_min_limit(pd->scroller, EINA_TRUE, EINA_FALSE);
66 efl_gfx_size_set(obj, EINA_SIZE2D(min.w, size.h));
67 }
68 }
69 else if ((max_size.w != -1) && (max_size.h != -1))
70 {
71 Eina_Size2D new_size;
72 Eina_Bool min_limit_w = EINA_FALSE;
73 Eina_Bool min_limit_h = EINA_FALSE;
74
75 if (max_size.w < min.w)
76 {
77 new_size.w = max_size.w;
78 }
79 else
80 {
81 min_limit_w = EINA_TRUE;
82 new_min.w = min.w;
83 new_size.w = min.w;
84 }
85
86 if (max_size.h < min.h)
87 {
88 new_size.h = max_size.h;
89 }
90 else
91 {
92 min_limit_h = EINA_TRUE;
93 new_min.h = min.h;
94 new_size.h = min.h;
95 }
96
97 elm_scroller_content_min_limit(pd->scroller, min_limit_w, min_limit_h);
98 efl_gfx_size_set(obj, new_size);
99 }
100
101 efl_gfx_size_hint_min_set(obj, new_min);
102}
21 103
104static void
105_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd)
106{
22 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 107 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
23 Evas_Coord minw = -1, minh = -1; 108 Evas_Coord obj_minw = -1, obj_minh = -1;
109 Evas_Coord scr_minw = -1, scr_minh = -1;
110
111 //Calculate popup's min size including scroller's min size
112 {
113 elm_scroller_content_min_limit(pd->scroller, EINA_TRUE, EINA_TRUE);
114
115 elm_coords_finger_size_adjust(1, &scr_minw, 1, &scr_minh);
116 edje_object_size_min_restricted_calc
117 (wd->resize_obj, &scr_minw, &scr_minh, scr_minw, scr_minh);
118 }
119
120 //Calculate popup's min size except scroller's min size
121 {
122 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
123
124 elm_coords_finger_size_adjust(1, &obj_minw, 1, &obj_minh);
125 edje_object_size_min_restricted_calc
126 (wd->resize_obj, &obj_minw, &obj_minh, obj_minw, obj_minh);
127 }
128
129 _scroller_sizing_eval(obj, pd, EINA_SIZE2D(obj_minw, obj_minh), EINA_SIZE2D(scr_minw, scr_minh));
130}
131
132EOLIAN static void
133_efl_ui_popup_alert_scroll_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd)
134{
135 if (pd->needs_size_calc) return;
136 pd->needs_size_calc = EINA_TRUE;
137
138 evas_object_smart_changed(obj);
139}
140
141EOLIAN static void
142_efl_ui_popup_alert_scroll_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd)
143{
144 if (pd->needs_size_calc)
145 {
146 _sizing_eval(obj, pd);
24 147
25 elm_coords_finger_size_adjust(1, &minw, 1, &minh); 148 pd->needs_size_calc = EINA_FALSE;
26 edje_object_size_min_restricted_calc 149 }
27 (wd->resize_obj, &minw, &minh, minw, minh);
28 efl_gfx_size_hint_min_set(obj, EINA_SIZE2D(minw, minh));
29} 150}
30 151
31static Eina_Bool 152static Eina_Bool
@@ -91,6 +212,48 @@ _efl_ui_popup_alert_scroll_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Scro
91 return efl_text_get(efl_part(efl_super(obj, MY_CLASS), part)); 212 return efl_text_get(efl_part(efl_super(obj, MY_CLASS), part));
92} 213}
93 214
215static void
216_efl_ui_popup_alert_scroll_expandable_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Scroll_Data *pd, Eina_Size2D max_size)
217{
218 Eina_Bool valid_max_w = EINA_FALSE;
219 Eina_Bool valid_max_h = EINA_FALSE;
220
221 if ((max_size.w == -1) || (max_size.w >= 0))
222 valid_max_w = EINA_TRUE;
223
224 if ((max_size.h == -1) || (max_size.h >= 0))
225 valid_max_h = EINA_TRUE;
226
227 if (!valid_max_w || !valid_max_h)
228 {
229 ERR("Invalid max size(%d, %d)!"
230 "The max size should be equal to or bigger than 0. "
231 "To disable expandable property, set -1 to the max size.",
232 max_size.w, max_size.h);
233 return;
234 }
235
236 pd->max_size = max_size;
237
238 elm_layout_sizing_eval(obj);
239}
240
241static Eina_Size2D
242_efl_ui_popup_alert_scroll_expandable_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Scroll_Data *pd)
243{
244 return pd->max_size;
245}
246
247EOLIAN static void
248_efl_ui_popup_alert_scroll_efl_ui_popup_popup_size_set(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd, Eina_Size2D size)
249{
250 pd->size = size;
251
252 efl_gfx_size_set(obj, size);
253
254 elm_layout_sizing_eval(obj);
255}
256
94EOLIAN static Eo * 257EOLIAN static Eo *
95_efl_ui_popup_alert_scroll_efl_object_constructor(Eo *obj, 258_efl_ui_popup_alert_scroll_efl_object_constructor(Eo *obj,
96 Efl_Ui_Popup_Alert_Scroll_Data *pd) 259 Efl_Ui_Popup_Alert_Scroll_Data *pd)
@@ -114,6 +277,10 @@ _efl_ui_popup_alert_scroll_efl_object_constructor(Eo *obj,
114 efl_content_set(efl_part(efl_super(obj, MY_CLASS), "elm.swallow.content"), 277 efl_content_set(efl_part(efl_super(obj, MY_CLASS), "elm.swallow.content"),
115 pd->scroller); 278 pd->scroller);
116 279
280 pd->size = EINA_SIZE2D(0, 0);
281 pd->max_size = EINA_SIZE2D(-1, -1);
282 pd->needs_size_calc = EINA_FALSE;
283
117 return obj; 284 return obj;
118} 285}
119 286
diff --git a/src/lib/elementary/efl_ui_popup_alert_scroll.eo b/src/lib/elementary/efl_ui_popup_alert_scroll.eo
index af13c9b395..33302b915b 100644
--- a/src/lib/elementary/efl_ui_popup_alert_scroll.eo
+++ b/src/lib/elementary/efl_ui_popup_alert_scroll.eo
@@ -1,7 +1,32 @@
1import eina_types;
2
1class Efl.Ui.Popup_Alert_Scroll(Efl.Ui.Popup_Alert) 3class Efl.Ui.Popup_Alert_Scroll(Efl.Ui.Popup_Alert)
2{ 4{
5 methods {
6 @property expandable {
7 set {
8 [[Set the expandable max size of popup.
9
10 If the given max_size is -1, then popup appears with its size.
11 However, if the given max_size is bigger than 0, then popup size is upto the given max_size. If popup content's min size is bigger than the given max_size, then scroller appears in the popup content area.
12 ]]
13 }
14 get {
15 [[Get the expandable max size of popup.
16
17 If the given max_size is -1, then popup appears with its size.
18 However, if the given max_size is bigger than 0, then popup size is upto the given max_size. If popup content's min size is bigger than the given max_size, then scroller appears in the popup content area.
19 ]]
20 }
21 values {
22 max_size: Eina.Size2D; [[A 2D max size in pixel units.]]
23 }
24 }
25 }
3 implements { 26 implements {
4 Efl.Object.constructor; 27 Efl.Object.constructor;
28 Efl.Canvas.Group.group_calculate;
5 Efl.Part.part; 29 Efl.Part.part;
30 Efl.Ui.Popup.popup_size { set;}
6 } 31 }
7} 32}
diff --git a/src/lib/elementary/efl_ui_popup_alert_scroll_private.h b/src/lib/elementary/efl_ui_popup_alert_scroll_private.h
index c1219b9398..290eaa75ad 100644
--- a/src/lib/elementary/efl_ui_popup_alert_scroll_private.h
+++ b/src/lib/elementary/efl_ui_popup_alert_scroll_private.h
@@ -6,8 +6,11 @@
6typedef struct _Efl_Ui_Popup_Alert_Scroll_Data Efl_Ui_Popup_Alert_Scroll_Data; 6typedef struct _Efl_Ui_Popup_Alert_Scroll_Data Efl_Ui_Popup_Alert_Scroll_Data;
7struct _Efl_Ui_Popup_Alert_Scroll_Data 7struct _Efl_Ui_Popup_Alert_Scroll_Data
8{ 8{
9 Eo *scroller; 9 Eo *scroller;
10 Eo *content; 10 Eo *content;
11 Eina_Size2D size;
12 Eina_Size2D max_size;
13 Eina_Bool needs_size_calc : 1;
11}; 14};
12 15
13#endif 16#endif
diff --git a/src/lib/elementary/efl_ui_popup_private.h b/src/lib/elementary/efl_ui_popup_private.h
index a62a654046..f018812389 100644
--- a/src/lib/elementary/efl_ui_popup_private.h
+++ b/src/lib/elementary/efl_ui_popup_private.h
@@ -9,6 +9,7 @@ struct _Efl_Ui_Popup_Data
9 Efl_Ui_Popup_Align align; 9 Efl_Ui_Popup_Align align;
10 Ecore_Timer *timer; 10 Ecore_Timer *timer;
11 double timeout; 11 double timeout;
12 Eina_Bool needs_size_calc : 1;
12}; 13};
13 14
14#endif 15#endif