Merge "[Password]: New design based changes, a new style removed password mode contro...
[framework/uifw/elementary.git] / src / lib / elm_notify.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3
4
5 /**
6  * @defgroup Notify Notify
7  *
8  * Display a window in a particular region of the application (top,
9  * bottom, etc.  A timeout can be set to automatically close the
10  * window. This is so that, after an evas_object_show() on a notify
11  * object, if a timeout was set on it, it will <b>automatically</b>
12  * get hidden after that time.
13  *
14  * Signals that you can add callbacks for are:
15  *
16  * "timeout" - when timeout happens on notify and it's hidden
17  * "block,clicked" - when it's hidden by a click outside of the notify's view
18  */
19
20 typedef struct _Widget_Data Widget_Data;
21
22 struct _Widget_Data
23 {
24    Evas_Object *notify, *content, *parent;
25
26    Elm_Notify_Orient orient;
27    Eina_Bool repeat_events;
28    Evas_Object *block_events;
29
30    double timeout;
31    Ecore_Timer *timer;
32 };
33
34 static const char *widtype = NULL;
35 static void _del_hook(Evas_Object *obj);
36 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
37 static void _theme_hook(Evas_Object *obj);
38 static void _sizing_eval(Evas_Object *obj);
39 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
40 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
41 static void _signal_block_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
42 static void _calc(Evas_Object *obj);
43 static void _content_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
44 static void _show(void *data, Evas *e, Evas_Object *obj, void *event_info);
45 static void _hide(void *data, Evas *e, Evas_Object *obj, void *event_info);
46 static void _parent_del(void *data,  Evas *e, Evas_Object *obj, void *event_info);
47 static void _parent_hide(void *data,  Evas *e, Evas_Object *obj, void *event_info);
48
49 static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
50 static void _restack(void *data, Evas *e, Evas_Object *obj, void *event_info);
51
52 static const char SIG_BLOCK_CLICKED[] = "block,clicked";
53 static const char SIG_TIMEOUT[] = "timeout";
54 static const Evas_Smart_Cb_Description _signals[] = {
55        {SIG_BLOCK_CLICKED, ""},
56        {SIG_TIMEOUT, ""},
57        {NULL, NULL}
58 };
59
60 static void
61 _del_pre_hook(Evas_Object *obj)
62 {
63    evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
64    evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE, _resize, obj);
65    evas_object_event_callback_del_full(obj, EVAS_CALLBACK_SHOW, _show, obj);
66    evas_object_event_callback_del_full(obj, EVAS_CALLBACK_HIDE, _hide, obj);
67    evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESTACK, _restack, obj);
68 }
69
70 static void
71 _del_hook(Evas_Object *obj)
72 {
73    Widget_Data *wd = elm_widget_data_get(obj);
74    if (!wd) return;
75    elm_notify_parent_set(obj, NULL);
76    elm_notify_repeat_events_set(obj, EINA_TRUE);
77    if (wd->timer)
78      {
79         ecore_timer_del(wd->timer);
80         wd->timer = NULL;
81      }
82    free(wd);
83 }
84
85 /**
86  * Return Notification orientation with RTL
87  *
88  * This function switches-sides of notification area when in RTL mode.
89  *
90  * @param obj notification object.
91  *
92  * @param orient Original notification orientation.
93  *
94  * @return notification orientation with respect to the object RTL mode.
95  *
96  * @internal
97  **/
98 static Elm_Notify_Orient
99 _notify_orientation_with_rtl(Evas_Object *obj, Elm_Notify_Orient orient)
100 {
101    if (elm_widget_mirrored_get(obj))
102      {
103         switch (orient)
104           {
105            case ELM_NOTIFY_ORIENT_LEFT:
106               orient = ELM_NOTIFY_ORIENT_RIGHT;
107               break;
108            case ELM_NOTIFY_ORIENT_RIGHT:
109               orient = ELM_NOTIFY_ORIENT_LEFT;
110               break;
111            case ELM_NOTIFY_ORIENT_TOP_LEFT:
112               orient = ELM_NOTIFY_ORIENT_TOP_RIGHT;
113               break;
114            case ELM_NOTIFY_ORIENT_TOP_RIGHT:
115               orient = ELM_NOTIFY_ORIENT_TOP_LEFT;
116               break;
117            case ELM_NOTIFY_ORIENT_BOTTOM_LEFT:
118               orient = ELM_NOTIFY_ORIENT_BOTTOM_RIGHT;
119               break;
120            case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT:
121               orient = ELM_NOTIFY_ORIENT_BOTTOM_LEFT;
122               break;
123            default:
124               break;
125           }
126      }
127
128    return orient;
129 }
130
131 static void
132 _notify_theme_apply(Evas_Object *obj)
133 {
134    Widget_Data *wd = elm_widget_data_get(obj);
135    const char *style = elm_widget_style_get(obj);
136
137    switch (wd->orient)
138      {
139       case ELM_NOTIFY_ORIENT_TOP:
140          _elm_theme_object_set(obj, wd->notify, "notify", "top", style);
141          break;
142       case ELM_NOTIFY_ORIENT_CENTER:
143          _elm_theme_object_set(obj, wd->notify, "notify", "center", style);
144          break;
145       case ELM_NOTIFY_ORIENT_BOTTOM:
146          _elm_theme_object_set(obj, wd->notify, "notify", "bottom", style);
147          break;
148       case ELM_NOTIFY_ORIENT_LEFT:
149          _elm_theme_object_set(obj, wd->notify, "notify", "left", style);
150          break;
151       case ELM_NOTIFY_ORIENT_RIGHT:
152          _elm_theme_object_set(obj, wd->notify, "notify", "right", style);
153          break;
154       case ELM_NOTIFY_ORIENT_TOP_LEFT:
155          _elm_theme_object_set(obj, wd->notify, "notify", "top_left", style);
156          break;
157       case ELM_NOTIFY_ORIENT_TOP_RIGHT:
158          _elm_theme_object_set(obj, wd->notify, "notify", "top_right", style);
159          break;
160       case ELM_NOTIFY_ORIENT_BOTTOM_LEFT:
161          _elm_theme_object_set(obj, wd->notify, "notify", "bottom_left", style);
162          break;
163       case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT:
164          _elm_theme_object_set(obj, wd->notify, "notify", "bottom_right", style);
165          break;
166       case ELM_NOTIFY_ORIENT_LAST:
167          break;
168      }
169 }
170
171 /**
172  * Moves notification to orientation.
173  *
174  * This fucntion moves notification to orientation
175  * according to object RTL orientation.
176  *
177  * @param obj notification object.
178  *
179  * @param orient notification orientation.
180  *
181  * @internal
182  **/
183 static void
184 _notify_move_to_orientation(Evas_Object *obj)
185 {
186    Widget_Data *wd = elm_widget_data_get(obj);
187    int offx;
188    int offy;
189    Evas_Coord minw = -1, minh = -1;
190    Evas_Coord x, y, w, h;
191
192    if (!wd) return;
193    evas_object_geometry_get(obj, &x, &y, &w, &h);
194    edje_object_size_min_get(wd->notify, &minw, &minh);
195    edje_object_size_min_restricted_calc(wd->notify, &minw, &minh, minw, minh);
196    offx = (w - minw) / 2;
197    offy = (h - minh) / 2;
198
199    switch (_notify_orientation_with_rtl(obj, wd->orient))
200      {
201       case ELM_NOTIFY_ORIENT_TOP:
202          evas_object_move(wd->notify, x + offx, y);
203          break;
204       case ELM_NOTIFY_ORIENT_CENTER:
205          evas_object_move(wd->notify, x + offx, y + offy);
206          break;
207       case ELM_NOTIFY_ORIENT_BOTTOM:
208          evas_object_move(wd->notify, x + offx, y + h - minh);
209          break;
210       case ELM_NOTIFY_ORIENT_LEFT:
211          evas_object_move(wd->notify, x, y + offy);
212          break;
213       case ELM_NOTIFY_ORIENT_RIGHT:
214          evas_object_move(wd->notify, x + w - minw, y + offy);
215          break;
216       case ELM_NOTIFY_ORIENT_TOP_LEFT:
217          evas_object_move(wd->notify, x, y);
218          break;
219       case ELM_NOTIFY_ORIENT_TOP_RIGHT:
220          evas_object_move(wd->notify, x + w - minw, y);
221          break;
222       case ELM_NOTIFY_ORIENT_BOTTOM_LEFT:
223          evas_object_move(wd->notify, x, y + h - minh);
224          break;
225       case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT:
226          evas_object_move(wd->notify, x + w - minw, y + h - minh);
227          break;
228       case ELM_NOTIFY_ORIENT_LAST:
229          break;
230      }
231 }
232
233 static void
234 _block_events_theme_apply(Evas_Object *obj)
235 {
236    Widget_Data *wd = elm_widget_data_get(obj);
237    const char *style = elm_widget_style_get(obj);
238    _elm_theme_object_set(obj, wd->block_events, "notify", "block_events", style);
239 }
240
241 static void
242 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
243 {
244    Widget_Data *wd = elm_widget_data_get(obj);
245    if (!wd) return;
246    edje_object_mirrored_set(wd->notify, rtl);
247    _notify_move_to_orientation(obj);
248 }
249
250 static void
251 _theme_hook(Evas_Object *obj)
252 {
253    Widget_Data *wd = elm_widget_data_get(obj);
254    if (!wd) return;
255    _elm_widget_mirrored_reload(obj);
256    _mirrored_set(obj, elm_widget_mirrored_get(obj));
257    _notify_theme_apply(obj);
258    if (wd->block_events) _block_events_theme_apply(obj);
259    edje_object_scale_set(wd->notify, elm_widget_scale_get(obj) *
260                          _elm_config->scale);
261    _sizing_eval(obj);
262 }
263
264 static void
265 _sizing_eval(Evas_Object *obj)
266 {
267    Widget_Data *wd = elm_widget_data_get(obj);
268    Evas_Coord x,y,w,h;
269    if (!wd) return;
270    if (!wd->parent) return;
271    evas_object_geometry_get(wd->parent, &x, &y, &w, &h);
272    evas_object_move(obj, x, y);
273    evas_object_resize(obj, w, h);
274 }
275
276 static void
277 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
278 {
279    _calc(data);
280 }
281
282 static void
283 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
284 {
285    Widget_Data *wd = elm_widget_data_get(obj);
286    Evas_Object *sub = event_info;
287    if (!wd) return;
288
289    if (sub == wd->content)
290      {
291         evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
292                                             _changed_size_hints, obj);
293         evas_object_event_callback_del_full(sub, EVAS_CALLBACK_RESIZE,
294                                             _content_resize, obj);
295         wd->content = NULL;
296      }
297 }
298
299 static void
300 _signal_block_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
301 {
302    Widget_Data *wd = elm_widget_data_get(data);
303    if (!wd) return;
304    evas_object_smart_callback_call(data, SIG_BLOCK_CLICKED, NULL);
305 }
306
307 static void
308 _restack(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
309 {
310    Widget_Data *wd = elm_widget_data_get(obj);
311    if (!wd) return;
312    evas_object_layer_set(wd->notify,
313                          evas_object_layer_get(obj));
314 }
315
316 static void
317 _resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
318 {
319    _calc(obj);
320 }
321
322 static void
323 _content_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
324 {
325    _calc(data);
326 }
327
328 static void
329 _calc(Evas_Object *obj)
330 {
331    Widget_Data *wd = elm_widget_data_get(obj);
332    Evas_Coord minw = -1, minh = -1;
333    Evas_Coord x, y, w, h;
334
335    if (!wd) return;
336    evas_object_geometry_get(obj, &x, &y, &w, &h);
337    edje_object_size_min_get(wd->notify, &minw, &minh);
338    edje_object_size_min_restricted_calc(wd->notify, &minw, &minh, minw, minh);
339
340    if (wd->content)
341      {
342         _notify_move_to_orientation(obj);
343         evas_object_resize(wd->notify, minw, minh);
344      }
345    _sizing_eval(obj);
346 }
347
348 static Eina_Bool
349 _timer_cb(void *data)
350 {
351    Evas_Object *obj = data;
352    Widget_Data *wd = elm_widget_data_get(obj);
353    if (!wd) return ECORE_CALLBACK_CANCEL;
354    wd->timer = NULL;
355    evas_object_hide(obj);
356    evas_object_smart_callback_call(obj, SIG_TIMEOUT, NULL);
357    return ECORE_CALLBACK_CANCEL;
358 }
359
360 static void
361 _timer_init(Evas_Object *obj, Widget_Data *wd)
362 {
363    if (wd->timer)
364      {
365         ecore_timer_del(wd->timer);
366         wd->timer = NULL;
367      }
368    if ((evas_object_visible_get(obj)) && (wd->timeout > 0.0))
369      wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj);
370 }
371
372 static void
373 _show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
374 {
375    Widget_Data *wd = elm_widget_data_get(obj);
376    if (!wd) return;
377    evas_object_show(wd->notify);
378    if (!wd->repeat_events)
379      evas_object_show(wd->block_events);
380    _timer_init(obj, wd);
381    elm_object_focus(obj);
382 }
383
384 static void
385 _hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
386 {
387    Widget_Data *wd = elm_widget_data_get(obj);
388    if (!wd) return;
389    evas_object_hide(wd->notify);
390    if (!wd->repeat_events)
391      evas_object_hide(wd->block_events);
392    if (wd->timer)
393      {
394         ecore_timer_del(wd->timer);
395         wd->timer = NULL;
396      }
397 }
398
399 static void
400 _parent_del(void *data,  Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
401 {
402    Widget_Data *wd = elm_widget_data_get(data);
403    if (!wd) return;
404    wd->parent = NULL;
405    evas_object_hide(data);
406 }
407
408 static void
409 _parent_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
410 {
411    Widget_Data *wd = elm_widget_data_get(data);
412    if (!wd) return;
413    evas_object_hide(data);
414 }
415
416 static Eina_Bool
417 _elm_notify_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
418 {
419    Widget_Data *wd = elm_widget_data_get(obj);
420    Evas_Object *cur;
421
422    if ((!wd) || (!wd->content))
423      return EINA_FALSE;
424
425    cur = wd->content;
426
427    /* Try Focus cycle in subitem */
428    return elm_widget_focus_next_get(cur, dir, next);
429 }
430
431 /**
432  * Add a new notify to the parent
433  *
434  * @param parent The parent object
435  * @return The new object or NULL if it cannot be created
436  *
437  * @ingroup Notify
438  */
439 EAPI Evas_Object *
440 elm_notify_add(Evas_Object *parent)
441 {
442    Evas_Object *obj;
443    Evas *e;
444    Widget_Data *wd;
445
446    ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
447
448    ELM_SET_WIDTYPE(widtype, "notify");
449    elm_widget_type_set(obj, "notify");
450    elm_widget_sub_object_add(parent, obj);
451    elm_widget_data_set(obj, wd);
452    elm_widget_del_pre_hook_set(obj, _del_pre_hook);
453    elm_widget_del_hook_set(obj, _del_hook);
454    elm_widget_theme_hook_set(obj, _theme_hook);
455    elm_widget_can_focus_set(obj, EINA_FALSE);
456    elm_widget_focus_next_hook_set(obj, _elm_notify_focus_next_hook);
457
458    wd->repeat_events = EINA_TRUE;
459
460    wd->notify = edje_object_add(e);
461    wd->orient = -1;
462    elm_notify_orient_set(obj, ELM_NOTIFY_ORIENT_TOP);
463
464    elm_notify_parent_set(obj, parent);
465
466    evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
467    evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
468    evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _resize, obj);
469    evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _show, obj);
470    evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, obj);
471    evas_object_event_callback_add(obj, EVAS_CALLBACK_RESTACK, _restack, obj);
472    _mirrored_set(obj, elm_widget_mirrored_get(obj));
473    _sizing_eval(obj);
474
475    evas_object_smart_callbacks_descriptions_set(obj, _signals);
476    return obj;
477 }
478
479 /**
480  * Set the content of the notify widget
481  *
482  * Once the content object is set, a previously set one will be deleted.
483  * If you want to keep that old content object, use the
484  * elm_notify_content_unset() function.
485  *
486  * @param obj The notify object
487  * @param content The content will be filled in this notify object
488  *
489  * @ingroup Notify
490  */
491 EAPI void
492 elm_notify_content_set(Evas_Object *obj, Evas_Object *content)
493 {
494    ELM_CHECK_WIDTYPE(obj, widtype);
495    Widget_Data *wd = elm_widget_data_get(obj);
496    if (!wd) return;
497    if (wd->content == content) return;
498    if (wd->content) evas_object_del(wd->content);
499    wd->content = content;
500
501    if (content)
502      {
503         elm_widget_sub_object_add(obj, content);
504         evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
505                                        _changed_size_hints, obj);
506         evas_object_event_callback_add(content, EVAS_CALLBACK_RESIZE,
507                                        _content_resize, obj);
508         edje_object_part_swallow(wd->notify, "elm.swallow.content", content);
509      }
510    _sizing_eval(obj);
511    _calc(obj);
512 }
513
514 /**
515  * Unset the content of the notify widget
516  *
517  * Unparent and return the content object which was set for this widget
518  *
519  * @param obj The notify object
520  * @return The content that was being used
521  *
522  * @ingroup Notify
523  */
524 EAPI Evas_Object *
525 elm_notify_content_unset(Evas_Object *obj)
526 {
527    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
528    Widget_Data *wd = elm_widget_data_get(obj);
529    Evas_Object *content;
530    if (!wd) return NULL;
531    if (!wd->content) return NULL;
532    content = wd->content;
533    elm_widget_sub_object_del(obj, wd->content);
534    edje_object_part_unswallow(wd->notify, wd->content);
535    wd->content = NULL;
536    return content;
537 }
538
539 /**
540  * Return the content of the notify widget
541  *
542  * @param obj The notify object
543  * @return The content that is being used
544  *
545  * @ingroup Notify
546  */
547 EAPI Evas_Object *
548 elm_notify_content_get(const Evas_Object *obj)
549 {
550    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
551    Widget_Data *wd = elm_widget_data_get(obj);
552
553    if (!wd) return NULL;
554    return wd->content;
555 }
556
557 /**
558  * Set the notify parent
559  *
560  * Once the parent object is set, a previously set one will be disconnected
561  * and replaced.
562  *
563  * @param obj The notify object
564  * @param content The new parent
565  *
566  * @ingroup Notify
567  */
568 EAPI void
569 elm_notify_parent_set(Evas_Object *obj, Evas_Object *parent)
570 {
571    ELM_CHECK_WIDTYPE(obj, widtype);
572    Widget_Data *wd = elm_widget_data_get(obj);
573    if (!wd) return;
574    if (wd->parent)
575      {
576         evas_object_event_callback_del_full(wd->parent,
577                                             EVAS_CALLBACK_CHANGED_SIZE_HINTS,
578                                             _changed_size_hints, obj);
579         evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE,
580                                             _changed_size_hints, obj);
581         evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_MOVE,
582                                             _changed_size_hints, obj);
583         evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_DEL,
584                                             _parent_del, obj);
585         evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_HIDE,
586                                             _parent_hide, obj);
587         wd->parent = NULL;
588      }
589
590    if (parent)
591      {
592         wd->parent = parent;
593         evas_object_event_callback_add(parent,
594                                        EVAS_CALLBACK_CHANGED_SIZE_HINTS,
595                                        _changed_size_hints, obj);
596         evas_object_event_callback_add(parent, EVAS_CALLBACK_RESIZE,
597                                        _changed_size_hints, obj);
598         evas_object_event_callback_add(parent, EVAS_CALLBACK_MOVE,
599                                        _changed_size_hints, obj);
600         evas_object_event_callback_add(parent, EVAS_CALLBACK_DEL,
601                                        _parent_del, obj);
602         evas_object_event_callback_add(parent, EVAS_CALLBACK_HIDE,
603                                        _parent_hide, obj);
604         edje_object_part_swallow(wd->notify, "elm.swallow.parent", parent);
605         _sizing_eval(obj);
606      }
607    _calc(obj);
608 }
609
610 /**
611  * Get the notify parent
612  *
613  * @param obj The notify object
614  * @return The parent
615  *
616  * @ingroup Notify
617  */
618 EAPI Evas_Object *
619 elm_notify_parent_get(const Evas_Object *obj)
620 {
621    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
622    Widget_Data *wd = elm_widget_data_get(obj);
623    if (!wd) return NULL;
624    return wd->parent;
625 }
626
627 /**
628  * Set the orientation
629  *
630  * @param obj The notify object
631  * @param orient The new orientation
632  *
633  * @ingroup Notify
634  */
635 EAPI void
636 elm_notify_orient_set(Evas_Object *obj, Elm_Notify_Orient orient)
637 {
638    ELM_CHECK_WIDTYPE(obj, widtype);
639    Widget_Data *wd = elm_widget_data_get(obj);
640    if (!wd) return;
641    if (wd->orient == orient) return;
642    wd->orient = orient;
643    _notify_theme_apply(obj);
644    _resize(obj, NULL, obj, NULL);
645 }
646
647 /**
648  * Return the orientation
649  * @param obj the notify objects
650  */
651 EAPI Elm_Notify_Orient
652 elm_notify_orient_get(const Evas_Object *obj)
653 {
654    ELM_CHECK_WIDTYPE(obj, widtype) -1;
655    Widget_Data *wd = elm_widget_data_get(obj);
656    if (!wd) return -1;
657    return wd->orient;
658 }
659
660 /**
661  * Set the time interval after which the notify window is going to be
662  * hidden.
663  *
664  * @param obj The notify object
665  * @param time The new timeout
666  *
667  * As said previously, an evas_object_show() on a notify object which
668  * had a timeout set by this function will trigger a timer to
669  * automatically hide it again. So, any order one calls
670  * elm_notify_timeout_set() and evas_object_show() on the same object
671  * (at hidden state) will behave the same.
672  *
673  * @note Set a value <= 0.0 to disable a running timer.
674  *
675  * @note If the value > 0.0 and the notify is previously visible, the
676  * timer will be started with this value, canceling any running timer.
677  *
678  */
679 EAPI void
680 elm_notify_timeout_set(Evas_Object *obj, double timeout)
681 {
682    ELM_CHECK_WIDTYPE(obj, widtype);
683    Widget_Data *wd = elm_widget_data_get(obj);
684    if (!wd) return;
685    wd->timeout = timeout;
686    _timer_init(obj, wd);
687 }
688
689 /**
690  * Return the timeout value (in seconds)
691  * @param obj the notify object
692  */
693 EAPI double
694 elm_notify_timeout_get(const Evas_Object *obj)
695 {
696    ELM_CHECK_WIDTYPE(obj, widtype) 0.0;
697    Widget_Data *wd = elm_widget_data_get(obj);
698    if (!wd) return 0.0;
699    return wd->timeout;
700 }
701
702 /**
703  * When true if the user clicks outside the window the events will be
704  * catch by the others widgets, else the events are block and the signal
705  * dismiss will be sent when the user click outside the window.
706  *
707  * @note The default value is EINA_TRUE.
708  *
709  * @param obj The notify object
710  * @param repeats EINA_TRUE Events are repeats, else no
711  */
712 EAPI void
713 elm_notify_repeat_events_set(Evas_Object *obj, Eina_Bool repeat)
714 {
715    ELM_CHECK_WIDTYPE(obj, widtype);
716    Widget_Data *wd = elm_widget_data_get(obj);
717    if (!wd) return;
718    if (repeat == wd->repeat_events) return;
719    wd->repeat_events = repeat;
720    if (!repeat)
721      {
722         wd->block_events = edje_object_add(evas_object_evas_get(obj));
723         _block_events_theme_apply(obj);
724         elm_widget_resize_object_set(obj, wd->block_events);
725         edje_object_signal_callback_add(wd->block_events, "elm,action,clicked",
726                                         "elm", _signal_block_clicked, obj);
727      }
728    else
729      evas_object_del(wd->block_events);
730 }
731
732 /**
733  * Return true if events are repeat below the notify object
734  * @param obj the notify object
735  */
736 EAPI Eina_Bool
737 elm_notify_repeat_events_get(const Evas_Object *obj)
738 {
739    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
740    Widget_Data *wd = elm_widget_data_get(obj);
741    if (!wd) return EINA_FALSE;
742    return wd->repeat_events;
743 }