summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2013-11-26 23:44:27 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2013-11-26 23:44:27 +0900
commit9ad540238885690d75d6df23d4bd1218e7f792f8 (patch)
treeb32d0eb3f4e22fd0558b9baaea76b077fe4bceab /src
parent427eb2e3e8be5815b5cab5e49da0dda45e27938c (diff)
test_icon.c: internal refactoring of test_icon example.
Now it looks like a normal efl app. - Declare variables at the start of the function. - Resize and show the window right after its creation. - Set widgets' parents properly.
Diffstat (limited to 'src')
-rw-r--r--src/bin/test_icon.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/bin/test_icon.c b/src/bin/test_icon.c
index b6e372ec7..d4a59199b 100644
--- a/src/bin/test_icon.c
+++ b/src/bin/test_icon.c
@@ -54,34 +54,36 @@ bt_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_inf
54void 54void
55test_icon(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 55test_icon(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
56{ 56{
57 Evas_Object *win, *box, *hbox, *tg, *bt; 57 Evas_Object *win, *box, *ic, *hbox, *tg, *bt;
58 win = elm_win_util_standard_add("icon test", "Icon Test"); 58 char buf[PATH_MAX];
59
60 win = elm_win_util_standard_add("icon-test", "Icon Test");
59 elm_win_autodel_set(win, EINA_TRUE); 61 elm_win_autodel_set(win, EINA_TRUE);
62 evas_object_resize(win, 400, 400);
63 evas_object_show(win);
60 64
61 box = elm_box_add(win); 65 box = elm_box_add(win);
62 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 66 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
63 elm_win_resize_object_add(win, box); 67 elm_win_resize_object_add(win, box);
64 evas_object_show(box); 68 evas_object_show(box);
65 69
66 Evas_Object *ic = elm_icon_add(win); 70 ic = elm_icon_add(box);
67 char buf[PATH_MAX];
68 snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get()); 71 snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get());
69 elm_image_file_set(ic, buf, NULL); 72 elm_image_file_set(ic, buf, NULL);
70 elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE); 73 elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
71 evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 74 evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
72 evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL); 75 evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL);
73
74 elm_box_pack_end(box, ic); 76 elm_box_pack_end(box, ic);
75 evas_object_show(ic); 77 evas_object_show(ic);
76 78
77 hbox = elm_box_add(win); 79 hbox = elm_box_add(box);
78 elm_box_horizontal_set(hbox, EINA_TRUE); 80 elm_box_horizontal_set(hbox, EINA_TRUE);
79 evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0); 81 evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
80 elm_box_pack_end(box, hbox); 82 elm_box_pack_end(box, hbox);
81 evas_object_show(hbox); 83 evas_object_show(hbox);
82 84
83 /* Test Aspect Fixed */ 85 /* Test Aspect Fixed */
84 tg = elm_check_add(win); 86 tg = elm_check_add(hbox);
85 elm_object_text_set(tg, "Aspect Fixed"); 87 elm_object_text_set(tg, "Aspect Fixed");
86 elm_check_state_set(tg, EINA_TRUE); 88 elm_check_state_set(tg, EINA_TRUE);
87 evas_object_smart_callback_add(tg, "changed", aspect_fixed_cb, ic); 89 evas_object_smart_callback_add(tg, "changed", aspect_fixed_cb, ic);
@@ -89,14 +91,14 @@ test_icon(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info
89 evas_object_show(tg); 91 evas_object_show(tg);
90 92
91 /* Test Fill Outside */ 93 /* Test Fill Outside */
92 tg = elm_check_add(win); 94 tg = elm_check_add(hbox);
93 elm_object_text_set(tg, "Fill Outside"); 95 elm_object_text_set(tg, "Fill Outside");
94 evas_object_smart_callback_add(tg, "changed", fill_outside_cb, ic); 96 evas_object_smart_callback_add(tg, "changed", fill_outside_cb, ic);
95 elm_box_pack_end(hbox, tg); 97 elm_box_pack_end(hbox, tg);
96 evas_object_show(tg); 98 evas_object_show(tg);
97 99
98 /* Test Smooth */ 100 /* Test Smooth */
99 tg = elm_check_add(win); 101 tg = elm_check_add(hbox);
100 elm_object_text_set(tg, "Smooth"); 102 elm_object_text_set(tg, "Smooth");
101 elm_check_state_set(tg, EINA_TRUE); 103 elm_check_state_set(tg, EINA_TRUE);
102 evas_object_smart_callback_add(tg, "changed", smooth_cb, ic); 104 evas_object_smart_callback_add(tg, "changed", smooth_cb, ic);
@@ -104,14 +106,11 @@ test_icon(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info
104 evas_object_show(tg); 106 evas_object_show(tg);
105 107
106 /* Test Preload, Prescale */ 108 /* Test Preload, Prescale */
107 bt = elm_button_add(win); 109 bt = elm_button_add(hbox);
108 elm_object_text_set(bt, "Preload & Prescale"); 110 elm_object_text_set(bt, "Preload & Prescale");
109 evas_object_smart_callback_add(bt, "clicked", bt_clicked, NULL); 111 evas_object_smart_callback_add(bt, "clicked", bt_clicked, NULL);
110 elm_box_pack_end(hbox, bt); 112 elm_box_pack_end(hbox, bt);
111 evas_object_show(bt); 113 evas_object_show(bt);
112
113 evas_object_resize(win, 400, 400);
114 evas_object_show(win);
115} 114}
116 115
117static void 116static void