forked from enlightenment/efl
efl_ui/popup: remove scroll_alert class
this can now be done by simply calling efl_ui_widget_scrollable_content_set on an alert popup tests have been adjusted for this Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9675
This commit is contained in:
parent
1a517b4c2d
commit
9d8735caf7
|
@ -389,7 +389,7 @@ _alert_scroll_case1_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
Eo *win = data;
|
Eo *win = data;
|
||||||
Eo *efl_ui_popup= efl_add(EFL_UI_SCROLL_ALERT_POPUP_CLASS, win);
|
Eo *efl_ui_popup= efl_add(EFL_UI_ALERT_POPUP_CLASS, win);
|
||||||
|
|
||||||
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
|
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ _alert_scroll_case1_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
|
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
|
||||||
efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content");
|
efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content");
|
||||||
|
|
||||||
efl_content_set(efl_ui_popup, layout);
|
efl_ui_widget_scrollable_content_set(efl_ui_popup, layout);
|
||||||
|
|
||||||
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_POSITIVE, "Yes", NULL);
|
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_POSITIVE, "Yes", NULL);
|
||||||
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_NEGATIVE, "No", NULL);
|
||||||
|
@ -413,7 +413,7 @@ _alert_scroll_case2_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
Eo *win = data;
|
Eo *win = data;
|
||||||
Eo *efl_ui_popup= efl_add(EFL_UI_SCROLL_ALERT_POPUP_CLASS, win);
|
Eo *efl_ui_popup= efl_add(EFL_UI_ALERT_POPUP_CLASS, win);
|
||||||
|
|
||||||
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
|
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ _alert_scroll_case2_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
|
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
|
||||||
efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content");
|
efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content");
|
||||||
|
|
||||||
efl_content_set(efl_ui_popup, layout);
|
efl_ui_widget_scrollable_content_set(efl_ui_popup, layout);
|
||||||
|
|
||||||
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_POSITIVE, "Yes", NULL);
|
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_POSITIVE, "Yes", NULL);
|
||||||
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_NEGATIVE, "No", NULL);
|
||||||
|
@ -439,7 +439,7 @@ _alert_scroll_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
Eo *win = data;
|
Eo *win = data;
|
||||||
Eo *efl_ui_popup= efl_add(EFL_UI_SCROLL_ALERT_POPUP_CLASS, win);
|
Eo *efl_ui_popup= efl_add(EFL_UI_ALERT_POPUP_CLASS, win);
|
||||||
|
|
||||||
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
|
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ _alert_scroll_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
|
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
|
||||||
efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content");
|
efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content");
|
||||||
|
|
||||||
efl_content_set(efl_ui_popup, layout);
|
efl_ui_widget_scrollable_content_set(efl_ui_popup, layout);
|
||||||
|
|
||||||
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_POSITIVE, "Yes", NULL);
|
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_POSITIVE, "Yes", NULL);
|
||||||
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_NEGATIVE, "No", NULL);
|
||||||
|
@ -465,7 +465,7 @@ _alert_scroll_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
Eo *win = data;
|
Eo *win = data;
|
||||||
Eo *efl_ui_popup= efl_add(EFL_UI_SCROLL_ALERT_POPUP_CLASS, win);
|
Eo *efl_ui_popup= efl_add(EFL_UI_ALERT_POPUP_CLASS, win);
|
||||||
|
|
||||||
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
|
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
|
||||||
|
|
||||||
|
@ -473,7 +473,7 @@ _alert_scroll_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
|
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
|
||||||
efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content");
|
efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content");
|
||||||
|
|
||||||
efl_content_set(efl_ui_popup, layout);
|
efl_ui_widget_scrollable_content_set(efl_ui_popup, layout);
|
||||||
|
|
||||||
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_POSITIVE, "Yes", NULL);
|
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_POSITIVE, "Yes", NULL);
|
||||||
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_NEGATIVE, "No", NULL);
|
||||||
|
@ -491,7 +491,7 @@ _alert_scroll_case5_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
Eo *win = data;
|
Eo *win = data;
|
||||||
Eo *efl_ui_popup= efl_add(EFL_UI_SCROLL_ALERT_POPUP_CLASS, win);
|
Eo *efl_ui_popup= efl_add(EFL_UI_ALERT_POPUP_CLASS, win);
|
||||||
|
|
||||||
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
|
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ _alert_scroll_case5_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
|
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
|
||||||
efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content");
|
efl_file_simple_load(layout, buf, "efl_ui_popup_scroll_content");
|
||||||
|
|
||||||
efl_content_set(efl_ui_popup, layout);
|
efl_ui_widget_scrollable_content_set(efl_ui_popup, layout);
|
||||||
|
|
||||||
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_POSITIVE, "Yes", NULL);
|
efl_ui_alert_popup_button_set(efl_ui_popup, EFL_UI_ALERT_POPUP_BUTTON_POSITIVE, "Yes", NULL);
|
||||||
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_NEGATIVE, "No", NULL);
|
||||||
|
|
|
@ -268,7 +268,6 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
|
||||||
# include <efl_ui_multi_selectable.eo.h>
|
# include <efl_ui_multi_selectable.eo.h>
|
||||||
# include <efl_ui_popup.eo.h>
|
# include <efl_ui_popup.eo.h>
|
||||||
# include <efl_ui_alert_popup.eo.h>
|
# include <efl_ui_alert_popup.eo.h>
|
||||||
# include <efl_ui_scroll_alert_popup.eo.h>
|
|
||||||
# include <efl_ui_text_alert_popup.eo.h>
|
# include <efl_ui_text_alert_popup.eo.h>
|
||||||
# include <efl_ui_popup_part_backwall.eo.h>
|
# include <efl_ui_popup_part_backwall.eo.h>
|
||||||
# include <efl_ui_grid.eo.h>
|
# include <efl_ui_grid.eo.h>
|
||||||
|
|
|
@ -311,7 +311,6 @@ typedef Eo Efl_Ui_Focus_Manager;
|
||||||
# include <efl_ui_text.eo.h>
|
# include <efl_ui_text.eo.h>
|
||||||
# include <efl_ui_popup.eo.h>
|
# include <efl_ui_popup.eo.h>
|
||||||
# include <efl_ui_alert_popup.eo.h>
|
# include <efl_ui_alert_popup.eo.h>
|
||||||
# include <efl_ui_scroll_alert_popup.eo.h>
|
|
||||||
# include <efl_ui_text_alert_popup.eo.h>
|
# include <efl_ui_text_alert_popup.eo.h>
|
||||||
# include <efl_ui_popup_part_backwall.eo.h>
|
# include <efl_ui_popup_part_backwall.eo.h>
|
||||||
# include <efl_ui_text_factory_images.eo.h>
|
# include <efl_ui_text_factory_images.eo.h>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#define EFL_PART_PROTECTED
|
#define EFL_PART_PROTECTED
|
||||||
#define EFL_UI_POPUP_PROTECTED
|
#define EFL_UI_POPUP_PROTECTED
|
||||||
#define EFL_PART_PROTECTED
|
#define EFL_PART_PROTECTED
|
||||||
|
#define EFL_UI_WIDGET_SCROLLABLE_CONTENT_PROTECTED
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
|
||||||
#include "elm_priv.h"
|
#include "elm_priv.h"
|
||||||
|
@ -479,6 +479,57 @@ _efl_ui_popup_timeout_get(const Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd)
|
||||||
return pd->timeout;
|
return pd->timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* this will ONLY be called during _sizing_eval() */
|
||||||
|
static void
|
||||||
|
_scrollable_content_size_cb(void *data EINA_UNUSED, const Efl_Event *ev)
|
||||||
|
{
|
||||||
|
Eina_Size2D *size = ev->info;
|
||||||
|
|
||||||
|
efl_gfx_entity_size_set(ev->object, *size);
|
||||||
|
/* finish group calc chain */
|
||||||
|
efl_canvas_group_calculate(efl_super(ev->object, EFL_UI_WIDGET_SCROLLABLE_CONTENT_MIXIN));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_sizing_eval(Eo *obj)
|
||||||
|
{
|
||||||
|
Eina_Size2D min;
|
||||||
|
|
||||||
|
/* trigger layout calc */
|
||||||
|
efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
|
||||||
|
if (efl_ui_widget_scrollable_content_did_group_calc_get(obj)) return;
|
||||||
|
min = efl_gfx_hint_size_combined_min_get(obj);
|
||||||
|
|
||||||
|
Eina_Size2D size = efl_gfx_entity_size_get(obj);
|
||||||
|
|
||||||
|
Eina_Size2D new_size;
|
||||||
|
new_size.w = (min.w > size.w ? min.w : size.w);
|
||||||
|
new_size.h = (min.h > size.h ? min.h : size.h);
|
||||||
|
efl_gfx_entity_size_set(obj, new_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Data *pd)
|
||||||
|
{
|
||||||
|
/* When efl_canvas_group_change() is called, just flag is set instead of size
|
||||||
|
* calculation.
|
||||||
|
* The actual size calculation is done here when the object is rendered to
|
||||||
|
* avoid duplicate size calculations. */
|
||||||
|
efl_canvas_group_need_recalculate_set(obj, EINA_FALSE);
|
||||||
|
pd->in_calc = EINA_TRUE;
|
||||||
|
_sizing_eval(obj);
|
||||||
|
pd->in_calc = EINA_FALSE;
|
||||||
|
if (pd->anchor)
|
||||||
|
_anchor_calc(obj);
|
||||||
|
else
|
||||||
|
_calc_align(obj);
|
||||||
|
|
||||||
|
Eina_Rect p_geom = efl_gfx_entity_geometry_get(pd->win_parent);
|
||||||
|
|
||||||
|
efl_gfx_entity_position_set(pd->backwall, EINA_POSITION2D(0, 0));
|
||||||
|
efl_gfx_entity_size_set(pd->backwall, EINA_SIZE2D(p_geom.w, p_geom.h));
|
||||||
|
}
|
||||||
|
|
||||||
EOLIAN static Eo *
|
EOLIAN static Eo *
|
||||||
_efl_ui_popup_efl_object_constructor(Eo *obj, Efl_Ui_Popup_Data *pd)
|
_efl_ui_popup_efl_object_constructor(Eo *obj, Efl_Ui_Popup_Data *pd)
|
||||||
{
|
{
|
||||||
|
@ -489,6 +540,7 @@ _efl_ui_popup_efl_object_constructor(Eo *obj, Efl_Ui_Popup_Data *pd)
|
||||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||||
efl_canvas_object_type_set(obj, MY_CLASS_NAME);
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME);
|
||||||
efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED, _hints_changed_cb, pd);
|
efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED, _hints_changed_cb, pd);
|
||||||
|
efl_event_callback_add(obj, EFL_UI_WIDGET_SCROLLABLE_CONTENT_EVENT_OPTIMAL_SIZE_CALC, _scrollable_content_size_cb, pd);
|
||||||
|
|
||||||
elm_widget_can_focus_set(obj, EINA_TRUE);
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
||||||
if (elm_widget_theme_object_set(obj, wd->resize_obj,
|
if (elm_widget_theme_object_set(obj, wd->resize_obj,
|
||||||
|
@ -529,48 +581,6 @@ _efl_ui_popup_efl_object_destructor(Eo *obj, Efl_Ui_Popup_Data *pd)
|
||||||
efl_destructor(efl_super(obj, MY_CLASS));
|
efl_destructor(efl_super(obj, MY_CLASS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_sizing_eval(Eo *obj)
|
|
||||||
{
|
|
||||||
Eina_Size2D min;
|
|
||||||
|
|
||||||
/* trigger layout calc */
|
|
||||||
efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
|
|
||||||
min = efl_gfx_hint_size_combined_min_get(obj);
|
|
||||||
|
|
||||||
Eina_Size2D size = efl_gfx_entity_size_get(obj);
|
|
||||||
|
|
||||||
Eina_Size2D new_size;
|
|
||||||
new_size.w = (min.w > size.w ? min.w : size.w);
|
|
||||||
new_size.h = (min.h > size.h ? min.h : size.h);
|
|
||||||
efl_gfx_entity_size_set(obj, new_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_ui_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Data *pd)
|
|
||||||
{
|
|
||||||
/* When efl_canvas_group_change() is called, just flag is set instead of size
|
|
||||||
* calculation.
|
|
||||||
* The actual size calculation is done here when the object is rendered to
|
|
||||||
* avoid duplicate size calculations. */
|
|
||||||
efl_canvas_group_need_recalculate_set(obj, EINA_FALSE);
|
|
||||||
if (!pd->in_calc)
|
|
||||||
{
|
|
||||||
pd->in_calc = EINA_TRUE;
|
|
||||||
_sizing_eval(obj);
|
|
||||||
pd->in_calc = EINA_FALSE;
|
|
||||||
}
|
|
||||||
if (pd->anchor)
|
|
||||||
_anchor_calc(obj);
|
|
||||||
else
|
|
||||||
_calc_align(obj);
|
|
||||||
|
|
||||||
Eina_Rect p_geom = efl_gfx_entity_geometry_get(pd->win_parent);
|
|
||||||
|
|
||||||
efl_gfx_entity_position_set(pd->backwall, EINA_POSITION2D(0, 0));
|
|
||||||
efl_gfx_entity_size_set(pd->backwall, EINA_SIZE2D(p_geom.w, p_geom.h));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Standard widget overrides */
|
/* Standard widget overrides */
|
||||||
|
|
||||||
ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_popup, Efl_Ui_Popup_Data)
|
ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_popup, Efl_Ui_Popup_Data)
|
||||||
|
|
|
@ -8,7 +8,7 @@ enum @beta Efl.Ui.Popup_Align {
|
||||||
bottom [[Popup aligned to bottom]]
|
bottom [[Popup aligned to bottom]]
|
||||||
}
|
}
|
||||||
|
|
||||||
class @beta Efl.Ui.Popup extends Efl.Ui.Layout_Base implements Efl.Content, Efl.Ui.Focus.Layer
|
class @beta Efl.Ui.Popup extends Efl.Ui.Layout_Base implements Efl.Content, Efl.Ui.Focus.Layer, Efl.Ui.Widget.Scrollable_Content
|
||||||
{
|
{
|
||||||
[[EFL UI popup class]]
|
[[EFL UI popup class]]
|
||||||
methods {
|
methods {
|
||||||
|
|
|
@ -1,257 +0,0 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "elementary_config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define EFL_PART_PROTECTED
|
|
||||||
|
|
||||||
#include <Elementary.h>
|
|
||||||
|
|
||||||
#include "elm_priv.h"
|
|
||||||
#include "efl_ui_popup_private.h"
|
|
||||||
#include "efl_ui_scroll_alert_popup_private.h"
|
|
||||||
#include "efl_ui_scroll_alert_popup_part.eo.h"
|
|
||||||
#include "elm_part_helper.h"
|
|
||||||
|
|
||||||
#define MY_CLASS EFL_UI_SCROLL_ALERT_POPUP_CLASS
|
|
||||||
#define MY_CLASS_NAME "Efl.Ui.Scroll_Alert_Popup"
|
|
||||||
|
|
||||||
static void
|
|
||||||
_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 = 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);
|
|
||||||
|
|
||||||
Eina_Size2D size;
|
|
||||||
size.w = (obj_min.w > min_size.w) ? obj_min.w : min_size.w;
|
|
||||||
size.h = (obj_min.h > min_size.h) ? obj_min.h : min_size.h;
|
|
||||||
|
|
||||||
Eina_Size2D new_min = obj_min;
|
|
||||||
|
|
||||||
if ((max_size.w == -1) && (max_size.h == -1))
|
|
||||||
{
|
|
||||||
efl_ui_scrollable_match_content_set(pd->scroller, EINA_FALSE, EINA_FALSE);
|
|
||||||
efl_gfx_entity_size_set(obj, size);
|
|
||||||
}
|
|
||||||
else if ((max_size.w == -1) && (max_size.h != -1))
|
|
||||||
{
|
|
||||||
if (max_size.h < scr_min.h)
|
|
||||||
{
|
|
||||||
efl_ui_scrollable_match_content_set(pd->scroller, EINA_FALSE, EINA_FALSE);
|
|
||||||
efl_gfx_entity_size_set(obj, EINA_SIZE2D(size.w, max_size.h));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
new_min.h = scr_min.h;
|
|
||||||
efl_ui_scrollable_match_content_set(pd->scroller, EINA_FALSE, EINA_TRUE);
|
|
||||||
efl_gfx_entity_size_set(obj, EINA_SIZE2D(size.w, scr_min.h));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((max_size.w != -1) && (max_size.h == -1))
|
|
||||||
{
|
|
||||||
if (max_size.w < scr_min.w)
|
|
||||||
{
|
|
||||||
efl_ui_scrollable_match_content_set(pd->scroller, EINA_FALSE, EINA_FALSE);
|
|
||||||
efl_gfx_entity_size_set(obj, EINA_SIZE2D(max_size.w, size.h));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
new_min.w = scr_min.w;
|
|
||||||
efl_ui_scrollable_match_content_set(pd->scroller, EINA_TRUE, EINA_FALSE);
|
|
||||||
efl_gfx_entity_size_set(obj, EINA_SIZE2D(scr_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 < scr_min.w)
|
|
||||||
{
|
|
||||||
new_size.w = max_size.w;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
min_limit_w = EINA_TRUE;
|
|
||||||
new_min.w = scr_min.w;
|
|
||||||
new_size.w = scr_min.w;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (max_size.h < scr_min.h)
|
|
||||||
{
|
|
||||||
new_size.h = max_size.h;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
min_limit_h = EINA_TRUE;
|
|
||||||
new_min.h = scr_min.h;
|
|
||||||
new_size.h = scr_min.h;
|
|
||||||
}
|
|
||||||
|
|
||||||
efl_ui_scrollable_match_content_set(pd->scroller, min_limit_w, min_limit_h);
|
|
||||||
efl_gfx_entity_size_set(obj, new_size);
|
|
||||||
}
|
|
||||||
efl_canvas_group_calculate(pd->scroller);
|
|
||||||
|
|
||||||
efl_gfx_hint_size_restricted_min_set(obj, new_min);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_sizing_eval(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd)
|
|
||||||
{
|
|
||||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
||||||
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
|
|
||||||
{
|
|
||||||
efl_ui_scrollable_match_content_set(pd->scroller, EINA_TRUE, EINA_TRUE);
|
|
||||||
efl_canvas_group_calculate(pd->scroller);
|
|
||||||
|
|
||||||
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
|
|
||||||
{
|
|
||||||
efl_ui_scrollable_match_content_set(pd->scroller, EINA_FALSE, EINA_FALSE);
|
|
||||||
efl_canvas_group_calculate(pd->scroller);
|
|
||||||
|
|
||||||
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_scroll_alert_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd)
|
|
||||||
{
|
|
||||||
EFL_UI_POPUP_DATA_GET_OR_RETURN(obj, ppd);
|
|
||||||
ppd->in_calc = EINA_TRUE;
|
|
||||||
|
|
||||||
_sizing_eval(obj, pd);
|
|
||||||
efl_canvas_group_need_recalculate_set(pd->scroller, EINA_FALSE);
|
|
||||||
efl_canvas_group_need_recalculate_set(obj, EINA_FALSE);
|
|
||||||
|
|
||||||
//Not to calculate size by super class
|
|
||||||
efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
|
|
||||||
ppd->in_calc = EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_efl_ui_scroll_alert_popup_content_set(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd, const char *part, Eo *content)
|
|
||||||
{
|
|
||||||
//For efl_content_set()
|
|
||||||
if (part && !strcmp(part, "efl.content"))
|
|
||||||
{
|
|
||||||
pd->content = content;
|
|
||||||
|
|
||||||
//Content should have expand propeties since the scroller is not layout layer
|
|
||||||
efl_gfx_hint_weight_set(pd->content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
||||||
efl_gfx_hint_fill_set(pd->content, EINA_TRUE, EINA_TRUE);
|
|
||||||
|
|
||||||
efl_content_set(pd->scroller, pd->content);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content);
|
|
||||||
}
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Eo *
|
|
||||||
_efl_ui_scroll_alert_popup_content_get(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd, const char *part)
|
|
||||||
{
|
|
||||||
//For efl_content_set()
|
|
||||||
if (part && !strcmp(part, "efl.content"))
|
|
||||||
return pd->content;
|
|
||||||
|
|
||||||
return efl_content_get(efl_part(efl_super(obj, MY_CLASS), part));
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eo *
|
|
||||||
_efl_ui_scroll_alert_popup_content_unset(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd, const char *part)
|
|
||||||
{
|
|
||||||
//For efl_content_set()
|
|
||||||
if (part && !strcmp(part, "efl.content"))
|
|
||||||
{
|
|
||||||
Eo *content = pd->content;
|
|
||||||
if (!content) return content;
|
|
||||||
|
|
||||||
pd->content = NULL;
|
|
||||||
|
|
||||||
return efl_content_unset(pd->scroller);
|
|
||||||
}
|
|
||||||
|
|
||||||
return efl_content_unset(efl_part(efl_super(obj, MY_CLASS), part));
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_efl_ui_scroll_alert_popup_text_set(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd EINA_UNUSED, const char *part, const char *label)
|
|
||||||
{
|
|
||||||
efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label);
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
_efl_ui_scroll_alert_popup_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Scroll_Alert_Popup_Data *pd EINA_UNUSED, const char *part)
|
|
||||||
{
|
|
||||||
return efl_text_get(efl_part(efl_super(obj, MY_CLASS), part));
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static Eo *
|
|
||||||
_efl_ui_scroll_alert_popup_efl_object_constructor(Eo *obj,
|
|
||||||
Efl_Ui_Scroll_Alert_Popup_Data *pd)
|
|
||||||
{
|
|
||||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
|
||||||
|
|
||||||
if (!elm_widget_theme_klass_get(obj))
|
|
||||||
elm_widget_theme_klass_set(obj, "scroll_alert_popup");
|
|
||||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
|
||||||
efl_canvas_object_type_set(obj, MY_CLASS_NAME);
|
|
||||||
|
|
||||||
pd->scroller = efl_add(EFL_UI_SCROLLER_CLASS, obj,
|
|
||||||
efl_ui_widget_style_set(efl_added, "popup/no_inset_shadow"),
|
|
||||||
efl_ui_scrollbar_bar_mode_set(efl_added, EFL_UI_SCROLLBAR_MODE_AUTO, EFL_UI_SCROLLBAR_MODE_AUTO));
|
|
||||||
|
|
||||||
efl_content_set(efl_part(efl_super(obj, MY_CLASS), "efl.content"),
|
|
||||||
pd->scroller);
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Efl.Part begin */
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_part_is_efl_ui_scroll_alert_popup_part(const Eo *obj EINA_UNUSED, const char *part)
|
|
||||||
{
|
|
||||||
//Use Efl.Ui.Widget's "background" and "shadow" parts
|
|
||||||
if (eina_streq(part, "background") || eina_streq(part, "shadow"))
|
|
||||||
return EINA_FALSE;
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ELM_PART_OVERRIDE_PARTIAL(efl_ui_scroll_alert_popup, EFL_UI_SCROLL_ALERT_POPUP, Efl_Ui_Scroll_Alert_Popup_Data, _part_is_efl_ui_scroll_alert_popup_part)
|
|
||||||
ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_scroll_alert_popup, EFL_UI_SCROLL_ALERT_POPUP, Efl_Ui_Scroll_Alert_Popup_Data)
|
|
||||||
ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_scroll_alert_popup, EFL_UI_SCROLL_ALERT_POPUP, Efl_Ui_Scroll_Alert_Popup_Data)
|
|
||||||
ELM_PART_OVERRIDE_CONTENT_UNSET(efl_ui_scroll_alert_popup, EFL_UI_SCROLL_ALERT_POPUP, Efl_Ui_Scroll_Alert_Popup_Data)
|
|
||||||
ELM_PART_OVERRIDE_TEXT_SET(efl_ui_scroll_alert_popup, EFL_UI_SCROLL_ALERT_POPUP, Efl_Ui_Scroll_Alert_Popup_Data)
|
|
||||||
ELM_PART_OVERRIDE_TEXT_GET(efl_ui_scroll_alert_popup, EFL_UI_SCROLL_ALERT_POPUP, Efl_Ui_Scroll_Alert_Popup_Data)
|
|
||||||
#include "efl_ui_scroll_alert_popup_part.eo.c"
|
|
||||||
|
|
||||||
/* Efl.Part end */
|
|
||||||
|
|
||||||
#include "efl_ui_scroll_alert_popup.eo.c"
|
|
|
@ -1,11 +0,0 @@
|
||||||
import eina_types;
|
|
||||||
|
|
||||||
class @beta Efl.Ui.Scroll_Alert_Popup extends Efl.Ui.Alert_Popup
|
|
||||||
{
|
|
||||||
[[EFL UI Scroll Alert Popup class]]
|
|
||||||
implements {
|
|
||||||
Efl.Object.constructor;
|
|
||||||
Efl.Canvas.Group.group_calculate;
|
|
||||||
Efl.Part.part_get;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
class @beta Efl.Ui.Scroll_Alert_Popup_Part extends Efl.Ui.Layout_Part implements Efl.Content, Efl.Text
|
|
||||||
{
|
|
||||||
[[Efl UI Scroll Alert Popup internal part class]]
|
|
||||||
data: null;
|
|
||||||
implements {
|
|
||||||
Efl.Content.content { get; set; }
|
|
||||||
Efl.Content.content_unset;
|
|
||||||
Efl.Text.text { set; get; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
#ifndef EFL_UI_SCROLL_ALERT_POPUP_H
|
|
||||||
#define EFL_UI_SCROLL_ALERT_POPUP_H
|
|
||||||
|
|
||||||
#include "Elementary.h"
|
|
||||||
|
|
||||||
typedef struct _Efl_Ui_Scroll_Alert_Popup_Data Efl_Ui_Scroll_Alert_Popup_Data;
|
|
||||||
struct _Efl_Ui_Scroll_Alert_Popup_Data
|
|
||||||
{
|
|
||||||
Eo *scroller;
|
|
||||||
Eo *content;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -84,8 +84,6 @@ pub_eo_files = [
|
||||||
'efl_ui_popup_part_backwall.eo',
|
'efl_ui_popup_part_backwall.eo',
|
||||||
'efl_ui_alert_popup.eo',
|
'efl_ui_alert_popup.eo',
|
||||||
'efl_ui_alert_popup_part.eo',
|
'efl_ui_alert_popup_part.eo',
|
||||||
'efl_ui_scroll_alert_popup.eo',
|
|
||||||
'efl_ui_scroll_alert_popup_part.eo',
|
|
||||||
'efl_ui_text_alert_popup.eo',
|
'efl_ui_text_alert_popup.eo',
|
||||||
'efl_ui_text_alert_popup_part.eo',
|
'efl_ui_text_alert_popup_part.eo',
|
||||||
'efl_ui_text_editable.eo',
|
'efl_ui_text_editable.eo',
|
||||||
|
@ -310,7 +308,6 @@ elementary_headers_unstable = [
|
||||||
'efl_ui_widget_image.h',
|
'efl_ui_widget_image.h',
|
||||||
'efl_ui_popup_private.h',
|
'efl_ui_popup_private.h',
|
||||||
'efl_ui_alert_popup_private.h',
|
'efl_ui_alert_popup_private.h',
|
||||||
'efl_ui_scroll_alert_popup_private.h',
|
|
||||||
'efl_ui_text_alert_popup_private.h',
|
'efl_ui_text_alert_popup_private.h',
|
||||||
'elm_widget_index.h',
|
'elm_widget_index.h',
|
||||||
'elm_widget_inwin.h',
|
'elm_widget_inwin.h',
|
||||||
|
@ -871,7 +868,6 @@ elementary_src = [
|
||||||
'efl_ui_box_private.h',
|
'efl_ui_box_private.h',
|
||||||
'efl_ui_popup.c',
|
'efl_ui_popup.c',
|
||||||
'efl_ui_alert_popup.c',
|
'efl_ui_alert_popup.c',
|
||||||
'efl_ui_scroll_alert_popup.c',
|
|
||||||
'efl_ui_text_alert_popup.c',
|
'efl_ui_text_alert_popup.c',
|
||||||
'efl_ui_table.c',
|
'efl_ui_table.c',
|
||||||
'efl_ui_table_static.c',
|
'efl_ui_table_static.c',
|
||||||
|
|
|
@ -47,14 +47,14 @@ static Eina_Size2D
|
||||||
_popup_scroll_alert_setup(Eo **popup_ret, Eo **layout_ret)
|
_popup_scroll_alert_setup(Eo **popup_ret, Eo **layout_ret)
|
||||||
{
|
{
|
||||||
Eina_Size2D layout_sz_min;
|
Eina_Size2D layout_sz_min;
|
||||||
Eo *popup = *popup_ret = _popup_alert_setup(EFL_UI_SCROLL_ALERT_POPUP_CLASS);
|
Eo *popup = *popup_ret = _popup_alert_setup(EFL_UI_ALERT_POPUP_CLASS);
|
||||||
Eo *layout = *layout_ret = _popup_layout_create(popup);
|
Eo *layout = *layout_ret = _popup_layout_create(popup);
|
||||||
|
|
||||||
/* should be 200x200 */
|
/* should be 200x200 */
|
||||||
layout_sz_min = efl_gfx_hint_size_combined_min_get(layout);
|
layout_sz_min = efl_gfx_hint_size_combined_min_get(layout);
|
||||||
efl_gfx_entity_size_set(layout, layout_sz_min);
|
efl_gfx_entity_size_set(layout, layout_sz_min);
|
||||||
|
|
||||||
efl_content_set(popup, layout);
|
efl_ui_widget_scrollable_content_set(popup, layout);
|
||||||
return layout_sz_min;
|
return layout_sz_min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue