diff options
Diffstat (limited to 'libraries/elementary/src/bin/test_notify.c')
-rw-r--r-- | libraries/elementary/src/bin/test_notify.c | 300 |
1 files changed, 300 insertions, 0 deletions
diff --git a/libraries/elementary/src/bin/test_notify.c b/libraries/elementary/src/bin/test_notify.c new file mode 100644 index 0000000..dcb387a --- /dev/null +++ b/libraries/elementary/src/bin/test_notify.c | |||
@@ -0,0 +1,300 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "elementary_config.h" | ||
3 | #endif | ||
4 | #include <Elementary.h> | ||
5 | #ifndef ELM_LIB_QUICKLAUNCH | ||
6 | |||
7 | static void | ||
8 | _bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
9 | { | ||
10 | Evas_Object *notify = data; | ||
11 | evas_object_show(notify); | ||
12 | } | ||
13 | |||
14 | static void | ||
15 | _bt_close(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
16 | { | ||
17 | Evas_Object *notify = data; | ||
18 | evas_object_hide(notify); | ||
19 | } | ||
20 | |||
21 | static void | ||
22 | _bt_timer_close(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
23 | { | ||
24 | Evas_Object *notify = data; | ||
25 | elm_notify_timeout_set(notify, 2.0); | ||
26 | } | ||
27 | |||
28 | static void | ||
29 | _notify_timeout(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
30 | { | ||
31 | printf("Notify timed out!\n"); | ||
32 | } | ||
33 | |||
34 | static void | ||
35 | _notify_block(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
36 | { | ||
37 | printf("Notify block area clicked!!\n"); | ||
38 | } | ||
39 | |||
40 | void | ||
41 | test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
42 | { | ||
43 | Evas_Object *win, *bx, *tb, *notify, *bt, *lb; | ||
44 | |||
45 | win = elm_win_util_standard_add("notify", "Notify"); | ||
46 | elm_win_autodel_set(win, EINA_TRUE); | ||
47 | |||
48 | tb = elm_table_add(win); | ||
49 | elm_win_resize_object_add(win, tb); | ||
50 | evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
51 | evas_object_show(tb); | ||
52 | |||
53 | notify = elm_notify_add(win); | ||
54 | evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
55 | |||
56 | bx = elm_box_add(win); | ||
57 | elm_object_content_set(notify, bx); | ||
58 | elm_box_horizontal_set(bx, EINA_TRUE); | ||
59 | evas_object_show(bx); | ||
60 | |||
61 | lb = elm_label_add(win); | ||
62 | elm_object_text_set(lb, "This position is the default."); | ||
63 | elm_box_pack_end(bx, lb); | ||
64 | evas_object_show(lb); | ||
65 | |||
66 | bt = elm_button_add(win); | ||
67 | elm_object_text_set(bt, "Close"); | ||
68 | evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); | ||
69 | elm_box_pack_end(bx, bt); | ||
70 | evas_object_show(bt); | ||
71 | |||
72 | bt = elm_button_add(win); | ||
73 | elm_object_text_set(bt, "Top"); | ||
74 | evas_object_smart_callback_add(bt, "clicked", _bt, notify); | ||
75 | elm_table_pack(tb, bt, 1, 0, 1, 1); | ||
76 | evas_object_show(bt); | ||
77 | |||
78 | notify = elm_notify_add(win); | ||
79 | elm_notify_allow_events_set(notify, EINA_FALSE); | ||
80 | evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
81 | elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM); | ||
82 | elm_notify_timeout_set(notify, 5.0); | ||
83 | evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL); | ||
84 | evas_object_smart_callback_add(notify, "block,clicked", _notify_block, NULL); | ||
85 | |||
86 | bx = elm_box_add(win); | ||
87 | elm_object_content_set(notify, bx); | ||
88 | elm_box_horizontal_set(bx, EINA_TRUE); | ||
89 | evas_object_show(bx); | ||
90 | |||
91 | lb = elm_label_add(win); | ||
92 | elm_object_text_set(lb, "Bottom position. This notify use a timeout of 5 sec.<br/>" | ||
93 | "<b>The events outside the window are blocked.</b>"); | ||
94 | elm_box_pack_end(bx, lb); | ||
95 | evas_object_show(lb); | ||
96 | |||
97 | bt = elm_button_add(win); | ||
98 | elm_object_text_set(bt, "Close"); | ||
99 | evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); | ||
100 | elm_box_pack_end(bx, bt); | ||
101 | evas_object_show(bt); | ||
102 | |||
103 | bt = elm_button_add(win); | ||
104 | elm_object_text_set(bt, "Bottom"); | ||
105 | evas_object_smart_callback_add(bt, "clicked", _bt, notify); | ||
106 | elm_table_pack(tb, bt, 1, 2, 1, 1); | ||
107 | evas_object_show(bt); | ||
108 | |||
109 | notify = elm_notify_add(win); | ||
110 | evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
111 | elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_LEFT); | ||
112 | elm_notify_timeout_set(notify, 10.0); | ||
113 | evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL); | ||
114 | |||
115 | bx = elm_box_add(win); | ||
116 | elm_object_content_set(notify, bx); | ||
117 | elm_box_horizontal_set(bx, EINA_TRUE); | ||
118 | evas_object_show(bx); | ||
119 | |||
120 | lb = elm_label_add(win); | ||
121 | elm_object_text_set(lb, "Left position. This notify use a timeout of 10 sec."); | ||
122 | elm_box_pack_end(bx, lb); | ||
123 | evas_object_show(lb); | ||
124 | |||
125 | bt = elm_button_add(win); | ||
126 | elm_object_text_set(bt, "Close"); | ||
127 | evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); | ||
128 | elm_box_pack_end(bx, bt); | ||
129 | evas_object_show(bt); | ||
130 | |||
131 | bt = elm_button_add(win); | ||
132 | elm_object_text_set(bt, "Left"); | ||
133 | evas_object_smart_callback_add(bt, "clicked", _bt, notify); | ||
134 | elm_table_pack(tb, bt, 0, 1, 1, 1); | ||
135 | evas_object_show(bt); | ||
136 | |||
137 | notify = elm_notify_add(win); | ||
138 | evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
139 | elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_CENTER); | ||
140 | elm_notify_timeout_set(notify, 10.0); | ||
141 | evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL); | ||
142 | |||
143 | bx = elm_box_add(win); | ||
144 | elm_object_content_set(notify, bx); | ||
145 | elm_box_horizontal_set(bx, EINA_TRUE); | ||
146 | evas_object_show(bx); | ||
147 | |||
148 | lb = elm_label_add(win); | ||
149 | elm_object_text_set(lb, "Center position. This notify use a timeout of 10 sec."); | ||
150 | elm_box_pack_end(bx, lb); | ||
151 | evas_object_show(lb); | ||
152 | |||
153 | bt = elm_button_add(win); | ||
154 | elm_object_text_set(bt, "Close"); | ||
155 | evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); | ||
156 | elm_box_pack_end(bx, bt); | ||
157 | evas_object_show(bt); | ||
158 | |||
159 | bt = elm_button_add(win); | ||
160 | elm_object_text_set(bt, "Center"); | ||
161 | evas_object_smart_callback_add(bt, "clicked", _bt, notify); | ||
162 | elm_table_pack(tb, bt, 1, 1, 1, 1); | ||
163 | evas_object_show(bt); | ||
164 | |||
165 | notify = elm_notify_add(win); | ||
166 | evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
167 | elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_RIGHT); | ||
168 | |||
169 | bx = elm_box_add(win); | ||
170 | elm_object_content_set(notify, bx); | ||
171 | elm_box_horizontal_set(bx, EINA_TRUE); | ||
172 | evas_object_show(bx); | ||
173 | |||
174 | lb = elm_label_add(win); | ||
175 | elm_object_text_set(lb, "Right position."); | ||
176 | elm_box_pack_end(bx, lb); | ||
177 | evas_object_show(lb); | ||
178 | |||
179 | bt = elm_button_add(win); | ||
180 | elm_object_text_set(bt, "Close"); | ||
181 | evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); | ||
182 | elm_box_pack_end(bx, bt); | ||
183 | evas_object_show(bt); | ||
184 | |||
185 | bt = elm_button_add(win); | ||
186 | elm_object_text_set(bt, "Right"); | ||
187 | evas_object_smart_callback_add(bt, "clicked", _bt, notify); | ||
188 | elm_table_pack(tb, bt, 2, 1, 1, 1); | ||
189 | evas_object_show(bt); | ||
190 | |||
191 | notify = elm_notify_add(win); | ||
192 | evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
193 | elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_TOP_LEFT); | ||
194 | |||
195 | bx = elm_box_add(win); | ||
196 | elm_object_content_set(notify, bx); | ||
197 | elm_box_horizontal_set(bx, EINA_TRUE); | ||
198 | evas_object_show(bx); | ||
199 | |||
200 | lb = elm_label_add(win); | ||
201 | elm_object_text_set(lb, "Top Left position."); | ||
202 | elm_box_pack_end(bx, lb); | ||
203 | evas_object_show(lb); | ||
204 | |||
205 | bt = elm_button_add(win); | ||
206 | elm_object_text_set(bt, "Close"); | ||
207 | evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); | ||
208 | elm_box_pack_end(bx, bt); | ||
209 | evas_object_show(bt); | ||
210 | |||
211 | bt = elm_button_add(win); | ||
212 | elm_object_text_set(bt, "Top Left"); | ||
213 | evas_object_smart_callback_add(bt, "clicked", _bt, notify); | ||
214 | elm_table_pack(tb, bt, 0, 0, 1, 1); | ||
215 | evas_object_show(bt); | ||
216 | |||
217 | notify = elm_notify_add(win); | ||
218 | evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
219 | elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_TOP_RIGHT); | ||
220 | |||
221 | bx = elm_box_add(win); | ||
222 | elm_object_content_set(notify, bx); | ||
223 | elm_box_horizontal_set(bx, EINA_TRUE); | ||
224 | evas_object_show(bx); | ||
225 | |||
226 | lb = elm_label_add(win); | ||
227 | elm_object_text_set(lb, "Top Right position."); | ||
228 | elm_box_pack_end(bx, lb); | ||
229 | evas_object_show(lb); | ||
230 | |||
231 | bt = elm_button_add(win); | ||
232 | elm_object_text_set(bt, "Close"); | ||
233 | evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); | ||
234 | elm_box_pack_end(bx, bt); | ||
235 | evas_object_show(bt); | ||
236 | |||
237 | bt = elm_button_add(win); | ||
238 | elm_object_text_set(bt, "Top Right"); | ||
239 | evas_object_smart_callback_add(bt, "clicked", _bt, notify); | ||
240 | elm_table_pack(tb, bt, 2, 0, 1, 1); | ||
241 | evas_object_show(bt); | ||
242 | |||
243 | notify = elm_notify_add(win); | ||
244 | evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
245 | elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM_LEFT); | ||
246 | |||
247 | bx = elm_box_add(win); | ||
248 | elm_object_content_set(notify, bx); | ||
249 | elm_box_horizontal_set(bx, EINA_TRUE); | ||
250 | evas_object_show(bx); | ||
251 | |||
252 | lb = elm_label_add(win); | ||
253 | elm_object_text_set(lb, "Bottom Left position."); | ||
254 | elm_box_pack_end(bx, lb); | ||
255 | evas_object_show(lb); | ||
256 | |||
257 | bt = elm_button_add(win); | ||
258 | elm_object_text_set(bt, "Close"); | ||
259 | evas_object_smart_callback_add(bt, "clicked", _bt_close, notify); | ||
260 | elm_box_pack_end(bx, bt); | ||
261 | evas_object_show(bt); | ||
262 | |||
263 | bt = elm_button_add(win); | ||
264 | elm_object_text_set(bt, "Bottom Left"); | ||
265 | evas_object_smart_callback_add(bt, "clicked", _bt, notify); | ||
266 | elm_table_pack(tb, bt, 0, 2, 1, 1); | ||
267 | evas_object_show(bt); | ||
268 | |||
269 | notify = elm_notify_add(win); | ||
270 | evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
271 | elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM_RIGHT); | ||
272 | |||
273 | bx = elm_box_add(win); | ||
274 | elm_object_content_set(notify, bx); | ||
275 | elm_box_horizontal_set(bx, EINA_TRUE); | ||
276 | evas_object_show(bx); | ||
277 | |||
278 | lb = elm_label_add(win); | ||
279 | elm_object_text_set(lb, "Bottom Right position."); | ||
280 | elm_box_pack_end(bx, lb); | ||
281 | evas_object_show(lb); | ||
282 | |||
283 | bt = elm_button_add(win); | ||
284 | elm_object_text_set(bt, "Close in 2s"); | ||
285 | evas_object_smart_callback_add(bt, "clicked", _bt_timer_close, notify); | ||
286 | elm_box_pack_end(bx, bt); | ||
287 | evas_object_show(bt); | ||
288 | |||
289 | bt = elm_button_add(win); | ||
290 | elm_object_text_set(bt, "Bottom Right"); | ||
291 | evas_object_smart_callback_add(bt, "clicked", _bt, notify); | ||
292 | elm_table_pack(tb, bt, 2, 2, 1, 1); | ||
293 | evas_object_show(bt); | ||
294 | |||
295 | evas_object_show(win); | ||
296 | evas_object_resize(win, 300, 350); | ||
297 | } | ||
298 | |||
299 | #endif | ||
300 | |||