summaryrefslogtreecommitdiff
path: root/src/bin/elementary/test_ui_pager_scroll.c
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2019-04-02 16:35:12 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2019-04-02 16:35:12 +0900
commit5742caa6016bf0ea852059546ded493c2d52b1a7 (patch)
tree568dd50a2ee360781c4dbee7047d9f5bb81acd27 /src/bin/elementary/test_ui_pager_scroll.c
parentf652bf932837846c5911c26992196213780394df (diff)
Revert "test/efl_ui_pager_scroll: fix demo"
This reverts commit 30bd541bf264d369e2a96d27fa3ff5139c360e26. The commit is reverted to revert the following commits. 74c48f029632d2260816b4cb3de6dbb40a29f040 913a5bff66dd7a58753ccae1474657ec33350e43 The above commits will be restored after release and then 30bd541bf264d369e2a96d27fa3ff5139c360e26 will be also restored.
Diffstat (limited to 'src/bin/elementary/test_ui_pager_scroll.c')
-rw-r--r--src/bin/elementary/test_ui_pager_scroll.c72
1 files changed, 15 insertions, 57 deletions
diff --git a/src/bin/elementary/test_ui_pager_scroll.c b/src/bin/elementary/test_ui_pager_scroll.c
index 8df58c6..30a4306 100644
--- a/src/bin/elementary/test_ui_pager_scroll.c
+++ b/src/bin/elementary/test_ui_pager_scroll.c
@@ -36,8 +36,7 @@ typedef enum _Pack_Type {
36 PACK_BEFORE, 36 PACK_BEFORE,
37 PACK_AFTER, 37 PACK_AFTER,
38 PACK_AT, 38 PACK_AT,
39 UNPACK_AT, 39 UNPACK_AT
40 CLEAR
41} Pack_Type; 40} Pack_Type;
42 41
43typedef struct _Params { 42typedef struct _Params {
@@ -241,7 +240,7 @@ static void pack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
241 Eo *page = NULL, *curr_page; 240 Eo *page = NULL, *curr_page;
242 int index, cnt; 241 int index, cnt;
243 242
244 if ((param->type != UNPACK_AT) && (param->type != CLEAR)) { 243 if (param->type != UNPACK_AT) {
245 index = efl_content_count(pager); 244 index = efl_content_count(pager);
246 245
247 switch (index % 3) { 246 switch (index % 3) {
@@ -283,12 +282,10 @@ static void pack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
283 break; 282 break;
284 case UNPACK_AT: 283 case UNPACK_AT:
285 index = efl_ui_range_value_get(param->unpack_sp); 284 index = efl_ui_range_value_get(param->unpack_sp);
286 page = efl_pack_unpack_at(pager, index); 285 page = efl_pack_content_get(pager, index);
286 efl_pack_unpack(pager, page);
287 efl_del(page); 287 efl_del(page);
288 break; 288 break;
289 case CLEAR:
290 efl_pack_clear(pager);
291 break;
292 } 289 }
293 290
294 cnt = efl_content_count(pager); 291 cnt = efl_content_count(pager);
@@ -356,11 +353,13 @@ static void next_block_check_cb(void *data, const Efl_Event *ev)
356 efl_ui_pager_scroll_block_set(pager, prev, next); 353 efl_ui_pager_scroll_block_set(pager, prev, next);
357} 354}
358 355
359static void loop_radio_cb(void *data, const Efl_Event *ev) 356static void loop_check_cb(void *data, const Efl_Event *ev)
360{ 357{
361 Eo *pager = data; 358 Eo *pager = data;
362 int state = efl_ui_nstate_value_get(ev->object); 359 int state = efl_ui_nstate_value_get(ev->object);
363 360
361 //FIXME use other widget (i.e. radio) than check
362 // since loop might not be enabled according to the number of items
364 efl_ui_pager_loop_mode_set(pager, state); 363 efl_ui_pager_loop_mode_set(pager, state);
365} 364}
366 365
@@ -702,24 +701,6 @@ static void pack_cb(void *data,
702 efl_pack_end(box, in_box2); 701 efl_pack_end(box, in_box2);
703 efl_pack_end(in_box2, btn); 702 efl_pack_end(in_box2, btn);
704 efl_pack_end(in_box2, sp2); 703 efl_pack_end(in_box2, sp2);
705
706 // Clear
707 pack_param = calloc(1, sizeof(Pack_Params));
708 if (!pack_param) return;
709
710 pack_param->pager = pager;
711 pack_param->pack_sp = sp1;
712 pack_param->unpack_sp = sp2;
713 pack_param->unpack_btn = btn;
714 pack_param->type = CLEAR;
715
716 efl_add(EFL_UI_BUTTON_CLASS, box,
717 efl_text_set(efl_added, "Clear"),
718 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
719 pack_btn_cb, pack_param),
720 efl_event_callback_add(efl_added, EFL_EVENT_DEL,
721 pack_btn_del_cb, pack_param),
722 efl_pack_end(box, efl_added));
723} 704}
724 705
725static void current_page_cb(void *data, 706static void current_page_cb(void *data,
@@ -817,8 +798,7 @@ static void loop_cb(void *data EINA_UNUSED,
817 Params *params = (Params *)data; 798 Params *params = (Params *)data;
818 Evas_Object *navi = params->navi; 799 Evas_Object *navi = params->navi;
819 Eo *pager = params->pager; 800 Eo *pager = params->pager;
820 Eo *btn, *box, *rd; 801 Eo *btn, *box;
821 Efl_Ui_Pager_Loop loop;
822 802
823 btn = efl_add(EFL_UI_BUTTON_CLASS, navi, 803 btn = efl_add(EFL_UI_BUTTON_CLASS, navi,
824 efl_text_set(efl_added, "Back"), 804 efl_text_set(efl_added, "Back"),
@@ -830,35 +810,13 @@ static void loop_cb(void *data EINA_UNUSED,
830 elm_naviframe_item_push(navi, "Loop", btn, NULL, 810 elm_naviframe_item_push(navi, "Loop", btn, NULL,
831 efl_added, NULL)); 811 efl_added, NULL));
832 812
833 rd = efl_add(EFL_UI_RADIO_CLASS, box, 813 efl_add(EFL_UI_CHECK_CLASS, box,
834 efl_ui_radio_state_value_set(efl_added, EFL_UI_PAGER_LOOP_DISABLED), 814 efl_ui_widget_style_set(efl_added, "toggle"),
835 efl_text_set(efl_added, "Disabled"), 815 efl_text_set(efl_added, "Loop"),
836 efl_gfx_hint_weight_set(efl_added, 1, 0), 816 efl_ui_nstate_value_set(efl_added, efl_ui_pager_loop_mode_get(pager)),
837 efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED, 817 efl_event_callback_add(efl_added, EFL_UI_CHECK_EVENT_CHANGED,
838 loop_radio_cb, pager), 818 loop_check_cb, pager),
839 efl_pack(box, efl_added)); 819 efl_pack_end(box, efl_added));
840
841 rd = efl_add(EFL_UI_RADIO_CLASS, box,
842 efl_ui_radio_state_value_set(efl_added, EFL_UI_PAGER_LOOP_ENABLED),
843 efl_ui_radio_group_add(efl_added, rd),
844 efl_text_set(efl_added, "Enabled"),
845 efl_gfx_hint_weight_set(efl_added, 1, 0),
846 efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED,
847 loop_radio_cb, pager),
848 efl_pack(box, efl_added));
849
850 loop = efl_ui_pager_loop_mode_get(pager);
851
852 efl_ui_nstate_value_set(rd, loop);
853
854 if (loop == EFL_UI_PAGER_LOOP_DISABLED)
855 {
856 Eina_Bool ret = efl_ui_pager_loop_mode_set(pager, EFL_UI_PAGER_LOOP_ENABLED);
857 if (!ret)
858 elm_object_disabled_set(rd, EINA_TRUE);
859 else
860 efl_ui_pager_loop_mode_set(pager, EFL_UI_PAGER_LOOP_DISABLED);
861 }
862} 820}
863 821
864static void indicator_cb(void *data EINA_UNUSED, 822static void indicator_cb(void *data EINA_UNUSED,