From a5ca31330505d7e97ceb4319bb050a58725bbd92 Mon Sep 17 00:00:00 2001 From: Daniel Juyung Seo Date: Thu, 12 Sep 2013 01:16:58 +0900 Subject: [PATCH] elm_flip.c: Added support for flip focus direction. --- legacy/elementary/ChangeLog | 4 ++++ legacy/elementary/NEWS | 1 + legacy/elementary/src/lib/elm_flip.c | 41 ++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index 5a04ca8..c06f86f 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -1607,3 +1607,7 @@ 2013-09-10 Jose Roberto de Souza (zehortigoza) * table : Introduce elm_table_child_get() API. + +2013-09-11 Daniel Juyung Seo (SeoZ) + + * flip : Added support for focus direction. diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS index d581773..5cb62b2 100644 --- a/legacy/elementary/NEWS +++ b/legacy/elementary/NEWS @@ -88,6 +88,7 @@ Additions: * Add elm_object_item_object_get(). * Add support for more than one progress status in a progressbar. * Add elm_table_child_get(). + * Add support for flip focus direction. Improvements: diff --git a/legacy/elementary/src/lib/elm_flip.c b/legacy/elementary/src/lib/elm_flip.c index ba2a074..eefe4a7 100644 --- a/legacy/elementary/src/lib/elm_flip.c +++ b/legacy/elementary/src/lib/elm_flip.c @@ -132,6 +132,45 @@ _elm_flip_smart_focus_next(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list * } static void +_elm_flip_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list) +{ + Eina_Bool *ret = va_arg(*list, Eina_Bool *); + if (!elm_widget_can_focus_get(obj)) + *ret = EINA_TRUE; + else + *ret = EINA_FALSE; +} + +static void +_elm_flip_smart_focus_direction(Eo *obj, void *_pd, va_list *list) +{ + 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_List *l = NULL; + void *(*list_data_get)(const Eina_List *list); + + list_data_get = eina_list_data_get; + + if (sd->front.content) + l = eina_list_append(l, sd->front.content); + if (sd->back.content) + l = eina_list_append(l, sd->back.content); + + int_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); +} + +static void _changed_size_hints_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, @@ -2180,6 +2219,8 @@ _class_constructor(Eo_Class *klass) EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_THEME), _elm_flip_smart_theme), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_flip_smart_focus_next_manager_is), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT), _elm_flip_smart_focus_next), + EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_flip_smart_focus_direction_manager_is), + EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION), _elm_flip_smart_focus_direction), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_SUB_OBJECT_ADD), _elm_flip_smart_sub_object_add), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_SUB_OBJECT_DEL), _elm_flip_smart_sub_object_del), -- 2.7.4