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)
downloadefl-devs/jaehyun/efl_popup_alert_scroll.tar.gz
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)
printf("Negative Button is clicked\n");
else if(event->button_type == EFL_UI_POPUP_ALERT_BUTTON_USER)
printf("User Button is clicked\n");
+
+ efl_del(ev->object);
}
void
@@ -356,22 +358,63 @@ test_ui_popup_alert(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
}
-void
-test_ui_popup_alert_scroll(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+static void
+_alert_scroll_case1_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
char buf[PATH_MAX];
+ Eo *win = data;
+ Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_SCROLL_CLASS, win);
- Eo *win = efl_add(EFL_UI_WIN_CLASS, NULL,
- efl_text_set(efl_added, "Efl.Ui.Popup.Alert.Scroll"),
- efl_ui_win_autodel_set(efl_added, EINA_TRUE));
+ efl_text_set(efl_part(efl_ui_popup, "title"), "title");
- efl_gfx_size_set(win, EINA_SIZE2D(320, 320));
+ Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup);
+ snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
+ efl_file_set(layout, buf, "efl_ui_popup_scroll_content");
+ efl_content_set(efl_ui_popup, layout);
+
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_POSITIVE, "Yes");
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
+
+ efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
+
+ efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
+}
+
+static void
+_alert_scroll_case2_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+ char buf[PATH_MAX];
+ Eo *win = data;
Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_SCROLL_CLASS, win);
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
- efl_gfx_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
+ Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup);
+ snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
+ efl_file_set(layout, buf, "efl_ui_popup_scroll_content");
+
+ efl_content_set(efl_ui_popup, layout);
+
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_POSITIVE, "Yes");
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
+
+ efl_ui_popup_alert_scroll_expandable_set(efl_ui_popup, EINA_SIZE2D(320, -1));
+ efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
+
+ efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
+}
+
+static void
+_alert_scroll_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+ char buf[PATH_MAX];
+ Eo *win = data;
+ Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_SCROLL_CLASS, win);
+
+ efl_text_set(efl_part(efl_ui_popup, "title"), "title");
Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup);
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,
efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
+ efl_ui_popup_alert_scroll_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 320));
+ efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
+
efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
}
+static void
+_alert_scroll_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+ char buf[PATH_MAX];
+ Eo *win = data;
+ Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_SCROLL_CLASS, win);
+
+ efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+
+ Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup);
+ snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
+ efl_file_set(layout, buf, "efl_ui_popup_scroll_content");
+
+ efl_content_set(efl_ui_popup, layout);
+
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_POSITIVE, "Yes");
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
+
+ efl_ui_popup_alert_scroll_expandable_set(efl_ui_popup, EINA_SIZE2D(320, 320));
+ efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
+
+ efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
+}
+
+static void
+_alert_scroll_case5_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+ char buf[PATH_MAX];
+ Eo *win = data;
+ Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_SCROLL_CLASS, win);
+
+ efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+
+ Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, efl_ui_popup);
+ snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
+ efl_file_set(layout, buf, "efl_ui_popup_scroll_content");
+
+ efl_content_set(efl_ui_popup, layout);
+
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_POSITIVE, "Yes");
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
+
+ efl_ui_popup_alert_scroll_expandable_set(efl_ui_popup, EINA_SIZE2D(80, 80));
+ efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
+
+ efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
+}
+
+void
+test_ui_popup_alert_scroll(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Eo *win = efl_add(EFL_UI_WIN_CLASS, NULL,
+ efl_text_set(efl_added, "Efl.Ui.Popup.Alert.Scroll"),
+ efl_ui_win_autodel_set(efl_added, EINA_TRUE));
+
+ efl_gfx_size_set(win, EINA_SIZE2D(500, 500));
+
+ Eo *create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+ efl_text_set(create_btn, "1. size(160,160), content(200, 200), expand(-1, -1)");
+ efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 0));
+ efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+ efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, _alert_scroll_case1_cb, win);
+
+ create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+ efl_text_set(create_btn, "2. size(160,160), content(200, 200), expand(320, -1)");
+ efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 50));
+ efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+ efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, _alert_scroll_case2_cb, win);
+
+ create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+ efl_text_set(create_btn, "3. size(160,160), content(200, 200), expand(-1, 320)");
+ efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 100));
+ efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+ efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, _alert_scroll_case3_cb, win);
+
+ create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+ efl_text_set(create_btn, "4. size(160,160), content(200, 200), expand(320, 320)");
+ efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 150));
+ efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+ efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, _alert_scroll_case4_cb, win);
+
+ create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+ efl_text_set(create_btn, "5. size(160,160), content(200, 200), expand(80, 80)");
+ efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 200));
+ efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+ efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, _alert_scroll_case5_cb, win);
+}
+
void
test_ui_popup_alert_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
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)
efl_destructor(efl_super(obj, MY_CLASS));
}
-EOLIAN static void
-_efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED)
+static void
+_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
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)
_calc_align(obj);
}
+EOLIAN static void
+_efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd)
+{
+ if (pd->needs_size_calc) return;
+ pd->needs_size_calc = EINA_TRUE;
+
+ evas_object_smart_changed(obj);
+}
+
+EOLIAN static void
+_efl_ui_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Data *pd)
+{
+ if (pd->needs_size_calc)
+ {
+ _sizing_eval(obj, pd);
+ pd->needs_size_calc = EINA_FALSE;
+ }
+}
+
/* Standard widget overrides */
ELM_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)
implements {
Efl.Object.constructor;
Efl.Object.destructor;
+ Efl.Canvas.Group.group_calculate;
Efl.Gfx.position { set; }
Efl.Gfx.size { set;}
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] =
"elm.swallow.button2",
"elm.swallow.button3"};
-EOLIAN static void
-_efl_ui_popup_alert_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Data *pd EINA_UNUSED)
-{
- elm_layout_sizing_eval(efl_super(obj, MY_CLASS));
-
- ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
- Evas_Coord minw = -1, minh = -1;
-
- elm_coords_finger_size_adjust(1, &minw, 1, &minh);
- edje_object_size_min_restricted_calc
- (wd->resize_obj, &minw, &minh, minw, minh);
- efl_gfx_size_hint_min_set(obj, EINA_SIZE2D(minw, minh));
-}
-
static Eina_Bool
_efl_ui_popup_alert_text_set(Eo *obj, Efl_Ui_Popup_Alert_Data *pd, const char *part, const char *label)
{
@@ -182,6 +168,8 @@ _efl_ui_popup_alert_button_set(Eo *obj, Efl_Ui_Popup_Alert_Data *pd, Efl_Ui_Popu
}
elm_layout_signal_emit(obj, "elm,buttons,show", "elm");
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
+ edje_object_message_signal_process(wd->resize_obj);
elm_layout_sizing_eval(obj);
}
@@ -223,7 +211,4 @@ ELM_PART_OVERRIDE_TEXT_GET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_
/* Efl.Part end */
-#define EFL_UI_POPUP_ALERT_EXTRA_OPS \
- ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_popup_alert)
-
#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 @@
static const char PART_NAME_SCROLLER[] = "scroller";
-EOLIAN static void
-_efl_ui_popup_alert_scroll_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd EINA_UNUSED)
+static void
+_scroller_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd,
+ Eina_Size2D exp_scr_min, Eina_Size2D min)
{
- elm_layout_sizing_eval(efl_super(obj, MY_CLASS));
+ Eina_Size2D max_size;
+ max_size.w = -1;
+ max_size.h = -1;
+
+ if (pd->max_size.w != -1)
+ max_size.w = (exp_scr_min.w > pd->max_size.w) ? exp_scr_min.w : pd->max_size.w;
+ if (pd->max_size.h != -1)
+ max_size.h = (exp_scr_min.h > pd->max_size.h) ? exp_scr_min.h : pd->max_size.h;
+
+ Eina_Size2D size;
+ size.w = (exp_scr_min.w > pd->size.w) ? exp_scr_min.w : pd->size.w;
+ size.h = (exp_scr_min.h > pd->size.h) ? exp_scr_min.h : pd->size.h;
+
+ Eina_Size2D new_min = exp_scr_min;
+
+ if ((max_size.w == -1) && (max_size.h == -1))
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, size);
+ }
+ else if ((max_size.w == -1) && (max_size.h != -1))
+ {
+ if (max_size.h < min.h)
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(size.w, max_size.h));
+ }
+ else
+ {
+ new_min.h = min.h;
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(size.w, min.h));
+ }
+ }
+ else if ((max_size.w != -1) && (max_size.h == -1))
+ {
+ if (max_size.w < min.w)
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(max_size.w, size.h));
+ }
+ else
+ {
+ new_min.w = min.w;
+ elm_scroller_content_min_limit(pd->scroller, EINA_TRUE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(min.w, size.h));
+ }
+ }
+ else if ((max_size.w != -1) && (max_size.h != -1))
+ {
+ Eina_Size2D new_size;
+ Eina_Bool min_limit_w = EINA_FALSE;
+ Eina_Bool min_limit_h = EINA_FALSE;
+
+ if (max_size.w < min.w)
+ {
+ new_size.w = max_size.w;
+ }
+ else
+ {
+ min_limit_w = EINA_TRUE;
+ new_min.w = min.w;
+ new_size.w = min.w;
+ }
+
+ if (max_size.h < min.h)
+ {
+ new_size.h = max_size.h;
+ }
+ else
+ {
+ min_limit_h = EINA_TRUE;
+ new_min.h = min.h;
+ new_size.h = min.h;
+ }
+
+ elm_scroller_content_min_limit(pd->scroller, min_limit_w, min_limit_h);
+ efl_gfx_size_set(obj, new_size);
+ }
+
+ efl_gfx_size_hint_min_set(obj, new_min);
+}
+static void
+_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd)
+{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
- Evas_Coord minw = -1, minh = -1;
+ Evas_Coord obj_minw = -1, obj_minh = -1;
+ Evas_Coord scr_minw = -1, scr_minh = -1;
+
+ //Calculate popup's min size including scroller's min size
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_TRUE, EINA_TRUE);
+
+ elm_coords_finger_size_adjust(1, &scr_minw, 1, &scr_minh);
+ edje_object_size_min_restricted_calc
+ (wd->resize_obj, &scr_minw, &scr_minh, scr_minw, scr_minh);
+ }
+
+ //Calculate popup's min size except scroller's min size
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+
+ elm_coords_finger_size_adjust(1, &obj_minw, 1, &obj_minh);
+ edje_object_size_min_restricted_calc
+ (wd->resize_obj, &obj_minw, &obj_minh, obj_minw, obj_minh);
+ }
+
+ _scroller_sizing_eval(obj, pd, EINA_SIZE2D(obj_minw, obj_minh), EINA_SIZE2D(scr_minw, scr_minh));
+}
+
+EOLIAN static void
+_efl_ui_popup_alert_scroll_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd)
+{
+ if (pd->needs_size_calc) return;
+ pd->needs_size_calc = EINA_TRUE;
+
+ evas_object_smart_changed(obj);
+}
+
+EOLIAN static void
+_efl_ui_popup_alert_scroll_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd)
+{
+ if (pd->needs_size_calc)
+ {
+ _sizing_eval(obj, pd);
- elm_coords_finger_size_adjust(1, &minw, 1, &minh);
- edje_object_size_min_restricted_calc
- (wd->resize_obj, &minw, &minh, minw, minh);
- efl_gfx_size_hint_min_set(obj, EINA_SIZE2D(minw, minh));
+ pd->needs_size_calc = EINA_FALSE;
+ }
}
static Eina_Bool
@@ -91,6 +212,48 @@ _efl_ui_popup_alert_scroll_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Scro
return efl_text_get(efl_part(efl_super(obj, MY_CLASS), part));
}
+static void
+_efl_ui_popup_alert_scroll_expandable_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Scroll_Data *pd, Eina_Size2D max_size)
+{
+ Eina_Bool valid_max_w = EINA_FALSE;
+ Eina_Bool valid_max_h = EINA_FALSE;
+
+ if ((max_size.w == -1) || (max_size.w >= 0))
+ valid_max_w = EINA_TRUE;
+
+ if ((max_size.h == -1) || (max_size.h >= 0))
+ valid_max_h = EINA_TRUE;
+
+ if (!valid_max_w || !valid_max_h)
+ {
+ ERR("Invalid max size(%d, %d)!"
+ "The max size should be equal to or bigger than 0. "
+ "To disable expandable property, set -1 to the max size.",
+ max_size.w, max_size.h);
+ return;
+ }
+
+ pd->max_size = max_size;
+
+ elm_layout_sizing_eval(obj);
+}
+
+static Eina_Size2D
+_efl_ui_popup_alert_scroll_expandable_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Scroll_Data *pd)
+{
+ return pd->max_size;
+}
+
+EOLIAN static void
+_efl_ui_popup_alert_scroll_efl_ui_popup_popup_size_set(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd, Eina_Size2D size)
+{
+ pd->size = size;
+
+ efl_gfx_size_set(obj, size);
+
+ elm_layout_sizing_eval(obj);
+}
+
EOLIAN static Eo *
_efl_ui_popup_alert_scroll_efl_object_constructor(Eo *obj,
Efl_Ui_Popup_Alert_Scroll_Data *pd)
@@ -114,6 +277,10 @@ _efl_ui_popup_alert_scroll_efl_object_constructor(Eo *obj,
efl_content_set(efl_part(efl_super(obj, MY_CLASS), "elm.swallow.content"),
pd->scroller);
+ pd->size = EINA_SIZE2D(0, 0);
+ pd->max_size = EINA_SIZE2D(-1, -1);
+ pd->needs_size_calc = EINA_FALSE;
+
return obj;
}
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 @@
+import eina_types;
+
class Efl.Ui.Popup_Alert_Scroll(Efl.Ui.Popup_Alert)
{
+ methods {
+ @property expandable {
+ set {
+ [[Set the expandable max size of popup.
+
+ If the given max_size is -1, then popup appears with its size.
+ 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.
+ ]]
+ }
+ get {
+ [[Get the expandable max size of popup.
+
+ If the given max_size is -1, then popup appears with its size.
+ 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.
+ ]]
+ }
+ values {
+ max_size: Eina.Size2D; [[A 2D max size in pixel units.]]
+ }
+ }
+ }
implements {
Efl.Object.constructor;
+ Efl.Canvas.Group.group_calculate;
Efl.Part.part;
+ Efl.Ui.Popup.popup_size { set;}
}
}
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 @@
typedef struct _Efl_Ui_Popup_Alert_Scroll_Data Efl_Ui_Popup_Alert_Scroll_Data;
struct _Efl_Ui_Popup_Alert_Scroll_Data
{
- Eo *scroller;
- Eo *content;
+ Eo *scroller;
+ Eo *content;
+ Eina_Size2D size;
+ Eina_Size2D max_size;
+ Eina_Bool needs_size_calc : 1;
};
#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
Efl_Ui_Popup_Align align;
Ecore_Timer *timer;
double timeout;
+ Eina_Bool needs_size_calc : 1;
};
#endif