elm: Removed trailing whitespaces.
[framework/uifw/elementary.git] / src / bin / test_check.c
1 #include <Elementary.h>
2 #ifdef HAVE_CONFIG_H
3 # include "elementary_config.h"
4 #endif
5 #ifndef ELM_LIB_QUICKLAUNCH
6 static void
7 changed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
8 {
9    Evas_Object *ck2 = data;
10    printf("ck %p to %i\n", obj, elm_check_state_get(obj));
11    elm_check_state_set(ck2, elm_check_state_get(obj));
12    printf("ck2 %p is now %i\n", ck2, elm_check_state_get(ck2));
13 }
14
15 void
16 test_check(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
17 {
18    Evas_Object *win, *bg, *bx, *ic, *ck, *ck0;
19    char buf[PATH_MAX];
20
21    win = elm_win_add(NULL, "checks", ELM_WIN_BASIC);
22    elm_win_title_set(win, "Checks");
23    elm_win_autodel_set(win, EINA_TRUE);
24
25    bg = elm_bg_add(win);
26    elm_win_resize_object_add(win, bg);
27    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
28    evas_object_show(bg);
29
30    bx = elm_box_add(win);
31    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
32    elm_win_resize_object_add(win, bx);
33    evas_object_show(bx);
34
35    ic = elm_icon_add(win);
36    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
37    elm_icon_file_set(ic, buf, NULL);
38    evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
39    ck = elm_check_add(win);
40    evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
41    evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5);
42    elm_object_text_set(ck, "Icon sized to check");
43    elm_object_part_content_set(ck, "icon", ic);
44    elm_check_state_set(ck, 1);
45    elm_box_pack_end(bx, ck);
46    evas_object_show(ck);
47    evas_object_show(ic);
48
49    ck0 = ck;
50
51    ic = elm_icon_add(win);
52    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
53    elm_icon_file_set(ic, buf, NULL);
54    elm_icon_scale_set(ic, 0, 0);
55    ck = elm_check_add(win);
56    elm_object_text_set(ck, "Icon no scale");
57    elm_object_part_content_set(ck, "icon", ic);
58    elm_box_pack_end(bx, ck);
59    evas_object_show(ck);
60    evas_object_show(ic);
61
62    evas_object_smart_callback_add(ck, "changed", changed_cb, ck0);
63
64    ck = elm_check_add(win);
65    elm_object_text_set(ck, "Label Only");
66    elm_box_pack_end(bx, ck);
67    evas_object_show(ck);
68
69    ic = elm_icon_add(win);
70    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
71    elm_icon_file_set(ic, buf, NULL);
72    evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
73    ck = elm_check_add(win);
74    evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
75    evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5);
76    elm_object_text_set(ck, "Disabled check");
77    elm_object_part_content_set(ck, "icon", ic);
78    elm_check_state_set(ck, 1);
79    elm_box_pack_end(bx, ck);
80    elm_object_disabled_set(ck, 1);
81    evas_object_show(ck);
82    evas_object_show(ic);
83
84    ic = elm_icon_add(win);
85    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
86    elm_icon_file_set(ic, buf, NULL);
87    elm_icon_scale_set(ic, 0, 0);
88    ck = elm_check_add(win);
89    elm_object_part_content_set(ck, "icon", ic);
90    elm_box_pack_end(bx, ck);
91    evas_object_show(ck);
92    evas_object_show(ic);
93
94    evas_object_show(win);
95 }
96 #endif