Merge "[multibuttonentry]CQ:H0100137536- 'item,selected' signal sends 2 times when...
[framework/uifw/elementary.git] / src / lib / elm_tickernoti.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3
4 typedef struct _Widget_Data Widget_Data;
5
6 struct _Widget_Data
7 {
8    Evas_Object *win;
9    Evas_Object *edje_obj;
10    Evas_Object *icon;
11    Evas_Object *button;
12    Ecore_Event_Handler *rotation_event_handler;
13    const char *label;
14    int noti_height;
15    int angle;
16    Elm_Tickernoti_Mode mode;
17    Elm_Tickernoti_Orient orient;
18 };
19
20 static const char *widtype = NULL;
21 static void _del_hook(Evas_Object *obj);
22 static void _theme_hook(Evas_Object *obj);
23 static void _sizing_eval(Evas_Object *obj);
24 static void _update_geometry_on_rotation(Evas_Object *obj, int angle, int *x, int *y, int *w);
25
26 static const char SIG_CLICKED[] = "clicked";
27 static const char SIG_HIDDEN[] = "hide";
28 static const Evas_Smart_Cb_Description _signals[] = {
29        {SIG_CLICKED, ""},
30        {SIG_HIDDEN, ""},
31        {NULL, NULL}
32 };
33
34 static void
35 _del_job(void *data)
36 {
37    evas_object_del(data);
38 }
39
40 static void
41 _del_hook(Evas_Object *obj)
42 {
43    Evas_Object *parent;
44    Widget_Data *wd = elm_widget_data_get(obj);
45
46    if (!wd) return;
47    parent = elm_widget_parent_get(obj);
48    if (wd->rotation_event_handler)
49      ecore_event_handler_del(wd->rotation_event_handler);
50    if (wd->win) ecore_job_add(_del_job, parent);
51    evas_object_del(wd->edje_obj);
52    wd->edje_obj = NULL;
53    free(wd);
54 }
55
56 static void
57 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
58 {
59    Widget_Data *wd = elm_widget_data_get(obj);
60
61    if (!wd) return;
62    edje_object_mirrored_set(wd->edje_obj, rtl);
63 }
64
65 static void
66 _theme_hook(Evas_Object *obj)
67 {
68    char *data_win_height = NULL;
69    Evas_Coord w;
70    Widget_Data *wd = elm_widget_data_get(obj);
71
72    if (!wd) return;
73    _elm_widget_mirrored_reload(obj);
74    _mirrored_set(obj, elm_widget_mirrored_get(obj));
75
76    _elm_theme_object_set(wd->win, wd->edje_obj, "tickernoti",
77                           "base", elm_widget_style_get(obj));
78
79    edje_object_scale_set(wd->edje_obj, elm_widget_scale_get(obj) * _elm_config->scale);
80
81    /* tickernoti detail height set */
82    data_win_height = (char *)edje_object_data_get(wd->edje_obj, "height");
83    if (data_win_height != NULL && elm_scale_get() > 0.0)
84      wd->noti_height = (int)(elm_scale_get() * atoi(data_win_height));
85
86    evas_object_geometry_get(wd->win, NULL, NULL, &w, NULL);
87    evas_object_resize(wd->win, w, wd->noti_height);
88
89    if (wd->label)
90      edje_object_part_text_set(wd->edje_obj, "elm.text", wd->label);
91    if (wd->icon)
92      edje_object_part_swallow(wd->edje_obj, "icon", wd->icon);
93    if (wd->button)
94      edje_object_part_swallow(wd->edje_obj, "button", wd->button);
95    edje_object_signal_emit(wd->edje_obj, "effect,show", "elm");
96    edje_object_message_signal_process(wd->edje_obj);
97
98    _sizing_eval(obj);
99 }
100
101 static void
102 _sizing_eval(Evas_Object *obj)
103 {
104    Widget_Data *wd = elm_widget_data_get(obj);
105    Evas_Coord minw = -1, minh = -1;
106
107    if (!wd) return;
108    elm_coords_finger_size_adjust(1, &minw, 1, &minh);
109    edje_object_size_min_restricted_calc(wd->edje_obj, &minw, &minh, minw, minh);
110    evas_object_size_hint_min_set(obj, minw, minh);
111 }
112
113 #ifdef HAVE_ELEMENTARY_X
114 static void
115 _update_window_hints(Evas_Object *obj)
116 {
117    Ecore_X_Window xwin;
118    Ecore_X_Atom _notification_level_atom;
119    int level;
120    // elm_win_xwindow_get() must call after elm_win_alpha_set()
121    xwin = elm_win_xwindow_get(obj);
122
123    ecore_x_icccm_hints_set(xwin, 0, ECORE_X_WINDOW_STATE_HINT_NONE, 0, 0, 0, 0, 0);
124    ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
125    ecore_x_netwm_opacity_set(xwin, 0);
126    // Create atom for notification level
127    _notification_level_atom = ecore_x_atom_get("_E_ILLUME_NOTIFICATION_LEVEL");
128
129    // HIGH:150, NORMAL:100, LOW:50
130    level = 100;
131
132    // Set notification level of the window
133    ecore_x_window_prop_property_set(xwin, _notification_level_atom, ECORE_X_ATOM_CARDINAL, 32, &level, 1);
134 }
135 #endif
136
137 static void _hide_cb(void *data, Evas_Object *obj __UNUSED__,
138                              const char *emission __UNUSED__,
139                              const char *source __UNUSED__)
140 {
141    Widget_Data *wd = elm_widget_data_get(data);
142
143    if (!wd) return;
144    evas_object_hide(wd->win);
145    evas_object_smart_callback_call(data, SIG_HIDDEN, NULL);
146 }
147
148 static void _clicked_cb(void *data, Evas_Object *obj __UNUSED__,
149                              const char *emission __UNUSED__,
150                              const char *source __UNUSED__)
151 {
152    Widget_Data *wd = elm_widget_data_get(data);
153
154    if (!wd) return;
155    evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
156 }
157
158 static Evas_Object
159 *_create_window(Evas_Object *parent, const char *name)
160 {
161    Evas_Object *win;
162
163    win = elm_win_add(parent, name, ELM_WIN_BASIC);
164    elm_win_title_set(win, name);
165    elm_win_borderless_set(win, EINA_TRUE);
166    elm_win_autodel_set(win, EINA_TRUE);
167    elm_win_alpha_set(win, EINA_TRUE);
168    evas_object_size_hint_weight_set(win, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
169    evas_object_size_hint_align_set(win, EVAS_HINT_FILL, EVAS_HINT_FILL);
170
171 #ifdef HAVE_ELEMENTARY_X
172    // set top window
173    _update_window_hints(win);
174 #endif
175    return win;
176 }
177
178 static void
179 _win_rotated(Evas_Object *obj)
180 {
181    Widget_Data *wd = elm_widget_data_get(obj);
182    int x = 0, y = 0, w = 0, angle = 0;
183
184    if (!wd) return;
185    angle = elm_win_rotation_get(wd->win);
186    if (angle % 90) return;
187    angle %= 360;
188    if (angle < 0) angle += 360;
189    wd->angle = angle;
190    _update_geometry_on_rotation(obj, wd->angle, &x, &y, &w);
191    evas_object_move(wd->win, x, y);
192    evas_object_resize(wd->win, w, wd->noti_height);
193 #ifdef HAVE_ELEMENTARY_X
194    _update_window_hints(wd->win);
195 #endif
196 }
197
198 static Eina_Bool
199 _prop_change(void *data, int type __UNUSED__, void *event)
200 {
201 #ifdef HAVE_ELEMENTARY_X
202    Ecore_X_Event_Window_Property *ev;
203    Widget_Data *wd = elm_widget_data_get(data);
204
205    if (!wd) return ECORE_CALLBACK_PASS_ON;
206    ev = event;
207    if (ev->atom == ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE)
208      {
209         if (ev->win == elm_win_xwindow_get(wd->win))
210           {
211              _win_rotated(data);
212           }
213      }
214    return ECORE_CALLBACK_PASS_ON;
215 #endif
216 }
217
218 static void
219 _create_tickernoti(Evas_Object *obj)
220 {
221 #ifdef HAVE_ELEMENTARY_X
222    Evas_Coord w;
223 #endif
224    Widget_Data *wd = elm_widget_data_get(obj);
225    char *data_win_height = NULL;
226    Evas *e;
227
228    if (!wd) return;
229
230    evas_object_move(wd->win, 0, 0);
231    e = evas_object_evas_get(wd->win);
232
233    wd->edje_obj = edje_object_add(e);
234    _elm_theme_object_set(wd->win, wd->edje_obj, "tickernoti", "base", "default");
235    elm_win_resize_object_add(wd->win, wd->edje_obj);
236
237    // tickernoti height setting
238    data_win_height = (char *)edje_object_data_get(wd->edje_obj, "height");
239    if (data_win_height != NULL && elm_scale_get() > 0.0)
240      wd->noti_height = (int)(elm_scale_get() * atoi(data_win_height));
241
242 #ifdef HAVE_ELEMENTARY_X
243    ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, NULL);
244    evas_object_resize(wd->win, w, wd->noti_height);
245    wd->rotation_event_handler = ecore_event_handler_add(
246             ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, obj);
247 #endif
248
249    edje_object_signal_callback_add(wd->edje_obj, "request,hide", "", _hide_cb, obj);
250    edje_object_signal_callback_add(wd->edje_obj, "clicked", "", _clicked_cb, obj);
251    evas_object_show(wd->edje_obj);
252 }
253
254 static void
255 _disable_hook(Evas_Object *obj)
256 {
257    Widget_Data *wd = elm_widget_data_get(obj);
258
259    if (!wd) return;
260 //TODO: To stop the event in case of being disabled
261 }
262
263 static void
264 _show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
265       void *event_info __UNUSED__)
266 {
267    Widget_Data *wd = elm_widget_data_get(obj);
268    if (!wd) return;
269
270 #ifdef HAVE_ELEMENTARY_X
271    _update_window_hints(wd->win);
272 #endif
273    evas_object_show(wd->win);
274    edje_object_signal_emit(wd->edje_obj, "effect,show", "elm");
275    edje_object_message_signal_process(wd->edje_obj);
276 }
277
278 static void
279 _hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
280       void *event_info __UNUSED__)
281 {
282    Widget_Data *wd = elm_widget_data_get(obj);
283
284    if (!wd) return;
285    evas_object_hide(wd->win);
286 }
287
288 static void _tickernoti_hide_cb(void *data, Evas_Object *obj __UNUSED__,
289                                  void *event_info __UNUSED__)
290 {
291    Widget_Data *wd = data;
292
293    if (!wd) return;
294
295    edje_object_signal_emit(wd->edje_obj, "effect,hide", "elm");
296    edje_object_message_signal_process(wd->edje_obj);
297 }
298
299 static void
300 _update_geometry_on_rotation(Evas_Object *obj, int angle, int *x, int *y, int *w)
301 {
302    ELM_CHECK_WIDTYPE(obj, widtype);
303    Widget_Data *wd = elm_widget_data_get(obj);
304
305    if (!wd) return;
306
307 #ifdef HAVE_ELEMENTARY_X
308    Evas_Coord root_w, root_h;
309
310    /*
311    * manually calculate win_tickernoti_indi window position & size
312    *  - win_indi is not full size window
313    */
314    ecore_x_window_size_get(ecore_x_window_root_first_get(), &root_w, &root_h);
315    // rotate win
316    switch(angle)
317      {
318       case 90:
319          *w = root_h;
320          if (wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM)
321            *x = root_w - wd->noti_height;
322          break;
323       case 270:
324          *w = root_h;
325          if (!(wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM))
326            *x = root_w - wd->noti_height;
327          break;
328       case 180:
329          *w = root_w;
330          if (!wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM)
331            *y = root_h - wd->noti_height;
332          break;
333        case 0:
334       default:
335          *w = root_w;
336          if (wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM)
337            *y = root_h - wd->noti_height;
338          break;
339      }
340 #endif
341 }
342
343 static void
344 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
345 {
346    Widget_Data *wd = elm_widget_data_get(obj);
347    Evas_Object *sub = event_info;
348    if (!wd) return;
349    if (sub == wd->icon)
350      wd->icon = NULL;
351    if (sub == wd->button)
352      wd->button = NULL;
353 }
354
355 static void
356 _elm_tickernoti_label_set(Evas_Object *obj, const char *part, const char *label)
357 {
358    ELM_CHECK_WIDTYPE(obj, widtype);
359    Widget_Data *wd = elm_widget_data_get(obj);
360
361    if (!wd) return;
362    if (part && strcmp(part, "default")) return;
363    eina_stringshare_replace(&wd->label, label);
364    edje_object_part_text_set(wd->edje_obj, "elm.text", wd->label);
365    _sizing_eval(obj);
366 }
367
368 const char *
369 _elm_tickernoti_label_get(const Evas_Object *obj, const char *part)
370 {
371    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
372    Widget_Data *wd = elm_widget_data_get(obj);
373
374    if (part && strcmp(part, "default")) return NULL;
375    if (!wd) return NULL;
376    return wd->label;
377 }
378
379 static void
380 _elm_tickernoti_icon_set(Evas_Object *obj, Evas_Object *icon)
381 {
382    ELM_CHECK_WIDTYPE(obj, widtype);
383    Widget_Data *wd = elm_widget_data_get(obj);
384
385    if (!wd) return;
386    if (wd->icon == icon) return;
387    if (wd->icon) evas_object_del(wd->icon);
388    wd->icon = icon;
389    if (icon)
390      {
391         elm_widget_sub_object_add(obj, icon);
392         edje_object_part_swallow(wd->edje_obj, "icon", icon);
393      }
394 }
395
396 static void
397 _elm_tickernoti_button_set(Evas_Object *obj, Evas_Object *button)
398 {
399    ELM_CHECK_WIDTYPE(obj, widtype);
400    Widget_Data *wd = elm_widget_data_get(obj);
401
402    if (!wd) return;
403    if (wd->button == button) return;
404    if (wd->button) evas_object_del(wd->button);
405    wd->button = button;
406    if (button)
407      {
408         elm_widget_sub_object_add(obj, button);
409         edje_object_part_swallow(wd->edje_obj, "button", button);
410         evas_object_smart_callback_add(wd->button, "clicked", _tickernoti_hide_cb, wd);
411      }
412 }
413
414 static void
415 _elm_tickernoti_content_part_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
416 {
417    ELM_CHECK_WIDTYPE(obj, widtype);
418    Widget_Data *wd = elm_widget_data_get(obj);
419
420    if (!wd || !part) return;
421    if (!part || !strcmp(part, "icon"))
422      {
423         _elm_tickernoti_icon_set(obj, content);
424         return;
425      }
426    else if (!strcmp(part, "button"))
427      {
428         _elm_tickernoti_button_set(obj, content);
429         return;
430      }
431 }
432
433 static Evas_Object *
434 _elm_tickernoti_icon_get(const Evas_Object *obj)
435 {
436    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
437    Widget_Data *wd = elm_widget_data_get(obj);
438    if (!wd) return NULL;
439    return wd->icon;
440 }
441
442 static Evas_Object *
443 _elm_tickernoti_button_get(const Evas_Object *obj)
444 {
445    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
446    Widget_Data *wd = elm_widget_data_get(obj);
447    if (!wd) return NULL;
448    return wd->button;
449 }
450
451 static Evas_Object *
452 _elm_tickernoti_content_part_get_hook(Evas_Object *obj, const char *part)
453 {
454    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
455    Widget_Data *wd = elm_widget_data_get(obj);
456
457    if (!wd || !part) return NULL;
458    if (!part || !strcmp(part, "icon"))
459      return _elm_tickernoti_icon_get(obj);
460    else if (!strcmp(part, "button"))
461      return _elm_tickernoti_button_get(obj);
462    return NULL;
463 }
464
465 static Evas_Object *
466 _elm_tickernoti_icon_unset(Evas_Object *obj)
467 {
468    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
469    Evas_Object *icon;
470    Widget_Data *wd = elm_widget_data_get(obj);
471
472    if (!wd || !wd->icon) return NULL;
473    icon = wd->icon;
474    elm_widget_sub_object_del(obj, wd->icon);
475    edje_object_part_unswallow(wd->edje_obj, icon);
476    wd->icon = NULL;
477    return icon;
478 }
479
480 static Evas_Object *
481 _elm_tickernoti_button_unset(Evas_Object *obj)
482 {
483    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
484    Evas_Object *button;
485    Widget_Data *wd = elm_widget_data_get(obj);
486
487    if (!wd || !wd->button) return NULL;
488    button = wd->button;
489    elm_widget_sub_object_del(obj, wd->button);
490    edje_object_part_unswallow(wd->edje_obj, button);
491    wd->button = NULL;
492    return button;
493 }
494
495 static Evas_Object *
496 _elm_tickernoti_content_part_unset_hook(Evas_Object *obj, const char *part)
497 {
498    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
499    Widget_Data *wd = elm_widget_data_get(obj);
500
501    if (!wd || !part) return NULL;
502    if (!strcmp(part, "icon"))
503      return _elm_tickernoti_icon_unset(obj);
504    else if (!strcmp(part, "button"))
505      return _elm_tickernoti_button_unset(obj);
506    return NULL;
507 }
508
509 EAPI Evas_Object *
510 elm_tickernoti_add(Evas_Object *parent)
511 {
512    Evas_Object *obj;
513    Evas *e;
514    Widget_Data *wd;
515
516    wd = ELM_NEW(Widget_Data);
517    wd->win = _create_window(parent, "noti-window");
518
519    e = evas_object_evas_get(wd->win);
520    obj = elm_widget_add(e);
521    ELM_SET_WIDTYPE(widtype, "tickernoti");
522    elm_widget_type_set(obj, widtype);
523    elm_widget_sub_object_add(wd->win, obj);
524    elm_widget_data_set(obj, wd);
525    elm_widget_del_hook_set(obj, _del_hook);
526    elm_widget_theme_hook_set(obj, _theme_hook);
527    elm_widget_can_focus_set(obj, 0);
528    elm_widget_disable_hook_set(obj, _disable_hook);
529
530    wd->orient = ELM_TICKERNOTI_ORIENT_TOP;
531
532    _create_tickernoti(obj);
533    elm_widget_text_set_hook_set(obj, _elm_tickernoti_label_set);
534    elm_widget_text_get_hook_set(obj, _elm_tickernoti_label_get);
535    elm_widget_content_set_hook_set(obj, _elm_tickernoti_content_part_set_hook);
536    elm_widget_content_get_hook_set(obj, _elm_tickernoti_content_part_get_hook);
537    elm_widget_content_unset_hook_set(obj, _elm_tickernoti_content_part_unset_hook);
538    evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, NULL);
539
540    evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _show, NULL);
541    evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, NULL);
542    evas_object_smart_callbacks_descriptions_set(obj, _signals);
543    return obj;
544 }
545
546 EAPI int
547 elm_tickernoti_rotation_get(const Evas_Object *obj)
548 {
549    ELM_CHECK_WIDTYPE(obj, widtype) -1;
550    Widget_Data *wd = elm_widget_data_get(obj);
551    if (!wd) return -1;
552    return wd->angle;
553 }
554
555 EAPI void
556 elm_tickernoti_rotation_set(Evas_Object *obj, int angle)
557 {
558    ELM_CHECK_WIDTYPE(obj, widtype);
559    Widget_Data *wd = elm_widget_data_get(obj);
560
561    if (!wd) return;
562    if (angle % 90) return;
563    angle %= 360;
564    if (angle < 0) angle += 360;
565    wd->angle = angle;
566    elm_win_rotation_with_resize_set (wd->win, angle);
567 }
568
569 EAPI void
570 elm_tickernoti_orient_set(Evas_Object *obj, Elm_Tickernoti_Orient orient)
571 {
572    ELM_CHECK_WIDTYPE(obj, widtype);
573
574 #ifdef HAVE_ELEMENTARY_X
575    Evas_Coord root_w, root_h;
576 #endif
577    Widget_Data *wd = elm_widget_data_get(obj);
578
579    if (!wd) return;
580    if (orient >= ELM_TICKERNOTI_ORIENT_LAST) return;
581
582 #ifdef HAVE_ELEMENTARY_X
583    ecore_x_window_size_get(ecore_x_window_root_first_get(), &root_w, &root_h);
584 #endif
585
586    switch(orient) {
587       case ELM_TICKERNOTI_ORIENT_BOTTOM:
588 #ifdef HAVE_ELEMENTARY_X
589          evas_object_move(wd->win, 0, root_h - wd->noti_height);
590 #endif
591          wd->orient = ELM_TICKERNOTI_ORIENT_BOTTOM;
592          break;
593       case ELM_TICKERNOTI_ORIENT_TOP:
594       default:
595 #ifdef HAVE_ELEMENTARY_X
596          evas_object_move(wd->win, 0, 0);
597 #endif
598          wd->orient = ELM_TICKERNOTI_ORIENT_TOP;
599          break;
600    }
601 #ifdef HAVE_ELEMENTARY_X
602    _update_window_hints(wd->win);
603 #endif
604 }
605
606 EAPI Elm_Tickernoti_Orient
607 elm_tickernoti_orient_get(const Evas_Object *obj)
608 {
609    ELM_CHECK_WIDTYPE(obj, widtype) -1;
610    Widget_Data *wd = elm_widget_data_get(obj);
611
612    if (!wd) return ELM_TICKERNOTI_ORIENT_LAST;
613    return wd->orient;
614 }
615
616 EAPI Evas_Object *
617 elm_tickernoti_win_get(const Evas_Object *obj)
618 {
619    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
620    Widget_Data *wd = elm_widget_data_get(obj);
621    if (!wd) return NULL;
622    return wd->win;
623 }
624
625 EAPI void
626 elm_tickernoti_detailview_label_set(Evas_Object *obj, const char *label)
627 {
628    _elm_tickernoti_label_set(obj, NULL, label);
629 }
630
631 EAPI const char *
632 elm_tickernoti_detailview_label_get(const Evas_Object *obj)
633 {
634    return _elm_tickernoti_label_get(obj, NULL);
635 }
636
637 EAPI void
638 elm_tickernoti_detailview_button_set(Evas_Object *obj, Evas_Object *button)
639 {
640    _elm_tickernoti_button_set(obj, button);
641 }
642
643 EAPI Evas_Object *
644 elm_tickernoti_detailview_button_get(const Evas_Object *obj)
645 {
646    return _elm_tickernoti_button_get(obj);
647 }
648
649 EAPI void
650 elm_tickernoti_detailview_icon_set(Evas_Object *obj, Evas_Object *icon)
651 {
652    _elm_tickernoti_icon_set(obj, icon);
653 }
654
655 EAPI Evas_Object *
656 elm_tickernoti_detailview_icon_get(const Evas_Object *obj)
657 {
658    return _elm_tickernoti_icon_get(obj);
659 }
660
661 EAPI Elm_Tickernoti_Mode
662 elm_tickernoti_mode_get(const Evas_Object *obj)
663 {
664    ELM_CHECK_WIDTYPE(obj, widtype) -1;
665    Widget_Data *wd = elm_widget_data_get(obj);
666    if (!wd) return -1;
667    return wd->mode;
668 }
669
670 EAPI void
671 elm_tickernoti_mode_set(Evas_Object *obj, Elm_Tickernoti_Mode mode)
672 {
673    ELM_CHECK_WIDTYPE(obj, widtype);
674    Widget_Data *wd = elm_widget_data_get(obj);
675    if (!wd) return;
676
677    switch(mode){
678       case ELM_TICKERNOTI_DEFAULT:
679       case ELM_TICKERNOTI_DETAILVIEW:
680          wd->mode = mode;
681          break;
682       default:
683          break;
684    }
685 }
686
687 EAPI Evas_Object *
688 elm_tickernoti_detailview_get(const Evas_Object *obj)
689 {
690    return elm_tickernoti_win_get(obj);
691 }
692
693 EAPI void
694 elm_tickernoti_orientation_set(Evas_Object *obj, Elm_Tickernoti_Orient orient)
695 {
696    elm_tickernoti_orient_set(obj, orient);
697 }
698
699 EAPI Elm_Tickernoti_Orient
700 elm_tickernoti_orientation_get(const Evas_Object *obj)
701 {
702    return elm_tickernoti_orient_get(obj);
703 }
704
705 EAPI void
706 elm_tickernoti_label_set(Evas_Object *obj, const char *label)
707 {
708    _elm_tickernoti_label_set(obj, NULL, label);
709 }
710
711 EAPI const char *
712 elm_tickernoti_label_get(const Evas_Object *obj)
713 {
714    return _elm_tickernoti_label_get(obj, NULL);
715 }
716
717 EAPI void
718 elm_tickernoti_button_set(Evas_Object *obj, Evas_Object *button)
719 {
720    _elm_tickernoti_button_set(obj, button);
721 }
722
723 EAPI Evas_Object *
724 elm_tickernoti_button_get(const Evas_Object *obj)
725 {
726    return _elm_tickernoti_button_get(obj);
727 }
728
729 EAPI void
730 elm_tickernoti_icon_set(Evas_Object *obj, Evas_Object *icon)
731 {
732    _elm_tickernoti_icon_set(obj, icon);
733 }
734
735 EAPI Evas_Object *
736 elm_tickernoti_icon_get(const Evas_Object *obj)
737 {
738    return _elm_tickernoti_icon_get(obj);
739 }