jackdanielz pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=00650ef7b1982c359163f8f3ab39e64f02778fd1
commit 00650ef7b1982c359163f8f3ab39e64f02778fd1 Author: Daniel Zaoui <[email protected]> Date: Sun Mar 23 11:14:48 2014 +0200 Eolian: Integration of Flip --- src/lib/Makefile.am | 10 +- src/lib/elm_flip.c | 391 +++++++++++----------------------------------- src/lib/elm_flip.eo | 264 +++++++++++++++++++++++++++++++ src/lib/elm_flip_eo.h | 4 + src/lib/elm_widget_flip.h | 6 +- 5 files changed, 370 insertions(+), 305 deletions(-) diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 598d5a3..a1f8bd7 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -583,7 +583,9 @@ BUILT_SOURCES = \ elm_diskselector.eo.c \ elm_diskselector.eo.h \ elm_entry.eo.c \ - elm_entry.eo.h + elm_entry.eo.h \ + elm_flip.eo.c \ + elm_flip.eo.h EXTRA_DIST += \ elm_widget.eo \ @@ -615,7 +617,8 @@ EXTRA_DIST += \ elm_datetime.eo \ elm_dayselector.eo \ elm_diskselector.eo \ - elm_entry.eo + elm_entry.eo \ + elm_flip.eo nodist_includesunstable_HEADERS = \ elm_widget.eo.h \ @@ -647,5 +650,6 @@ nodist_includesunstable_HEADERS = \ elm_datetime.eo.h \ elm_dayselector.eo.h \ elm_diskselector.eo.h \ - elm_entry.eo.h + elm_entry.eo.h \ + elm_flip.eo.h diff --git a/src/lib/elm_flip.c b/src/lib/elm_flip.c index da313db..0b12934 100644 --- a/src/lib/elm_flip.c +++ b/src/lib/elm_flip.c @@ -7,8 +7,6 @@ #include "elm_widget_flip.h" #include "elm_widget_container.h" -EAPI Eo_Op ELM_OBJ_FLIP_BASE_ID = EO_NOOP; - #define MY_CLASS ELM_OBJ_FLIP_CLASS #define MY_CLASS_NAME "Elm_Flip" @@ -32,7 +30,7 @@ _slice_free(Slice *sl) } static void -_state_slices_clear(Elm_Flip_Smart_Data *sd) +_state_slices_clear(Elm_Flip_Data *sd) { int i, j, num; @@ -93,66 +91,48 @@ _sizing_eval(Evas_Object *obj) evas_object_size_hint_max_set(obj, maxw, maxh); } -static void -_elm_flip_smart_theme(Eo *obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elm_flip_elm_widget_theme_apply(Eo *obj, Elm_Flip_Data *sd EINA_UNUSED) { - Eina_Bool *ret = va_arg(*list, Eina_Bool *); Eina_Bool int_ret; - if (ret) *ret = EINA_FALSE; - eo_do_super(obj, MY_CLASS, elm_obj_widget_theme_apply(&int_ret)); - if (!int_ret) return; + if (!int_ret) return EINA_FALSE; _sizing_eval(obj); - if (ret) *ret = EINA_TRUE; + return EINA_TRUE; } -static void -_elm_flip_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elm_flip_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Flip_Data *_pd EINA_UNUSED) { - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - *ret = EINA_TRUE; + return EINA_TRUE; } -static void -_elm_flip_smart_focus_next(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elm_flip_elm_widget_focus_next(Eo *obj EINA_UNUSED, Elm_Flip_Data *sd, Elm_Focus_Direction dir, Evas_Object **next) { - Elm_Focus_Direction dir = va_arg(*list, Elm_Focus_Direction); - Evas_Object **next = va_arg(*list, Evas_Object **); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - Eina_Bool int_ret; - Elm_Flip_Smart_Data *sd = _pd; /* attempt to cycle focus on in sub-items */ if (sd->state) - int_ret = elm_widget_focus_next_get(sd->front.content, dir, next); + return elm_widget_focus_next_get(sd->front.content, dir, next); else - int_ret = elm_widget_focus_next_get(sd->back.content, dir, next); - if (ret) *ret = int_ret; + return elm_widget_focus_next_get(sd->back.content, dir, next); } -static void -_elm_flip_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elm_flip_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Flip_Data *_pd EINA_UNUSED) { - Eina_Bool *ret = va_arg(*list, Eina_Bool *); if (!elm_widget_can_focus_get(obj)) - *ret = EINA_TRUE; + return EINA_TRUE; else - *ret = EINA_FALSE; + return EINA_FALSE; } -static void -_elm_flip_smart_focus_direction(Eo *obj, void *_pd, va_list *list) +EOLIAN static Eina_Bool +_elm_flip_elm_widget_focus_direction(Eo *obj, Elm_Flip_Data *sd, const Evas_Object *base, double degree, Evas_Object **direction, double *weight) { - Evas_Object *base = va_arg(*list, Evas_Object *); - double degree = va_arg(*list, double); - Evas_Object **direction = va_arg(*list, Evas_Object **); - double *weight = va_arg(*list, double *); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - if (ret) *ret = EINA_FALSE; - Eina_Bool int_ret; - Elm_Flip_Smart_Data *sd = _pd; + Eina_Bool ret; Eina_List *l = NULL; void *(*list_data_get)(const Eina_List *list); @@ -164,11 +144,12 @@ _elm_flip_smart_focus_direction(Eo *obj, void *_pd, va_list *list) if (sd->back.content) l = eina_list_append(l, sd->back.content); - int_ret = elm_widget_focus_list_direction_get + ret = elm_widget_focus_list_direction_get (obj, base, l, list_data_get, degree, direction, weight); - if (ret) *ret = int_ret; eina_list_free(l); + + return ret; } static void @@ -180,41 +161,33 @@ _changed_size_hints_cb(void *data, _sizing_eval(data); } -static void -_elm_flip_smart_sub_object_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elm_flip_elm_widget_sub_object_add(Eo *obj, Elm_Flip_Data *_pd EINA_UNUSED, Evas_Object *sobj) { - Evas_Object *sobj = va_arg(*list, Evas_Object *); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); Eina_Bool int_ret; - if (ret) *ret = EINA_FALSE; if (evas_object_data_get(sobj, "elm-parent") == obj) - goto end; + return EINA_TRUE; eo_do_super(obj, MY_CLASS, elm_obj_widget_sub_object_add(sobj, &int_ret)); - if (!int_ret) return; + if (!int_ret) return EINA_FALSE; evas_object_data_set(sobj, "_elm_leaveme", sobj); evas_object_smart_member_add(sobj, obj); evas_object_event_callback_add (sobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints_cb, obj); -end: - if (ret) *ret = EINA_TRUE; + return EINA_TRUE; } -static void -_elm_flip_smart_sub_object_del(Eo *obj, void *_pd, va_list *list) +EOLIAN static Eina_Bool +_elm_flip_elm_widget_sub_object_del(Eo *obj, Elm_Flip_Data *sd, Evas_Object *sobj) { - Evas_Object *sobj = va_arg(*list, Evas_Object *); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); Eina_Bool int_ret; - if (ret) *ret = EINA_FALSE; - Elm_Flip_Smart_Data *sd = _pd; eo_do_super(obj, MY_CLASS, elm_obj_widget_sub_object_del(sobj, &int_ret)); - if (!int_ret) return; + if (!int_ret) return EINA_FALSE; if (sobj == sd->front.content) { @@ -236,7 +209,7 @@ _elm_flip_smart_sub_object_del(Eo *obj, void *_pd, va_list *list) (sobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints_cb, obj); _sizing_eval(obj); - if (ret) *ret = EINA_TRUE; + return EINA_TRUE; } static Slice * @@ -260,7 +233,7 @@ _slice_new(Evas_Object *container_obj, } static void -_slice_apply(Elm_Flip_Smart_Data *sd, +_slice_apply(Elm_Flip_Data *sd, Slice *sl, Evas_Coord x EINA_UNUSED, Evas_Coord y EINA_UNUSED, @@ -317,7 +290,7 @@ _slice_apply(Elm_Flip_Smart_Data *sd, } static void -_slice_3d(Elm_Flip_Smart_Data *sd EINA_UNUSED, +_slice_3d(Elm_Flip_Data *sd EINA_UNUSED, Slice *sl, Evas_Coord x, Evas_Coord y, @@ -345,7 +318,7 @@ _slice_3d(Elm_Flip_Smart_Data *sd EINA_UNUSED, } static void -_slice_light(Elm_Flip_Smart_Data *sd EINA_UNUSED, +_slice_light(Elm_Flip_Data *sd EINA_UNUSED, Slice *sl, Evas_Coord x, Evas_Coord y, @@ -381,7 +354,7 @@ _slice_light(Elm_Flip_Smart_Data *sd EINA_UNUSED, } static void -_slice_xyz(Elm_Flip_Smart_Data *sd EINA_UNUSED, +_slice_xyz(Elm_Flip_Data *sd EINA_UNUSED, Slice *sl, double xx1, double yy1, @@ -403,7 +376,7 @@ _slice_xyz(Elm_Flip_Smart_Data *sd EINA_UNUSED, } static void -_slice_uv(Elm_Flip_Smart_Data *sd EINA_UNUSED, +_slice_uv(Elm_Flip_Data *sd EINA_UNUSED, Slice *sl, double u1, double v1, @@ -531,7 +504,7 @@ _slice_obj_vert_color_merge(Slice *s1, static int _state_update(Evas_Object *obj) { - Elm_Flip_Smart_Data *sd = eo_data_scope_get(obj, MY_CLASS); + Elm_Flip_Data *sd = eo_data_scope_get(obj, MY_CLASS); Slice *sl; Vertex3 *tvo, *tvol; Evas_Object *front, *back; @@ -891,7 +864,7 @@ _state_update(Evas_Object *obj) } static void -_state_end(Elm_Flip_Smart_Data *sd) +_state_end(Elm_Flip_Data *sd) { _state_slices_clear(sd); } @@ -1393,7 +1366,7 @@ _animate(void *data) static double _pos_get(Evas_Object *obj, - Elm_Flip_Smart_Data *sd, + Elm_Flip_Data *sd, int *rev, Elm_Flip_Mode *m) { @@ -1470,7 +1443,7 @@ static Eina_Bool _event_anim(void *data, double pos) { - Elm_Flip_Smart_Data *sd = data; + Elm_Flip_Data *sd = data; double p; p = ecore_animator_pos_map(pos, ECORE_POS_MAP_ACCELERATE, 0.0, 0.0); @@ -1548,7 +1521,7 @@ _update_job(void *data) { Elm_Flip_Mode m = ELM_FLIP_ROTATE_X_CENTER_AXIS; Evas_Object *obj = data; - Elm_Flip_Smart_Data *sd = eo_data_scope_get(obj, MY_CLASS); + Elm_Flip_Data *sd = eo_data_scope_get(obj, MY_CLASS); int rev = 0; double p; @@ -1794,55 +1767,39 @@ _flip_content_unset(Evas_Object *obj, return content; } -static void -_elm_flip_smart_content_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Eina_Bool +_elm_flip_elm_container_content_set(Eo *obj, Elm_Flip_Data *_pd EINA_UNUSED, const char *part, Evas_Object *content) { - const char *part = va_arg(*list, const char *); - Evas_Object *content = va_arg(*list, Evas_Object *); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - Eina_Bool int_ret = EINA_FALSE; - if (!part || !strcmp(part, "front")) - int_ret = _flip_content_set(obj, content, EINA_TRUE); + return _flip_content_set(obj, content, EINA_TRUE); else if (!strcmp(part, "back")) - int_ret = _flip_content_set(obj, content, EINA_FALSE); - - if (ret) *ret = int_ret; + return _flip_content_set(obj, content, EINA_FALSE); + return EINA_FALSE; } -static void -_elm_flip_smart_content_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static Evas_Object* +_elm_flip_elm_container_content_get(Eo *obj EINA_UNUSED, Elm_Flip_Data *sd, const char *part) { - const char *part = va_arg(*list, const char *); - Evas_Object **ret = va_arg(*list, Evas_Object **); - Elm_Flip_Smart_Data *sd = _pd; - *ret = NULL; - if (!part || !strcmp(part, "front")) - *ret = sd->front.content; + return sd->front.content; else if (!strcmp(part, "back")) - *ret = sd->back.content; + return sd->back.content; + return NULL; } -static void -_elm_flip_smart_content_unset(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list) +EOLIAN static Evas_Object* +_elm_flip_elm_container_content_unset(Eo *obj EINA_UNUSED, Elm_Flip_Data *_pd EINA_UNUSED, const char *part) { - const char *part = va_arg(*list, const char *); - Evas_Object **ret = va_arg(*list, Evas_Object **); - Evas_Object *int_ret = NULL; - if (!part || !strcmp(part, "front")) - int_ret = _flip_content_unset(obj, EINA_TRUE); + return _flip_content_unset(obj, EINA_TRUE); else if (!strcmp(part, "back")) - int_ret = _flip_content_unset(obj, EINA_FALSE); - if (ret) *ret = int_ret; + return _flip_content_unset(obj, EINA_FALSE); + return NULL; } -static void -_elm_flip_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_elm_flip_evas_smart_add(Eo *obj, Elm_Flip_Data *priv) { - Elm_Flip_Smart_Data *priv = _pd; - eo_do_super(obj, MY_CLASS, evas_obj_smart_add()); elm_widget_sub_object_parent_add(obj); @@ -1883,11 +1840,9 @@ _elm_flip_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) _sizing_eval(obj); } -static void -_elm_flip_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_elm_flip_evas_smart_del(Eo *obj, Elm_Flip_Data *sd) { - Elm_Flip_Smart_Data *sd = _pd; - ecore_animator_del(sd->animator); _state_slices_clear(sd); @@ -1903,10 +1858,9 @@ elm_flip_add(Evas_Object *parent) return obj; } -static void -_constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_elm_flip_eo_base_constructor(Eo *obj, Elm_Flip_Data *sd) { - Elm_Flip_Smart_Data *sd = _pd; sd->obj = obj; eo_do_super(obj, MY_CLASS, eo_constructor()); @@ -1915,21 +1869,10 @@ _constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED) evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL)); } -EAPI Eina_Bool -elm_flip_front_visible_get(const Evas_Object *obj) -{ - ELM_FLIP_CHECK(obj) EINA_FALSE; - Eina_Bool ret; - eo_do((Eo *) obj, elm_obj_flip_front_visible_get(&ret)); - return ret; -} - -static void -_front_visible_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static Eina_Bool +_elm_flip_front_visible_get(Eo *obj EINA_UNUSED, Elm_Flip_Data *sd) { - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - Elm_Flip_Smart_Data *sd = _pd; - *ret = sd->state; + return sd->state; } EAPI void @@ -1944,8 +1887,8 @@ elm_flip_perspective_set(Evas_Object *obj, // FIXME: add ambient and lighting control static void -_elm_flip_go_to(Evas_Object *obj, - Elm_Flip_Smart_Data *sd, +_internal_elm_flip_go_to(Evas_Object *obj, + Elm_Flip_Data *sd, Eina_Bool front, Elm_Flip_Mode mode) { @@ -1983,54 +1926,22 @@ _elm_flip_go_to(Evas_Object *obj, } } -EAPI void -elm_flip_go_to(Evas_Object *obj, - Eina_Bool front, - Elm_Flip_Mode mode) +EOLIAN static void +_elm_flip_go_to(Eo *obj, Elm_Flip_Data *sd, Eina_Bool front, Elm_Flip_Mode mode) { - ELM_FLIP_CHECK(obj); - eo_do(obj, elm_obj_flip_go_to(front, mode)); -} - -static void -_go_to(Eo *obj, void *_pd, va_list *list) -{ - Eina_Bool front = va_arg(*list, int); - Elm_Flip_Mode mode = va_arg(*list, Elm_Flip_Mode); - Elm_Flip_Smart_Data *sd = _pd; - if (sd->next_state == front) return; - _elm_flip_go_to(obj, sd, front, mode); -} - -EAPI void -elm_flip_go(Evas_Object *obj, - Elm_Flip_Mode mode) -{ - ELM_FLIP_CHECK(obj); - eo_do(obj, elm_obj_flip_go(mode)); -} - -static void -_go(Eo *obj, void *_pd, va_list *list) -{ - Elm_Flip_Mode mode = va_arg(*list, Elm_Flip_Mode); - Elm_Flip_Smart_Data *sd = _pd; - - _elm_flip_go_to(obj, sd, !sd->state, mode); + _internal_elm_flip_go_to(obj, sd, front, mode); } -EAPI void -elm_flip_interaction_set(Evas_Object *obj, - Elm_Flip_Interaction mode) +EOLIAN static void +_elm_flip_go(Eo *obj, Elm_Flip_Data *sd, Elm_Flip_Mode mode) { - ELM_FLIP_CHECK(obj); - eo_do(obj, elm_obj_flip_interaction_set(mode)); + _internal_elm_flip_go_to(obj, sd, !sd->state, mode); } static void -_event_rect_create(Eo *obj, Elm_Flip_Smart_Data *sd, int i) +_event_rect_create(Eo *obj, Elm_Flip_Data *sd, int i) { Evas_Object *clip; Evas *e; @@ -2054,13 +1965,11 @@ _event_rect_create(Eo *obj, Elm_Flip_Smart_Data *sd, int i) (sd->event[i], EVAS_CALLBACK_MOUSE_MOVE, _move_cb, obj); } -static void -_interaction_set(Eo *obj, void *_pd, va_list *list) +EOLIAN static void +_elm_flip_interaction_set(Eo *obj, Elm_Flip_Data *sd, Elm_Flip_Interaction mode) { - Elm_Flip_Interaction mode = va_arg(*list, Elm_Flip_Interaction); int i; - Elm_Flip_Smart_Data *sd = _pd; if (sd->intmode == mode) return; sd->intmode = mode; @@ -2081,41 +1990,18 @@ _interaction_set(Eo *obj, void *_pd, va_list *list) _configure(obj); } -EAPI Elm_Flip_Interaction -elm_flip_interaction_get(const Evas_Object *obj) +EOLIAN static Elm_Flip_Interaction +_elm_flip_interaction_get(Eo *obj EINA_UNUSED, Elm_Flip_Data *sd) { - ELM_FLIP_CHECK(obj) ELM_FLIP_INTERACTION_NONE; - Elm_Flip_Interaction ret = ELM_FLIP_INTERACTION_NONE; - eo_do((Eo *) obj, elm_obj_flip_interaction_get(&ret)); - return ret; + return sd->intmode; } -static void -_interaction_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - Elm_Flip_Interaction *ret = va_arg(*list, Elm_Flip_Interaction *); - Elm_Flip_Smart_Data *sd = _pd; - *ret = sd->intmode; -} - -EAPI void -elm_flip_interaction_direction_enabled_set(Evas_Object *obj, - Elm_Flip_Direction dir, - Eina_Bool enabled) +EOLIAN static void +_elm_flip_interaction_direction_enabled_set(Eo *obj, Elm_Flip_Data *sd, Elm_Flip_Direction dir, Eina_Bool enabled) { - ELM_FLIP_CHECK(obj); - eo_do(obj, elm_obj_flip_interaction_direction_enabled_set(dir, enabled)); -} - -static void -_interaction_direction_enabled_set(Eo *obj, void *_pd, va_list *list) -{ - Elm_Flip_Direction dir = va_arg(*list, Elm_Flip_Direction); - Eina_Bool enabled = va_arg(*list, int); int i = (int) dir; int area; - Elm_Flip_Smart_Data *sd = _pd; enabled = !!enabled; if (sd->dir_enabled[i] == enabled) return; @@ -2133,44 +2019,17 @@ _interaction_direction_enabled_set(Eo *obj, void *_pd, va_list *list) _configure(obj); } -EAPI Eina_Bool -elm_flip_interaction_direction_enabled_get(Evas_Object *obj, - Elm_Flip_Direction dir) +EOLIAN static Eina_Bool +_elm_flip_interaction_direction_enabled_get(Eo *obj EINA_UNUSED, Elm_Flip_Data *sd, Elm_Flip_Direction dir) { - ELM_FLIP_CHECK(obj) EINA_FALSE; - Eina_Bool ret; - eo_do(obj, elm_obj_flip_interaction_direction_enabled_get(dir, &ret)); - return ret; -} - -static void -_interaction_direction_enabled_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - Elm_Flip_Direction dir = va_arg(*list, Elm_Flip_Direction); - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - - Elm_Flip_Smart_Data *sd = _pd; - - *ret = sd->dir_enabled[(int) dir]; -} - -EAPI void -elm_flip_interaction_direction_hitsize_set(Evas_Object *obj, - Elm_Flip_Direction dir, - double hitsize) -{ - ELM_FLIP_CHECK(obj); - eo_do(obj, elm_obj_flip_interaction_direction_hitsize_set(dir, hitsize)); + return sd->dir_enabled[(int) dir]; } -static void -_interaction_direction_hitsize_set(Eo *obj, void *_pd, va_list *list) +EOLIAN static void +_elm_flip_interaction_direction_hitsize_set(Eo *obj, Elm_Flip_Data *sd, Elm_Flip_Direction dir, double hitsize) { - Elm_Flip_Direction dir = va_arg(*list, Elm_Flip_Direction); - double hitsize = va_arg(*list, double); int i = (int) dir; - Elm_Flip_Smart_Data *sd = _pd; if (hitsize < 0.0) hitsize = -1.0; @@ -2189,84 +2048,18 @@ _interaction_direction_hitsize_set(Eo *obj, void *_pd, va_list *list) _configure(obj); } -EAPI double -elm_flip_interaction_direction_hitsize_get(Evas_Object *obj, - Elm_Flip_Direction dir) +EOLIAN static double +_elm_flip_interaction_direction_hitsize_get(Eo *obj EINA_UNUSED, Elm_Flip_Data *sd, Elm_Flip_Direction dir) { - ELM_FLIP_CHECK(obj) EINA_FALSE; - double ret; - eo_do(obj, elm_obj_flip_interaction_direction_hitsize_get(dir, &ret)); - return ret; -} - -static void -_interaction_direction_hitsize_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) -{ - Elm_Flip_Direction dir = va_arg(*list, Elm_Flip_Direction); - double *ret = va_arg(*list, double *); int i = (int) dir; - Elm_Flip_Smart_Data *sd = _pd; - *ret = sd->dir_hitsize[i]; + return sd->dir_hitsize[i]; } static void -_class_constructor(Eo_Class *klass) +_elm_flip_class_constructor(Eo_Class *klass) { - const Eo_Op_Func_Description func_desc[] = { - EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor), - - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_flip_smart_add), - EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _elm_flip_smart_del), - - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_THEME_APPLY), _elm_flip_smart_theme), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_flip_smart_focus_next_manager_is), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_NEXT), _elm_flip_smart_focus_next), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_flip_smart_focus_direction_manager_is), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_DIRECTION), _elm_flip_smart_focus_direction), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_SUB_OBJECT_ADD), _elm_flip_smart_sub_object_add), - EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_SUB_OBJECT_DEL), _elm_flip_smart_sub_object_del), - - EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SET), _elm_flip_smart_content_set), - EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_GET), _elm_flip_smart_content_get), - EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_UNSET), _elm_flip_smart_content_unset), - - EO_OP_FUNC(ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_FRONT_VISIBLE_GET), _front_visible_get), - EO_OP_FUNC(ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_GO), _go), - EO_OP_FUNC(ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_GO_TO), _go_to), - EO_OP_FUNC(ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_INTERACTION_SET), _interaction_set), - EO_OP_FUNC(ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_INTERACTION_GET), _interaction_get), - EO_OP_FUNC(ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_INTERACTION_DIRECTION_ENABLED_SET), _interaction_direction_enabled_set), - EO_OP_FUNC(ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_INTERACTION_DIRECTION_ENABLED_GET), _interaction_direction_enabled_get), - EO_OP_FUNC(ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_INTERACTION_DIRECTION_HITSIZE_SET), _interaction_direction_hitsize_set), - EO_OP_FUNC(ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_INTERACTION_DIRECTION_HITSIZE_GET), _interaction_direction_hitsize_get), - EO_OP_FUNC_SENTINEL - }; - eo_class_funcs_set(klass, func_desc); - evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); } -static const Eo_Op_Description op_desc[] = { - EO_OP_DESCRIPTION(ELM_OBJ_FLIP_SUB_ID_FRONT_VISIBLE_GET, "Get flip front visibility state"), - EO_OP_DESCRIPTION(ELM_OBJ_FLIP_SUB_ID_PERSPECTIVE_SET, "Set flip perspective."), - EO_OP_DESCRIPTION(ELM_OBJ_FLIP_SUB_ID_GO, "Runs the flip animation."), - EO_OP_DESCRIPTION(ELM_OBJ_FLIP_SUB_ID_GO_TO, "Runs the flip animation to front or back."), - EO_OP_DESCRIPTION(ELM_OBJ_FLIP_SUB_ID_INTERACTION_SET, "Set the interactive flip mode."), - EO_OP_DESCRIPTION(ELM_OBJ_FLIP_SUB_ID_INTERACTION_GET, "Get the interactive flip mode."), - EO_OP_DESCRIPTION(ELM_OBJ_FLIP_SUB_ID_INTERACTION_DIRECTION_ENABLED_SET, "Set which directions of the flip respond to interactive flip."), - EO_OP_DESCRIPTION(ELM_OBJ_FLIP_SUB_ID_INTERACTION_DIRECTION_ENABLED_GET, "Get the enabled state of that flip direction."), - EO_OP_DESCRIPTION(ELM_OBJ_FLIP_SUB_ID_INTERACTION_DIRECTION_HITSIZE_SET, "Set the amount of the flip that is sensitive to interactive flip."), - EO_OP_DESCRIPTION(ELM_OBJ_FLIP_SUB_ID_INTERACTION_DIRECTION_HITSIZE_GET, "Get the amount of the flip that is sensitive to interactive flip."), - EO_OP_DESCRIPTION_SENTINEL -}; -static const Eo_Class_Description class_desc = { - EO_VERSION, - MY_CLASS_NAME, - EO_CLASS_TYPE_REGULAR, - EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_FLIP_BASE_ID, op_desc, ELM_OBJ_FLIP_SUB_ID_LAST), - NULL, - sizeof(Elm_Flip_Smart_Data), - _class_constructor, - NULL -}; -EO_DEFINE_CLASS(elm_obj_flip_class_get, &class_desc, ELM_OBJ_CONTAINER_CLASS, NULL); + +#include "elm_flip.eo.c" diff --git a/src/lib/elm_flip.eo b/src/lib/elm_flip.eo new file mode 100644 index 0000000..e53c084 --- /dev/null +++ b/src/lib/elm_flip.eo @@ -0,0 +1,264 @@ +class Elm_Flip (Elm_Container) +{ + eo_prefix: elm_obj_flip; + properties { + interaction { + set { + /*@ + @brief Set the interactive flip mode + + This sets if the flip should be interactive (allow user to click and + drag a side of the flip to reveal the back page and cause it to flip). + By default a flip is not interactive. You may also need to set which + sides of the flip are "active" for flipping and how much space they use + (a minimum of a finger size) with elm_flip_interaction_direction_enabled_set() + and elm_flip_interaction_direction_hitsize_set() + + The four available mode of interaction are: + @li ELM_FLIP_INTERACTION_NONE - No interaction is allowed + @li ELM_FLIP_INTERACTION_ROTATE - Interaction will cause rotate animation + @li ELM_FLIP_INTERACTION_CUBE - Interaction will cause cube animation + @li ELM_FLIP_INTERACTION_PAGE - Interaction will cause page animation + + @note ELM_FLIP_INTERACTION_ROTATE won't cause + ELM_FLIP_ROTATE_XZ_CENTER_AXIS or ELM_FLIP_ROTATE_YZ_CENTER_AXIS to + happen, those can only be achieved with elm_flip_go(); + + @ingroup Flip */ + } + get { + /*@ + @brief Get the interactive flip mode + + @return The interactive flip mode + + Returns the interactive flip mode set by elm_flip_interaction_set() + + @ingroup Flip */ + } + values { + Elm_Flip_Interaction mode; /*@ The interactive flip mode to use */ + } + } + front_visible { + get { + /*@ + @brief Get flip front visibility state + + @return EINA_TRUE if front front is showing, EINA_FALSE if the back is + showing. + + @ingroup Flip */ + return Eina_Bool; + } + } + } + methods { + interaction_direction_hitsize_set { + /*@ + @brief Set the amount of the flip that is sensitive to interactive flip + + Set the amount of the flip that is sensitive to interactive flip, with 0 + representing no area in the flip and 1 representing the entire flip. There + is however a consideration to be made in that the area will never be + smaller than the finger size set (as set in your Elementary configuration), + and dragging must always start from the opposite half of the flip (eg. right + half of the flip when dragging to the left). + + Note that the @c dir parameter is not actually related to the direction of + the drag, it only refers to the area in the flip where interaction can + occur (top, bottom, left, right). + + Negative values of @c hitsize will disable this hit area. + + @see elm_flip_interaction_set() + + @ingroup Flip */ + + params { + @in Elm_Flip_Direction dir; /*@ The hit area to set */ + @in double hitsize; /*@ The amount of that dimension (0.0 to 1.0) to use */ + } + } + interaction_direction_hitsize_get { + /*@ + @brief Get the amount of the flip that is sensitive to interactive flip + + @return The size set for that direction + + Returns the amount of sensitive area set by + elm_flip_interaction_direction_hitsize_set(). + + @ingroup Flip */ + + return double; + params { + @in Elm_Flip_Direction dir; /*@ The direction to check */ + } + } + interaction_direction_enabled_set { + /*@ + @brief Set which directions of the flip respond to interactive flip + + By default all directions are disabled, so you may want to enable the + desired directions for flipping if you need interactive flipping. You must + call this function once for each direction that should be enabled. + + You can also set the appropriate hit area size by calling + @c elm_flip_interaction_direction_hitsize_set(). By default, a minimum + hit area will be created on the opposite edge of the flip. + + @see elm_flip_interaction_set() + + @ingroup Flip */ + + params { + @in Elm_Flip_Direction dir; /*@ The direction to change */ + @in Eina_Bool enabled; /*@ If that direction is enabled or not */ + } + } + interaction_direction_enabled_get { + /*@ + @brief Get the enabled state of that flip direction + + @return If that direction is enabled or not + + Get the enabled state set by elm_flip_interaction_direction_enabled_set() + + @see elm_flip_interaction_set() + + @ingroup Flip */ + + return Eina_Bool; + params { + @in Elm_Flip_Direction dir; /*@ The direction to check */ + } + } + go { + /*@ + @brief Runs the flip animation + + Flips the front and back contents using the @p mode animation. This + effectively hides the currently visible content and shows the hidden one. + + There a number of possible animations to use for the flipping: + @li ELM_FLIP_ROTATE_X_CENTER_AXIS - Rotate the currently visible content + around a horizontal axis in the middle of its height, the other content + is shown as the other side of the flip. + @li ELM_FLIP_ROTATE_Y_CENTER_AXIS - Rotate the currently visible content + around a vertical axis in the middle of its width, the other content is + shown as the other side of the flip. + @li ELM_FLIP_ROTATE_XZ_CENTER_AXIS - Rotate the currently visible content + around a diagonal axis in the middle of its width, the other content is + shown as the other side of the flip. + @li ELM_FLIP_ROTATE_YZ_CENTER_AXIS - Rotate the currently visible content + around a diagonal axis in the middle of its height, the other content is + shown as the other side of the flip. + @li ELM_FLIP_CUBE_LEFT - Rotate the currently visible content to the left + as if the flip was a cube, the other content is show as the right face of + the cube. + @li ELM_FLIP_CUBE_RIGHT - Rotate the currently visible content to the + right as if the flip was a cube, the other content is show as the left + face of the cube. + @li ELM_FLIP_CUBE_UP - Rotate the currently visible content up as if the + flip was a cube, the other content is show as the bottom face of the cube. + @li ELM_FLIP_CUBE_DOWN - Rotate the currently visible content down as if + the flip was a cube, the other content is show as the upper face of the + cube. + @li ELM_FLIP_PAGE_LEFT - Move the currently visible content to the left as + if the flip was a book, the other content is shown as the page below that. + @li ELM_FLIP_PAGE_RIGHT - Move the currently visible content to the right + as if the flip was a book, the other content is shown as the page below + that. + @li ELM_FLIP_PAGE_UP - Move the currently visible content up as if the + flip was a book, the other content is shown as the page below that. + @li ELM_FLIP_PAGE_DOWN - Move the currently visible content down as if the + flip was a book, the other content is shown as the page below that. + + @image html elm_flip.png + @image latex elm_flip.eps width=\textwidth + + @see elm_flip_go_to() + + @ingroup Flip */ + + params { + @in Elm_Flip_Mode mode; /*@ The mode type */ + } + } + go_to { + /*@ + @brief Runs the flip animation to front or back. + + Flips the front and back contents using the @p mode animation. This + effectively hides the currently visible content and shows the hidden one. + + There a number of possible animations to use for the flipping: + @li ELM_FLIP_ROTATE_X_CENTER_AXIS - Rotate the currently visible content + around a horizontal axis in the middle of its height, the other content + is shown as the other side of the flip. + @li ELM_FLIP_ROTATE_Y_CENTER_AXIS - Rotate the currently visible content + around a vertical axis in the middle of its width, the other content is + shown as the other side of the flip. + @li ELM_FLIP_ROTATE_XZ_CENTER_AXIS - Rotate the currently visible content + around a diagonal axis in the middle of its width, the other content is + shown as the other side of the flip. + @li ELM_FLIP_ROTATE_YZ_CENTER_AXIS - Rotate the currently visible content + around a diagonal axis in the middle of its height, the other content is + shown as the other side of the flip. + @li ELM_FLIP_CUBE_LEFT - Rotate the currently visible content to the left + as if the flip was a cube, the other content is show as the right face of + the cube. + @li ELM_FLIP_CUBE_RIGHT - Rotate the currently visible content to the + right as if the flip was a cube, the other content is show as the left + face of the cube. + @li ELM_FLIP_CUBE_UP - Rotate the currently visible content up as if the + flip was a cube, the other content is show as the bottom face of the cube. + @li ELM_FLIP_CUBE_DOWN - Rotate the currently visible content down as if + the flip was a cube, the other content is show as the upper face of the + cube. + @li ELM_FLIP_PAGE_LEFT - Move the currently visible content to the left as + if the flip was a book, the other content is shown as the page below that. + @li ELM_FLIP_PAGE_RIGHT - Move the currently visible content to the right + as if the flip was a book, the other content is shown as the page below + that. + @li ELM_FLIP_PAGE_UP - Move the currently visible content up as if the + flip was a book, the other content is shown as the page below that. + @li ELM_FLIP_PAGE_DOWN - Move the currently visible content down as if the + flip was a book, the other content is shown as the page below that. + + @image html elm_flip.png + @image latex elm_flip.eps width=\textwidth + + @since 1.7 + + @ingroup Flip */ + + params { + @in Eina_Bool front; /*@ if @c EINA_TRUE, makes front visible, otherwise makes back. */ + @in Elm_Flip_Mode mode; /*@ The mode type */ + } + } + } + implements { + class::constructor; + Eo_Base::constructor; + Evas_Smart::add; + Evas_Smart::del; + Elm_Widget::focus_direction; + Elm_Widget::sub_object_add; + Elm_Widget::theme_apply; + Elm_Widget::focus_direction_manager_is; + Elm_Widget::focus_next_manager_is; + Elm_Widget::focus_next; + Elm_Widget::sub_object_del; + Elm_Container::content_get; + Elm_Container::content_set; + Elm_Container::content_unset; + } + events { + animate,begin; + animate,done; + } + +} diff --git a/src/lib/elm_flip_eo.h b/src/lib/elm_flip_eo.h index 1e17a62..efd1ea0 100644 --- a/src/lib/elm_flip_eo.h +++ b/src/lib/elm_flip_eo.h @@ -1,3 +1,6 @@ +#include "elm_flip.eo.h" + +#if 0 #define ELM_OBJ_FLIP_CLASS elm_obj_flip_class_get() const Eo_Class *elm_obj_flip_class_get(void) EINA_CONST; @@ -152,3 +155,4 @@ enum * @ingroup Flip */ #define elm_obj_flip_interaction_direction_hitsize_get(dir, ret) ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_INTERACTION_DIRECTION_HITSIZE_GET), EO_TYPECHECK(Elm_Flip_Direction, dir), EO_TYPECHECK(double *, ret) +#endif diff --git a/src/lib/elm_widget_flip.h b/src/lib/elm_widget_flip.h index 5425bc3..4ac529a 100644 --- a/src/lib/elm_widget_flip.h +++ b/src/lib/elm_widget_flip.h @@ -19,8 +19,8 @@ typedef struct _Slice Slice; /** * Base widget smart data extended with flip instance data. */ -typedef struct _Elm_Flip_Smart_Data Elm_Flip_Smart_Data; -struct _Elm_Flip_Smart_Data +typedef struct _Elm_Flip_Data Elm_Flip_Data; +struct _Elm_Flip_Data { Evas_Object *obj; Evas_Object *clip; @@ -76,7 +76,7 @@ struct _Vertex3 */ #define ELM_FLIP_DATA_GET(o, sd) \ - Elm_Flip_Smart_Data * sd = eo_data_scope_get(o, ELM_OBJ_FLIP_CLASS) + Elm_Flip_Data * sd = eo_data_scope_get(o, ELM_OBJ_FLIP_CLASS) #define ELM_FLIP_DATA_GET_OR_RETURN(o, ptr) \ ELM_FLIP_DATA_GET(o, ptr); \ --
