layout: apply widget's states when elm_layout_file_set is called
authorJaeun Choi <jaeun12.choi@samsung.com>
Fri, 27 Feb 2015 05:15:42 +0000 (14:15 +0900)
committerJaeun Choi <jaeun12.choi@samsung.com>
Fri, 27 Feb 2015 05:46:40 +0000 (14:46 +0900)
when a layout's theme is changed by elm_layout_theme_set, the edje is updated
according to the widget's states such as 'disabled' or 'highlight_in_theme'.
but the update is dropped for elm_layout_file_set.
this patch tied up the codes into _visuals_refresh function
so that the same update happens for elm_layout_file_set.

@fix

src/lib/elm_layout.c

index e77564e..5f9ca8e 100644 (file)
@@ -274,18 +274,54 @@ _parts_cursors_apply(Elm_Layout_Smart_Data *sd)
 }
 
 static void
+_elm_layout_highlight_in_theme(Evas_Object *obj)
+{
+   const char *fh;
+
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+
+   fh = edje_object_data_get
+       (wd->resize_obj, "focus_highlight");
+   if ((fh) && (!strcmp(fh, "on")))
+     elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
+   else
+     elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
+
+   fh = edje_object_data_get
+       (wd->resize_obj, "access_highlight");
+   if ((fh) && (!strcmp(fh, "on")))
+     elm_widget_access_highlight_in_theme_set(obj, EINA_TRUE);
+   else
+     elm_widget_access_highlight_in_theme_set(obj, EINA_FALSE);
+}
+
+static Eina_Bool
 _visuals_refresh(Evas_Object *obj,
                  Elm_Layout_Smart_Data *sd)
 {
+   Eina_Bool ret = EINA_FALSE;
 
-   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
 
    _parts_swallow_fix(sd, wd);
    _parts_text_fix(sd);
    _parts_signals_emit(sd);
    _parts_cursors_apply(sd);
 
+   edje_object_mirrored_set
+     (wd->resize_obj, elm_widget_mirrored_get(obj));
+
+   edje_object_scale_set
+     (wd->resize_obj,
+     elm_widget_scale_get(obj) * elm_config_scale_get());
+
+   _elm_layout_highlight_in_theme(obj);
+
+   eo_do(obj, ret = elm_obj_widget_disable());
+
    eo_do(obj, elm_obj_layout_sizing_eval());
+
+   return ret;
 }
 
 EOLIAN static Eina_Bool
@@ -303,28 +339,6 @@ _elm_layout_elm_widget_disable(Eo *obj, Elm_Layout_Smart_Data *_pd EINA_UNUSED)
    return EINA_TRUE;
 }
 
-static void
-_elm_layout_highlight_in_theme(Evas_Object *obj)
-{
-   const char *fh;
-
-   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
-
-   fh = edje_object_data_get
-       (wd->resize_obj, "focus_highlight");
-   if ((fh) && (!strcmp(fh, "on")))
-     elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
-   else
-     elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
-
-   fh = edje_object_data_get
-       (wd->resize_obj, "access_highlight");
-   if ((fh) && (!strcmp(fh, "on")))
-     elm_widget_access_highlight_in_theme_set(obj, EINA_TRUE);
-   else
-     elm_widget_access_highlight_in_theme_set(obj, EINA_FALSE);
-}
-
 static Eina_Bool
 _elm_layout_theme_internal(Eo *obj, Elm_Layout_Smart_Data *sd)
 {
@@ -337,21 +351,10 @@ _elm_layout_theme_internal(Eo *obj, Elm_Layout_Smart_Data *sd)
                                     elm_widget_style_get(obj)))
      return EINA_FALSE;
 
-   edje_object_mirrored_set
-     (wd->resize_obj, elm_widget_mirrored_get(obj));
-
-   edje_object_scale_set
-     (wd->resize_obj,
-     elm_widget_scale_get(obj) * elm_config_scale_get());
-
-   _elm_layout_highlight_in_theme(obj);
+   ret = _visuals_refresh(obj, sd);
 
    evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
 
-   _visuals_refresh(obj, sd);
-
-   eo_do(obj, ret = elm_obj_widget_disable());
-
    return ret;
 }