From: Enlightenment S. <no-...@en...> - 2011-02-09 16:14:08
|
Log: Elementary ui-mirroring: Added on-the-fly ui-mirroring infrastructure Author: tasn Date: 2011-02-09 08:13:58 -0800 (Wed, 09 Feb 2011) New Revision: 56845 Trac: http://trac.enlightenment.org/e/changeset/56845 Modified: trunk/elementary/src/lib/Elementary.h.in trunk/elementary/src/lib/elm_config.c trunk/elementary/src/lib/elm_priv.h trunk/elementary/src/lib/elm_widget.c Modified: trunk/elementary/src/lib/Elementary.h.in =================================================================== --- trunk/elementary/src/lib/Elementary.h.in 2011-02-09 15:52:21 UTC (rev 56844) +++ trunk/elementary/src/lib/Elementary.h.in 2011-02-09 16:13:58 UTC (rev 56845) @@ -278,6 +278,8 @@ EAPI Eina_Bool elm_object_disabled_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI Eina_Bool elm_widget_mirrored_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI void elm_widget_mirrored_set(Evas_Object *obj, Eina_Bool mirrored) EINA_ARG_NONNULL(1); + EAPI Eina_Bool elm_widget_mirrored_automatic_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_widget_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic) EINA_ARG_NONNULL(1); EAPI Eina_Bool elm_object_widget_check(const Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI Evas_Object *elm_object_parent_widget_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); Modified: trunk/elementary/src/lib/elm_config.c =================================================================== --- trunk/elementary/src/lib/elm_config.c 2011-02-09 15:52:21 UTC (rev 56844) +++ trunk/elementary/src/lib/elm_config.c 2011-02-09 16:13:58 UTC (rev 56845) @@ -1597,8 +1597,8 @@ EAPI void elm_mirrored_set(Eina_Bool mirrored) { - /* TODO: Should update all interface */ _elm_config->is_mirrored = mirrored; + _elm_rescale(); } void Modified: trunk/elementary/src/lib/elm_priv.h =================================================================== --- trunk/elementary/src/lib/elm_priv.h 2011-02-09 15:52:21 UTC (rev 56844) +++ trunk/elementary/src/lib/elm_priv.h 2011-02-09 16:13:58 UTC (rev 56845) @@ -157,6 +157,7 @@ void _elm_unneed_ethumb(void); void _elm_rescale(void); +void _elm_widget_mirrored_reload(Evas_Object *obj); void _elm_config_init(void); void _elm_config_sub_init(void); Modified: trunk/elementary/src/lib/elm_widget.c =================================================================== --- trunk/elementary/src/lib/elm_widget.c 2011-02-09 15:52:21 UTC (rev 56844) +++ trunk/elementary/src/lib/elm_widget.c 2011-02-09 16:13:58 UTC (rev 56845) @@ -77,6 +77,7 @@ Eina_Bool highlight_in_theme : 1; Eina_Bool disabled : 1; Eina_Bool is_mirrored : 1; + Eina_Bool mirrored_auto_mode : 1; /* This is TRUE by default */ Eina_List *focus_chain; Eina_List *event_cb; @@ -562,7 +563,62 @@ } } +/** + * @internal + * Resets the mirrored mode from the system mirror mode for widgets that are in + * automatic mirroring mode. This function does not call elm_widget_theme. + * + * @param obj The widget. + * @param mirrored EINA_TRUE to set mirrored mode. EINA_FALSE to unset. + */ +void +_elm_widget_mirrored_reload(Evas_Object *obj) +{ + API_ENTRY return; + Eina_Bool mirrored = elm_mirrored_get(); + if (elm_widget_mirrored_automatic_get(obj) && (sd->is_mirrored != mirrored)) + { + sd->is_mirrored = mirrored; + } +} + +/** + * Returns the widget's mirrored mode setting. + * + * @param obj The widget. + * @return mirrored mode setting of the object. + * + **/ +EAPI Eina_Bool +elm_widget_mirrored_automatic_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->mirrored_auto_mode; +} + +/** + * Sets the widget's mirrored mode setting. + * When widget in automatic mode, it follows the system mirrored mode set by + * elm_mirrored_set(). + * @param obj The widget. + * @param automatic EINA_TRUE for auto mirrored mode. EINA_FALSE for manual. + */ EAPI void +elm_widget_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic) +{ + API_ENTRY return; + if (sd->mirrored_auto_mode != automatic) + { + sd->mirrored_auto_mode = automatic; + + if (automatic) + { + elm_widget_mirrored_set(obj, elm_mirrored_get()); + } + } +} + +EAPI void elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data) { API_ENTRY return; @@ -2456,6 +2512,7 @@ sd->obj = obj; sd->x = sd->y = sd->w = sd->h = 0; sd->can_focus = 1; + sd->mirrored_auto_mode = EINA_TRUE; /* will follow system locale settings */ evas_object_smart_data_set(obj, sd); } |