From afa738e3e60a16bcf061a2c7df4b95ec33a8f478 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Thu, 14 Feb 2013 05:38:26 +0000 Subject: [PATCH] elementary/widget - added widget orientation mode infra and 2 apis elm_object_orientation_mode_disabled_set(0, elm_object_orientation_mode_disabled_get() Orientation Mode is used for widgets to change it's styles or to send signals whenever it's window degree is changed. If the orientation mode is enabled and the widget has different looks and styles for the window degree(0, 90, 180, 270), it will apply a style that is readied for the current degree, otherwise, it will send signals to it's own edje to change it's any states if the style doesn't be readied. SVN revision: 83880 --- legacy/elementary/ChangeLog | 4 ++ legacy/elementary/NEWS | 1 + legacy/elementary/src/lib/elm_main.c | 13 ++++- legacy/elementary/src/lib/elm_object.h | 36 ++++++++++++++ legacy/elementary/src/lib/elm_widget.c | 69 +++++++++++++++++++++++++- legacy/elementary/src/lib/elm_widget.h | 41 +++++++++++++++ legacy/elementary/src/lib/elm_win.c | 1 + 7 files changed, 163 insertions(+), 2 deletions(-) diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index 60079d2ec0..7e9008aef1 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -1005,3 +1005,7 @@ 2013-02-12 ChunEon Park (Hermet) * replace elm_object_domain_translatable_text_part_set(), elm_object_translatable_text_part_get() with elm_object_domain)translatable_part_text_set(), elm_object_translatable_part_text_get(). + +2013-02-14 ChunEon Park (Hermet) + + * added 2 APIs elm_object_orientation_mode_disabled_set(), elm_object_orientation_mode_disabled_get() diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS index c02815b165..e598e41e10 100644 --- a/legacy/elementary/NEWS +++ b/legacy/elementary/NEWS @@ -36,6 +36,7 @@ Additions: * Add elm_glview, elm_gengrid smart callback - "language,changed". * Add APIs - elm_object_item_domain_translatable_part_text_set(), elm_object_item_translatable_part_text_get(). * Add APIs - elm_object_domain_translatable_part_text_set(), elm_object_translatable_part_text_get(). + * Add APIs - elm_object_orientation_mode_disabled_set(), elm_object_orientation_mode_disabled_get(). Improvements: diff --git a/legacy/elementary/src/lib/elm_main.c b/legacy/elementary/src/lib/elm_main.c index 99b6064228..958788feab 100644 --- a/legacy/elementary/src/lib/elm_main.c +++ b/legacy/elementary/src/lib/elm_main.c @@ -1540,7 +1540,6 @@ elm_object_item_translatable_part_text_get(const Elm_Object_Item *it, const char return _elm_widget_item_translatable_part_text_get((Elm_Widget_Item *)it, part); } - EAPI void elm_object_access_info_set(Evas_Object *obj, const char *txt) { @@ -1553,6 +1552,18 @@ elm_object_name_find(const Evas_Object *obj, const char *name, int recurse) return elm_widget_name_find(obj, name, recurse); } +EAPI void +elm_object_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + elm_widget_orientation_mode_disabled_set(obj, disabled); +} + +EAPI Eina_Bool +elm_object_orientation_mode_disabled_get(const Evas_Object *obj) +{ + return elm_widget_orientation_mode_disabled_get(obj); +} + EAPI void elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt) { diff --git a/legacy/elementary/src/lib/elm_object.h b/legacy/elementary/src/lib/elm_object.h index 6dd412bda1..e3dc536f8d 100644 --- a/legacy/elementary/src/lib/elm_object.h +++ b/legacy/elementary/src/lib/elm_object.h @@ -437,3 +437,39 @@ EAPI void elm_object_event_callback_add(Evas_Object *obj, Elm_Event_Cb f * @ingroup General */ EAPI void *elm_object_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data); + +/** + * Disable the orientation mode of a given widget. + * + * Orientation Mode is used for widgets to change it's styles or to send signals + * whenever it's window degree is changed. If the orientation mode is enabled + * and the widget has different looks and styles for the window degree(0, 90, + * 180, 270), it will apply a style that is readied for the current degree, + * otherwise, it will send signals to it's own edje to change it's states if + * the style doesn't be readied. + * + * @param obj The Elementary object to operate on orientation mode. + * @param disabled The state to put in in: @c EINA_TRUE for disabled, + * @c EINA_FALSE for enabled. + * + * @since 1.8 + * + * @ingroup General + */ +EAPI void elm_object_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled); + +/** + * Get the orientation mode of a give widget. + * + * @param obj The Elementary widget to query for its style + * @return @c EINA_TRUE, if the widget orientation mode is disabled, + * @c EINA_FALSE if the orientation mode is enabled (or on errors) + * + * @see elm_object_orientation_mode_disabled_set() + * + * @since 1.8 + * + * @ingroup General + */ +EAPI Eina_Bool elm_object_orientation_mode_disabled_get(const Evas_Object *obj); + diff --git a/legacy/elementary/src/lib/elm_widget.c b/legacy/elementary/src/lib/elm_widget.c index 2b16501cf7..aacab461ea 100644 --- a/legacy/elementary/src/lib/elm_widget.c +++ b/legacy/elementary/src/lib/elm_widget.c @@ -4427,7 +4427,7 @@ EAPI void elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode) { ELM_WIDGET_CHECK(obj); - eo_do(obj, elm_wdg_display_mode_set(dispmode)); + eo_do((Eo *) obj, elm_wdg_display_mode_set(dispmode)); } static void @@ -4456,6 +4456,66 @@ _elm_widget_display_mode_set(Eo *obj, void *_pd, va_list *list) } +EAPI void +elm_widget_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + ELM_WIDGET_CHECK(obj); + eo_do((Eo *) obj, elm_wdg_orientation_mode_disabled_set(disabled)); +} + +static void +_elm_widget_orientation_mode_disabled_set(Eo *obj __UNUSED__, void *_pd, va_list *list) +{ + Eina_Bool disabled = va_arg(*list, int); + Elm_Widget_Smart_Data *sd = _pd; + disabled = !!disabled; + sd->orientation_disabled = disabled; +} + +EAPI Eina_Bool +elm_widget_orientation_mode_disabled_get(const Evas_Object *obj) +{ + ELM_WIDGET_CHECK(obj) EINA_FALSE; + Eina_Bool ret; + eo_do((Eo *) obj, elm_wdg_orientation_mode_disabled_get(&ret)); + return ret; +} + +static void +_elm_widget_orientation_mode_disabled_get(Eo *obj __UNUSED__, void *_pd, va_list *list) +{ + Eina_Bool *ret = (Eina_Bool *)va_arg(*list, int); + Elm_Widget_Smart_Data *sd = _pd; + *ret = sd->orientation_disabled; +} + + +EAPI void +elm_widget_orientation_set(Evas_Object *obj, int rotation) +{ + ELM_WIDGET_CHECK(obj); + eo_do((Eo *) obj, elm_wdg_orientation_set(rotation)); +} + +static void +_elm_widget_orientation_set(Eo *obj __UNUSED__, void *_pd, va_list *list) +{ + Evas_Object *child; + Eina_List *l; + int rotation = va_arg(*list, int); + Elm_Widget_Smart_Data *sd = _pd; + if (sd->orientation_disabled) return; + + if (sd->resize_obj && _elm_widget_is(sd->resize_obj)) + elm_widget_orientation_set(sd->resize_obj, rotation); + if (sd->hover_obj && _elm_widget_is(sd->hover_obj)) + elm_widget_orientation_set(sd->hover_obj, rotation); + + EINA_LIST_FOREACH (sd->subobjs, l, child) + elm_widget_orientation_set(child, rotation); +} + + /** * @internal * @@ -5526,6 +5586,10 @@ _class_constructor(Eo_Class *klass) EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_THEME_OBJECT_SET), _elm_widget_theme_object_set), + EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_SET), _elm_widget_orientation_set), + EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_MODE_DISABLED_SET), _elm_widget_orientation_mode_disabled_set), + EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_MODE_DISABLED_GET), _elm_widget_orientation_mode_disabled_get), + EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_CUSTOM_CHAIN_SET), _elm_widget_focus_custom_chain_set), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_CUSTOM_CHAIN_GET), _elm_widget_focus_custom_chain_get), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_CUSTOM_CHAIN_UNSET), _elm_widget_focus_custom_chain_unset), @@ -5662,6 +5726,9 @@ static const Eo_Op_Description op_desc[] = { EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_REGION_GET, "Get the focus region of the given widget."), EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_THEME_OBJECT_SET, "description here"), + EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_ORIENTATION_SET, "description here"), + EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_ORIENTATION_MODE_DISABLED_SET, "description here"), + EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_ORIENTATION_MODE_DISABLED_GET, "description here"), EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_CUSTOM_CHAIN_SET, "Set custom focus chain."), EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_CUSTOM_CHAIN_GET, "Get custom focus chain."), diff --git a/legacy/elementary/src/lib/elm_widget.h b/legacy/elementary/src/lib/elm_widget.h index a0b4bdae14..e59ee271f3 100644 --- a/legacy/elementary/src/lib/elm_widget.h +++ b/legacy/elementary/src/lib/elm_widget.h @@ -430,6 +430,7 @@ typedef struct _Elm_Widget_Smart_Data Eina_Bool still_in : 1; Eina_Bool can_access : 1; Eina_Bool highlighted : 1; + Eina_Bool orientation_disabled : 1; } Elm_Widget_Smart_Data; /** @@ -691,6 +692,9 @@ EAPI Evas_Object *elm_widget_content_part_get(const Evas_Object *obj, const EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char *part); EAPI void elm_widget_access_info_set(Evas_Object *obj, const char *txt); EAPI const char *elm_widget_access_info_get(const Evas_Object *obj); +EAPI void elm_widget_orientation_set(Evas_Object *obj, int rotation); +EAPI void elm_widget_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled); +EAPI Eina_Bool elm_widget_orientation_mode_disabled_get(const Evas_Object *obj); EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size); EAPI void _elm_widget_item_free(Elm_Widget_Item *item); EAPI Evas_Object *_elm_widget_item_widget_get(const Elm_Widget_Item *item); @@ -1121,6 +1125,10 @@ enum ELM_WIDGET_SUB_ID_FOCUS_REGION_GET, ELM_WIDGET_SUB_ID_THEME_OBJECT_SET, + ELM_WIDGET_SUB_ID_ORIENTATION_SET, + ELM_WIDGET_SUB_ID_ORIENTATION_MODE_DISABLED_SET, + ELM_WIDGET_SUB_ID_ORIENTATION_MODE_DISABLED_GET, + /* internal */ ELM_WIDGET_SUB_ID_FOCUS_CUSTOM_CHAIN_SET, ELM_WIDGET_SUB_ID_FOCUS_CUSTOM_CHAIN_GET, @@ -2387,5 +2395,38 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l); */ #define elm_wdg_can_focus_child_list_get(ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET), EO_TYPECHECK(Eina_List **, ret) +/** + * @def elm_wdg_orientation_set + * @since 1.8 + * + * No description supplied by the EAPI. + * + * @param[out] ret + * + */ +#define elm_wdg_orientation_set(rotation) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_SET), EO_TYPECHECK(int, rotation) + +/** + * @def elm_wdg_orientation_mode_disabled_set + * @since 1.8 + * + * No description supplied by the EAPI. + * + * @param[out] ret + * + */ +#define elm_wdg_orientation_mode_disabled_set(disabled) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_MODE_DISABLED_SET), EO_TYPECHECK(Eina_Bool, disabled) + +/** + * @def elm_wdg_orientation_mode_disabled_get + * @since 1.8 + * + * No description supplied by the EAPI. + * + * @param[out] ret + * + */ +#define elm_wdg_orientation_mode_disabled_get(ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_MODE_DISABLED_GET), EO_TYPECHECK(Eina_Bool *, ret) + #endif diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c index 6d65d7d31d..ce8a3059b4 100644 --- a/legacy/elementary/src/lib/elm_win.c +++ b/legacy/elementary/src/lib/elm_win.c @@ -4232,6 +4232,7 @@ _win_rotate(Evas_Object *obj, Elm_Win_Smart_Data *sd, int rotation, Eina_Bool re #ifdef HAVE_ELEMENTARY_X _elm_win_xwin_update(sd); #endif + elm_widget_orientation_set(obj, rotation); evas_object_smart_callback_call(obj, SIG_ROTATION_CHANGED, NULL); }