summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinwoo Kim <cinoo.kim@samsung.com>2015-06-09 14:05:58 +0100
committerTom Hacohen <tom@stosb.com>2015-06-09 14:05:58 +0100
commit0e126b7091edcd9bd905fdbbe5b4f7d04f569586 (patch)
treeea47f607971a5355caa871d374ab0ccf948f32ab
parent99fca104fdd8f869efe282d17840b16fda90107c (diff)
[layout] support mirrored set for layout which is using elm_layout_file_set()
Summary: mirroed mode does not work, if layout uses elm_layout_file_set(). Test Plan: the following is test code. [test.edc] collections { group { name: "layout/test"; parts { part { name: "bg"; type: RECT; description { state: "default" 0.0; color: 255 255 0 100; } } part { name: "test.rect"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1.to: bg; rel1.relative: 0.2 0.1; rel2.to: bg; rel2.relative: 0.5 0.2; } } } /* parts */ } /* group */ } /* collections */ [test.c] //Compile with: //gcc -g test.c -o test `pkg-config --cflags --libs elementary` #include <Elementary.h> #include <Ecore_X.h> static void _bt_click(void *data, Evas_Object *obj, void *event_info) { Eina_Bool mirrored; Evas_Object *layout; layout = data; mirrored = elm_config_mirrored_get(); mirrored = !mirrored; printf("mirred: %d\n", mirrored); elm_config_mirrored_set(mirrored); } EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *box, *layout, *bt, *check; char buf[PATH_MAX]; elm_app_info_set(elm_main, "elementary", "./test.edj"); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); win = elm_win_add(NULL, "Layout", ELM_WIN_BASIC); elm_win_autodel_set(win, EINA_TRUE); box = elm_box_add(win); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, box); evas_object_show(box); // Adding layout and filling it with widgets layout = elm_layout_add(win); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); snprintf(buf, sizeof(buf), "./test.edj"); elm_layout_file_set(layout, buf, "layout/test"); elm_box_pack_end(box, layout); evas_object_show(layout); bt = elm_button_add(win); elm_object_text_set(bt, "mirrored"); evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_smart_callback_add(bt, "clicked", _bt_click, layout); elm_box_pack_end(box, bt); evas_object_show(bt); check = elm_check_add(win); elm_object_text_set(check, "test"); evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box, check); evas_object_show(check); evas_object_resize(win, 500, 500); evas_object_show(win); elm_run(); elm_shutdown(); return 0; } ELM_MAIN() Reviewers: seoz, raster, tasn, Hermet Subscribers: seoz, cedric Differential Revision: https://phab.enlightenment.org/D2142
-rw-r--r--src/lib/elm_layout.c21
-rw-r--r--src/lib/elm_theme.c1
-rw-r--r--src/lib/elm_widget_layout.h1
3 files changed, 16 insertions, 7 deletions
diff --git a/src/lib/elm_layout.c b/src/lib/elm_layout.c
index 991112b1f..f49d158b4 100644
--- a/src/lib/elm_layout.c
+++ b/src/lib/elm_layout.c
@@ -359,13 +359,17 @@ _elm_layout_theme_internal(Eo *obj, Elm_Layout_Smart_Data *sd)
359 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); 359 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
360 360
361 /* function already prints error messages, if any */ 361 /* function already prints error messages, if any */
362 if (!elm_widget_theme_object_set(obj, wd->resize_obj, sd->klass, sd->group, 362 if (!sd->file_set)
363 elm_widget_style_get(obj))) 363 {
364 return EINA_FALSE; 364 ret = elm_widget_theme_object_set
365 (obj, wd->resize_obj, sd->klass, sd->group,
366 elm_widget_style_get(obj));
367 }
365 368
366 ret = _visuals_refresh(obj, sd); 369 if (ret)
370 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
367 371
368 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL); 372 ret = _visuals_refresh(obj, sd) && ret;
369 373
370 return ret; 374 return ret;
371} 375}
@@ -852,7 +856,11 @@ _elm_layout_efl_file_file_set(Eo *obj, Elm_Layout_Smart_Data *sd, const char *fi
852 int_ret = 856 int_ret =
853 edje_object_file_set(wd->resize_obj, file, group); 857 edje_object_file_set(wd->resize_obj, file, group);
854 858
855 if (int_ret) _visuals_refresh(obj, sd); 859 if (int_ret)
860 {
861 sd->file_set = EINA_TRUE;
862 _visuals_refresh(obj, sd);
863 }
856 else 864 else
857 ERR("failed to set edje file '%s', group '%s': %s", 865 ERR("failed to set edje file '%s', group '%s': %s",
858 file, group, 866 file, group,
@@ -874,6 +882,7 @@ _elm_layout_theme_set(Eo *obj, Elm_Layout_Smart_Data *sd, const char *klass, con
874{ 882{
875 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); 883 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
876 884
885 if (sd->file_set) sd->file_set = EINA_FALSE;
877 eina_stringshare_replace(&(sd->klass), klass); 886 eina_stringshare_replace(&(sd->klass), klass);
878 eina_stringshare_replace(&(sd->group), group); 887 eina_stringshare_replace(&(sd->group), group);
879 eina_stringshare_replace(&(wd->style), style); 888 eina_stringshare_replace(&(wd->style), style);
diff --git a/src/lib/elm_theme.c b/src/lib/elm_theme.c
index e2db50948..8fa383e37 100644
--- a/src/lib/elm_theme.c
+++ b/src/lib/elm_theme.c
@@ -293,7 +293,6 @@ _elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *grou
293 293
294 if ((!clas) || (!group) || (!style)) return EINA_FALSE; 294 if ((!clas) || (!group) || (!style)) return EINA_FALSE;
295 if (!th) th = &(theme_default); 295 if (!th) th = &(theme_default);
296
297 snprintf(buf2, sizeof(buf2), "elm/%s/%s/%s", clas, group, style); 296 snprintf(buf2, sizeof(buf2), "elm/%s/%s/%s", clas, group, style);
298 if (!eina_hash_find(th->cache_style_load_failed, buf2)) 297 if (!eina_hash_find(th->cache_style_load_failed, buf2))
299 { 298 {
diff --git a/src/lib/elm_widget_layout.h b/src/lib/elm_widget_layout.h
index f109da695..0e0871c54 100644
--- a/src/lib/elm_widget_layout.h
+++ b/src/lib/elm_widget_layout.h
@@ -84,6 +84,7 @@ typedef struct _Elm_Layout_Smart_Data
84 Eina_Bool restricted_calc_h : 1; 84 Eina_Bool restricted_calc_h : 1;
85 Eina_Bool can_access : 1; /**< This is true when all text(including textblock) parts can be accessible by accessibility. */ 85 Eina_Bool can_access : 1; /**< This is true when all text(including textblock) parts can be accessible by accessibility. */
86 Eina_Bool destructed_is : 1; /**< This flag indicates if Elm_Layout destructor was called */ 86 Eina_Bool destructed_is : 1; /**< This flag indicates if Elm_Layout destructor was called */
87 Eina_Bool file_set : 1; /**< This flag indicates if Elm_Layout source file is set */
87} Elm_Layout_Smart_Data; 88} Elm_Layout_Smart_Data;
88 89
89/** 90/**