summaryrefslogtreecommitdiff
path: root/src/bin/elementary/test_ui_tab_pager.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-02 10:26:40 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-06 16:10:40 +0200
commit588745e9956ba622aadc9fe6f11988a372687d39 (patch)
treea9fd09013d9ae94db44582ddb8cc3f674d94eea4 /src/bin/elementary/test_ui_tab_pager.c
parentb36e159d313bae4a6dd4e0c60deae0aef2309b50 (diff)
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite weird to have a index, where most of the time you work with widgets. We might want to add syntax suger in the future to make it easier to just jump to the next element, or to the previous, but that still is to be decided. The event and the communication to the spotlight manager are still left to be used with the index, reason for this is, that we might need to fill there an invalid pointer, if a deletion is triggering an animation, which seems quite weird. That needs further discussing. Docx have been updated, the sitemarks about the shifting of the active_index can be removed, as the element is not subject of change during content adds/deletes. ref T7991 Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com> Differential Revision: https://phab.enlightenment.org/D9813
Diffstat (limited to '')
-rw-r--r--src/bin/elementary/test_ui_tab_pager.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/bin/elementary/test_ui_tab_pager.c b/src/bin/elementary/test_ui_tab_pager.c
index 93aaa12..01ca807 100644
--- a/src/bin/elementary/test_ui_tab_pager.c
+++ b/src/bin/elementary/test_ui_tab_pager.c
@@ -139,10 +139,10 @@ test_ui_tab_pager(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
139 { 139 {
140 page = tab_page_add(tp); 140 page = tab_page_add(tp);
141 efl_pack_end(tp, page); 141 efl_pack_end(tp, page);
142 if (i == 0)
143 efl_ui_spotlight_active_element_set(tp, page);
142 } 144 }
143 145
144 efl_ui_spotlight_active_index_set(tp, 0);
145
146 ad = (App_Data*)calloc(1, sizeof(App_Data)); 146 ad = (App_Data*)calloc(1, sizeof(App_Data));
147 ad->navi = navi; 147 ad->navi = navi;
148 ad->tab_pager = tp; 148 ad->tab_pager = tp;
@@ -175,7 +175,7 @@ static void
175_tab_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED) 175_tab_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
176{ 176{
177 Tab_Set_Data *tsd = data; 177 Tab_Set_Data *tsd = data;
178 efl_ui_spotlight_active_index_set(tsd->tab_pager, elm_spinner_value_get(tsd->spinner)); 178 efl_ui_spotlight_active_element_set(tsd->tab_pager, efl_pack_content_get(tsd->tab_pager, elm_spinner_value_get(tsd->spinner)));
179} 179}
180 180
181static void 181static void
@@ -206,7 +206,7 @@ _current_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
206 206
207 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, box, 207 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, box,
208 efl_ui_range_limits_set(efl_added, 0, efl_content_count(tab_pager) - 1), 208 efl_ui_range_limits_set(efl_added, 0, efl_content_count(tab_pager) - 1),
209 efl_ui_range_value_set(efl_added, efl_ui_spotlight_active_index_get(tab_pager)), 209 efl_ui_range_value_set(efl_added, efl_content_count(tab_pager)),
210 efl_pack_end(box, efl_added)); 210 efl_pack_end(box, efl_added));
211 211
212 tsd->tab_pager = tab_pager; 212 tsd->tab_pager = tab_pager;
@@ -246,10 +246,8 @@ _pack_before_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
246{ 246{
247 Eo *tab_pager = data; 247 Eo *tab_pager = data;
248 Eo *tab_page, *cur_tab_page; 248 Eo *tab_page, *cur_tab_page;
249 int index;
250 249
251 index = efl_ui_spotlight_active_index_get(tab_pager); 250 cur_tab_page = efl_ui_spotlight_active_element_get(tab_pager);
252 cur_tab_page = efl_pack_content_get(tab_pager, index);
253 251
254 tab_page = tab_page_add(tab_pager); 252 tab_page = tab_page_add(tab_pager);
255 253
@@ -261,10 +259,8 @@ _pack_after_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
261{ 259{
262 Eo *tab_pager = data; 260 Eo *tab_pager = data;
263 Eo *tab_page, *cur_tab_page; 261 Eo *tab_page, *cur_tab_page;
264 int index;
265 262
266 index = efl_ui_spotlight_active_index_get(tab_pager); 263 cur_tab_page = efl_ui_spotlight_active_element_get(tab_pager);
267 cur_tab_page = efl_pack_content_get(tab_pager, index);
268 264
269 tab_page = tab_page_add(tab_pager); 265 tab_page = tab_page_add(tab_pager);
270 266
@@ -340,7 +336,7 @@ _pack_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
340 336
341 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box, 337 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box,
342 efl_ui_range_limits_set(efl_added, 0, efl_content_count(tab_pager) - 1), 338 efl_ui_range_limits_set(efl_added, 0, efl_content_count(tab_pager) - 1),
343 efl_ui_range_value_set(efl_added, efl_ui_spotlight_active_index_get(tab_pager)), 339 efl_ui_range_value_set(efl_added, efl_content_count(tab_pager)),
344 efl_pack_end(in_box, efl_added)); 340 efl_pack_end(in_box, efl_added));
345 341
346 tsd->tab_pager = tab_pager; 342 tsd->tab_pager = tab_pager;
@@ -365,8 +361,9 @@ static void
365_unpack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED) 361_unpack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
366{ 362{
367 Eo *tab_pager = data; 363 Eo *tab_pager = data;
368 int index = efl_ui_spotlight_active_index_get(tab_pager); 364
369 Eo *tab_page = efl_pack_content_get(tab_pager, index); 365 Eo *tab_page = efl_ui_spotlight_active_element_get(tab_pager);
366
370 efl_pack_unpack(tab_pager, tab_page); 367 efl_pack_unpack(tab_pager, tab_page);
371 efl_del(tab_page); 368 efl_del(tab_page);
372} 369}
@@ -440,7 +437,7 @@ _unpack_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
440 437
441 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box, 438 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box,
442 efl_ui_range_limits_set(efl_added, 0, efl_content_count(tab_pager) - 1), 439 efl_ui_range_limits_set(efl_added, 0, efl_content_count(tab_pager) - 1),
443 efl_ui_range_value_set(efl_added, efl_ui_spotlight_active_index_get(tab_pager)), 440 efl_ui_range_value_set(efl_added, efl_content_count(tab_pager)),
444 efl_pack_end(in_box, efl_added)); 441 efl_pack_end(in_box, efl_added));
445 442
446 tsd->tab_pager = tab_pager; 443 tsd->tab_pager = tab_pager;
@@ -463,9 +460,8 @@ _change_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
463 Eo *tab_page, *content; 460 Eo *tab_page, *content;
464 char *label = NULL; 461 char *label = NULL;
465 char *icon = NULL; 462 char *icon = NULL;
466 int cur; 463
467 cur = efl_ui_spotlight_active_index_get(tcd->tab_pager); 464 tab_page = efl_ui_spotlight_active_element_get(tcd->tab_pager);
468 tab_page = efl_pack_content_get(tcd->tab_pager, cur);
469 465
470 if (efl_ui_selectable_selected_get(tcd->label_check)) 466 if (efl_ui_selectable_selected_get(tcd->label_check))
471 { 467 {