summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaeun Choi <jaeun12.choi@samsung.com>2018-04-23 15:40:52 +0900
committerJaeun Choi <jaeun12.choi@samsung.com>2018-04-23 16:28:41 +0900
commit0be50771b7afccc5d316cbbcd2622c06403b0e20 (patch)
treef1b4de68cbfa095d93900eba2fbc12cf5b4e7bd1
parent7a123b0da5d5ec2582b1602f94d6d38eb523e1f8 (diff)
downloadefl-0be50771b7afccc5d316cbbcd2622c06403b0e20.tar.gz
efl_ui_pager: change efl_page_indicator's parameter type
-rw-r--r--src/lib/elementary/efl_page_indicator.c21
-rw-r--r--src/lib/elementary/efl_page_indicator.eo10
-rw-r--r--src/lib/elementary/efl_page_indicator.h1
-rw-r--r--src/lib/elementary/efl_page_indicator_icon.c66
-rw-r--r--src/lib/elementary/efl_page_indicator_icon.eo2
-rw-r--r--src/lib/elementary/efl_ui_pager.c19
-rw-r--r--src/lib/elementary/efl_ui_pager.eo2
7 files changed, 72 insertions, 49 deletions
diff --git a/src/lib/elementary/efl_page_indicator.c b/src/lib/elementary/efl_page_indicator.c
index 7f5456af11..86ea8511e5 100644
--- a/src/lib/elementary/efl_page_indicator.c
+++ b/src/lib/elementary/efl_page_indicator.c
@@ -25,26 +25,25 @@ _efl_page_indicator_pack(Eo *obj EINA_UNUSED,
Efl_Page_Indicator_Data *pd,
int index EINA_UNUSED)
{
- ERR("called");
pd->cnt++;
}
-EOLIAN static Eo *
-_efl_page_indicator_efl_object_constructor(Eo *obj,
- Efl_Page_Indicator_Data *pd)
+EOLIAN static void
+_efl_page_indicator_bind(Eo *obj EINA_UNUSED,
+ Efl_Page_Indicator_Data *pd,
+ Eo *pager,
+ Efl_Canvas_Group *idbox)
{
- obj = efl_constructor(efl_super(obj, MY_CLASS));
+ if (pd->pager.obj == pager) return;
- pd->idbox = efl_parent_get(obj);
- pd->pager.obj = efl_parent_get(pd->idbox);
+ pd->pager.obj = pager;
+ pd->idbox = idbox;
- pd->cnt = efl_content_count(pd->pager.obj);
-
- return obj;
+ if (pager)
+ pd->cnt = efl_content_count(pd->pager.obj);
}
-
EOAPI EFL_VOID_FUNC_BODYV(efl_page_indicator_update,
EFL_FUNC_CALL(pos), double pos)
EOAPI EFL_VOID_FUNC_BODYV(efl_page_indicator_pack,
diff --git a/src/lib/elementary/efl_page_indicator.eo b/src/lib/elementary/efl_page_indicator.eo
index e4f206ae74..110c4be072 100644
--- a/src/lib/elementary/efl_page_indicator.eo
+++ b/src/lib/elementary/efl_page_indicator.eo
@@ -6,7 +6,13 @@ class Efl.Page.Indicator (Efl.Object)
It is located on the top layer of pager widget and helps users to know
the number of pages and the current page's index without scrolling.
]]
- implements {
- Efl.Object.constructor;
+ methods {
+ bind {
+ [[set object]]
+ params {
+ @in pager: Efl.Ui.Pager; [[pager object]]
+ @in group: Efl.Canvas.Group; [[a dummy object for layer adjustment]]
+ }
+ }
}
}
diff --git a/src/lib/elementary/efl_page_indicator.h b/src/lib/elementary/efl_page_indicator.h
index 430dc47cfd..42dc88651d 100644
--- a/src/lib/elementary/efl_page_indicator.h
+++ b/src/lib/elementary/efl_page_indicator.h
@@ -7,6 +7,7 @@ struct _Efl_Page_Indicator_Data
{
struct {
Efl_Object *obj;
+ Efl_Object *group;
Evas_Coord x, y, w, h;
} pager;
diff --git a/src/lib/elementary/efl_page_indicator_icon.c b/src/lib/elementary/efl_page_indicator_icon.c
index d3d28b7d9b..9b9f02c78b 100644
--- a/src/lib/elementary/efl_page_indicator_icon.c
+++ b/src/lib/elementary/efl_page_indicator_icon.c
@@ -79,45 +79,55 @@ _efl_page_indicator_icon_pack(Eo *obj,
}
}
-EOLIAN static Eo *
-_efl_page_indicator_icon_efl_object_constructor(Eo *obj,
- Efl_Page_Indicator_Icon_Data *pd)
+EOLIAN static void
+_efl_page_indicator_icon_efl_page_indicator_bind(Eo *obj,
+ Efl_Page_Indicator_Icon_Data *pd,
+ Eo *pager,
+ Efl_Canvas_Group *idbox)
{
- ERR("call");
EFL_PAGE_INDICATOR_DATA_GET(obj, spd);
Eo *item;
int i, page;
- obj = efl_constructor(efl_super(obj, MY_CLASS));
-
- efl_ui_direction_set(spd->idbox, EFL_UI_DIR_HORIZONTAL);
- efl_pack_padding_set(spd->idbox, 15, 15, EINA_TRUE);
-
- pd->v = eina_value_float_new(0.0);
-
- if (spd->cnt != 0)
+ if (spd->pager.obj)
{
- for (i = 0; i < spd->cnt; i++)
+ EINA_LIST_FREE(pd->items, item)
{
- item = efl_add(EFL_CANVAS_LAYOUT_CLASS, spd->idbox);
- pd->items = eina_list_append(pd->items, item);
-
- elm_widget_theme_object_set(spd->idbox, item,
- "pager", "indicator", "default");
- efl_gfx_size_hint_align_set(item, 0.5, 0.5);
- efl_gfx_size_hint_weight_set(item, 0, 0);
- efl_pack_end(spd->idbox, item);
+ efl_del(item);
}
+ }
- page = efl_ui_pager_current_page_get(spd->pager.obj);
- item = eina_list_nth(pd->items, page);
- eina_value_set(pd->v, 1.0);
- efl_layout_signal_message_send(item, 1, *(pd->v));
+ efl_page_indicator_bind(efl_super(obj, MY_CLASS), pager, idbox);
- pd->curr = item;
- }
+ if (spd->pager.obj)
+ {
+ efl_ui_direction_set(spd->idbox, EFL_UI_DIR_HORIZONTAL);
+ efl_pack_padding_set(spd->idbox, 15, 15, EINA_TRUE);
+
+ pd->v = eina_value_float_new(0.0);
- return obj;
+ if (spd->cnt != 0)
+ {
+ for (i = 0; i < spd->cnt; i++)
+ {
+ item = efl_add(EFL_CANVAS_LAYOUT_CLASS, spd->idbox);
+ pd->items = eina_list_append(pd->items, item);
+
+ elm_widget_theme_object_set(spd->idbox, item,
+ "pager", "indicator", "default");
+ efl_gfx_size_hint_align_set(item, 0.5, 0.5);
+ efl_gfx_size_hint_weight_set(item, 0, 0);
+ efl_pack_end(spd->idbox, item);
+ }
+
+ page = efl_ui_pager_current_page_get(spd->pager.obj);
+ item = eina_list_nth(pd->items, page);
+ eina_value_set(pd->v, 1.0);
+ efl_layout_signal_message_send(item, 1, *(pd->v));
+
+ pd->curr = item;
+ }
+ }
}
EOLIAN static void
diff --git a/src/lib/elementary/efl_page_indicator_icon.eo b/src/lib/elementary/efl_page_indicator_icon.eo
index e40a6be310..d837072c7e 100644
--- a/src/lib/elementary/efl_page_indicator_icon.eo
+++ b/src/lib/elementary/efl_page_indicator_icon.eo
@@ -7,7 +7,7 @@ class Efl.Page.Indicator.Icon (Efl.Page.Indicator)
arrange them in a linear order. An icon has two states: default and selected.
]]
implements {
- Efl.Object.constructor;
Efl.Object.invalidate;
+ Efl.Page.Indicator.bind;
}
}
diff --git a/src/lib/elementary/efl_ui_pager.c b/src/lib/elementary/efl_ui_pager.c
index 6677d63051..03fe1f3ff3 100644
--- a/src/lib/elementary/efl_ui_pager.c
+++ b/src/lib/elementary/efl_ui_pager.c
@@ -673,18 +673,25 @@ _efl_ui_pager_transition_set(Eo *obj,
EOLIAN static void
_efl_ui_pager_indicator_set(Eo *obj EINA_UNUSED,
Efl_Ui_Pager_Data *pd,
- const Efl_Class *klass)
+ Efl_Page_Indicator *indicator)
{
+ if (pd->indicator == indicator) return;
+
if (pd->indicator)
{
- efl_del(pd->indicator);
+ efl_page_indicator_bind(pd->indicator, NULL, NULL);
pd->indicator = NULL;
}
- if (!klass)
+ pd->indicator = indicator;
+
+ if (!pd->indicator)
{
- efl_del(pd->idbox);
- pd->idbox = NULL;
+ if (pd->idbox)
+ {
+ efl_del(pd->idbox);
+ pd->idbox = NULL;
+ }
return;
}
@@ -694,7 +701,7 @@ _efl_ui_pager_indicator_set(Eo *obj EINA_UNUSED,
efl_content_set(efl_part(obj, "indicator"), pd->idbox);
}
- pd->indicator = efl_add(klass, pd->idbox);
+ efl_page_indicator_bind(pd->indicator, obj, pd->idbox);
}
EOLIAN Eina_Size2D
diff --git a/src/lib/elementary/efl_ui_pager.eo b/src/lib/elementary/efl_ui_pager.eo
index 359aba2114..86c5b63a5a 100644
--- a/src/lib/elementary/efl_ui_pager.eo
+++ b/src/lib/elementary/efl_ui_pager.eo
@@ -40,7 +40,7 @@ class Efl.Ui.Pager (Efl.Ui.Layout, Efl.Pack.Linear)
[[Set a page indicator]]
}
values {
- klass: const(Efl.Class) @nullable; [[indicator class]]
+ indicator: Efl.Page.Indicator @nullable; [[indicator class]]
}
}
@property current_page {