aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-26 16:46:58 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-30 20:45:44 +0200
commit67e4f21c88ac5b3ab2185b5d13e10bac055a4c31 (patch)
tree98459fa26f1be7bae49808cee36ce9d3621e966d
parentefl_ui_pager: provide a pack( implementation (diff)
downloadefl-67e4f21c88ac5b3ab2185b5d13e10bac055a4c31.tar.gz
efl_ui_pager: refactor registering function for pager
this is a starting point for further function additions. this is esp. usefull since a few functions need to be executed to every added object. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D8740
-rw-r--r--src/lib/elementary/efl_ui_pager.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/elementary/efl_ui_pager.c b/src/lib/elementary/efl_ui_pager.c
index b386a034be..e5856a88ba 100644
--- a/src/lib/elementary/efl_ui_pager.c
+++ b/src/lib/elementary/efl_ui_pager.c
@@ -398,11 +398,21 @@ _efl_ui_pager_efl_container_content_count(Eo *obj EINA_UNUSED,
return pd->cnt;
}
+static Eina_Bool
+_register_child(Eo *obj EINA_UNUSED, Efl_Ui_Pager_Data *pd, Efl_Gfx_Entity *subobj)
+{
+ if (!pd->transition)
+ efl_canvas_object_clipper_set(subobj, pd->backclip);
+
+ return EINA_TRUE;
+}
+
EOLIAN static Eina_Bool
_efl_ui_pager_efl_pack_linear_pack_begin(Eo *obj EINA_UNUSED,
Efl_Ui_Pager_Data *pd,
Efl_Gfx_Entity *subobj)
{
+ if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
pd->content_list = eina_list_prepend(pd->content_list, subobj);
pd->cnt++;
@@ -414,7 +424,6 @@ _efl_ui_pager_efl_pack_linear_pack_begin(Eo *obj EINA_UNUSED,
{
if (pd->cnt == 1)
efl_pack(pd->page_box, subobj);
- else efl_canvas_object_clipper_set(subobj, pd->backclip);
}
if (pd->indicator)
@@ -428,6 +437,7 @@ _efl_ui_pager_efl_pack_linear_pack_end(Eo *obj EINA_UNUSED,
Efl_Ui_Pager_Data *pd,
Efl_Gfx_Entity *subobj)
{
+ if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
pd->content_list = eina_list_append(pd->content_list, subobj);
pd->cnt++;
@@ -439,7 +449,6 @@ _efl_ui_pager_efl_pack_linear_pack_end(Eo *obj EINA_UNUSED,
{
if (pd->cnt == 1)
efl_pack(pd->page_box, subobj);
- else efl_canvas_object_clipper_set(subobj, pd->backclip);
}
if (pd->indicator)
@@ -454,6 +463,7 @@ _efl_ui_pager_efl_pack_linear_pack_before(Eo *obj EINA_UNUSED,
Efl_Gfx_Entity *subobj,
const Efl_Gfx_Entity *existing)
{
+ if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
int index = eina_list_data_idx(pd->content_list, (void *)existing);
if (index == -1) return EINA_FALSE;
@@ -464,7 +474,6 @@ _efl_ui_pager_efl_pack_linear_pack_before(Eo *obj EINA_UNUSED,
if (pd->transition)
efl_page_transition_pack(pd->transition, index);
- else efl_canvas_object_clipper_set(subobj, pd->backclip);
if (pd->indicator)
efl_page_indicator_pack(pd->indicator, index);
@@ -478,6 +487,7 @@ _efl_ui_pager_efl_pack_linear_pack_after(Eo *obj EINA_UNUSED,
Efl_Gfx_Entity *subobj,
const Efl_Gfx_Entity *existing)
{
+ if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
int index = eina_list_data_idx(pd->content_list, (void *)existing);
if (index == -1) return EINA_FALSE;
@@ -488,7 +498,6 @@ _efl_ui_pager_efl_pack_linear_pack_after(Eo *obj EINA_UNUSED,
if (pd->transition)
efl_page_transition_pack(pd->transition, (index + 1));
- else efl_canvas_object_clipper_set(subobj, pd->backclip);
if (pd->indicator)
efl_page_indicator_pack(pd->indicator, (index + 1));
@@ -514,6 +523,7 @@ _efl_ui_pager_efl_pack_linear_pack_at(Eo *obj,
{
Efl_Gfx_Entity *existing = NULL;
+ if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
existing = eina_list_nth(pd->content_list, index);
pd->content_list = eina_list_prepend_relative(
pd->content_list, subobj, existing);
@@ -523,7 +533,6 @@ _efl_ui_pager_efl_pack_linear_pack_at(Eo *obj,
if (pd->transition)
efl_page_transition_pack(pd->transition, index);
- else efl_canvas_object_clipper_set(subobj, pd->backclip);
if (pd->indicator)
efl_page_indicator_pack(pd->indicator, index);