aboutsummaryrefslogtreecommitdiffstats
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
parenttest_icon.c: removed unnecessary box. (diff)
downloadelementary-9ad540238885690d75d6df23d4bd1218e7f792f8.tar.gz
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.
-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
void
test_icon(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- Evas_Object *win, *box, *hbox, *tg, *bt;
- win = elm_win_util_standard_add("icon test", "Icon Test");
+ Evas_Object *win, *box, *ic, *hbox, *tg, *bt;
+ char buf[PATH_MAX];
+
+ win = elm_win_util_standard_add("icon-test", "Icon Test");
elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_resize(win, 400, 400);
+ evas_object_show(win);
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);
- Evas_Object *ic = elm_icon_add(win);
- char buf[PATH_MAX];
+ ic = elm_icon_add(box);
snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get());
elm_image_file_set(ic, buf, NULL);
elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
elm_box_pack_end(box, ic);
evas_object_show(ic);
- hbox = elm_box_add(win);
+ hbox = elm_box_add(box);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(box, hbox);
evas_object_show(hbox);
/* Test Aspect Fixed */
- tg = elm_check_add(win);
+ tg = elm_check_add(hbox);
elm_object_text_set(tg, "Aspect Fixed");
elm_check_state_set(tg, EINA_TRUE);
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
evas_object_show(tg);
/* Test Fill Outside */
- tg = elm_check_add(win);
+ tg = elm_check_add(hbox);
elm_object_text_set(tg, "Fill Outside");
evas_object_smart_callback_add(tg, "changed", fill_outside_cb, ic);
elm_box_pack_end(hbox, tg);
evas_object_show(tg);
/* Test Smooth */
- tg = elm_check_add(win);
+ tg = elm_check_add(hbox);
elm_object_text_set(tg, "Smooth");
elm_check_state_set(tg, EINA_TRUE);
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
evas_object_show(tg);
/* Test Preload, Prescale */
- bt = elm_button_add(win);
+ bt = elm_button_add(hbox);
elm_object_text_set(bt, "Preload & Prescale");
evas_object_smart_callback_add(bt, "clicked", bt_clicked, NULL);
elm_box_pack_end(hbox, bt);
evas_object_show(bt);
-
- evas_object_resize(win, 400, 400);
- evas_object_show(win);
}
static void