1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
8 _bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
10 Evas_Object *notify = data;
11 evas_object_show(notify);
15 _bt_close(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
17 Evas_Object *notify = data;
18 evas_object_hide(notify);
22 _bt_timer_close(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
24 Evas_Object *notify = data;
25 elm_notify_timeout_set(notify, 2.0);
29 _notify_timeout(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
31 printf("Notify timed out!\n");
35 _notify_block(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
37 printf("Notify block area clicked!!\n");
41 test_notify(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
43 Evas_Object *win, *bg, *bx, *tb, *notify, *bt, *lb;
45 win = elm_win_add(NULL, "notify", ELM_WIN_BASIC);
46 elm_win_title_set(win, "Notify");
47 elm_win_autodel_set(win, 1);
50 elm_win_resize_object_add(win, bg);
51 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
54 tb = elm_table_add(win);
55 elm_win_resize_object_add(win, tb);
56 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
59 notify = elm_notify_add(win);
60 evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
62 bx = elm_box_add(win);
63 elm_notify_content_set(notify, bx);
64 elm_box_horizontal_set(bx, 1);
67 lb = elm_label_add(win);
68 elm_label_label_set(lb, "This position is the default.");
69 elm_box_pack_end(bx, lb);
72 bt = elm_button_add(win);
73 elm_button_label_set(bt, "Close");
74 evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
75 elm_box_pack_end(bx, bt);
78 bt = elm_button_add(win);
79 elm_button_label_set(bt, "Top");
80 evas_object_smart_callback_add(bt, "clicked", _bt, notify);
81 elm_table_pack(tb, bt, 1, 0, 1, 1);
84 notify = elm_notify_add(win);
85 elm_notify_repeat_events_set(notify, EINA_FALSE);
86 evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
87 elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM);
88 elm_notify_timeout_set(notify, 5.0);
89 evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL);
90 evas_object_smart_callback_add(notify, "block,clicked", _notify_block, NULL);
92 bx = elm_box_add(win);
93 elm_notify_content_set(notify, bx);
94 elm_box_horizontal_set(bx, 1);
97 lb = elm_label_add(win);
98 elm_label_label_set(lb, "Bottom position. This notify use a timeout of 5 sec.<br>"
99 "<b>The events outside the window are blocked.</b>");
100 elm_box_pack_end(bx, lb);
101 evas_object_show(lb);
103 bt = elm_button_add(win);
104 elm_button_label_set(bt, "Close");
105 evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
106 elm_box_pack_end(bx, bt);
107 evas_object_show(bt);
109 bt = elm_button_add(win);
110 elm_button_label_set(bt, "Bottom");
111 evas_object_smart_callback_add(bt, "clicked", _bt, notify);
112 elm_table_pack(tb, bt, 1, 2, 1, 1);
113 evas_object_show(bt);
115 notify = elm_notify_add(win);
116 evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
117 elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_LEFT);
118 elm_notify_timeout_set(notify, 10.0);
119 evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL);
121 bx = elm_box_add(win);
122 elm_notify_content_set(notify, bx);
123 elm_box_horizontal_set(bx, 1);
124 evas_object_show(bx);
126 lb = elm_label_add(win);
127 elm_label_label_set(lb, "Left position. This notify use a timeout of 10 sec.");
128 elm_box_pack_end(bx, lb);
129 evas_object_show(lb);
131 bt = elm_button_add(win);
132 elm_button_label_set(bt, "Close");
133 evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
134 elm_box_pack_end(bx, bt);
135 evas_object_show(bt);
137 bt = elm_button_add(win);
138 elm_button_label_set(bt, "Left");
139 evas_object_smart_callback_add(bt, "clicked", _bt, notify);
140 elm_table_pack(tb, bt, 0, 1, 1, 1);
141 evas_object_show(bt);
143 notify = elm_notify_add(win);
144 evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
145 elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_CENTER);
146 elm_notify_timeout_set(notify, 10.0);
147 evas_object_smart_callback_add(notify, "timeout", _notify_timeout, NULL);
149 bx = elm_box_add(win);
150 elm_notify_content_set(notify, bx);
151 elm_box_horizontal_set(bx, 1);
152 evas_object_show(bx);
154 lb = elm_label_add(win);
155 elm_label_label_set(lb, "Center position. This notify use a timeout of 10 sec.");
156 elm_box_pack_end(bx, lb);
157 evas_object_show(lb);
159 bt = elm_button_add(win);
160 elm_button_label_set(bt, "Close");
161 evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
162 elm_box_pack_end(bx, bt);
163 evas_object_show(bt);
165 bt = elm_button_add(win);
166 elm_button_label_set(bt, "Center");
167 evas_object_smart_callback_add(bt, "clicked", _bt, notify);
168 elm_table_pack(tb, bt, 1, 1, 1, 1);
169 evas_object_show(bt);
171 notify = elm_notify_add(win);
172 evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
173 elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_RIGHT);
175 bx = elm_box_add(win);
176 elm_notify_content_set(notify, bx);
177 elm_box_horizontal_set(bx, 1);
178 evas_object_show(bx);
180 lb = elm_label_add(win);
181 elm_label_label_set(lb, "Right position.");
182 elm_box_pack_end(bx, lb);
183 evas_object_show(lb);
185 bt = elm_button_add(win);
186 elm_button_label_set(bt, "Close");
187 evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
188 elm_box_pack_end(bx, bt);
189 evas_object_show(bt);
191 bt = elm_button_add(win);
192 elm_button_label_set(bt, "Right");
193 evas_object_smart_callback_add(bt, "clicked", _bt, notify);
194 elm_table_pack(tb, bt, 2, 1, 1, 1);
195 evas_object_show(bt);
197 notify = elm_notify_add(win);
198 evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
199 elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_TOP_LEFT);
201 bx = elm_box_add(win);
202 elm_notify_content_set(notify, bx);
203 elm_box_horizontal_set(bx, 1);
204 evas_object_show(bx);
206 lb = elm_label_add(win);
207 elm_label_label_set(lb, "Top Left position.");
208 elm_box_pack_end(bx, lb);
209 evas_object_show(lb);
211 bt = elm_button_add(win);
212 elm_button_label_set(bt, "Close");
213 evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
214 elm_box_pack_end(bx, bt);
215 evas_object_show(bt);
217 bt = elm_button_add(win);
218 elm_button_label_set(bt, "Top Left");
219 evas_object_smart_callback_add(bt, "clicked", _bt, notify);
220 elm_table_pack(tb, bt, 0, 0, 1, 1);
221 evas_object_show(bt);
223 notify = elm_notify_add(win);
224 evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
225 elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_TOP_RIGHT);
227 bx = elm_box_add(win);
228 elm_notify_content_set(notify, bx);
229 elm_box_horizontal_set(bx, 1);
230 evas_object_show(bx);
232 lb = elm_label_add(win);
233 elm_label_label_set(lb, "Top Right position.");
234 elm_box_pack_end(bx, lb);
235 evas_object_show(lb);
237 bt = elm_button_add(win);
238 elm_button_label_set(bt, "Close");
239 evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
240 elm_box_pack_end(bx, bt);
241 evas_object_show(bt);
243 bt = elm_button_add(win);
244 elm_button_label_set(bt, "Top Right");
245 evas_object_smart_callback_add(bt, "clicked", _bt, notify);
246 elm_table_pack(tb, bt, 2, 0, 1, 1);
247 evas_object_show(bt);
249 notify = elm_notify_add(win);
250 evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
251 elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM_LEFT);
253 bx = elm_box_add(win);
254 elm_notify_content_set(notify, bx);
255 elm_box_horizontal_set(bx, 1);
256 evas_object_show(bx);
258 lb = elm_label_add(win);
259 elm_label_label_set(lb, "Bottom Left position.");
260 elm_box_pack_end(bx, lb);
261 evas_object_show(lb);
263 bt = elm_button_add(win);
264 elm_button_label_set(bt, "Close");
265 evas_object_smart_callback_add(bt, "clicked", _bt_close, notify);
266 elm_box_pack_end(bx, bt);
267 evas_object_show(bt);
269 bt = elm_button_add(win);
270 elm_button_label_set(bt, "Bottom Left");
271 evas_object_smart_callback_add(bt, "clicked", _bt, notify);
272 elm_table_pack(tb, bt, 0, 2, 1, 1);
273 evas_object_show(bt);
275 notify = elm_notify_add(win);
276 evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
277 elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM_RIGHT);
279 bx = elm_box_add(win);
280 elm_notify_content_set(notify, bx);
281 elm_box_horizontal_set(bx, 1);
282 evas_object_show(bx);
284 lb = elm_label_add(win);
285 elm_label_label_set(lb, "Bottom Right position.");
286 elm_box_pack_end(bx, lb);
287 evas_object_show(lb);
289 bt = elm_button_add(win);
290 elm_button_label_set(bt, "Close in 2s");
291 evas_object_smart_callback_add(bt, "clicked", _bt_timer_close, notify);
292 elm_box_pack_end(bx, bt);
293 evas_object_show(bt);
295 bt = elm_button_add(win);
296 elm_button_label_set(bt, "Bottom Right");
297 evas_object_smart_callback_add(bt, "clicked", _bt, notify);
298 elm_table_pack(tb, bt, 2, 2, 1, 1);
299 evas_object_show(bt);
301 evas_object_show(win);
302 evas_object_resize(win, 300, 350);