aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/bin/test_icon.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/elementary/src/bin/test_icon.c')
-rw-r--r--libraries/elementary/src/bin/test_icon.c159
1 files changed, 159 insertions, 0 deletions
diff --git a/libraries/elementary/src/bin/test_icon.c b/libraries/elementary/src/bin/test_icon.c
new file mode 100644
index 0000000..28bda73
--- /dev/null
+++ b/libraries/elementary/src/bin/test_icon.c
@@ -0,0 +1,159 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5#ifndef ELM_LIB_QUICKLAUNCH
6
7static void
8aspect_fixed_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
9{
10 Evas_Object *ic = (Evas_Object *)data;
11 elm_icon_aspect_fixed_set(ic, elm_check_state_get(obj));
12}
13
14static void
15fill_outside_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
16{
17 Evas_Object *ic = (Evas_Object *)data;
18 elm_icon_fill_outside_set(ic, elm_check_state_get(obj));
19}
20
21static void
22smooth_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
23{
24 Evas_Object *ic = (Evas_Object *)data;
25 elm_icon_smooth_set(ic, elm_check_state_get(obj));
26}
27
28static void
29bt_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
30{
31 Evas_Object *win, *ic;
32 char buf[PATH_MAX];
33
34 win = elm_win_util_standard_add("preload-prescale", "Preload & Prescale");
35 elm_win_autodel_set(win, EINA_TRUE);
36
37 ic = elm_icon_add(win);
38 elm_win_resize_object_add(win, ic);
39 snprintf(buf, sizeof(buf), "%s/images/insanely_huge_test_image.jpg",
40 elm_app_data_dir_get());
41 elm_icon_file_set(ic, buf, NULL);
42
43 evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
44 evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL);
45 elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
46 elm_icon_aspect_fixed_set(ic, EINA_FALSE);
47 elm_icon_preload_disabled_set(ic, EINA_TRUE);
48 elm_icon_prescale_set(ic, EINA_TRUE);
49 evas_object_show(ic);
50
51 evas_object_resize(win, 350, 350);
52 evas_object_show(win);
53}
54
55void
56test_icon(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
57{
58 Evas_Object *win, *box, *content_box, *hbox, *tg, *bt;
59 win = elm_win_util_standard_add("icon test", "Icon Test");
60 elm_win_autodel_set(win, EINA_TRUE);
61
62 box = elm_box_add(win);
63 elm_win_resize_object_add(win, box);
64 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
65 evas_object_show(box);
66
67 content_box = elm_box_add(win);
68 elm_win_resize_object_add(win, content_box);
69 evas_object_size_hint_weight_set(content_box, EVAS_HINT_EXPAND,
70 EVAS_HINT_EXPAND);
71 evas_object_size_hint_align_set(content_box, EVAS_HINT_FILL,
72 EVAS_HINT_FILL);
73 elm_box_pack_end(box, content_box);
74 evas_object_show(content_box);
75
76 Evas_Object *ic = elm_icon_add(win);
77 char buf[PATH_MAX];
78 snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get());
79 elm_icon_file_set(ic, buf, NULL);
80 elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
81 evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
82 evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL);
83
84 elm_box_pack_end(content_box, ic);
85 evas_object_show(ic);
86
87 hbox = elm_box_add(win);
88 elm_box_horizontal_set(hbox, EINA_TRUE);
89 evas_object_size_hint_weight_set(content_box, EVAS_HINT_EXPAND,
90 EVAS_HINT_EXPAND);
91 elm_box_pack_end(box, hbox);
92 evas_object_show(hbox);
93
94 /* Test Aspect Fixed */
95 tg = elm_check_add(win);
96 elm_object_text_set(tg, "Aspect Fixed");
97 elm_check_state_set(tg, EINA_TRUE);
98 evas_object_smart_callback_add(tg, "changed", aspect_fixed_cb, ic);
99 elm_box_pack_end(hbox, tg);
100 evas_object_show(tg);
101
102 /* Test Fill Outside */
103 tg = elm_check_add(win);
104 elm_object_text_set(tg, "Fill Outside");
105 evas_object_smart_callback_add(tg, "changed", fill_outside_cb, ic);
106 elm_box_pack_end(hbox, tg);
107 evas_object_show(tg);
108
109 /* Test Smooth */
110 tg = elm_check_add(win);
111 elm_object_text_set(tg, "Smooth");
112 elm_check_state_set(tg, EINA_TRUE);
113 evas_object_smart_callback_add(tg, "changed", smooth_cb, ic);
114 elm_box_pack_end(hbox, tg);
115 evas_object_show(tg);
116
117 /* Test Preload, Prescale */
118 bt = elm_button_add(win);
119 elm_object_text_set(bt, "Preload & Prescale");
120 evas_object_smart_callback_add(bt, "clicked", bt_clicked, NULL);
121 elm_box_pack_end(hbox, bt);
122 evas_object_show(bt);
123
124 evas_object_resize(win, 400, 400);
125 evas_object_show(win);
126}
127
128static void
129icon_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
130{
131 printf("clicked!\n");
132}
133
134void
135test_icon_transparent(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
136{
137 Evas_Object *win, *ic;
138 char buf[PATH_MAX];
139
140 win = elm_win_add(NULL, "icon-transparent", ELM_WIN_BASIC);
141 elm_win_title_set(win, "Icon Transparent");
142 elm_win_autodel_set(win, EINA_TRUE);
143 elm_win_alpha_set(win, EINA_TRUE);
144
145 ic = elm_icon_add(win);
146 snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get());
147 elm_icon_file_set(ic, buf, NULL);
148 elm_icon_resizable_set(ic, 0, 0);
149 elm_icon_no_scale_set(ic, 1);
150 evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
151 evas_object_size_hint_fill_set(ic, 0.5, 0.5);
152 elm_win_resize_object_add(win, ic);
153 evas_object_show(ic);
154
155 evas_object_smart_callback_add(ic, "clicked", icon_clicked, NULL);
156
157 evas_object_show(win);
158}
159#endif