efl_ui/popup: remove 'expandable' property from popup subclasses

this is more or less just the max size hint, so just set the max size
hint

ref T7902

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9550
This commit is contained in:
Mike Blumenkrantz 2019-08-09 15:11:15 -04:00 committed by Cedric BAIL
parent 0c72d430c3
commit 144d086fd7
8 changed files with 32 additions and 134 deletions

View File

@ -428,7 +428,7 @@ _alert_scroll_case2_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
//This is beta API for now. So EFL_UI_SCROLL_ALERT_POPUP_BETA should be defined.
efl_ui_scroll_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(320, -1));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(320, -1));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160));
efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL);
@ -454,7 +454,7 @@ _alert_scroll_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
//This is beta API for now. So EFL_UI_SCROLL_ALERT_POPUP_BETA should be defined.
efl_ui_scroll_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 320));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(-1, 320));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160));
efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL);
@ -480,7 +480,7 @@ _alert_scroll_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
//This is beta API for now. So EFL_UI_SCROLL_ALERT_POPUP_BETA should be defined.
efl_ui_scroll_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(320, 320));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(320, 320));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160));
efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL);
@ -506,7 +506,7 @@ _alert_scroll_case5_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
//This is beta API for now. So EFL_UI_SCROLL_ALERT_POPUP_BETA should be defined.
efl_ui_scroll_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(80, 80));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(80, 80));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(160, 160));
efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_alert_popup_clicked_cb, NULL);
@ -619,7 +619,7 @@ _alert_text_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED)
Eo *efl_ui_popup= efl_add(EFL_UI_TEXT_ALERT_POPUP_CLASS, win);
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200));
efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, 300));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(300, 300));
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
efl_text_set(efl_ui_popup, "This is Text Popup");
@ -646,7 +646,7 @@ _alert_text_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL);
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, -1));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(300, -1));
efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL);
}
@ -664,7 +664,7 @@ _alert_text_case5_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL);
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 300));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(-1, 300));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200));
efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL);
@ -686,7 +686,7 @@ _alert_text_case6_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL);
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, 300));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(300, 300));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200));
@ -713,7 +713,7 @@ _alert_text_case7_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL);
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, -1));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(300, -1));
efl_event_callback_add(efl_ui_popup, EFL_UI_ALERT_POPUP_EVENT_BUTTON_CLICKED, efl_ui_text_alert_popup_clicked_cb, NULL);
@ -736,7 +736,7 @@ _alert_text_case8_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL);
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 300));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(-1, 300));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200));
@ -761,7 +761,7 @@ _alert_text_case9_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL);
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(10, 10));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(10, 10));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200));
@ -786,7 +786,7 @@ _alert_text_case10_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL);
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(150, 150));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(150, 150));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200));
@ -811,7 +811,7 @@ _alert_text_case11_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL);
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(150, -1));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(150, -1));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200));
@ -836,7 +836,7 @@ _alert_text_case12_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL);
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(300, -1));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(300, -1));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200));
@ -861,7 +861,7 @@ _alert_text_case13_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL);
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 150));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(-1, 150));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200));
@ -886,7 +886,7 @@ _alert_text_case14_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_NEGATIVE, "No", NULL);
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_USER, "Cancel", NULL);
efl_ui_text_alert_popup_expandable_set(efl_ui_popup, EINA_SIZE2D(-1, 300));
efl_gfx_hint_size_max_set(efl_ui_popup, EINA_SIZE2D(-1, 300));
efl_gfx_hint_size_min_set(efl_ui_popup, EINA_SIZE2D(200, 200));

View File

@ -20,13 +20,12 @@ _scroller_sizing_eval(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd,
Eina_Size2D obj_min, Eina_Size2D scr_min)
{
Eina_Size2D max_size, min_size;
max_size.w = -1;
max_size.h = -1;
max_size = efl_gfx_hint_size_max_get(obj);
if (pd->max_size.w != -1)
max_size.w = (obj_min.w > pd->max_size.w) ? obj_min.w : pd->max_size.w;
if (pd->max_size.h != -1)
max_size.h = (obj_min.h > pd->max_size.h) ? obj_min.h : pd->max_size.h;
if (max_size.w != -1)
max_size.w = (obj_min.w > max_size.w) ? obj_min.w : max_size.w;
if (max_size.h != -1)
max_size.h = (obj_min.h > max_size.h) ? obj_min.h : max_size.h;
min_size = efl_gfx_hint_size_min_get(obj);
@ -216,38 +215,6 @@ _efl_ui_scroll_alert_popup_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Scroll_Alert_Pop
return efl_text_get(efl_part(efl_super(obj, MY_CLASS), part));
}
static void
_efl_ui_scroll_alert_popup_expandable_set(Eo *obj EINA_UNUSED, Efl_Ui_Scroll_Alert_Popup_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;
efl_canvas_group_change(obj);
}
static Eina_Size2D
_efl_ui_scroll_alert_popup_expandable_get(const Eo *obj EINA_UNUSED, Efl_Ui_Scroll_Alert_Popup_Data *pd)
{
return pd->max_size;
}
EOLIAN static Eo *
_efl_ui_scroll_alert_popup_efl_object_constructor(Eo *obj,
Efl_Ui_Scroll_Alert_Popup_Data *pd)
@ -267,8 +234,6 @@ _efl_ui_scroll_alert_popup_efl_object_constructor(Eo *obj,
efl_content_set(efl_part(efl_super(obj, MY_CLASS), "efl.content"),
pd->scroller);
pd->max_size = EINA_SIZE2D(-1, -1);
return obj;
}

View File

