From 37266b93a5ec5c9345190f91418480c7108407fb Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Thu, 16 May 2019 19:29:35 +0200 Subject: [PATCH] efl.ui.pager: remove! This can be done with Efl.Ui.Active_View Reviewed-by: Jaehyun Cho Differential Revision: https://phab.enlightenment.org/D8907 --- src/Makefile_Elementary.am | 17 - src/bin/elementary/meson.build | 2 - src/bin/elementary/test.c | 5 - src/lib/elementary/Elementary.h | 12 - src/lib/elementary/efl_page_indicator.c | 95 -- src/lib/elementary/efl_page_indicator.eo | 18 - src/lib/elementary/efl_page_indicator.h | 24 - src/lib/elementary/efl_page_indicator_icon.eo | 12 - src/lib/elementary/efl_page_indicator_icon.h | 19 - src/lib/elementary/efl_page_transition.c | 132 --- src/lib/elementary/efl_page_transition.eo | 17 - src/lib/elementary/efl_page_transition.h | 27 - .../elementary/efl_page_transition_scroll.c | 688 ------------- .../elementary/efl_page_transition_scroll.eo | 22 - .../elementary/efl_page_transition_scroll.h | 92 -- src/lib/elementary/efl_ui_pager.c | 973 ------------------ src/lib/elementary/efl_ui_pager.eo | 109 -- src/lib/elementary/efl_ui_tab_pager.c | 1 - src/lib/elementary/efl_ui_widget_pager.h | 69 -- src/lib/elementary/elm_priv.h | 13 - src/lib/elementary/meson.build | 15 - .../elementary/spec/efl_test_pack_linear.c | 2 +- 22 files changed, 1 insertion(+), 2363 deletions(-) delete mode 100644 src/lib/elementary/efl_page_indicator.c delete mode 100644 src/lib/elementary/efl_page_indicator.eo delete mode 100644 src/lib/elementary/efl_page_indicator.h delete mode 100644 src/lib/elementary/efl_page_indicator_icon.eo delete mode 100644 src/lib/elementary/efl_page_indicator_icon.h delete mode 100644 src/lib/elementary/efl_page_transition.c delete mode 100644 src/lib/elementary/efl_page_transition.eo delete mode 100644 src/lib/elementary/efl_page_transition.h delete mode 100644 src/lib/elementary/efl_page_transition_scroll.c delete mode 100644 src/lib/elementary/efl_page_transition_scroll.eo delete mode 100644 src/lib/elementary/efl_page_transition_scroll.h delete mode 100644 src/lib/elementary/efl_ui_pager.c delete mode 100644 src/lib/elementary/efl_ui_pager.eo delete mode 100644 src/lib/elementary/efl_ui_widget_pager.h diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 06209a7bc5..166f2457e7 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -118,7 +118,6 @@ elm_public_eolian_files = \ lib/elementary/efl_ui_dnd.eo \ lib/elementary/efl_ui_dnd_container.eo \ lib/elementary/efl_ui_focus_manager_window_root.eo \ - lib/elementary/efl_ui_pager.eo \ lib/elementary/efl_ui_active_view_container.eo \ lib/elementary/efl_ui_active_view_view_manager.eo \ lib/elementary/efl_ui_active_view_view_manager_plain.eo \ @@ -126,10 +125,6 @@ elm_public_eolian_files = \ lib/elementary/efl_ui_active_view_view_manager_stack.eo \ lib/elementary/efl_ui_active_view_indicator.eo \ lib/elementary/efl_ui_active_view_indicator_icon.eo \ - lib/elementary/efl_page_transition.eo \ - lib/elementary/efl_page_transition_scroll.eo \ - lib/elementary/efl_page_indicator.eo \ - lib/elementary/efl_page_indicator_icon.eo \ lib/elementary/efl_ui_tab_pager.eo \ lib/elementary/efl_ui_tab_bar.eo \ lib/elementary/efl_ui_tab_page.eo \ @@ -768,11 +763,6 @@ includesunstable_HEADERS = \ lib/elementary/efl_ui_widget_pan.h \ lib/elementary/efl_ui_nstate_private.h \ lib/elementary/Efl_Ui.h \ - lib/elementary/efl_ui_widget_pager.h \ - lib/elementary/efl_page_transition.h \ - lib/elementary/efl_page_transition_scroll.h \ - lib/elementary/efl_page_indicator.h \ - lib/elementary/efl_page_indicator_icon.h \ lib/elementary/efl_ui_tab_pager_private.h \ lib/elementary/efl_ui_tab_bar_private.h \ lib/elementary/efl_ui_tab_page_private.h \ @@ -1203,7 +1193,6 @@ lib_elementary_libelementary_la_SOURCES = \ lib/elementary/elm_focus_legacy.c \ static_libs/buildsystem/buildsystem.h \ static_libs/buildsystem/buildsystem_autotools.c \ - lib/elementary/efl_ui_pager.c \ lib/elementary/efl_ui_active_view_container.c \ lib/elementary/efl_ui_active_view_view_manager.c \ lib/elementary/efl_ui_active_view_view_manager_plain.c \ @@ -1211,10 +1200,6 @@ lib_elementary_libelementary_la_SOURCES = \ lib/elementary/efl_ui_active_view_view_manager_stack.c \ lib/elementary/efl_ui_active_view_indicator.c \ lib/elementary/efl_ui_active_view_indicator_icon.c \ - lib/elementary/efl_page_transition.c \ - lib/elementary/efl_page_transition_scroll.c \ - lib/elementary/efl_page_indicator.c \ - lib/elementary/efl_page_indicator_icon.c \ lib/elementary/efl_ui_focus_graph.h \ lib/elementary/efl_ui_focus_graph.c \ lib/elementary/efl_ui_tab_pager.c \ @@ -1447,8 +1432,6 @@ bin/elementary/test_win_stack.c \ bin/elementary/test_win_indicator.c \ bin/elementary/test_gesture_framework.c \ bin/elementary/test_ui_tab_pager.c \ -bin/elementary/test_ui_pager.c \ -bin/elementary/test_ui_pager_scroll.c \ bin/elementary/test_ui_active_view.c \ bin/elementary/test_ui_relative_layout.c \ bin/elementary/test.h diff --git a/src/bin/elementary/meson.build b/src/bin/elementary/meson.build index 29e98f9ff5..65479f79ee 100644 --- a/src/bin/elementary/meson.build +++ b/src/bin/elementary/meson.build @@ -99,8 +99,6 @@ elementary_test_src = [ 'test_panes.c', 'test_ui_panes.c', 'test_ui_panel.c', - 'test_ui_pager.c', - 'test_ui_pager_scroll.c', 'test_ui_active_view.c', 'test_part_bg.c', 'test_part_shadow.c', diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index 1409831cd3..31a0fa0db6 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -386,9 +386,6 @@ void test_efl_anim_interpolator(void *data, Evas_Object *obj, void *event_info); void test_gesture_framework(void *data, Evas_Object *obj, void *event_info); void test_ui_tab_pager(void *data, Evas_Object *obj, void *event_info); -void test_ui_pager(void *data, Evas_Object *obj, void *event_info); -void test_ui_pager_stack(void *data, Evas_Object *obj, void *event_info); -void test_ui_pager_scroll(void *data, Evas_Object *obj, void *event_info); void test_ui_active_view_stack(void *data, Evas_Object *obj, void *event_info); void test_ui_active_view_plain(void *data, Evas_Object *obj, void *event_info); void test_ui_active_view_scroll(void *data, Evas_Object *obj, void *event_info); @@ -1119,8 +1116,6 @@ add_tests: //------------------------------// ADD_TEST_EO(NULL, "Tab Pager", "Efl.Ui.Tab_Pager", test_ui_tab_pager); - ADD_TEST_EO(NULL, "Pager", "Efl.Ui.Pager", test_ui_pager); - ADD_TEST_EO(NULL, "Scroll Pager", "Efl.Ui.Pager (Scroll)", test_ui_pager_scroll); ADD_TEST_EO(NULL, "Active View", "Efl.Ui.Active_View Plain", test_ui_active_view_plain); ADD_TEST_EO(NULL, "Active View", "Efl.Ui.Active_View Scroll", test_ui_active_view_scroll); ADD_TEST_EO(NULL, "Active View", "Efl.Ui.Active_View Stack", test_ui_active_view_stack); diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h index d062183d79..8db5fd9fe2 100644 --- a/src/lib/elementary/Elementary.h +++ b/src/lib/elementary/Elementary.h @@ -360,18 +360,6 @@ typedef Eo Efl_Ui_Focus_Manager; # include # include # include - -# ifndef _EFL_UI_PAGER_EO_CLASS_TYPE -# define _EFL_UI_PAGER_EO_CLASS_TYPE -typedef Eo Efl_Ui_Pager; -# endif - -# include -# include -# include -# include -# include - # include # include # include diff --git a/src/lib/elementary/efl_page_indicator.c b/src/lib/elementary/efl_page_indicator.c deleted file mode 100644 index 6b0be267b2..0000000000 --- a/src/lib/elementary/efl_page_indicator.c +++ /dev/null @@ -1,95 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#include -#include "elm_priv.h" - -#include "efl_page_indicator.h" -#include "efl_ui_widget_pager.h" - -#define MY_CLASS EFL_PAGE_INDICATOR_CLASS - - - -EOLIAN static void -_efl_page_indicator_update(Eo *obj EINA_UNUSED, - Efl_Page_Indicator_Data *pd, - double pos EINA_UNUSED) -{ - pd->curr_idx = efl_ui_pager_current_page_get(pd->pager.obj); -} - -EOLIAN static void -_efl_page_indicator_pack(Eo *obj EINA_UNUSED, - Efl_Page_Indicator_Data *pd, - int index) -{ - pd->cnt++; - if ((pd->curr_idx == -1) || (pd->curr_idx >= index)) pd->curr_idx++; -} - -EOLIAN static void -_efl_page_indicator_unpack(Eo *obj EINA_UNUSED, - Efl_Page_Indicator_Data *pd, - int index) -{ - pd->cnt--; - - if ((pd->cnt == 0) || - ((index == pd->curr_idx) && (index != 0)) || - (index < pd->curr_idx)) - pd->curr_idx--; -} - -EOLIAN static void -_efl_page_indicator_unpack_all(Eo *obj EINA_UNUSED, - Efl_Page_Indicator_Data *pd) -{ - pd->cnt = 0; - pd->curr_idx = -1; -} - -EOLIAN static void -_efl_page_indicator_bind(Eo *obj EINA_UNUSED, - Efl_Page_Indicator_Data *pd, - Eo *pager, - Efl_Canvas_Group *idbox) -{ - if (pd->pager.obj == pager) return; - - pd->pager.obj = pager; - pd->idbox = idbox; - - if (pager) - { - pd->cnt = efl_content_count(pd->pager.obj); - pd->curr_idx = efl_ui_pager_current_page_get(pd->pager.obj); - } - else - { - pd->cnt = 0; - pd->curr_idx = -1; - } -} - - -EOAPI EFL_VOID_FUNC_BODYV(efl_page_indicator_update, - EFL_FUNC_CALL(pos), double pos) -EOAPI EFL_VOID_FUNC_BODYV(efl_page_indicator_pack, - EFL_FUNC_CALL(index), int index) -EOAPI EFL_VOID_FUNC_BODYV(efl_page_indicator_unpack, - EFL_FUNC_CALL(index), int index) -EOAPI EFL_VOID_FUNC_BODY(efl_page_indicator_unpack_all) - -#define EFL_PAGE_INDICATOR_EXTRA_OPS \ - EFL_OBJECT_OP_FUNC(efl_page_indicator_update, \ - _efl_page_indicator_update), \ - EFL_OBJECT_OP_FUNC(efl_page_indicator_pack, \ - _efl_page_indicator_pack), \ - EFL_OBJECT_OP_FUNC(efl_page_indicator_unpack, \ - _efl_page_indicator_unpack), \ - EFL_OBJECT_OP_FUNC(efl_page_indicator_unpack_all, \ - _efl_page_indicator_unpack_all) - -#include "efl_page_indicator.eo.c" diff --git a/src/lib/elementary/efl_page_indicator.eo b/src/lib/elementary/efl_page_indicator.eo deleted file mode 100644 index be03c56433..0000000000 --- a/src/lib/elementary/efl_page_indicator.eo +++ /dev/null @@ -1,18 +0,0 @@ -class @beta Efl.Page.Indicator extends Efl.Object -{ - [[Page indicator - - Page indicator is used with @Efl.Ui.Pager. - 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. - ]] - 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 deleted file mode 100644 index 78dfd8c223..0000000000 --- a/src/lib/elementary/efl_page_indicator.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef EFL_PAGE_INDICATOR_H -#define EFL_PAGE_INDICATOR_H - -typedef struct _Efl_Page_Indicator_Data Efl_Page_Indicator_Data; - -struct _Efl_Page_Indicator_Data -{ - struct { - Efl_Object *obj; - Efl_Object *group; - Evas_Coord x, y, w, h; - } pager; - - Efl_Ui_Box *idbox; - - int cnt; - int curr_idx; -}; - -#define EFL_PAGE_INDICATOR_DATA_GET(o, pd) \ - Efl_Page_Indicator_Data *pd = \ - efl_data_scope_get(o, EFL_PAGE_INDICATOR_CLASS) - -#endif diff --git a/src/lib/elementary/efl_page_indicator_icon.eo b/src/lib/elementary/efl_page_indicator_icon.eo deleted file mode 100644 index 1af3bdc397..0000000000 --- a/src/lib/elementary/efl_page_indicator_icon.eo +++ /dev/null @@ -1,12 +0,0 @@ -class @beta Efl.Page.Indicator_Icon extends Efl.Page.Indicator -{ - [[Icon type page indicator - - This class offers icon type indicator for @Efl.Ui.Pager. - This type of page indicator creates the same number of icons as pages and - arrange them in a linear order. An icon has two states: default and selected. - ]] - implements { - Efl.Page.Indicator.bind; - } -} diff --git a/src/lib/elementary/efl_page_indicator_icon.h b/src/lib/elementary/efl_page_indicator_icon.h deleted file mode 100644 index 3c125fd475..0000000000 --- a/src/lib/elementary/efl_page_indicator_icon.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef EFL_PAGE_INDICATOR_ICON_H -#define EFL_PAGE_INDICATOR_ICON_H - -typedef struct _Efl_Page_Indicator_Icon_Data Efl_Page_Indicator_Icon_Data; - -struct _Efl_Page_Indicator_Icon_Data -{ - Eo *curr, *adj; - - Eina_List *items; - Eina_Value *v; -}; - - -#define EFL_PAGE_INDICATOR_ICON_DATA_GET(o, pd) \ - Efl_Page_Indicator_Icon_Data *pd = \ - efl_data_scope_get(o, EFL_PAGE_INDICATOR_ICON_CLASS) - -#endif diff --git a/src/lib/elementary/efl_page_transition.c b/src/lib/elementary/efl_page_transition.c deleted file mode 100644 index f6d73a2c10..0000000000 --- a/src/lib/elementary/efl_page_transition.c +++ /dev/null @@ -1,132 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#include -#include "elm_priv.h" - -#include "efl_page_transition.h" -#include "efl_ui_widget_pager.h" - -#define MY_CLASS EFL_PAGE_TRANSITION_CLASS - - -EOLIAN static void -_efl_page_transition_page_size_set(Eo *obj EINA_UNUSED, - Efl_Page_Transition_Data *pd, - Eina_Size2D sz) -{ - pd->page_spec.sz = sz; -} - -EOLIAN static void -_efl_page_transition_padding_size_set(Eo *obj EINA_UNUSED, - Efl_Page_Transition_Data *pd, - int padding) -{ - pd->page_spec.padding = padding; -} - -EOLIAN static void -_efl_page_transition_bind(Eo *obj EINA_UNUSED, - Efl_Page_Transition_Data *pd, - Eo *pager, - Efl_Canvas_Group *group) -{ - Eina_Rect group_rect; - - if (pd->pager.obj == pager) return; - - pd->pager.obj = pager; - pd->pager.group = group; - - if (pager) - { - group_rect = efl_gfx_entity_geometry_get(group); - - pd->pager.x = group_rect.x; - pd->pager.y = group_rect.y; - pd->pager.w = group_rect.w; - pd->pager.h = group_rect.h; - - pd->page_spec.sz = efl_ui_pager_page_size_get(pager); - pd->page_spec.padding = efl_ui_pager_padding_get(pager); - pd->loop = efl_ui_pager_loop_mode_get(pager); - } -} - -EOLIAN static void -_efl_page_transition_update(Eo *obj EINA_UNUSED, - Efl_Page_Transition_Data *pd EINA_UNUSED, - double move EINA_UNUSED) -{ - -} - -EOLIAN static void -_efl_page_transition_pack(Eo *obj EINA_UNUSED, - Efl_Page_Transition_Data *pd EINA_UNUSED, - int index EINA_UNUSED) -{ - -} - -EOLIAN static void -_efl_page_transition_unpack_all(Eo *obj EINA_UNUSED, - Efl_Page_Transition_Data *pd EINA_UNUSED, - int index EINA_UNUSED) -{ - -} - -EOLIAN static void -_efl_page_transition_curr_page_change(Eo *obj EINA_UNUSED, - Efl_Page_Transition_Data *pd EINA_UNUSED, - int diff EINA_UNUSED) -{ - -} - -EOLIAN static Eina_Bool -_efl_page_transition_loop_set(Eo *obj EINA_UNUSED, - Efl_Page_Transition_Data *pd, - Efl_Ui_Pager_Loop loop) -{ - pd->loop = loop; - - return EINA_TRUE; -} - - -EOAPI EFL_VOID_FUNC_BODYV(efl_page_transition_update, - EFL_FUNC_CALL(move), double move) -EOAPI EFL_VOID_FUNC_BODYV(efl_page_transition_pack, - EFL_FUNC_CALL(index), int index) -EOAPI EFL_VOID_FUNC_BODY(efl_page_transition_unpack_all) -EOAPI EFL_VOID_FUNC_BODYV(efl_page_transition_curr_page_change, - EFL_FUNC_CALL(diff), int diff) -EOAPI EFL_VOID_FUNC_BODYV(efl_page_transition_page_size_set, - EFL_FUNC_CALL(sz), Eina_Size2D sz) -EOAPI EFL_VOID_FUNC_BODYV(efl_page_transition_padding_size_set, - EFL_FUNC_CALL(padding), int padding) -EOAPI EFL_FUNC_BODYV(efl_page_transition_loop_set, Eina_Bool, 0, - EFL_FUNC_CALL(loop), Efl_Ui_Pager_Loop loop) - - -#define EFL_PAGE_TRANSITION_EXTRA_OPS \ - EFL_OBJECT_OP_FUNC(efl_page_transition_update, \ - _efl_page_transition_update), \ - EFL_OBJECT_OP_FUNC(efl_page_transition_pack, \ - _efl_page_transition_pack), \ - EFL_OBJECT_OP_FUNC(efl_page_transition_unpack_all, \ - _efl_page_transition_unpack_all), \ - EFL_OBJECT_OP_FUNC(efl_page_transition_curr_page_change, \ - _efl_page_transition_curr_page_change), \ - EFL_OBJECT_OP_FUNC(efl_page_transition_page_size_set, \ - _efl_page_transition_page_size_set), \ - EFL_OBJECT_OP_FUNC(efl_page_transition_padding_size_set, \ - _efl_page_transition_padding_size_set), \ - EFL_OBJECT_OP_FUNC(efl_page_transition_loop_set, \ - _efl_page_transition_loop_set) - -#include "efl_page_transition.eo.c" diff --git a/src/lib/elementary/efl_page_transition.eo b/src/lib/elementary/efl_page_transition.eo deleted file mode 100644 index 5f97951b0e..0000000000 --- a/src/lib/elementary/efl_page_transition.eo +++ /dev/null @@ -1,17 +0,0 @@ -class @beta Efl.Page.Transition extends Efl.Object -{ - [[Page transition for @Efl.Ui.Pager - - A page transition is essential to @Efl.Ui.Pager object and invoked whenever - pages are rearranged or scrolled (see @Efl.Ui.Pager). - ]] - 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_transition.h b/src/lib/elementary/efl_page_transition.h deleted file mode 100644 index 38d4e6b9ab..0000000000 --- a/src/lib/elementary/efl_page_transition.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef EFL_PAGE_TRANSITION_H -#define EFL_PAGE_TRANSITION_H - - -typedef struct _Efl_Page_Transition_Data Efl_Page_Transition_Data; - -struct _Efl_Page_Transition_Data -{ - struct { - Efl_Object *obj; - Efl_Canvas_Group *group; - Evas_Coord x, y, w, h; - } pager; - - struct { - Eina_Size2D sz; - Evas_Coord padding; - } page_spec; - - Efl_Ui_Pager_Loop loop; -}; - -#define EFL_PAGE_TRANSITION_DATA_GET(o, pd) \ - Efl_Page_Transition_Data *pd = \ - efl_data_scope_get(o, EFL_PAGE_TRANSITION_CLASS) - -#endif diff --git a/src/lib/elementary/efl_page_transition_scroll.c b/src/lib/elementary/efl_page_transition_scroll.c deleted file mode 100644 index 3908710cc6..0000000000 --- a/src/lib/elementary/efl_page_transition_scroll.c +++ /dev/null @@ -1,688 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#include -#include "elm_priv.h" - -#include "efl_page_transition_scroll.h" -#include "efl_page_transition.h" -#include "efl_ui_widget_pager.h" - -#define MY_CLASS EFL_PAGE_TRANSITION_SCROLL_CLASS - - - -static void -_page_info_deallocate(Efl_Page_Transition_Scroll_Data *pd) -{ - Page_Info *pi; - - EINA_LIST_FREE(pd->page_infos, pi) - { - if (pi->content) - efl_pack_unpack(pi->obj, pi->content); - - efl_del(pi->obj); - free(pi); - } - - pd->head = NULL; - pd->tail = NULL; -} - -static void -_page_info_allocate(Efl_Page_Transition_Scroll_Data *pd, - Efl_Page_Transition_Data *spd) -{ - Page_Info *pi, *prev = NULL; - int i; - - for (i = 0; i < pd->page_info_num; i++) - { - pi = calloc(1, sizeof(*pi)); - if (!pi) return; - if (i == 0) pd->head = pi; - else if (i == (pd->page_info_num - 1)) pd->tail = pi; - pi->id = i; - pi->pos = i - (pd->side_page_num + 1); - pi->content_num = -1; - pi->content = NULL; - - pi->obj = efl_add(EFL_UI_BOX_CLASS, spd->pager.obj); - efl_canvas_group_member_add(spd->pager.group, pi->obj); - pd->page_infos = eina_list_append(pd->page_infos, pi); - - if (prev) - { - pi->prev = prev; - prev->next = pi; - } - prev = pi; - } - - pd->head->prev = pd->tail; - pd->tail->next = pd->head; -} - -//FIXME use ecore_job -static void -_page_info_geometry_change(Efl_Page_Transition_Scroll_Data *pd, - Efl_Page_Transition_Data *spd) -{ - Page_Info *curr; - Eo *tmp; - int content_w, tmp_id, curr_page, cnt; - - content_w = (spd->page_spec.sz.w * (pd->side_page_num * 2 + 1)) - + (spd->page_spec.padding * pd->side_page_num * 2); - - if (content_w < spd->pager.w) - { - EINA_RECTANGLE_SET(&pd->viewport, - spd->pager.x + ((spd->pager.w - content_w) / 2), - spd->pager.y, - content_w, - spd->pager.h); - } - else - { - EINA_RECTANGLE_SET(&pd->viewport, - spd->pager.x, - spd->pager.y, - spd->pager.w, - spd->pager.h); - } - - efl_gfx_entity_geometry_set(pd->foreclip, (Eina_Rect) pd->viewport); - - curr_page = efl_ui_pager_current_page_get(spd->pager.obj); - cnt = efl_content_count(spd->pager.obj); - - curr = pd->head; - do - { - EINA_RECTANGLE_SET(&curr->geometry, - spd->pager.x + (spd->pager.w / 2) - + curr->pos * (spd->page_spec.sz.w + spd->page_spec.padding) - - (spd->page_spec.sz.w / 2), - spd->pager.y + (spd->pager.h / 2) - (spd->page_spec.sz.h / 2), - spd->page_spec.sz.w, - spd->page_spec.sz.h); - - efl_gfx_entity_geometry_set(curr->obj, (Eina_Rect) curr->geometry); - - if (!eina_rectangles_intersect(&curr->geometry, &pd->viewport)) - { - if (curr->visible) - { - efl_canvas_object_clipper_set(curr->obj, pd->backclip); - - efl_pack_unpack(curr->obj, curr->content); - efl_canvas_object_clipper_set(curr->content, pd->backclip); - - curr->content_num = -1; - curr->content = NULL; - curr->visible = EINA_FALSE; - } - } - else - { - tmp_id = curr_page + curr->pos; - if (spd->loop == EFL_UI_PAGER_LOOP_ENABLED) - tmp_id = (tmp_id + cnt) % cnt; - - if ((abs(curr->pos) < cnt) && - (tmp_id >= 0) && - (tmp_id < cnt)) - { - if (curr->content_num != tmp_id) - { - tmp = efl_pack_content_get(spd->pager.obj, tmp_id); - - efl_canvas_object_clipper_set(curr->obj, pd->foreclip); - - efl_pack(curr->obj, tmp); - efl_canvas_object_clipper_set(tmp, pd->foreclip); - - curr->content_num = tmp_id; - curr->content = tmp; - curr->visible = EINA_TRUE; - } - } - else if (curr->content) - { - efl_canvas_object_clipper_set(curr->obj, pd->backclip); - - efl_pack_unpack(curr->obj, curr->content); - efl_canvas_object_clipper_set(curr->content, pd->backclip); - - curr->content_num = -1; - curr->content = NULL; - curr->visible = EINA_FALSE; - } - } - - curr = curr->next; - - } while (curr != pd->head); -} - -static void -_resize_cb(void *data, const Efl_Event *ev) -{ - Efl_Page_Transition_Scroll *obj = data; - EFL_PAGE_TRANSITION_SCROLL_DATA_GET(obj, pd); - EFL_PAGE_TRANSITION_DATA_GET(obj, spd); - - Eina_Size2D sz; - - Efl_Ui_Pager *pager = ev->object; - - sz = efl_gfx_entity_size_get(pager); - - spd->pager.w = sz.w; - spd->pager.h = sz.h; - - _page_info_geometry_change(pd, spd); -} - -static void -_move_cb(void *data, const Efl_Event *ev) -{ - Efl_Page_Transition_Scroll *obj = data; - EFL_PAGE_TRANSITION_SCROLL_DATA_GET(obj, pd); - EFL_PAGE_TRANSITION_DATA_GET(obj, spd); - - Eina_Position2D pos; - - Efl_Ui_Pager *pager = ev->object; - - pos = efl_gfx_entity_position_get(pager); - - spd->pager.x = pos.x; - spd->pager.y = pos.y; - - _page_info_geometry_change(pd, spd); -} - -EOLIAN static void -_efl_page_transition_scroll_efl_page_transition_bind(Eo *obj, - Efl_Page_Transition_Scroll_Data *pd, - Eo *pager, - Efl_Canvas_Group *group) -{ - EFL_PAGE_TRANSITION_DATA_GET(obj, spd); - - if (spd->pager.obj == pager) return; - - if (spd->pager.obj) - { - efl_event_callback_del(spd->pager.group, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, obj); - efl_event_callback_del(spd->pager.group, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _move_cb, obj); - - _page_info_deallocate(pd); - efl_del(pd->foreclip); - efl_del(pd->backclip); - } - - efl_page_transition_bind(efl_super(obj, MY_CLASS), pager, group); - - if (spd->pager.obj) - { - int cnt, i; - Eo *item; - - efl_event_callback_add(spd->pager.group, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, obj); - efl_event_callback_add(spd->pager.group, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _move_cb, obj); - - pd->foreclip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, - evas_object_evas_get(spd->pager.obj)); - evas_object_static_clip_set(pd->foreclip, EINA_TRUE); - - pd->backclip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, - evas_object_evas_get(spd->pager.obj)); - evas_object_static_clip_set(pd->backclip, EINA_TRUE); - efl_gfx_entity_visible_set(pd->backclip, EINA_FALSE); - - cnt = efl_content_count(spd->pager.obj); - for (i = 0; i < cnt; i++) - { - item = efl_pack_content_get(spd->pager.obj, i); - efl_canvas_object_clipper_set(item, pd->backclip); - } - _page_info_allocate(pd, spd); - _page_info_geometry_change(pd, spd); - } -} - -EOLIAN static void -_efl_page_transition_scroll_page_size_set(Eo *obj, - Efl_Page_Transition_Scroll_Data *pd, - Eina_Size2D sz) -{ - EFL_PAGE_TRANSITION_DATA_GET(obj, spd); - - efl_page_transition_page_size_set(efl_super(obj, MY_CLASS), sz); - _page_info_geometry_change(pd, spd); -} - -EOLIAN static void -_efl_page_transition_scroll_padding_size_set(Eo *obj, - Efl_Page_Transition_Scroll_Data *pd, - int padding) -{ - EFL_PAGE_TRANSITION_DATA_GET(obj, spd); - - efl_page_transition_padding_size_set(efl_super(obj, MY_CLASS), padding); - _page_info_geometry_change(pd, spd); -} - -EOLIAN static void -_efl_page_transition_scroll_update(Eo *obj, - Efl_Page_Transition_Scroll_Data *pd, - double pos) -{ - EFL_PAGE_TRANSITION_DATA_GET(obj, spd); - - Page_Info *start, *dummy, *curr, *target; - Eo *tmp; - double t; - int tmp_id, curr_page, cnt; - - t = pos; - if (t < 0) t *= (-1); - - curr_page = efl_ui_pager_current_page_get(spd->pager.obj); - cnt = efl_content_count(spd->pager.obj); - - // while pages are scrolled, - // 1. the geometry of each page needs to be changed - // 2. if a page gets out of the viewport, it needs to be hidden - // 3. if a page gets into the viewport, it needs to be shown - - if (pos < 0) // if scrolled right, each page takes next page's position - { - start = pd->head; - dummy = pd->tail; - } - else // if scrolled left, each page takes prev page's position - { - start = pd->tail; - dummy = pd->head; - } - - if (dummy->visible) - { - efl_canvas_object_clipper_set(dummy->obj, pd->backclip); - efl_pack_unpack(dummy->obj, dummy->content); - efl_canvas_object_clipper_set(dummy->content, pd->backclip); - - dummy->content_num = -1; - dummy->content = NULL; - dummy->visible = EINA_FALSE; - } - - curr = start; - do - { - if (pos < 0) target = curr->next; - else target = curr->prev; - - EINA_RECTANGLE_SET(&curr->temp, - target->geometry.x * t + curr->geometry.x * (1 - t), - target->geometry.y, - target->geometry.w, - target->geometry.h); - efl_gfx_entity_geometry_set(curr->obj, (Eina_Rect) curr->temp); - - if (!eina_rectangles_intersect(&curr->temp, &pd->viewport)) - { - if (curr->visible) - { - efl_canvas_object_clipper_set(curr->obj, pd->backclip); - - efl_pack_unpack(curr->obj, curr->content); - efl_canvas_object_clipper_set(curr->content, pd->backclip); - - curr->content_num = -1; - curr->content = NULL; - curr->visible = EINA_FALSE; - } - } - else - { - tmp_id = curr_page + curr->pos; - if (spd->loop == EFL_UI_PAGER_LOOP_ENABLED) - tmp_id = (tmp_id + cnt) % cnt; - - if ((abs(curr->pos) < cnt) && - (tmp_id >= 0) && - (tmp_id < cnt)) - { - tmp = efl_pack_content_get(spd->pager.obj, tmp_id); - - if (curr->content != tmp) - { - if (curr->content) - { - efl_pack_unpack(curr->obj, curr->content); - efl_canvas_object_clipper_set(curr->content, pd->backclip); - } - - efl_canvas_object_clipper_set(curr->obj, pd->foreclip); - - efl_pack(curr->obj, tmp); - efl_canvas_object_clipper_set(tmp, pd->foreclip); - - curr->content_num = tmp_id; - curr->content = tmp; - curr->visible = EINA_TRUE; - } - } - else if (curr->content) - { - efl_canvas_object_clipper_set(curr->obj, pd->backclip); - - efl_pack_unpack(curr->obj, curr->content); - efl_canvas_object_clipper_set(curr->content, pd->backclip); - - curr->content_num = -1; - curr->content = NULL; - curr->visible = EINA_FALSE; - } - } - - curr = target; - - } while (target != dummy); -} - -EOLIAN static void -_efl_page_transition_scroll_pack(Eo *obj, - Efl_Page_Transition_Scroll_Data *pd, - int index) -{ - EFL_PAGE_TRANSITION_DATA_GET(obj, spd); - Eo *tmp; - - tmp = efl_pack_content_get(spd->pager.obj, index); - efl_canvas_object_clipper_set(tmp, pd->backclip); - - _efl_page_transition_scroll_update(obj, pd, 0.0); -} - -EOLIAN static void -_efl_page_transition_scroll_unpack_all(Eo *obj EINA_UNUSED, - Efl_Page_Transition_Scroll_Data *pd) -{ - Eina_List *list; - Page_Info *pi; - - EINA_LIST_FOREACH(pd->page_infos, list, pi) - { - efl_pack_unpack(pi->obj, pi->content); - - pi->content_num = -1; - pi->content = NULL; - pi->visible = EINA_FALSE; - } - return; -} - -EOLIAN static void -_efl_page_transition_scroll_curr_page_change(Eo *obj EINA_UNUSED, - Efl_Page_Transition_Scroll_Data *pd, - int diff) -{ - Eina_List *list; - Page_Info *pi, *target = NULL; - - // after the current page is changed, page infos need to be updated - // with a new id based on the new geometry of the boxes. - EINA_LIST_FOREACH(pd->page_infos, list, pi) - { - if (diff == 1) - { - pi->id = (pi->id - 1 + pd->page_info_num) % pd->page_info_num; - target = pi->prev; - } - else - { - pi->id = (pi->id + 1) % pd->page_info_num; - target = pi->next; - } - pi->pos = pi->id - (pd->side_page_num + 1); - - EINA_RECTANGLE_SET(&pi->temp, - target->geometry.x, - target->geometry.y, - target->geometry.w, - target->geometry.h); - } - - EINA_LIST_FOREACH(pd->page_infos, list, pi) - { - EINA_RECTANGLE_SET(&pi->geometry, - pi->temp.x, - pi->temp.y, - pi->temp.w, - pi->temp.h); - } - - if (diff == 1) - { - pd->head = pd->head->next; - pd->tail = pd->tail->next; - } - else - { - pd->head = pd->head->prev; - pd->tail = pd->tail->prev; - } -} - -EOLIAN static int -_efl_page_transition_scroll_side_page_num_get(const Eo *obj EINA_UNUSED, - Efl_Page_Transition_Scroll_Data *pd) -{ - return pd->side_page_num; -} - -static Page_Info * -_add_item(Efl_Page_Transition_Scroll_Data *pd, Efl_Page_Transition_Data *spd) -{ - Page_Info *pi; - - pi = calloc(1, sizeof(*pi)); - if (!pi) return NULL; - pi->obj = efl_add(EFL_UI_BOX_CLASS, spd->pager.obj); - efl_canvas_group_member_add(spd->pager.group, pi->obj); - pi->content_num = -1; - pi->content = NULL; - - pi->next = pd->head; - pd->head->prev = pi; - pi->prev = pd->tail; - pd->tail->next = pi; - - return pi; -} - -static void -_remove_item(Page_Info *pi, Efl_Page_Transition_Scroll_Data *pd) -{ - efl_canvas_object_clipper_set(pi->content, pd->backclip); - efl_pack_unpack(pi->obj, pi->content); - efl_del(pi->obj); - pi->prev->next = pi->next; - pi->next->prev = pi->prev; - pd->page_infos = eina_list_remove(pd->page_infos, pi); - free(pi); -} - -EOLIAN static void -_efl_page_transition_scroll_side_page_num_set(Eo *obj, - Efl_Page_Transition_Scroll_Data *pd, - int side_page_num) -{ - EFL_PAGE_TRANSITION_DATA_GET(obj, spd); - Page_Info *pi; - int delta, i; - - if (pd->side_page_num == side_page_num) return; - - delta = side_page_num - pd->side_page_num; - pd->side_page_num = side_page_num; - pd->page_info_num = (side_page_num * 2) + 3; - - if (!spd->pager.obj) return; - - if (delta > 0) - { - // side_page_num is increased, so add boxes at both ends by the diff - for (i = 0; i < delta; i++) - { - pi = _add_item(pd, spd); - pd->page_infos = eina_list_prepend_relative(pd->page_infos, pi, pd->head); - pd->head = pi; - efl_gfx_stack_below(pi->obj, pi->next->obj); - - pi = _add_item(pd, spd); - pd->page_infos = eina_list_append_relative(pd->page_infos, pi, pd->tail); - pd->tail = pi; - efl_gfx_stack_above(pi->obj, pi->prev->obj); - } - } - else - { - // side_page_num is decreased, so remove boxes at both ends by the diff - for (i = 0; i > delta; i--) - { - pi = pd->head; - pd->head = pi->next; - _remove_item(pi, pd); - - pi = pd->tail; - pd->tail = pi->prev; - _remove_item(pi, pd); - } - } - - pi = pd->head; - for (i = 0; i < pd->page_info_num; i++) - { - pi->id = i; - pi->pos = i - (pd->side_page_num + 1); - pi = pi->next; - } - - _page_info_geometry_change(pd, spd); -} - -EOLIAN static Eina_Bool -_efl_page_transition_scroll_loop_set(Eo *obj, - Efl_Page_Transition_Scroll_Data *pd, - Efl_Ui_Pager_Loop loop) -{ - EFL_PAGE_TRANSITION_DATA_GET(obj, spd); - int tmp_id, curr_page, cnt; - Page_Info *curr; - Eo *tmp; - - if (loop == efl_ui_pager_loop_mode_get(spd->pager.obj)) - return EINA_TRUE; - - if ((loop == EFL_UI_PAGER_LOOP_ENABLED) && - (efl_content_count(spd->pager.obj) < (pd->page_info_num - 1))) - return EINA_FALSE; - - efl_page_transition_loop_set(efl_super(obj, MY_CLASS), loop); - - curr_page = efl_ui_pager_current_page_get(spd->pager.obj); - cnt = efl_content_count(spd->pager.obj); - - curr = pd->head->next; - do - { - tmp_id = curr_page + curr->pos; - if ((tmp_id < 0) || (tmp_id >= cnt)) - { - switch (loop) - { - case EFL_UI_PAGER_LOOP_ENABLED: - tmp_id = (tmp_id + cnt) % cnt; - tmp = efl_pack_content_get(spd->pager.obj, tmp_id); - - efl_pack(curr->obj, tmp); - efl_canvas_object_clipper_set(tmp, pd->foreclip); - - curr->content_num = tmp_id; - curr->content = tmp; - curr->visible = EINA_TRUE; - - break; - - case EFL_UI_PAGER_LOOP_DISABLED: - efl_pack_unpack(curr->obj, curr->content); - efl_canvas_object_clipper_set(curr->content, pd->backclip); - - curr->content_num = -1; - curr->content = NULL; - curr->visible = EINA_FALSE; - - break; - } - } - - curr = curr->next; - - } while (curr != pd->tail); - - return EINA_TRUE; -} - -EOLIAN static Eo * -_efl_page_transition_scroll_efl_object_constructor(Eo *obj, - Efl_Page_Transition_Scroll_Data *pd) -{ - obj = efl_constructor(efl_super(obj, MY_CLASS)); - - pd->side_page_num = 1; - pd->page_info_num = pd->side_page_num * 2 + 3; - - return obj; -} - -EOLIAN static void -_efl_page_transition_scroll_efl_object_invalidate(Eo *obj, - Efl_Page_Transition_Scroll_Data *pd) -{ - Page_Info *pi; - - EINA_LIST_FREE(pd->page_infos, pi) - { - free(pi); - } - - efl_invalidate(efl_super(obj, MY_CLASS)); -} - - -#define EFL_PAGE_TRANSITION_SCROLL_EXTRA_OPS \ - EFL_OBJECT_OP_FUNC(efl_page_transition_update, \ - _efl_page_transition_scroll_update), \ - EFL_OBJECT_OP_FUNC(efl_page_transition_pack, \ - _efl_page_transition_scroll_pack), \ - EFL_OBJECT_OP_FUNC(efl_page_transition_unpack_all, \ - _efl_page_transition_scroll_unpack_all), \ - EFL_OBJECT_OP_FUNC(efl_page_transition_curr_page_change, \ - _efl_page_transition_scroll_curr_page_change), \ - EFL_OBJECT_OP_FUNC(efl_page_transition_page_size_set, \ - _efl_page_transition_scroll_page_size_set), \ - EFL_OBJECT_OP_FUNC(efl_page_transition_padding_size_set, \ - _efl_page_transition_scroll_padding_size_set), \ - EFL_OBJECT_OP_FUNC(efl_page_transition_loop_set, \ - _efl_page_transition_scroll_loop_set) - -#include "efl_page_transition_scroll.eo.c" diff --git a/src/lib/elementary/efl_page_transition_scroll.eo b/src/lib/elementary/efl_page_transition_scroll.eo deleted file mode 100644 index e9af63b224..0000000000 --- a/src/lib/elementary/efl_page_transition_scroll.eo +++ /dev/null @@ -1,22 +0,0 @@ -class @beta Efl.Page.Transition_Scroll extends Efl.Page.Transition -{ - [[Page transition for @Efl.Ui.Pager - - With this type of transition, pages are arranged linearly and move parallel - to the screen by scrolling. The current page is displayed at center, and - previous and next pages might be displayed optionally. - ]] - methods { - @property side_page_num { - [[The number of pages displayed on each side of the current page]] - values { - side_page_num: int; - } - } - } - implements { - Efl.Object.constructor; - Efl.Object.invalidate; - Efl.Page.Transition.bind; - } -} diff --git a/src/lib/elementary/efl_page_transition_scroll.h b/src/lib/elementary/efl_page_transition_scroll.h deleted file mode 100644 index adec47d3cd..0000000000 --- a/src/lib/elementary/efl_page_transition_scroll.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef EFL_PAGE_TRANSITION_SCROLL_H -#define EFL_PAGE_TRANSITION_SCROLL_H - -//#include "efl_ui_widget_pager.h" - - -/** - * This is a description on how scroll transition works. - * - * Regardless of the number of pages, scroll transition maintains a fixed number - * of boxes which can contain pages. The boxes move along with scrolling and - * some of them are emptied or filled as they come in or out of screen area. - * When pager is scrolled left or right, each box takes the position of its - * previous or next box. Since the leftmost and rightmost boxes might move in - * reverse direction, they shouldn't be visible. This is why there are dummy - * boxes at both ends. - * - * Here is an example of box arrangement change by scrolling. - * The pager has 10 pages, numbered from 1 to 10. - * The current page is page5, and side_page_num equals 1. - * - * head |----- screen area ----| tail - * (dummy) | | (dummy) - * ---------- ---------- ---------- ---------- ---------- - * | BOX1 | | BOX2 | | BOX3 | | BOX4 | | BOX5 | - * | | | | | | | | | | - * | (empty)| | page4 | | page5 | | page6 | | (empty)| - * | | | | | | | | | | - * | | | | | | | | | | - * | | | | | | | | | | - * ---------- ---------- ---------- ---------- ---------- - * | | - * |----------------------| - * - * After scrolling left, - * 1. each box takes the position of it's previous box. - * 2. head and tail is changed. - * 3. The box moved to the end is emptied. - * 4. The box moved from the end is filled with content. - * - * head tail - * ---------- ---------- ---------- ---------- ---------- - * | BOX2 | | BOX3 | | BOX4 | | BOX5 | | BOX1 | - * | | | | | | | | | | - * | (empty)| | page5 | | page6 | | page7 | | (empty)| - * |*emptied| | | | | |*filled | | | - * | | | | | | | | | | - * | | | | | | | | | | - * ---------- ---------- ---------- ---------- ---------- - * - */ - - -typedef struct _Page_Info -{ - Evas_Map *map; - int id; - int pos; - int content_num; - Eo *obj; - Eo *content; - - Eina_Rectangle geometry; - Eina_Rectangle temp; - - struct _Page_Info *prev, *next; - - Eina_Bool visible; - -} Page_Info; - -typedef struct _Efl_Page_Transition_Scroll_Data Efl_Page_Transition_Scroll_Data; - -struct _Efl_Page_Transition_Scroll_Data -{ - Eina_List *page_infos; - - Page_Info *head, *tail; - - int page_info_num; - int side_page_num; - - Eo *foreclip; - Eo *backclip; - Eina_Rectangle viewport; -}; - -#define EFL_PAGE_TRANSITION_SCROLL_DATA_GET(o, pd) \ - Efl_Page_Transition_Scroll_Data *pd = \ - efl_data_scope_get(o, EFL_PAGE_TRANSITION_SCROLL_CLASS) - -#endif diff --git a/src/lib/elementary/efl_ui_pager.c b/src/lib/elementary/efl_ui_pager.c deleted file mode 100644 index 69e89adf0a..0000000000 --- a/src/lib/elementary/efl_ui_pager.c +++ /dev/null @@ -1,973 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#define EFL_PACK_LAYOUT_PROTECTED - -#include -#include "elm_priv.h" -#include "efl_ui_widget_pager.h" -#include "efl_page_transition.h" - -#define MY_CLASS EFL_UI_PAGER_CLASS - -static void _unpack(Eo *obj, Efl_Ui_Pager_Data *pd, Efl_Gfx_Entity *subobj, int index); - -static int -clamp_index(Efl_Ui_Pager_Data *pd, int index) -{ - if (index < ((int)eina_list_count(pd->content_list)) * -1) - return -1; - else if (index > (int)eina_list_count(pd->content_list) - 1) - return 1; - return 0; -} - -static int -index_rollover(Efl_Ui_Pager_Data *pd, int index) -{ - int c = eina_list_count(pd->content_list); - if (index < c * -1) - return 0; - else if (index > c - 1) - return c - 1; - else if (index < 0) - return index + c; - return index; -} - -static void -_efl_ui_pager_update(Efl_Ui_Pager_Data *pd) -{ - if (pd->cnt == 0) return; - - if (pd->transition) - efl_page_transition_update(pd->transition, pd->curr.pos); - - if (pd->indicator) - efl_page_indicator_update(pd->indicator, pd->curr.pos); -} - -static void -_job(void *data) -{ - Evas_Object *obj = data; - EFL_UI_PAGER_DATA_GET(obj, pd); - - int prev_page, page_diff; - double prev_pos, pos_diff; - - prev_page = pd->curr.page; - prev_pos = pd->curr.pos; - - pd->job = NULL; - - pos_diff = ((double) pd->down.x - (double) pd->mouse_x) / (double) pd->w; - pd->curr.pos = pd->down.pos + pos_diff; - page_diff = (int) pd->curr.pos; - - //FIXME what if (prev_pos != 0.0) - if ((pd->loop == EFL_UI_PAGER_LOOP_DISABLED) && - (((prev_page == 0) && (pd->curr.pos < 0)) || - ((prev_page == (pd->cnt - 1)) && (pd->curr.pos > 0)))) - { - pd->curr.page = prev_page; - pd->curr.pos = prev_pos; - return; - } - - pd->curr.page = (pd->down.page + page_diff + pd->cnt) % pd->cnt; - pd->curr.pos -= page_diff; - - //FIXME what if (page_diff >= 2 || page_diff <= -2) - if (page_diff != 0) - { - pd->down.x = pd->mouse_x; - pd->down.y = pd->mouse_y; - pd->down.page = pd->curr.page; - pd->down.pos = pd->curr.pos; - - efl_page_transition_curr_page_change(pd->transition, page_diff); - } - - _efl_ui_pager_update(pd); - - return; -} - -static void -_page_set_animation(void *data, const Efl_Event *event) -{ - Efl_Ui_Pager_Data *pd = data; - double p = ecore_loop_time_get() - pd->change.start_time; - double d, temp_pos; - int temp_page; - - if (p >= 1.0) p = 1.0; - p = ecore_animator_pos_map(p, ECORE_POS_MAP_ACCELERATE, 0.0, 0.0); - - d = pd->change.src + pd->change.delta * p; - temp_page = d; - temp_pos = d - temp_page; - - if ((temp_page < pd->curr.page) && (fabs(pd->curr.page - d) < 1.0)) - { - temp_page += 1; - temp_pos -= 1.0; - } - - if (pd->curr.page != temp_page) - { - if (pd->change.delta < 0) - efl_page_transition_curr_page_change(pd->transition, -1); - else - efl_page_transition_curr_page_change(pd->transition, 1); - temp_pos = 0.0; - } - - pd->curr.page = temp_page; - pd->curr.pos = temp_pos; - - ERR("page %d pos %lf", pd->curr.page, pd->curr.pos); - - _efl_ui_pager_update(pd); - - if (EINA_DBL_EQ(p, 1.0)) - efl_event_callback_del(event->object, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, - _page_set_animation, pd); -} - -static void -_mouse_up_animation(void *data, const Efl_Event *event) -{ - Efl_Ui_Pager_Data *pd = data; - double p = ecore_loop_time_get() - pd->mouse_up_time; - - if (p >= 1.0) p = 1.0; - p = ecore_animator_pos_map(p, ECORE_POS_MAP_ACCELERATE, 0.0, 0.0); - - if (pd->curr.pos < 0.0) - { - if (pd->curr.pos > -0.5) - pd->curr.pos = pd->curr.pos * (1 - p); - else - pd->curr.pos = (-1) - (-1 - pd->curr.pos) * (1 - p); - } - else - { - if (pd->curr.pos < 0.5) - pd->curr.pos = pd->curr.pos * (1 - p); - else - pd->curr.pos = 1 - (1 - pd->curr.pos) * (1 - p); - } - - if (EINA_DBL_EQ(pd->curr.pos, 1.0)) - { - efl_page_transition_curr_page_change(pd->transition, 1); - pd->curr.page = (pd->curr.page + 1 + pd->cnt) % pd->cnt; - pd->curr.pos = 0.0; - } - else if (EINA_DBL_EQ(pd->curr.pos, -1.0)) - { - efl_page_transition_curr_page_change(pd->transition, -1); - pd->curr.page = (pd->curr.page - 1 + pd->cnt) % pd->cnt; - pd->curr.pos = 0.0; - } - - _efl_ui_pager_update(pd); - - if (EINA_DBL_EQ(p, 1.0)) - efl_event_callback_del(event->object, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, - _mouse_up_animation, pd); -} - -static void -_mouse_down_cb(void *data, - const Efl_Event *event) -{ - Efl_Input_Pointer *ev = event->info; - Eo *obj = data; - EFL_UI_PAGER_DATA_GET(obj, pd); - Eina_Position2D pos; - - if (efl_input_pointer_button_get(ev) != 1) return; - if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return; - - if (pd->cnt == 0) return; - - efl_event_callback_del(obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _mouse_up_animation, pd); - efl_event_callback_del(obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _page_set_animation, pd); - - pd->move_started = EINA_FALSE; - - pos = efl_input_pointer_position_get(ev); - pd->mouse_x = pos.x - pd->x; - pd->mouse_y = pos.y - pd->y; - - pd->down.enabled = EINA_TRUE; - pd->down.x = pd->mouse_x; - pd->down.y = pd->mouse_y; - pd->down.page = pd->curr.page; - pd->down.pos = pd->curr.pos; -} - -static void -_mouse_move_cb(void *data, - const Efl_Event *event) -{ - Efl_Input_Pointer *ev = event->info; - Eo *obj = data; - EFL_UI_PAGER_DATA_GET(obj, pd); - Eina_Position2D pos; - - if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return; - if (!pd->down.enabled) return; - - pos = efl_input_pointer_position_get(ev); - - if (pd->prev_block && (pd->mouse_x < (pos.x - pd->x))) return; - if (pd->next_block && (pd->mouse_x > (pos.x - pd->x))) return; - - pd->mouse_x = pos.x - pd->x; - pd->mouse_y = pos.y - pd->y; - - if (!pd->move_started) - { - Evas_Coord dx, dy; - dx = pd->mouse_x - pd->down.x; - dy = pd->mouse_y - pd->down.y; - - if (((dx * dx) + (dy * dy)) <= - (_elm_config->finger_size * _elm_config->finger_size / 4)) - return; - - pd->move_started = EINA_TRUE; - } - - ecore_job_del(pd->job); - pd->job = ecore_job_add(_job, obj); -} - -static void -_mouse_up_cb(void *data, - const Efl_Event *event) -{ - Efl_Input_Pointer *ev = event->info; - Eo *obj = data; - EFL_UI_PAGER_DATA_GET(obj, pd); - - if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return; - if (!pd->down.enabled) return; - - pd->down.enabled = EINA_FALSE; - - ELM_SAFE_FREE(pd->job, ecore_job_del); - - if (EINA_DBL_EQ(pd->curr.pos, 0.0)) return; - - pd->mouse_up_time = ecore_loop_time_get(); - - efl_event_callback_add(obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _mouse_up_animation, pd); -} - -//FIXME sub_object_parent_add? destruction -static void -_event_handler_create(Eo *obj, Efl_Ui_Pager_Data *pd) -{ - pd->event = efl_add(EFL_CANVAS_RECTANGLE_CLASS, - evas_object_evas_get(obj)); - evas_object_color_set(pd->event, 0, 0, 0, 0); - evas_object_repeat_events_set(pd->event, EINA_TRUE); - - efl_content_set(efl_part(obj, "efl.event"), pd->event); - - efl_event_callback_add(pd->event, EFL_EVENT_POINTER_DOWN, - _mouse_down_cb, obj); - efl_event_callback_add(pd->event, EFL_EVENT_POINTER_UP, - _mouse_up_cb, obj); - efl_event_callback_add(pd->event, EFL_EVENT_POINTER_MOVE, - _mouse_move_cb, obj); -} - -static void -_event_handler_del(Eo *obj, Efl_Ui_Pager_Data *pd) -{ - efl_content_unset(efl_part(obj, "efl.event")); - efl_del(pd->event); - pd->event = NULL; -} - -static void -_resize_cb(void *data, const Efl_Event *ev) -{ - Efl_Ui_Pager_Data *pd = data; - Eina_Size2D sz; - - sz = efl_gfx_entity_size_get(ev->object); - - pd->w = sz.w; - pd->h = sz.h; - - if (pd->fill_width) pd->page_spec.sz.w = pd->w; - if (pd->fill_height) pd->page_spec.sz.h = pd->h; - - if (pd->transition) - efl_page_transition_page_size_set(pd->transition, pd->page_spec.sz); - else - { - efl_gfx_entity_size_set(pd->foreclip, sz); - efl_gfx_entity_size_set(pd->page_box, pd->page_spec.sz); - efl_gfx_entity_position_set(pd->page_box, - EINA_POSITION2D(pd->x + (pd->w / 2) - (pd->page_spec.sz.w / 2), - pd->y + (pd->h / 2) - (pd->page_spec.sz.h / 2))); - } -} - -static void -_move_cb(void *data, const Efl_Event *ev) -{ - Efl_Ui_Pager_Data *pd = data; - Eina_Position2D pos; - - pos = efl_gfx_entity_position_get(ev->object); - - pd->x = pos.x; - pd->y = pos.y; - - if (!pd->transition) - { - efl_gfx_entity_position_set(pd->foreclip, pos); - efl_gfx_entity_position_set(pd->page_box, - EINA_POSITION2D(pd->x + (pd->w / 2) - (pd->page_spec.sz.w / 2), - pd->y + (pd->h / 2) - (pd->page_spec.sz.h / 2))); - } -} - -EOLIAN static Eo * -_efl_ui_pager_efl_object_constructor(Eo *obj, - Efl_Ui_Pager_Data *pd) -{ - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); - - if (!elm_widget_theme_klass_get(obj)) - elm_widget_theme_klass_set(obj, "pager"); - - obj = efl_constructor(efl_super(obj, MY_CLASS)); - - if (elm_widget_theme_object_set(obj, wd->resize_obj, - elm_widget_theme_klass_get(obj), - elm_widget_theme_element_get(obj), - elm_widget_theme_style_get(obj)) == EFL_UI_THEME_APPLY_ERROR_GENERIC) - CRI("Failed to set layout!"); - - pd->cnt = 0; - pd->loop = EFL_UI_PAGER_LOOP_DISABLED; - - pd->curr.page = -1; - pd->curr.pos = 0.0; - - pd->transition = NULL; - pd->indicator = NULL; - - pd->fill_width = EINA_TRUE; - pd->fill_height = EINA_TRUE; - - pd->page_spec.sz.w = -1; - pd->page_spec.sz.h = -1; - - elm_widget_can_focus_set(obj, EINA_TRUE); - - pd->page_root = efl_add(EFL_CANVAS_GROUP_CLASS, evas_object_evas_get(obj)); - efl_content_set(efl_part(obj, "efl.page_root"), pd->page_root); - - efl_event_callback_add(pd->page_root, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, pd); - efl_event_callback_add(pd->page_root, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _move_cb, pd); - - pd->page_box = efl_add(EFL_UI_BOX_CLASS, obj); - efl_ui_widget_internal_set(pd->page_box, EINA_TRUE); - efl_canvas_group_member_add(pd->page_root, pd->page_box); - - pd->foreclip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, - evas_object_evas_get(obj)); - efl_canvas_group_member_add(pd->page_root, pd->foreclip); - evas_object_static_clip_set(pd->foreclip, EINA_TRUE); - efl_canvas_object_clipper_set(pd->page_box, pd->foreclip); - - pd->backclip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, - evas_object_evas_get(obj)); - efl_canvas_group_member_add(pd->page_root, pd->backclip); - evas_object_static_clip_set(pd->backclip, EINA_TRUE); - efl_gfx_entity_visible_set(pd->backclip, EINA_FALSE); - - return obj; -} - -EOLIAN static void -_efl_ui_pager_efl_object_invalidate(Eo *obj, - Efl_Ui_Pager_Data *pd) -{ - efl_invalidate(efl_super(obj, MY_CLASS)); - - /* Since the parent of foreclip and backclip is evas, foreclip and backclip - * are not deleted automatically when pager is deleted. - * Therefore, foreclip and backclip are deleted manually here. */ - efl_del(pd->foreclip); - efl_del(pd->backclip); -} - -EOLIAN static int -_efl_ui_pager_efl_container_content_count(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd) -{ - return pd->cnt; -} - -static void -_child_inv(void *data, const Efl_Event *ev) -{ - Efl_Ui_Pager_Data *pd = efl_data_scope_get(data, EFL_UI_PAGER_CLASS); - int index = eina_list_data_idx(pd->content_list, ev->object); - - pd->content_list = eina_list_remove(pd->content_list, ev->object); - - if (((index == pd->curr.page) && ((index != 0) || (pd->cnt == 0))) || - (index < pd->curr.page)) - pd->curr.page--; - pd->cnt--; -} - -static Eina_Bool -_register_child(Eo *obj EINA_UNUSED, Efl_Ui_Pager_Data *pd, Efl_Gfx_Entity *subobj) -{ - if (eina_list_data_find(pd->content_list, subobj)) - { - ERR("Object already added!"); - return EINA_FALSE; - } - if (!efl_ui_widget_sub_object_add(obj, subobj)) - return EINA_FALSE; - - if (!pd->transition) - efl_canvas_object_clipper_set(subobj, pd->backclip); - - efl_event_callback_add(subobj, EFL_EVENT_INVALIDATE, _child_inv, obj); - - return EINA_TRUE; -} - -static void -_update_internals(Eo *obj EINA_UNUSED, Efl_Ui_Pager_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index) -{ - pd->cnt++; - - if (pd->curr.page >= index) - pd->curr.page++; - - if (pd->transition) - efl_page_transition_pack(pd->transition, index); - - if (pd->indicator) - efl_page_transition_pack(pd->indicator, index); - - if (pd->cnt == 1) - efl_ui_pager_current_page_set(obj, 0); -} - -EOLIAN static Eina_Bool -_efl_ui_pager_efl_pack_linear_pack_begin(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - Efl_Gfx_Entity *subobj) -{ - if (!_register_child(obj, pd, subobj)) return EINA_FALSE; - pd->content_list = eina_list_prepend(pd->content_list, subobj); - _update_internals(obj, pd, subobj, 0); - return EINA_TRUE; -} - -EOLIAN static Eina_Bool -_efl_ui_pager_efl_pack_linear_pack_end(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - Efl_Gfx_Entity *subobj) -{ - if (!_register_child(obj, pd, subobj)) return EINA_FALSE; - pd->content_list = eina_list_append(pd->content_list, subobj); - _update_internals(obj, pd, subobj, eina_list_count(pd->content_list) - 1); - return EINA_TRUE; -} - -EOLIAN static Eina_Bool -_efl_ui_pager_efl_pack_linear_pack_before(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - Efl_Gfx_Entity *subobj, - const Efl_Gfx_Entity *existing) -{ - if (!_register_child(obj, pd, subobj)) return EINA_FALSE; - int index = eina_list_data_idx(pd->content_list, (void *)existing); - if (index == -1) return EINA_FALSE; - pd->content_list = eina_list_prepend_relative(pd->content_list, subobj, existing); - _update_internals(obj, pd, subobj, index); - return EINA_TRUE; -} - -EOLIAN static Eina_Bool -_efl_ui_pager_efl_pack_linear_pack_after(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - Efl_Gfx_Entity *subobj, - const Efl_Gfx_Entity *existing) -{ - if (!_register_child(obj, pd, subobj)) return EINA_FALSE; - int index = eina_list_data_idx(pd->content_list, (void *)existing); - if (index == -1) return EINA_FALSE; - pd->content_list = eina_list_append_relative(pd->content_list, subobj, existing); - _update_internals(obj, pd, subobj, index + 1); - return EINA_TRUE; -} - -EOLIAN static Eina_Bool -_efl_ui_pager_efl_pack_linear_pack_at(Eo *obj, - Efl_Ui_Pager_Data *pd, - Efl_Gfx_Entity *subobj, - int index) -{ - if (index == pd->cnt) - { - _efl_ui_pager_efl_pack_linear_pack_end(obj, pd, subobj); - } - else - { - Efl_Gfx_Entity *existing = NULL; - - if (!_register_child(obj, pd, subobj)) return EINA_FALSE; - int clamp = clamp_index(pd, index); - int pass_index = -1; - if (clamp == 0) - { - existing = eina_list_nth(pd->content_list, index_rollover(pd, index)); - pd->content_list = eina_list_prepend_relative( - pd->content_list, subobj, existing); - } - else if (clamp == 1) - { - pd->content_list = eina_list_append(pd->content_list, subobj); - pass_index = eina_list_count(pd->content_list); - } - else - { - pd->content_list = eina_list_prepend(pd->content_list, subobj); - pass_index = 0; - } - _update_internals(obj, pd, subobj, pass_index); - } - - return EINA_TRUE; -} - -EOLIAN static Efl_Gfx_Entity * -_efl_ui_pager_efl_pack_linear_pack_content_get(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - int index) -{ - return eina_list_nth(pd->content_list, index_rollover(pd, index)); -} - -EOLIAN static int -_efl_ui_pager_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - const Efl_Gfx_Entity *subobj) -{ - return eina_list_data_idx(pd->content_list, (void *)subobj); -} - -EOLIAN static void -_efl_ui_pager_current_page_set(Eo *obj, - Efl_Ui_Pager_Data *pd, - int index) -{ - if (index == pd->curr.page) return; - - efl_event_callback_del(obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _mouse_up_animation, pd); - efl_event_callback_del(obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _page_set_animation, pd); - - if ((index < 0) || (index > (pd->cnt - 1))) - { - ERR("page set fail"); - return; - } - - if (!pd->transition) - { - Eo *curr; - - curr = eina_list_nth(pd->content_list, pd->curr.page); - if (curr) - efl_pack_unpack(pd->page_box, curr); - efl_canvas_object_clipper_set(curr, pd->backclip); - - pd->curr.page = index; - curr = eina_list_nth(pd->content_list, pd->curr.page); - efl_pack(pd->page_box, curr); - - if (pd->indicator) - efl_page_indicator_update(pd->indicator, pd->curr.pos); - - return; - } - - pd->change.src = pd->curr.page + pd->curr.pos; - pd->change.delta = index - pd->change.src; - - if (pd->change.delta == 0) return; - - pd->change.start_time = ecore_loop_time_get(); - efl_event_callback_add(obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _page_set_animation, pd); -} - -EOLIAN static int -_efl_ui_pager_current_page_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd) -{ - return pd->curr.page; -} - -EOLIAN static void -_efl_ui_pager_transition_set(Eo *obj, - Efl_Ui_Pager_Data *pd, - Efl_Page_Transition *transition) -{ - if (!EINA_DBL_EQ(pd->curr.pos, 0.0)) return; - - if (pd->transition == transition) return; - - if (pd->transition) - efl_page_transition_bind(pd->transition, NULL, NULL); - else - { - Eo *curr; - - curr = eina_list_nth(pd->content_list, pd->curr.page); - efl_pack_unpack(pd->page_box, curr); - efl_canvas_object_clipper_set(pd->page_box, pd->backclip); - } - - pd->transition = transition; - - if (pd->transition) - { - if (!pd->event) _event_handler_create(obj, pd); - efl_page_transition_bind(pd->transition, obj, pd->page_root); - } - else - { - Eina_List *list; - Eo *curr; - - _event_handler_del(obj, pd); - - efl_canvas_object_clipper_set(pd->page_box, pd->foreclip); - - EINA_LIST_FOREACH(pd->content_list, list, curr) - { - efl_canvas_object_clipper_set(curr, pd->backclip); - } - - curr = eina_list_nth(pd->content_list, pd->curr.page); - efl_pack(pd->page_box, curr); - } -} - -EOLIAN static void -_efl_ui_pager_indicator_set(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - Efl_Page_Indicator *indicator) -{ - if (pd->indicator == indicator) return; - - if (pd->indicator) - { - efl_page_indicator_bind(pd->indicator, NULL, NULL); - pd->indicator = NULL; - } - - pd->indicator = indicator; - - if (!pd->indicator) - { - if (pd->idbox) - { - efl_del(pd->idbox); - pd->idbox = NULL; - } - return; - } - - if (!pd->idbox) - { - pd->idbox = efl_add(EFL_UI_BOX_CLASS, obj); - efl_ui_widget_internal_set(pd->idbox, EINA_TRUE); - efl_content_set(efl_part(obj, "efl.indicator"), pd->idbox); - } - - efl_page_indicator_bind(pd->indicator, obj, pd->idbox); -} - -EOLIAN Eina_Size2D -_efl_ui_pager_page_size_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd) -{ - return pd->page_spec.sz; -} - -EOLIAN static void -_efl_ui_pager_page_size_set(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - Eina_Size2D sz) -{ - if (sz.w < -1 || sz.h < -1) return; - - if (sz.w == -1) - { - pd->fill_width = EINA_TRUE; - pd->page_spec.sz.w = pd->w; - } - else - { - pd->fill_width = EINA_FALSE; - pd->page_spec.sz.w = sz.w; - } - if (sz.h == -1) - { - pd->fill_height = EINA_TRUE; - pd->page_spec.sz.h = pd->h; - } - else - { - pd->fill_height = EINA_FALSE; - pd->page_spec.sz.h = sz.h; - } - - if (pd->transition) - efl_page_transition_page_size_set(pd->transition, pd->page_spec.sz); - else - { - efl_gfx_entity_size_set(pd->page_box, pd->page_spec.sz); - efl_gfx_entity_position_set(pd->page_box, - EINA_POSITION2D(pd->x + (pd->w / 2) - (pd->page_spec.sz.w / 2), - pd->y + (pd->h / 2) - (pd->page_spec.sz.h / 2))); - } -} - -EOLIAN static int -_efl_ui_pager_padding_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd) -{ - return pd->page_spec.padding; -} - -EOLIAN static void -_efl_ui_pager_padding_set(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - int padding) -{ - pd->page_spec.padding = padding; - - if (pd->transition) - efl_page_transition_padding_size_set(pd->transition, padding); -} - -EOLIAN static void -_efl_ui_pager_scroll_block_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - Eina_Bool *prev, - Eina_Bool *next) -{ - if (prev) *prev = pd->prev_block; - if (next) *next = pd->next_block; -} - -EOLIAN static void -_efl_ui_pager_scroll_block_set(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - Eina_Bool prev, - Eina_Bool next) -{ - pd->prev_block = prev; - pd->next_block = next; -} - -EOLIAN static Eina_Bool -_efl_ui_pager_loop_mode_set(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - Efl_Ui_Pager_Loop loop) -{ - if (pd->loop == loop) return EINA_TRUE; - - if (!pd->transition) return EINA_FALSE; - - if (efl_page_transition_loop_set(pd->transition, loop)) - { - pd->loop = loop; - return EINA_TRUE; - } - else return EINA_FALSE; -} - -EOLIAN static Efl_Ui_Pager_Loop -_efl_ui_pager_loop_mode_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd) -{ - return pd->loop; -} - -static void -_unpack_all(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd, - Eina_Bool clear) -{ - Eo *subobj; - - pd->cnt = 0; - pd->curr.page = -1; - pd->curr.pos = 0.0; - - if (pd->transition) - { - efl_page_transition_unpack_all(pd->transition); - } - else - { - subobj = eina_list_nth(pd->content_list, pd->curr.page); - if (subobj) - efl_pack_unpack(pd->page_box, subobj); - pd->curr.page = -1; - } - - if (clear) - { - EINA_LIST_FREE(pd->content_list, subobj) - { - efl_event_callback_del(subobj, EFL_EVENT_INVALIDATE, _child_inv, obj); - evas_object_del(subobj); - } - } - else - { - EINA_LIST_FREE(pd->content_list, subobj) - { - efl_event_callback_del(subobj, EFL_EVENT_INVALIDATE, _child_inv, obj); - efl_canvas_object_clipper_set(subobj, NULL); - } - } - - if (pd->indicator) - { - efl_page_indicator_unpack_all(pd->indicator); - } -} - -EOLIAN static Eina_Bool -_efl_ui_pager_efl_pack_pack_clear(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd) -{ - _unpack_all(obj, pd, EINA_TRUE); - - return EINA_TRUE; -} - -EOLIAN static Eina_Bool -_efl_ui_pager_efl_pack_unpack_all(Eo *obj EINA_UNUSED, - Efl_Ui_Pager_Data *pd) -{ - _unpack_all(obj, pd, EINA_FALSE); - - return EINA_TRUE; -} - -static void -_unpack(Eo *obj, - Efl_Ui_Pager_Data *pd, - Efl_Gfx_Entity *subobj, - int index) -{ - int self_index = eina_list_data_idx(pd->content_list, subobj); - int self_curr_page = pd->curr.page; - pd->content_list = eina_list_remove(pd->content_list, subobj); - pd->cnt--; - _elm_widget_sub_object_redirect_to_top(obj, subobj); - - if (((index == pd->curr.page) && ((index != 0) || (pd->cnt == 0))) || - (index < pd->curr.page)) - pd->curr.page--; - - if (pd->transition) - { - // if the number of pages is not enough after unpacking a page, - // loop mode needs to be disabled - if (pd->loop == EFL_UI_PAGER_LOOP_ENABLED) - { - _efl_ui_pager_loop_mode_set(obj, pd, EFL_UI_PAGER_LOOP_DISABLED); - _efl_ui_pager_loop_mode_set(obj, pd, EFL_UI_PAGER_LOOP_ENABLED); - } - efl_page_transition_update(pd->transition, pd->curr.pos); - } - else - { - if (self_curr_page == self_index) - { - efl_pack_unpack(pd->page_box, subobj); - self_curr_page = pd->curr.page; - pd->curr.page = -1; - efl_ui_pager_current_page_set(obj, self_curr_page); - } - } - - if (pd->indicator) - efl_page_indicator_unpack(pd->indicator, index); - - efl_event_callback_del(subobj, EFL_EVENT_INVALIDATE, _child_inv, obj); -} - -EOLIAN static Eina_Bool -_efl_ui_pager_efl_pack_unpack(Eo *obj, - Efl_Ui_Pager_Data *pd, - Efl_Gfx_Entity *subobj) -{ - if (!subobj) return EINA_FALSE; - - int index = eina_list_data_idx(pd->content_list, subobj); - if (index == -1) - { - ERR("You can only unpack items that have been added before"); - return EINA_FALSE; - } - - _unpack(obj, pd, subobj, index); - - return EINA_TRUE; -} - -EOLIAN static Efl_Gfx_Entity * -_efl_ui_pager_efl_pack_linear_pack_unpack_at(Eo *obj, - Efl_Ui_Pager_Data *pd, - int index) -{ - Efl_Gfx_Entity *subobj = eina_list_nth(pd->content_list, index_rollover(pd, index_rollover(pd, index))); - - _unpack(obj, pd, subobj, index); - - return subobj; -} - -EOLIAN static Eina_Bool -_efl_ui_pager_efl_pack_pack(Eo *obj, Efl_Ui_Pager_Data *pd EINA_UNUSED, Efl_Gfx_Entity *subobj) -{ - return efl_pack_begin(obj, subobj); -} - -EOLIAN static Eina_Iterator* -_efl_ui_pager_efl_container_content_iterate(Eo *obj EINA_UNUSED, Efl_Ui_Pager_Data *pd) -{ - return eina_list_iterator_new(pd->content_list); -} - - -#include "efl_ui_pager.eo.c" diff --git a/src/lib/elementary/efl_ui_pager.eo b/src/lib/elementary/efl_ui_pager.eo deleted file mode 100644 index 7389fd8e08..0000000000 --- a/src/lib/elementary/efl_ui_pager.eo +++ /dev/null @@ -1,109 +0,0 @@ -enum @beta Efl.Ui.Pager_Loop -{ - [[Efl ui pager loop mode]] - disabled, - enabled -} - -class @beta Efl.Ui.Pager extends Efl.Ui.Layout_Base implements Efl.Pack_Linear -{ - [[Pager widget - - A pager contains many pages in a linear fashion and allows users to scroll - through pages. Each page is numbered according to linear order and - one of the pages is marked as 'current page' and displayed in the middle. - The way each page is displayed is defined by @Efl.Page.Transition object, - allowing users to adopt different types of transition. - The most common use case of this widget is the home screen of mobile devices. - ]] - methods { - @property transition { - [[Page transition effect - - Page transition is in charge of displaying pages in a specific way and - invoked every time page layout needs to be updated. - ]] - set { - [[Set a page transition effect]] - } - values { - transition: Efl.Page.Transition; [[transition effect]] - } - } - @property indicator { - [[Page indicator - - Page indicator, located on the top layer of pager widget, helps users - to know the number of pages and the current page's index without scrolling. - ]] - set { - [[Set a page indicator]] - } - values { - indicator: Efl.Page.Indicator; [[indicator class]] - } - } - @property current_page { - [[One page is selected as the current page and mainly displayed.]] - set { - [[Set one page as current page]] - } - get { - [[Get the current page]] - } - values { - index: int; - } - } - @property scroll_block { - [[Pages can be scrolled back and forth by default. This property allows - limiting the direction of scrolling, or blocking scroll gesture at all. - ]] - values { - prev: bool; - next: bool; - } - } - @property loop_mode { - [[Pager is not scrolled after it's scrolled to the end by default. - This property gives the option to make a loop through pages. - ]] - set { - return: bool; [[$true on success, $false otherwise]] - } - get { - } - values { - loop: Efl.Ui.Pager_Loop; - } - } - @property page_size { - values { - size: Eina.Size2D; - } - } - @property padding { - values { - padding: int; - } - } - } - implements { - Efl.Object.constructor; - Efl.Object.invalidate; - Efl.Container.content_count; - Efl.Container.content_iterate; - Efl.Pack.pack_clear; //TODO - Efl.Pack.unpack_all; //TODO - Efl.Pack.unpack; //TODO - Efl.Pack.pack; - Efl.Pack_Linear.pack_begin; - Efl.Pack_Linear.pack_end; - Efl.Pack_Linear.pack_before; - Efl.Pack_Linear.pack_after; - Efl.Pack_Linear.pack_at; - Efl.Pack_Linear.pack_content_get; - Efl.Pack_Linear.pack_index_get; - Efl.Pack_Linear.pack_unpack_at; //TODO - } -} diff --git a/src/lib/elementary/efl_ui_tab_pager.c b/src/lib/elementary/efl_ui_tab_pager.c index de96213219..98569154c4 100644 --- a/src/lib/elementary/efl_ui_tab_pager.c +++ b/src/lib/elementary/efl_ui_tab_pager.c @@ -8,7 +8,6 @@ #include "efl_ui_tab_pager_private.h" #include "efl_ui_tab_page_private.h" -#include "efl_ui_widget_pager.h" #define MY_CLASS EFL_UI_TAB_PAGER_CLASS diff --git a/src/lib/elementary/efl_ui_widget_pager.h b/src/lib/elementary/efl_ui_widget_pager.h deleted file mode 100644 index d01cc29a5f..0000000000 --- a/src/lib/elementary/efl_ui_widget_pager.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef EFL_UI_WIDGET_PAGER_H -#define EFL_UI_WIDGET_PAGER_H - - -#include - -#include "efl_page_transition.h" - -typedef struct _Efl_Ui_Pager_Data -{ - Eina_List *page_infos; - Eina_List *content_list; - - Efl_Ui_Box *page_box; - Eo *foreclip; - Eo *backclip; - - Eo *page_root; - Eo *event; - Efl_Ui_Box *idbox; - Ecore_Job *job; - Ecore_Job *page_info_job; - - Evas_Coord x, y, w, h; - Evas_Coord mouse_x, mouse_y; - - struct { - Eina_Size2D sz; - Evas_Coord padding; - } page_spec; - - struct { - Evas_Coord x, y; - int page; - double pos; - Eina_Bool enabled; - } down; - - struct { - int page; - double pos; - } curr; - - struct { - double src; - double delta; - double start_time; - Eina_Bool jump; - } change; - - int cnt; - double mouse_up_time; - - Efl_Ui_Pager_Loop loop; - Efl_Page_Transition *transition; - Efl_Page_Indicator *indicator; - - Eina_Bool move_started : 1; - Eina_Bool prev_block : 1; - Eina_Bool next_block: 1; - Eina_Bool fill_width: 1; - Eina_Bool fill_height: 1; - -} Efl_Ui_Pager_Data; - -#define EFL_UI_PAGER_DATA_GET(o, sd) \ - Efl_Ui_Pager_Data *sd = efl_data_scope_get(o, EFL_UI_PAGER_CLASS) - -#endif diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index 2b2e8aa117..c8422bf5eb 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -871,19 +871,6 @@ void *_elm_icon_signal_callback_del(Evas_Object *obj, void _elm_widget_full_eval(Eo *obj); void _elm_widget_full_eval_children(Eo *obj, Elm_Widget_Smart_Data *pd); -EOAPI void efl_page_transition_page_size_set(Eo *obj, Eina_Size2D sz); -EOAPI void efl_page_transition_padding_size_set(Eo *obj, int padding); -EOAPI void efl_page_transition_update(Eo *obj, double pos); -EOAPI void efl_page_transition_pack(Eo *obj, int index); -EOAPI void efl_page_transition_unpack_all(Eo *obj); -EOAPI void efl_page_transition_curr_page_change(Eo *obj, int diff); -EOAPI Eina_Bool efl_page_transition_loop_set(Eo *obj, Efl_Ui_Pager_Loop loop); - -EOAPI void efl_page_indicator_update(Eo *obj, double pos); -EOAPI void efl_page_indicator_pack(Eo *obj, int index); -EOAPI void efl_page_indicator_unpack(Eo *obj, int index); -EOAPI void efl_page_indicator_unpack_all(Eo *obj); - Eina_Bool _elm_config_accel_preference_parse(const char *pref, Eina_Stringshare **accel, int *gl_depth, int *gl_stencil, int *gl_msaa); extern char *_elm_appname; diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index cb85beba17..695817a242 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -153,17 +153,12 @@ pub_eo_files = [ 'efl_ui_dnd.eo', 'efl_ui_dnd_container.eo', 'efl_ui_focus_manager_window_root.eo', - 'efl_ui_pager.eo', 'efl_ui_active_view_container.eo', 'efl_ui_active_view_view_manager.eo', 'efl_ui_active_view_view_manager_scroll.eo', 'efl_ui_active_view_view_manager_stack.eo', 'efl_ui_active_view_indicator.eo', 'efl_ui_active_view_indicator_icon.eo', - 'efl_page_transition.eo', - 'efl_page_transition_scroll.eo', - 'efl_page_indicator.eo', - 'efl_page_indicator_icon.eo', 'efl_ui_tab_pager.eo', 'efl_ui_tab_bar.eo', 'efl_ui_tab_page.eo', @@ -377,11 +372,6 @@ elementary_headers_unstable = [ 'efl_ui_widget_pan.h', 'efl_ui_nstate_private.h', 'Efl_Ui.h', - 'efl_ui_widget_pager.h', - 'efl_page_transition.h', - 'efl_page_transition_scroll.h', - 'efl_page_indicator.h', - 'efl_page_indicator_icon.h', 'efl_ui_tab_pager_private.h', 'efl_ui_tab_bar_private.h', 'efl_ui_tab_page_private.h', @@ -923,7 +913,6 @@ elementary_src = [ 'efl_datetime_manager.c', 'efl_ui_dnd.c', 'elm_focus_legacy.c', - 'efl_ui_pager.c', 'efl_ui_active_view_container.c', 'efl_ui_active_view_view_manager.c', 'efl_ui_active_view_view_manager_plain.c', @@ -931,10 +920,6 @@ elementary_src = [ 'efl_ui_active_view_view_manager_stack.c', 'efl_ui_active_view_indicator.c', 'efl_ui_active_view_indicator_icon.c', - 'efl_page_transition.c', - 'efl_page_transition_scroll.c', - 'efl_page_indicator.c', - 'efl_page_indicator_icon.c', 'efl_ui_focus_graph.h', 'efl_ui_focus_graph.c', 'efl_ui_tab_pager.c', diff --git a/src/tests/elementary/spec/efl_test_pack_linear.c b/src/tests/elementary/spec/efl_test_pack_linear.c index 148f8a0995..ede81ae5d4 100644 --- a/src/tests/elementary/spec/efl_test_pack_linear.c +++ b/src/tests/elementary/spec/efl_test_pack_linear.c @@ -9,7 +9,7 @@ /* spec-meta-start {"test-interface":"Efl.Pack_Linear", - "test-widgets": ["Efl.Ui.Box", "Efl.Ui.Grid", "Efl.Ui.Pager", "Efl.Ui.Active_View.Container"], + "test-widgets": ["Efl.Ui.Box", "Efl.Ui.Grid", "Efl.Ui.Active_View.Container"], "custom-mapping" : { "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS" }