Elementary ui-mirroring: Added on-the-fly ui-mirroring infrastructure
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 9 Feb 2011 16:13:58 +0000 (16:13 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 9 Feb 2011 16:13:58 +0000 (16:13 +0000)
git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@56845 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/Elementary.h.in
src/lib/elm_config.c
src/lib/elm_priv.h
src/lib/elm_widget.c

index 74704ee..f221460 100644 (file)
@@ -278,6 +278,8 @@ extern "C" {
    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);
index 8836964..75d944a 100644 (file)
@@ -1597,8 +1597,8 @@ elm_mirrored_get(void)
 EAPI void
 elm_mirrored_set(Eina_Bool mirrored)
 {
-   /* TODO: Should update all interface */
    _elm_config->is_mirrored = mirrored;
+   _elm_rescale();
 }
 
 void
index 4217a27..06d09bf 100644 (file)
@@ -157,6 +157,7 @@ void                _elm_widget_focus_region_show(const Evas_Object *obj);
 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);
index 1ef0892..e0be4cd 100644 (file)
@@ -77,6 +77,7 @@ struct _Smart_Data
    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,6 +563,61 @@ elm_widget_mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
      }
 }
 
+/**
+ * @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)
 {
@@ -2456,6 +2512,7 @@ _smart_add(Evas_Object *obj)
    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);
 }