@ -3,27 +3,6 @@ import eina_types;
class @beta Efl.Ui.Scroll_Alert_Popup extends Efl.Ui.Alert_Popup
{
[[EFL UI Scroll Alert Popup class]]
methods {
@property expandable @beta {
set {
[[Set the expandable max size of popup.
If the given max_size is -1, then a popup appears with its size.
However, if the given max_size is bigger than 0 the popup size is up to the given max_size. If popup content's min size is bigger than the given max_size the 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 the popup size is up to the given max_size. If popup content's min size is bigger than the given max_size the 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;

View File

@ -8,8 +8,6 @@ struct _Efl_Ui_Scroll_Alert_Popup_Data
{
Eo *scroller;
Eo *content;
Eina_Size2D size;
Eina_Size2D max_size;
};
#endif

View File

@ -21,13 +21,13 @@ static void
_scroller_sizing_eval(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd, Eina_Size2D obj_min, Eina_Size2D text_min)
{
Eina_Size2D max_size, min_size;
max_size.w = -1;
max_size.h = -1;
if (pd->max_size.w != -1)
max_size.w = (obj_min.w > pd->max_size.w) ? obj_min.w : pd->max_size.w;
if (pd->max_size.h != -1)
max_size.h = (obj_min.h > pd->max_size.h) ? obj_min.h : pd->max_size.h;
max_size = efl_gfx_hint_size_max_get(obj);
if (max_size.w != -1)
max_size.w = (obj_min.w > max_size.w) ? obj_min.w : max_size.w;
if (max_size.h != -1)
max_size.h = (obj_min.h > max_size.h) ? obj_min.h : max_size.h;
min_size = efl_gfx_hint_size_min_get(obj);
@ -231,32 +231,6 @@ _efl_ui_text_alert_popup_efl_text_text_get(const Eo *obj, Efl_Ui_Text_Alert_Popu
return _efl_ui_text_alert_popup_text_get(obj, pd, "efl.text");
}
static void
_efl_ui_text_alert_popup_expandable_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Alert_Popup_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;
efl_canvas_group_change(obj);
}
EOLIAN static Eo *
_efl_ui_text_alert_popup_efl_object_constructor(Eo *obj,
Efl_Ui_Text_Alert_Popup_Data *pd)
@ -276,8 +250,6 @@ _efl_ui_text_alert_popup_efl_object_constructor(Eo *obj,
efl_content_set(efl_part(efl_super(obj, MY_CLASS), "efl.content"),
pd->scroller);
pd->max_size = EINA_SIZE2D(-1, -1);
return obj;
}

View File

@ -3,21 +3,6 @@ import eina_types;
class @beta Efl.Ui.Text_Alert_Popup extends Efl.Ui.Alert_Popup implements Efl.Text
{
[[EFL UI Text Alert Popup class]]
methods {
@property expandable {
set {
[[Set the expandable of popup.
If the contents of the popup has min size, the popup will be increased by min size along the Y axis.
If max hint is set it will be increased to the value of max hint
and scrolling will occur.
]]
}
values {
max_size: Eina.Size2D; [[A 2D max size in pixel units.]]
}
}
}
implements {
Efl.Object.constructor;
Efl.Canvas.Group.group_calculate;

View File

@ -8,7 +8,6 @@ struct _Efl_Ui_Text_Alert_Popup_Data
{
Eo *scroller;
Eo *message;
Eina_Size2D max_size;
};
#endif

View File

@ -332,7 +332,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert_expand)
popup_sz_min = popup_sz_min1 = efl_gfx_hint_size_combined_min_get(popup);
/* first test horizontal expand */
efl_ui_scroll_alert_popup_expandable_set(popup, EINA_SIZE2D(POPUP_SIZE_EXPAND, -1));
efl_gfx_hint_size_max_set(popup, EINA_SIZE2D(POPUP_SIZE_EXPAND, -1));
efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE));
efl_canvas_group_calculate(popup);
@ -358,7 +358,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert_expand)
}
/* now expand vertically */
efl_ui_scroll_alert_popup_expandable_set(popup, EINA_SIZE2D(-1, POPUP_SIZE_EXPAND));
efl_gfx_hint_size_max_set(popup, EINA_SIZE2D(-1, POPUP_SIZE_EXPAND));
efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE));
efl_canvas_group_calculate(popup);
@ -385,7 +385,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert_expand)
}
/* now both */
efl_ui_scroll_alert_popup_expandable_set(popup, EINA_SIZE2D(POPUP_SIZE_EXPAND, POPUP_SIZE_EXPAND));
efl_gfx_hint_size_max_set(popup, EINA_SIZE2D(POPUP_SIZE_EXPAND, POPUP_SIZE_EXPAND));
efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE));
efl_canvas_group_calculate(popup);
@ -417,7 +417,7 @@ EFL_START_TEST(efl_ui_test_popup_scroll_alert_expand)
}
/* now use a confining expand which ignores content min size */
efl_ui_scroll_alert_popup_expandable_set(popup, EINA_SIZE2D(POPUP_SIZE / 2, POPUP_SIZE / 2));
efl_gfx_hint_size_max_set(popup, EINA_SIZE2D(POPUP_SIZE / 2, POPUP_SIZE / 2));
efl_gfx_hint_size_min_set(popup, EINA_SIZE2D(POPUP_SIZE, POPUP_SIZE));
efl_canvas_group_calculate(popup);
@ -511,7 +511,7 @@ EFL_START_TEST(efl_ui_test_popup_text_alert)
eina_strbuf_append(buf, test_string);
efl_text_set(popup, eina_strbuf_string_get(buf));
efl_ui_text_alert_popup_expandable_set(popup, test_expands[i]);
efl_gfx_hint_size_max_set(popup, test_expands[i]);
efl_canvas_group_calculate(popup);
/* get internal label object: VERY illegal */