summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-02 21:41:46 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-03 17:16:03 +0100
commit77a04db5788aa59107acfaab5ce67bb8db46b7b4 (patch)
tree6f3487a8448b792288b09e8800cb3d7684af8a51 /src/bin
parent70849969b8aaecd121aa56ce6f70f31c2ed06c77 (diff)
efl_ui_tab_pager: do not directly inherit from spotlight anymore
spotlight moved away from layout, this could have also been solved with setting a edje object as resize object. However, this commit now contains the spotlight internally. The resons why containing it internally is better: - You now only have one way of selecting a page, marking it as selection via the selectable API - You cannot build race conditions between selecting a page and setting the active_element anymore - The tab_pager is now also just a simple single_selectable implementor, which makes this whole usage more convinient. - There is now a event you can listen to if you want to know if something has changed the selected item - push and pop would have never worked correctly in the tab_pager, as the item would have appeared always before the item was "faded" in. This possibility is not given anymore Last but not least, this makes tab_pager usable again, the tab bar is displayed again. Differential Revision: https://phab.enlightenment.org/D10775
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/elementary/test_ui_tab_pager.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/bin/elementary/test_ui_tab_pager.c b/src/bin/elementary/test_ui_tab_pager.c
index 1cc0055051..2c948dcaac 100644
--- a/src/bin/elementary/test_ui_tab_pager.c
+++ b/src/bin/elementary/test_ui_tab_pager.c
@@ -139,7 +139,7 @@ test_ui_tab_pager(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
139 page = tab_page_add(tp); 139 page = tab_page_add(tp);
140 efl_pack_end(tp, page); 140 efl_pack_end(tp, page);
141 if (i == 0) 141 if (i == 0)
142 efl_ui_spotlight_active_element_set(tp, page); 142 efl_ui_selectable_selected_set(efl_ui_tab_page_tab_bar_item_get(page), EINA_TRUE);
143 } 143 }
144 144
145 ad = (App_Data*)calloc(1, sizeof(App_Data)); 145 ad = (App_Data*)calloc(1, sizeof(App_Data));
@@ -174,7 +174,9 @@ static void
174_tab_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED) 174_tab_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
175{ 175{
176 Tab_Set_Data *tsd = data; 176 Tab_Set_Data *tsd = data;
177 efl_ui_spotlight_active_element_set(tsd->tab_pager, efl_pack_content_get(tsd->tab_pager, elm_spinner_value_get(tsd->spinner))); 177 Efl_Ui_Tab_Page *page = efl_pack_content_get(tsd->tab_pager, elm_spinner_value_get(tsd->spinner));
178
179 efl_ui_selectable_selected_set(efl_ui_tab_page_tab_bar_item_get(page), EINA_TRUE);
178} 180}
179 181
180static void 182static void
@@ -246,7 +248,7 @@ _pack_before_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
246 Eo *tab_pager = data; 248 Eo *tab_pager = data;
247 Eo *tab_page, *cur_tab_page; 249 Eo *tab_page, *cur_tab_page;
248 250
249 cur_tab_page = efl_ui_spotlight_active_element_get(tab_pager); 251 cur_tab_page = efl_ui_selectable_last_selected_get(tab_pager);
250 252
251 tab_page = tab_page_add(tab_pager); 253 tab_page = tab_page_add(tab_pager);
252 254
@@ -259,7 +261,7 @@ _pack_after_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
259 Eo *tab_pager = data; 261 Eo *tab_pager = data;
260 Eo *tab_page, *cur_tab_page; 262 Eo *tab_page, *cur_tab_page;
261 263
262 cur_tab_page = efl_ui_spotlight_active_element_get(tab_pager); 264 cur_tab_page = efl_ui_selectable_last_selected_get(tab_pager);
263 265
264 tab_page = tab_page_add(tab_pager); 266 tab_page = tab_page_add(tab_pager);
265 267
@@ -361,7 +363,7 @@ _unpack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
361{ 363{
362 Eo *tab_pager = data; 364 Eo *tab_pager = data;
363 365
364 Eo *tab_page = efl_ui_spotlight_active_element_get(tab_pager); 366 Eo *tab_page = efl_ui_selectable_last_selected_get(tab_pager);
365 367
366 efl_pack_unpack(tab_pager, tab_page); 368 efl_pack_unpack(tab_pager, tab_page);
367 efl_del(tab_page); 369 efl_del(tab_page);
@@ -460,7 +462,7 @@ _change_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
460 char *label = NULL; 462 char *label = NULL;
461 char *icon = NULL; 463 char *icon = NULL;
462 464
463 tab_page = efl_ui_spotlight_active_element_get(tcd->tab_pager); 465 tab_page = efl_ui_selectable_last_selected_get(tcd->tab_pager);
464 466
465 if (efl_ui_selectable_selected_get(tcd->label_check)) 467 if (efl_ui_selectable_selected_get(tcd->label_check))
466 { 468 {
@@ -528,20 +530,20 @@ static void
528_tran_set_btn_scroll_cb(void *data, const Efl_Event *ev EINA_UNUSED) 530_tran_set_btn_scroll_cb(void *data, const Efl_Event *ev EINA_UNUSED)
529{ 531{
530 Efl_Ui_Spotlight_Scroll_Manager *scroll = efl_new(EFL_UI_SPOTLIGHT_SCROLL_MANAGER_CLASS); 532 Efl_Ui_Spotlight_Scroll_Manager *scroll = efl_new(EFL_UI_SPOTLIGHT_SCROLL_MANAGER_CLASS);
531 efl_ui_spotlight_manager_set(data, scroll); 533 efl_ui_tab_pager_spotlight_manager_set(data, scroll);
532} 534}
533 535
534static void 536static void
535_tran_set_btn_stack_cb(void *data, const Efl_Event *ev EINA_UNUSED) 537_tran_set_btn_stack_cb(void *data, const Efl_Event *ev EINA_UNUSED)
536{ 538{
537 Efl_Ui_Spotlight_Scroll_Manager *stack = efl_new(EFL_UI_SPOTLIGHT_FADE_MANAGER_CLASS); 539 Efl_Ui_Spotlight_Scroll_Manager *stack = efl_new(EFL_UI_SPOTLIGHT_FADE_MANAGER_CLASS);
538 efl_ui_spotlight_manager_set(data, stack); 540 efl_ui_tab_pager_spotlight_manager_set(data, stack);
539} 541}
540 542
541static void 543static void
542_tran_unset_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED) 544_tran_unset_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
543{ 545{
544 efl_ui_spotlight_manager_set(data, NULL); 546 efl_ui_tab_pager_spotlight_manager_set(data, NULL);
545} 547}
546 548
547static void 549static void