summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-05-16 19:13:30 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-05-30 11:48:17 +0200
commitbdc63d57d527bf0fb1bd69b7006abae359776249 (patch)
tree5dea177ab8bc39f84c60988938f22740d5e6914a
parent79fe0121eec5772fca8771d19d3265ad6a7d3117 (diff)
efl_ui_tab_pager: migrate to active_view
This now migrates to active_view. When we get back to this widget for stabelization. This is only the first step for loosening efl.ui.pager so it can be removed. For now the API of efl_ui_tab_pager stayes the same. Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com> Differential Revision: https://phab.enlightenment.org/D8906
-rw-r--r--src/bin/elementary/test_ui_tab_pager.c50
-rw-r--r--src/lib/elementary/efl_ui_tab_pager.c7
-rw-r--r--src/lib/elementary/efl_ui_tab_pager.eo4
3 files changed, 34 insertions, 27 deletions
diff --git a/src/bin/elementary/test_ui_tab_pager.c b/src/bin/elementary/test_ui_tab_pager.c
index 00fd21f58d..0b70c86c12 100644
--- a/src/bin/elementary/test_ui_tab_pager.c
+++ b/src/bin/elementary/test_ui_tab_pager.c
@@ -151,18 +151,11 @@ test_ui_tab_pager(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
151 tp = efl_add(EFL_UI_TAB_PAGER_CLASS, layout, 151 tp = efl_add(EFL_UI_TAB_PAGER_CLASS, layout,
152 efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), 152 efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
153 efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_TRUE), 153 efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_TRUE),
154 efl_ui_pager_page_size_set(efl_added, EINA_SIZE2D(-1, -1)),
155 efl_ui_pager_padding_set(efl_added, 20),
156 efl_content_set(efl_part(layout, "tab_pager"), efl_added)); 154 efl_content_set(efl_part(layout, "tab_pager"), efl_added));
157 155
158 tb = efl_add(EFL_UI_TAB_BAR_CLASS, tp); 156 tb = efl_add(EFL_UI_TAB_BAR_CLASS, tp);
159 efl_ui_tab_pager_tab_bar_set(tp, tb); 157 efl_ui_tab_pager_tab_bar_set(tp, tb);
160 158
161/*
162 tran = efl_add(EFL_PAGE_TRANSITION_SCROLL_CLASS, tp)
163 efl_ui_pager_transition_set(tp, tran);
164*/
165
166 tab_label_count = 0; 159 tab_label_count = 0;
167 tab_icon_count = 0; 160 tab_icon_count = 0;
168 161
@@ -172,7 +165,7 @@ test_ui_tab_pager(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
172 efl_pack_end(tp, page); 165 efl_pack_end(tp, page);
173 } 166 }
174 167
175 efl_ui_pager_current_page_set(tp, 0); 168 efl_ui_active_view_active_index_set(tp, 0);
176 169
177 ad = (App_Data*)calloc(1, sizeof(App_Data)); 170 ad = (App_Data*)calloc(1, sizeof(App_Data));
178 ad->navi = navi; 171 ad->navi = navi;
@@ -206,7 +199,7 @@ static void
206_tab_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED) 199_tab_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
207{ 200{
208 Tab_Set_Data *tsd = data; 201 Tab_Set_Data *tsd = data;
209 efl_ui_pager_current_page_set(tsd->tab_pager, elm_spinner_value_get(tsd->spinner)); 202 efl_ui_active_view_active_index_set(tsd->tab_pager, elm_spinner_value_get(tsd->spinner));
210} 203}
211 204
212static void 205static void
@@ -237,7 +230,7 @@ _current_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
237 230
238 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, box, 231 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, box,
239 efl_ui_range_min_max_set(efl_added, 0, efl_content_count(tab_pager) - 1), 232 efl_ui_range_min_max_set(efl_added, 0, efl_content_count(tab_pager) - 1),
240 efl_ui_range_value_set(efl_added, efl_ui_pager_current_page_get(tab_pager)), 233 efl_ui_range_value_set(efl_added, efl_ui_active_view_active_index_get(tab_pager)),
241 efl_pack_end(box, efl_added)); 234 efl_pack_end(box, efl_added));
242 235
243 tsd->tab_pager = tab_pager; 236 tsd->tab_pager = tab_pager;
@@ -279,7 +272,7 @@ _pack_before_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
279 Eo *tab_page, *cur_tab_page; 272 Eo *tab_page, *cur_tab_page;
280 int index; 273 int index;
281 274
282 index = efl_ui_pager_current_page_get(tab_pager); 275 index = efl_ui_active_view_active_index_get(tab_pager);
283 cur_tab_page = efl_pack_content_get(tab_pager, index); 276 cur_tab_page = efl_pack_content_get(tab_pager, index);
284 277
285 tab_page = tab_page_add(tab_pager); 278 tab_page = tab_page_add(tab_pager);
@@ -294,7 +287,7 @@ _pack_after_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
294 Eo *tab_page, *cur_tab_page; 287 Eo *tab_page, *cur_tab_page;
295 int index; 288 int index;
296 289
297 index = efl_ui_pager_current_page_get(tab_pager); 290 index = efl_ui_active_view_active_index_get(tab_pager);
298 cur_tab_page = efl_pack_content_get(tab_pager, index); 291 cur_tab_page = efl_pack_content_get(tab_pager, index);
299 292
300 tab_page = tab_page_add(tab_pager); 293 tab_page = tab_page_add(tab_pager);
@@ -371,7 +364,7 @@ _pack_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
371 364
372 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box, 365 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box,
373 efl_ui_range_min_max_set(efl_added, 0, efl_content_count(tab_pager) - 1), 366 efl_ui_range_min_max_set(efl_added, 0, efl_content_count(tab_pager) - 1),
374 efl_ui_range_value_set(efl_added, efl_ui_pager_current_page_get(tab_pager)), 367 efl_ui_range_value_set(efl_added, efl_ui_active_view_active_index_get(tab_pager)),
375 efl_pack_end(in_box, efl_added)); 368 efl_pack_end(in_box, efl_added));
376 369
377 tsd->tab_pager = tab_pager; 370 tsd->tab_pager = tab_pager;
@@ -396,7 +389,7 @@ static void
396_unpack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED) 389_unpack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
397{ 390{
398 Eo *tab_pager = data; 391 Eo *tab_pager = data;
399 int index = efl_ui_pager_current_page_get(tab_pager); 392 int index = efl_ui_active_view_active_index_get(tab_pager);
400 Eo *tab_page = efl_pack_content_get(tab_pager, index); 393 Eo *tab_page = efl_pack_content_get(tab_pager, index);
401 efl_pack_unpack(tab_pager, tab_page); 394 efl_pack_unpack(tab_pager, tab_page);
402 efl_del(tab_page); 395 efl_del(tab_page);
@@ -471,7 +464,7 @@ _unpack_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
471 464
472 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box, 465 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box,
473 efl_ui_range_min_max_set(efl_added, 0, efl_content_count(tab_pager) - 1), 466 efl_ui_range_min_max_set(efl_added, 0, efl_content_count(tab_pager) - 1),
474 efl_ui_range_value_set(efl_added, efl_ui_pager_current_page_get(tab_pager)), 467 efl_ui_range_value_set(efl_added, efl_ui_active_view_active_index_get(tab_pager)),
475 efl_pack_end(in_box, efl_added)); 468 efl_pack_end(in_box, efl_added));
476 469
477 tsd->tab_pager = tab_pager; 470 tsd->tab_pager = tab_pager;
@@ -495,7 +488,7 @@ _change_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
495 char *label = NULL; 488 char *label = NULL;
496 char *icon = NULL; 489 char *icon = NULL;
497 int cur; 490 int cur;
498 cur = efl_ui_pager_current_page_get(tcd->tab_pager); 491 cur = efl_ui_active_view_active_index_get(tcd->tab_pager);
499 tab_page = efl_pack_content_get(tcd->tab_pager, cur); 492 tab_page = efl_pack_content_get(tcd->tab_pager, cur);
500 493
501 if (efl_ui_nstate_value_get(tcd->label_check)) 494 if (efl_ui_nstate_value_get(tcd->label_check))
@@ -561,16 +554,25 @@ _tab_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
561} 554}
562 555
563static void 556static void
564_tran_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED) 557_tran_set_btn_scroll_cb(void *data, const Efl_Event *ev EINA_UNUSED)
565{ 558{
566 Efl_Page_Transition *tran = efl_add(EFL_PAGE_TRANSITION_SCROLL_CLASS, data); 559 Efl_Ui_Active_View_View_Manager_Scroll *scroll = efl_new(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_SCROLL_CLASS);
567 efl_ui_pager_transition_set(data, tran); 560 efl_ui_active_view_manager_set(data, scroll);
561 efl_unref(scroll);
562}
563
564static void
565_tran_set_btn_stack_cb(void *data, const Efl_Event *ev EINA_UNUSED)
566{
567 Efl_Ui_Active_View_View_Manager_Scroll *stack = efl_new(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_STACK_CLASS);
568 efl_ui_active_view_manager_set(data, stack);
569 efl_unref(stack);
568} 570}
569 571
570static void 572static void
571_tran_unset_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED) 573_tran_unset_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
572{ 574{
573 efl_ui_pager_transition_set(data, NULL); 575 efl_ui_active_view_manager_set(data, NULL);
574} 576}
575 577
576static void 578static void
@@ -593,8 +595,12 @@ _transition_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
593 elm_naviframe_item_push(navi, "Transition", btn, NULL, efl_added, NULL)); 595 elm_naviframe_item_push(navi, "Transition", btn, NULL, efl_added, NULL));
594 596
595 btn = efl_add(EFL_UI_BUTTON_CLASS, box, 597 btn = efl_add(EFL_UI_BUTTON_CLASS, box,
596 efl_text_set(efl_added, "Set"), 598 efl_text_set(efl_added, "Scroll"),
597 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _tran_set_btn_cb, tab_pager), 599 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _tran_set_btn_scroll_cb, tab_pager),
600 efl_pack_end(box, efl_added));
601 btn = efl_add(EFL_UI_BUTTON_CLASS, box,
602 efl_text_set(efl_added, "Stack"),
603 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _tran_set_btn_stack_cb, tab_pager),
598 efl_pack_end(box, efl_added)); 604 efl_pack_end(box, efl_added));
599 605
600 btn = efl_add(EFL_UI_BUTTON_CLASS, box, 606 btn = efl_add(EFL_UI_BUTTON_CLASS, box,
diff --git a/src/lib/elementary/efl_ui_tab_pager.c b/src/lib/elementary/efl_ui_tab_pager.c
index 2b43aa8939..de96213219 100644
--- a/src/lib/elementary/efl_ui_tab_pager.c
+++ b/src/lib/elementary/efl_ui_tab_pager.c
@@ -20,14 +20,14 @@ _select(Eo *obj, int index)
20 else sd->cur = 0; 20 else sd->cur = 0;
21 21
22 efl_ui_tab_bar_current_tab_set(sd->tab_bar, sd->cur); 22 efl_ui_tab_bar_current_tab_set(sd->tab_bar, sd->cur);
23 efl_ui_pager_current_page_set(efl_super(obj, MY_CLASS), sd->cur);
24} 23}
25 24
26static void 25static void
27_tab_select_cb(void *data, const Efl_Event *event) 26_tab_select_cb(void *data, const Efl_Event *event)
28{ 27{
29 int index = efl_ui_tab_bar_current_tab_get(event->object); 28 int index = efl_ui_tab_bar_current_tab_get(event->object);
30 _select(data, index); 29 if (efl_ui_active_view_active_index_get(data) != index)
30 efl_ui_active_view_active_index_set(data, index);
31} 31}
32 32
33static void 33static void
@@ -78,8 +78,9 @@ _efl_ui_tab_pager_tab_bar_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *
78} 78}
79 79
80EOLIAN static void 80EOLIAN static void
81_efl_ui_tab_pager_efl_ui_pager_current_page_set(Eo *obj, Efl_Ui_Tab_Pager_Data *sd EINA_UNUSED, int index) 81_efl_ui_tab_pager_efl_ui_active_view_container_active_index_set(Eo *obj, Efl_Ui_Tab_Pager_Data *sd EINA_UNUSED, int index)
82{ 82{
83 efl_ui_active_view_active_index_set(efl_super(obj, MY_CLASS), index);
83 _select(obj, index); 84 _select(obj, index);
84} 85}
85 86
diff --git a/src/lib/elementary/efl_ui_tab_pager.eo b/src/lib/elementary/efl_ui_tab_pager.eo
index c7e0b5504a..c566598d45 100644
--- a/src/lib/elementary/efl_ui_tab_pager.eo
+++ b/src/lib/elementary/efl_ui_tab_pager.eo
@@ -1,4 +1,4 @@
1class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Pager 1class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Active_View.Container
2{ 2{
3 [[Tab Pager class]] 3 [[Tab Pager class]]
4 methods { 4 methods {
@@ -23,6 +23,6 @@ class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Pager
23 Efl.Pack_Linear.pack_content_get; 23 Efl.Pack_Linear.pack_content_get;
24 Efl.Pack_Linear.pack_index_get; 24 Efl.Pack_Linear.pack_index_get;
25 Efl.Pack_Linear.pack_unpack_at; // TODO 25 Efl.Pack_Linear.pack_unpack_at; // TODO
26 Efl.Ui.Pager.current_page { set; } 26 Efl.Ui.Active_View.Container.active_index { set; }
27 } 27 }
28} 28}