[Refactoring] Removed trailing whitespaces.
[framework/uifw/elementary.git] / src / lib / elc_navigationbar.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3
4 /**
5  * @defgroup NavigationBar NavigationBar
6  * @ingroup Elementary
7  *
8  * The Navigationbar is an object that allows flipping (with animation) between 1 or
9  * more of objects, much like a stack of windows within the window. It also displays title
10  * area above all the pages consisting of title,function buttons.
11  *
12  * Objects can be pushed or popped from the stack.
13  * Pushes and pops will animate (and a pop will delete the object once the
14  * animation is finished). Objects are pushed to the top with
15  * elm_navigationbar_push() and when the top item is no longer
16  * wanted, simply pop it with elm_navigationbar_pop() and it will also be
17  * deleted. You can query which objects are the top and bottom with
18  * elm_navigationbar_content_bottom_get() and elm_navigationbar_content_top_get().
19  */
20
21 #define _ELM_NAVIBAR_PREV_BTN_DEFAULT_LABEL "Previous"
22
23 typedef struct _Widget_Data Widget_Data;
24 typedef struct _Elm_Navigationbar_Item Elm_Navigationbar_Item;
25 typedef struct _Transit_Cb_Data Transit_Cb_Data;
26
27 static const char _navigationbar_key[] = "_elm_navigationbar";
28
29 //TODO: Remove!
30 typedef enum
31   {
32      ELM_NAVIGATIONBAR_PREV_BUTTON = ELM_NAVIGATIONBAR_FUNCTION_BUTTON1,
33      ELM_NAVIGATIONBAR_NEXT_BUTTON = ELM_NAVIGATIONBAR_FUNCTION_BUTTON2,
34      ELM_NAVIGATIONBAR_TITLE_BTN_CNT = 2
35   } Elm_Navigationbar_Button_Type;
36
37 struct _Widget_Data
38 {
39    Eina_List *stack;
40    Evas_Object *base;
41    Evas_Object *pager;
42    Eina_Bool title_visible : 1;
43    Eina_Bool popping: 1;
44  };
45
46 struct _Elm_Navigationbar_Item
47 {
48    Elm_Widget_Item base;
49    const char *title;
50    const char *subtitle;
51    Eina_List *title_obj_list;   //TODO: Remove!
52    Evas_Object *title_obj;
53    Evas_Object *title_btns[ELM_NAVIGATIONBAR_TITLE_BTN_CNT];
54    Evas_Object *content;
55    Evas_Object *icon;
56    Eina_Bool titleobj_visible :1;
57    Eina_Bool back_btn :1;
58 };
59
60 //TODO: Remove!
61 struct _Transit_Cb_Data
62 {
63    Elm_Navigationbar_Item* prev_it;
64    Elm_Navigationbar_Item* it;
65    Evas_Object *navibar;
66    Eina_Bool pop : 1;
67    Eina_Bool first_page : 1;
68 };
69
70 static const char *widtype = NULL;
71
72 static void _del_hook(Evas_Object *obj);
73 static void _theme_hook(Evas_Object *obj);
74 static void _sizing_eval(Evas_Object *obj);
75 static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
76 static void _item_sizing_eval(Elm_Navigationbar_Item *it);
77 static void _item_del(Elm_Navigationbar_Item *it);
78 static void _back_button_clicked(void *data, Evas_Object *obj, void *event_info);
79 static void _button_size_set(Evas_Object *obj);
80 static Eina_Bool _button_set(Evas_Object *obj, Evas_Object *prev_btn, Evas_Object *new_btn, Eina_Bool back_btn);
81 static void _transition_complete_cb(void *data);
82 static void _elm_navigationbar_prev_btn_set(Evas_Object *obj,
83                                             Evas_Object *content,
84                                             Evas_Object *new_btn,
85                                             Elm_Navigationbar_Item *it);
86 static void _elm_navigationbar_next_btn_set(Evas_Object *obj,
87                                             Evas_Object *content,
88                                             Evas_Object *new_btn,
89                                             Elm_Navigationbar_Item *it);
90 static void _title_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
91 static void _titleobj_switching(Evas_Object *obj, Elm_Navigationbar_Item *it);
92
93 static const char SIG_HIDE_FINISHED[] = "hide,finished";
94 static const char SIG_TITLE_OBJ_VISIBLE_CHANGED[] = "titleobj,visible,changed";
95 static const char SIG_TITLE_CLICKED[] = "title,clicked";
96
97 static const Evas_Smart_Cb_Description _signals[] = {
98        {SIG_HIDE_FINISHED, ""},
99        {SIG_TITLE_OBJ_VISIBLE_CHANGED, ""},
100        {SIG_TITLE_CLICKED, ""},
101        {NULL, NULL}
102 };
103
104 static void
105 _content_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
106 {
107    Elm_Navigationbar_Item *it = data;
108    evas_object_data_del(obj, _navigationbar_key);
109    it->content = NULL;
110    //TODO: it will be better remove this page?
111 }
112
113 static void
114 _title_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
115 {
116    Elm_Navigationbar_Item *it = data;
117    Eina_List *l = NULL;
118    elm_navigationbar_title_object_list_unset(it->base.widget, it->content, &l);
119    if (!l) return;
120    evas_object_del(eina_list_data_get(l));
121    eina_list_free(l);
122 }
123
124 static void
125 _title_icon_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
126 {
127    Elm_Navigationbar_Item *it = data;
128    it->icon = NULL;
129 }
130
131 static void
132 _title_btn_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
133 {
134    Elm_Navigationbar_Item *it = data;
135
136    if (it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON] == obj)
137      it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON] = NULL;
138    else if (it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON] == obj)
139      it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON] = NULL;
140 }
141
142 static Eina_Bool
143 _title_btn_set(Elm_Navigationbar_Item *it, Evas_Object *btn, int title_btn_idx, Eina_Bool back_btn)
144 {
145    Eina_Bool changed;
146
147    if(it->title_btns[title_btn_idx] == btn) return EINA_FALSE;
148
149    changed = _button_set(it->base.widget, it->title_btns[title_btn_idx], btn, back_btn);
150    it->title_btns[title_btn_idx] = btn;
151
152    if ((!changed) || (!btn)) return EINA_FALSE;
153
154    it->back_btn = back_btn;
155
156    evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, _title_btn_del, it);
157
158    return EINA_TRUE;
159 }
160
161 static Evas_Object *
162 _create_back_btn(Evas_Object *parent, const char *title, void *data)
163 {
164    Evas_Object *btn = elm_button_add(parent);
165    if (!btn) return NULL;
166    elm_object_text_set(btn, title);
167    evas_object_smart_callback_add(btn, "clicked", _back_button_clicked, data);
168    elm_object_focus_allow_set(btn, EINA_FALSE);
169    return btn;
170 }
171
172 static void
173 _del_hook(Evas_Object *obj)
174 {
175    Widget_Data *wd = elm_widget_data_get(obj);
176    Eina_List *list;
177    Elm_Navigationbar_Item *it;
178
179    EINA_LIST_FOREACH(wd->stack, list, it)
180      _item_del(it);
181    eina_list_free(wd->stack);
182    free(wd);
183 }
184
185 static void
186 _theme_hook(Evas_Object *obj)
187 {
188    Widget_Data *wd = elm_widget_data_get(obj);
189    Eina_List *list = NULL;
190    Elm_Navigationbar_Item *it = NULL;
191    char buf[4096];
192
193    if (!wd) return;
194    _elm_theme_object_set(obj, wd->base, "navigationbar", "base", elm_widget_style_get(obj));
195
196    list = eina_list_last(wd->stack);
197    if (list)
198      {
199         it = eina_list_data_get(list);
200         if (it)
201           {
202              //buttons
203              if (it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON])
204                edje_object_part_swallow(wd->base, "elm.swallow.prev_btn", it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON]);
205              if (it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON])
206                edje_object_part_swallow(wd->base, "elm.swallow.next_btn", it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON]);
207
208              //icon
209              if (it->icon)
210                {
211                   edje_object_part_swallow(wd->base, "elm.swallow.icon", it->icon);
212                   edje_object_signal_emit(wd->base, "elm,state,icon,visible", "elm");
213                }
214
215              //title text
216              if (it->title)
217                edje_object_part_text_set(wd->base, "elm.text", it->title);
218
219              //title object
220              if (it->title_obj)
221                {
222                   edje_object_part_swallow(wd->base, "elm.swallow.title", it->title_obj);
223
224                   if (it->titleobj_visible)
225                     edje_object_signal_emit(wd->base, "elm,state,show,noanimate,title", "elm");
226                   else
227                     edje_object_signal_emit(wd->base, "elm,state,hide,noanimate,title", "elm"); //elm,state,title,hide
228
229                   if (it->title)
230                     edje_object_signal_emit(wd->base, "elm,state,show,extended", "elm");
231                }
232             }
233      }
234
235    if (!wd->title_visible)
236      edje_object_signal_emit(wd->base, "elm,state,item,moveup", "elm");
237
238    edje_object_message_signal_process(wd->base);
239    _sizing_eval(obj);
240 }
241
242 static void
243 _item_del(Elm_Navigationbar_Item *it)
244 {
245    //TODO: So hard to manage.
246    //TODO: Just prepare one layout for title objects.
247    //TODO: then remove the layout only.
248    Widget_Data *wd;
249    int idx;
250
251    if (!it) return;
252
253    wd = elm_widget_data_get(it->base.widget);
254    if (!wd) return;
255
256    //Remove Function Buttons
257    for (idx = 0; idx < ELM_NAVIGATIONBAR_TITLE_BTN_CNT; idx++)
258      {
259         if (!it->title_btns[idx]) continue;
260         if (!it->back_btn) elm_object_unfocus(it->title_btns[idx]);
261         evas_object_event_callback_del(it->title_btns[idx], EVAS_CALLBACK_DEL, _title_btn_del);
262         evas_object_del(it->title_btns[idx]);
263      }
264    if (it->icon)
265      {
266         evas_object_event_callback_del(it->icon, EVAS_CALLBACK_DEL, _title_icon_del);
267         evas_object_del(it->icon);
268      }
269    if (it->title_obj)
270      {
271         evas_object_event_callback_del(it->title_obj, EVAS_CALLBACK_DEL, _title_obj_del);
272         evas_object_del(it->title_obj);
273         eina_list_free(it->title_obj_list);
274      }
275    if (it->title) eina_stringshare_del(it->title);
276    if (it->subtitle) eina_stringshare_del(it->subtitle);
277
278    if (it->content)
279      {
280         evas_object_data_del(it->content, _navigationbar_key);
281         evas_object_event_callback_del(it->content, EVAS_CALLBACK_DEL, _content_del);
282      }
283
284    free(it);
285 }
286
287 static void
288 _sizing_eval(Evas_Object *obj)
289 {
290    Widget_Data *wd;
291    Eina_List *list;
292
293    wd  = elm_widget_data_get(obj);
294    if (!wd) return;
295
296    list = eina_list_last(wd->stack);
297    if (!list) return;
298
299    _item_sizing_eval(list->data);
300 }
301
302 static void
303 _item_sizing_eval(Elm_Navigationbar_Item *it)
304 {
305    if (!it) return;
306    Widget_Data *wd = elm_widget_data_get(it->base.widget);
307    Evas_Coord minw;
308
309    if (!wd) return;
310
311    edje_object_size_min_calc(wd->base, &minw, NULL);
312
313    //TODO: Even the below code for size calculation is redundant and should be removed.
314    //TODO: Item_sizing_eval function has to be totally refactored/removed.
315    _button_size_set(it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON]);
316    _button_size_set(it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON]);
317 }
318
319 static void
320 _resize(void *data __UNUSED__, Evas *e  __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
321 {
322    _sizing_eval(obj);
323 }
324
325 static void
326 _titleobj_switching(Evas_Object *obj, Elm_Navigationbar_Item *it)
327 {
328    Widget_Data *wd = elm_widget_data_get(obj);
329    if (!wd) return;
330
331    if (!it->title_obj) return;
332
333    if (elm_navigationbar_content_top_get(it->base.widget) != it->content)
334      return;
335
336    if (it->titleobj_visible)
337      edje_object_signal_emit(wd->base, "elm,state,show,title", "elm"); //elm,state,title,show
338    else
339      edje_object_signal_emit(wd->base, "elm,state,hide,title", "elm"); //elm,state,title,hide
340
341    _item_sizing_eval(it);
342 }
343
344 static void
345 _title_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
346 {
347    Evas_Object *navibar = data;
348    Widget_Data *wd;
349    Eina_List *last;
350    Elm_Navigationbar_Item *it;
351
352    wd = elm_widget_data_get(navibar);
353    if (!wd) return;
354
355    last = eina_list_last(wd->stack);
356    if (!last) return;
357
358    it = eina_list_data_get(last);
359    if ((!it) || (!it->title_obj)) return;
360
361    if (!it->titleobj_visible)
362      {
363         it->titleobj_visible = EINA_TRUE;
364         evas_object_smart_callback_call(it->base.widget, SIG_TITLE_OBJ_VISIBLE_CHANGED, (void *) EINA_TRUE);
365      }
366    else
367      {
368         it->titleobj_visible = EINA_FALSE;
369         evas_object_smart_callback_call(it->base.widget, SIG_TITLE_OBJ_VISIBLE_CHANGED, (void *) EINA_FALSE);
370      }
371
372    evas_object_smart_callback_call(navibar, SIG_TITLE_CLICKED, NULL);
373
374    _titleobj_switching(navibar, it);
375 }
376
377 //TODO: should be renamed.
378 static void
379 _transition_complete_cb(void *data)
380 {
381    Evas_Object *navi_bar;
382    Widget_Data *wd;
383    Elm_Navigationbar_Item *prev_it;
384    Elm_Navigationbar_Item *it;
385    Eina_List *ll;
386
387    Transit_Cb_Data *cb = data;
388    if (!cb) return;
389
390    navi_bar = cb->navibar;
391    if (!navi_bar) return;
392
393    wd = elm_widget_data_get(navi_bar);
394    if (!wd) return;
395
396    prev_it = cb->prev_it;
397    it = cb->it;
398
399    if (cb->pop && prev_it)
400      {
401         ll = eina_list_last(wd->stack);
402         if (ll->data == prev_it)
403           {
404              _item_del(prev_it);
405              wd->stack = eina_list_remove_list(wd->stack, ll);
406           }
407      }
408    else if (prev_it)
409      {
410         if (prev_it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON])
411            evas_object_hide(prev_it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON]);
412         if (prev_it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON])
413           evas_object_hide(prev_it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON]);
414         if (prev_it->title_obj)
415           evas_object_hide(prev_it->title_obj);
416         if (prev_it->icon)
417           evas_object_hide(prev_it->icon);
418      }
419    if ((it) && (wd->title_visible))
420      {
421         edje_object_part_text_set(wd->base, "elm.text", it->title);
422
423         if (!cb->first_page)
424           {
425              if (cb->pop)
426                edje_object_signal_emit(wd->base, "elm,action,pop", "elm");
427              else
428                edje_object_signal_emit(wd->base, "elm,action,push", "elm");
429              evas_object_pass_events_set(wd->base, EINA_TRUE);
430           }
431         if (it->title_obj)
432           {
433              edje_object_part_swallow(wd->base, "elm.swallow.title", it->title_obj);
434           }
435         if (it->subtitle)
436           edje_object_part_text_set(wd->base, "elm.text.sub", it->subtitle);
437         else
438           edje_object_part_text_set(wd->base, "elm.text.sub", NULL);
439
440         if (it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON])
441           edje_object_part_swallow(wd->base, "elm.swallow.prev_btn", it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON]);
442         if (it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON])
443           edje_object_part_swallow(wd->base, "elm.swallow.next_btn", it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON]);
444
445         if(it->icon)
446           {
447              edje_object_part_swallow(wd->base, "elm.swallow.icon", it->icon);
448              edje_object_signal_emit(wd->base, "elm,state,icon,visible", "elm");
449           }
450         else
451           edje_object_signal_emit(wd->base, "elm,state,icon,hidden", "elm");
452
453         if ((it->title_obj) && (it->title))
454           {
455              edje_object_signal_emit(wd->base, "elm,state,show,extended", "elm");
456              if(it->titleobj_visible)
457                {
458                  //TODO: remove the dependency on these signals as related to nbeat, try to make it totally theme dependent
459                  edje_object_signal_emit(wd->base, "elm,state,show,noanimate,title", "elm");
460                }
461              else
462                //TODO: remove the dependency on these signals as related to nbeat, try to make it totally theme dependent
463                edje_object_signal_emit(wd->base, "elm,state,hide,noanimate,title", "elm");
464           }
465         else
466           {
467              edje_object_signal_emit(wd->base, "elm,state,hide,extended", "elm");
468              //TODO: remove the dependency on these signals as related to nbeat, try to make it totally theme dependent
469              edje_object_signal_emit(wd->base, "elm,state,hide,noanimate,title", "elm");
470              it->titleobj_visible = EINA_FALSE;
471           }
472      }
473 }
474
475 static void
476 _back_button_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
477 {
478    Elm_Navigationbar_Item *it = data;
479    elm_navigationbar_pop(it->base.widget);
480 }
481
482 static void
483 _hide_finished(void *data, Evas_Object *obj __UNUSED__, void *event_info)
484 {
485    Evas_Object *navi_bar = data;
486    Widget_Data *wd =  elm_widget_data_get(navi_bar);
487    wd->popping = EINA_FALSE;
488    evas_object_smart_callback_call(navi_bar, SIG_HIDE_FINISHED, event_info);
489    evas_object_pass_events_set(wd->base, EINA_FALSE);
490 }
491
492 static void
493 _button_size_set(Evas_Object *obj)
494 {
495    if (!obj) return;
496    Evas_Coord minw = -1, minh = -1, maxw= -1, maxh = -1;
497    Evas_Coord w = 0, h = 0;
498
499    evas_object_size_hint_min_get(obj, &minw, &minh);
500    evas_object_size_hint_max_get(obj, &maxw, &maxh);
501    evas_object_geometry_get(obj, NULL, NULL, &w, &h);
502    if (w < minw) w = minw;
503    if (h < minh) h = minh;
504    if ((maxw >= 0) && (w > maxw)) w = maxw;
505    if ((maxh >= 0) && (h > maxh)) h = maxh;
506    evas_object_resize(obj, w, h);
507 }
508
509 static void
510 _elm_navigationbar_prev_btn_set(Evas_Object *obj, Evas_Object *content, Evas_Object *new_btn, Elm_Navigationbar_Item *it)
511 {
512    Widget_Data *wd;
513    Evas_Object *prev_btn;
514
515    wd = elm_widget_data_get(obj);
516    if (!wd) return;
517
518    if (!_title_btn_set(it, new_btn, ELM_NAVIGATIONBAR_PREV_BUTTON, EINA_FALSE))
519      return;
520
521    //update if the content is the top item
522    if (elm_navigationbar_content_top_get(obj) != content)
523      return;
524
525    prev_btn = edje_object_part_swallow_get(wd->base, "elm.swallow.prev_btn");
526    if (prev_btn) evas_object_del(prev_btn);
527    edje_object_part_swallow(wd->base, "elm.swallow.prev_btn", new_btn);
528 }
529
530 //TODO: looks make this  _elm_navigationbar_function_button1_set  same.
531 static void
532 _elm_navigationbar_next_btn_set(Evas_Object *obj, Evas_Object *content, Evas_Object *new_btn, Elm_Navigationbar_Item *it)
533 {
534    Widget_Data *wd;
535    Evas_Object *prev_btn;
536
537    wd = elm_widget_data_get(obj);
538    if (!wd) return;
539
540    if (!_title_btn_set(it, new_btn, ELM_NAVIGATIONBAR_NEXT_BUTTON, EINA_FALSE))
541      return;
542
543    //update if the content is the top item
544    if (elm_navigationbar_content_top_get(obj) != content)
545      return;
546
547    prev_btn = edje_object_part_swallow_get(wd->base, "elm.swallow.next_btn");
548    if (prev_btn) evas_object_del(prev_btn);
549    edje_object_part_swallow(wd->base, "elm.swallow.next_btn", new_btn);
550 }
551
552 static Eina_Bool
553 _button_set(Evas_Object *obj, Evas_Object *prev_btn, Evas_Object *new_btn, Eina_Bool back_btn)
554 {
555    char buf[4096];   //TODO: How to guarantee this buffer size?
556    Eina_Bool changed = EINA_FALSE;
557
558    if (prev_btn)
559      {
560         changed = EINA_TRUE;
561         evas_object_del(prev_btn);
562      }
563    if (!new_btn) return changed;
564
565    if (back_btn)
566      {
567         snprintf(buf, sizeof(buf), "navigationbar_prev_btn/%s", elm_widget_style_get(obj));
568         elm_object_style_set(new_btn, buf);
569      }
570    else
571      {
572         if (!strcmp("default", elm_object_style_get(new_btn)))
573           {
574              snprintf(buf, sizeof(buf), "navigationbar_next_btn/%s", elm_widget_style_get(obj));
575              elm_object_style_set(new_btn, buf);
576           }
577      }
578
579    elm_widget_sub_object_add(obj, new_btn);
580    changed = EINA_TRUE;
581
582    return changed;
583 }
584
585 /**
586  * Add a new navigationbar to the parent
587  *
588  * @param[in] parent The parent object
589  * @return The new object or NULL if it cannot be created
590  *
591  * @ingroup NavigationBar
592  */
593 EAPI Evas_Object *
594 elm_navigationbar_add(Evas_Object *parent)
595 {
596    Evas_Object *obj;
597    Evas *e;
598    Widget_Data *wd;
599
600    EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
601
602    wd = ELM_NEW(Widget_Data);
603    e = evas_object_evas_get(parent);
604    obj = elm_widget_add(e);
605    ELM_SET_WIDTYPE(widtype, "navigationbar");
606    elm_widget_type_set(obj, "navigationbar");
607    elm_widget_sub_object_add(parent, obj);
608    elm_widget_data_set(obj, wd);
609    elm_widget_del_hook_set(obj, _del_hook);
610    elm_widget_theme_hook_set(obj, _theme_hook);
611
612    wd->base = edje_object_add(e);
613    _elm_theme_object_set(obj, wd->base, "navigationbar", "base", "default");
614    elm_widget_resize_object_set(obj, wd->base);
615    //TODO: elm,action,title,clicked
616    edje_object_signal_callback_add(wd->base, "elm,action,clicked", "elm",
617                                             _title_clicked, obj);
618
619    //TODO: How about making the pager as a base?
620    //TODO: Swallow title and content as one content into the pager.
621    wd->pager = elm_pager_add(obj);
622    elm_object_style_set(wd->pager, "navigationbar");
623    elm_widget_sub_object_add(obj, wd->pager);
624    edje_object_part_swallow(wd->base, "elm.swallow.content", wd->pager);
625    evas_object_smart_callback_add(wd->pager, "hide,finished", _hide_finished, obj);
626    evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, NULL);
627
628    wd->title_visible = EINA_TRUE;
629
630    evas_object_smart_callbacks_descriptions_set(obj, _signals);
631
632    //TODO: apply elm_object_disabled_set
633
634    return obj;
635 }
636
637 /**
638  * Push an object to the top of the NavigationBar stack (and show it)
639  * The object pushed becomes a child of the navigationbar and will be controlled
640  * it is deleted when the navigationbar is deleted or when the content is popped.
641  *
642  * @param[in] obj The NavigationBar object
643  * @param[in] title The title string
644  * @param[in] prev_btn The previous button
645  * @param[in] next_btn The next button
646  * @param[in] unused Unused.
647  * @param[in] content The object to push
648  *
649  * @ingroup NavigationBar
650  */
651 EAPI void
652 elm_navigationbar_push(Evas_Object *obj, const char *title, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *unused __UNUSED__, Evas_Object *content)
653 {
654    ELM_CHECK_WIDTYPE(obj, widtype);
655
656    Widget_Data *wd;
657    Elm_Navigationbar_Item *it;
658    Elm_Navigationbar_Item *top_it;
659
660    if (!content) return;
661
662    wd = elm_widget_data_get(obj);
663    if (!wd) return;
664
665    if (evas_object_data_get(content, _navigationbar_key)) return;
666
667    it = elm_widget_item_new(obj, Elm_Navigationbar_Item);
668    if (!it) return;
669
670    top_it = eina_list_data_get(eina_list_last(wd->stack));
671
672    _title_btn_set(it, prev_btn, ELM_NAVIGATIONBAR_PREV_BUTTON, EINA_FALSE);
673    _title_btn_set(it, next_btn, ELM_NAVIGATIONBAR_NEXT_BUTTON, EINA_FALSE);
674
675    it->content = content;
676    evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, _content_del, it);
677    evas_object_data_set(content, _navigationbar_key, it);
678
679    //Add a prev-button automatically.
680    if ((!prev_btn) && (top_it))
681    {
682       if (top_it->title)
683         _title_btn_set(it, _create_back_btn(obj, top_it->title, it), ELM_NAVIGATIONBAR_PREV_BUTTON, EINA_TRUE);
684       else
685         _title_btn_set(it, _create_back_btn(obj, _ELM_NAVIBAR_PREV_BTN_DEFAULT_LABEL, it), ELM_NAVIGATIONBAR_PREV_BUTTON, EINA_TRUE);
686    }
687
688    eina_stringshare_replace(&it->title, title);
689    edje_object_part_text_set(wd->base, "elm.text", title);
690    _item_sizing_eval(it);
691
692    Transit_Cb_Data *cb = ELM_NEW(Transit_Cb_Data);
693    // unswallow items and start transition
694    // TODO: For what? why does it need to unswallow?
695    if (top_it)
696      {
697         cb->prev_it = top_it;
698         cb->first_page = EINA_FALSE;
699         if (top_it->title_obj) edje_object_part_unswallow(wd->base, top_it->title_obj);
700         if (top_it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON])
701           edje_object_part_unswallow(wd->base, top_it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON]);
702         if (top_it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON])
703           edje_object_part_unswallow(wd->base, top_it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON]);
704         if (top_it->icon)
705           edje_object_part_unswallow(wd->base, top_it->icon);
706      }
707    //If page is the first, then do not run the transition... but if user want.. ?
708    else
709      {
710         cb->prev_it = NULL;
711         cb->first_page = EINA_TRUE;
712      }
713    cb->navibar = obj;
714    cb->it = it;
715    cb->pop = EINA_FALSE;
716
717    _transition_complete_cb(cb);
718    free(cb);
719    elm_pager_content_push(wd->pager, it->content);
720
721    wd->stack = eina_list_append(wd->stack, it);
722    _sizing_eval(obj);
723 }
724
725 /**
726  * This pops the object that is on top (visible) in the navigationbar, makes it disappear, then deletes the object.
727  * The object that was underneath it, on the stack will become visible.
728  *
729  * @param[in] obj The NavigationBar object
730  *
731  * @ingroup NavigationBar
732  */
733 EAPI void
734 elm_navigationbar_pop(Evas_Object *obj)
735 {
736    ELM_CHECK_WIDTYPE(obj, widtype);
737    Widget_Data *wd = elm_widget_data_get(obj);
738    Eina_List *ll;
739    Transit_Cb_Data *cb;
740    Elm_Navigationbar_Item *it = NULL;
741    Elm_Navigationbar_Item *prev_it = NULL;
742
743    //TODO: It's impossible to pop while popping?
744    if (wd->popping) return;
745    if (!wd->stack) return;
746
747    //find item to be popped and to be shown
748    //TODO: hmm.. i think it's hard to manager separated list from elm_pager internal list. but how about use evas_object_data_set to each content??
749    ll = eina_list_last(wd->stack);
750    if (ll)
751      {
752         prev_it = ll->data;
753         ll = ll->prev;
754         if (ll)
755           it = ll->data;
756      }
757    //unswallow items and start trasition
758    cb = ELM_NEW(Transit_Cb_Data);
759
760    //Previous page is exist.
761    if (prev_it && it)
762      {
763         cb->prev_it = prev_it;
764         cb->it = it;
765         cb->pop = EINA_TRUE;
766         if (prev_it->title_obj)
767           edje_object_part_unswallow(wd->base, prev_it->title_obj);
768         if (prev_it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON])
769           edje_object_part_unswallow(wd->base, prev_it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON]);
770         if (prev_it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON])
771           edje_object_part_unswallow(wd->base, prev_it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON]);
772         if (prev_it->icon)
773           edje_object_part_unswallow(wd->base, prev_it->icon);
774         _item_sizing_eval(it);
775      }
776    //This case, it's the last page.
777    else if (prev_it)
778      {
779         cb->prev_it = prev_it;
780         cb->it = NULL;
781         cb->pop = EINA_TRUE;
782         //TODO: seems that flag is inverted.
783         cb->first_page = EINA_FALSE;
784      }
785    cb->navibar = obj;
786    _transition_complete_cb(cb);
787    wd->popping = EINA_TRUE;
788
789    elm_pager_content_pop(wd->pager);
790
791    if ((prev_it) && (!it))
792      edje_object_part_text_set(wd->base, "elm.text", NULL);
793
794    free(cb);
795 }
796
797 /**
798  * This Pops to the given content object (and update it) by deleting rest of the objects in between.
799  *
800  * @param[in] obj The NavigationBar object
801  * @param[in] content the object to show
802  *
803  * @ingroup NavigationBar
804  */
805 EAPI void
806 elm_navigationbar_to_content_pop(Evas_Object *obj, Evas_Object *content)
807 {
808    ELM_CHECK_WIDTYPE(obj, widtype);
809
810    Widget_Data *wd;
811    Eina_List *ll;
812    Elm_Navigationbar_Item *it;
813    Elm_Navigationbar_Item *prev_it;
814    Transit_Cb_Data *cb;
815
816    wd = elm_widget_data_get(obj);
817    if ((!wd) || (!content) || (!wd->stack)) return;
818
819    //find item to be popped and to be shown
820    it = prev_it = NULL;
821    ll = eina_list_last(wd->stack);
822    if (ll)
823      {
824         prev_it = ll->data;
825         ll =  ll->prev;
826      }
827    while (ll)
828      {
829         it = ll->data;
830         if ((it->base.widget) && (it->content != content))
831           {
832              _item_del(ll->data);
833              wd->stack = eina_list_remove_list(wd->stack, ll);
834              it = NULL;
835            }
836          else
837            break;
838          ll =  ll->prev;
839       }
840    if (prev_it && it)
841      {
842         //unswallow items and start trasition
843         cb = ELM_NEW(Transit_Cb_Data);
844         cb->prev_it = prev_it;
845         cb->it = it;
846         cb->pop = EINA_TRUE;
847         cb->first_page = EINA_FALSE;
848         cb->navibar = obj;
849
850         //TODO: make one call.
851         if (prev_it->title_obj)
852           edje_object_part_unswallow(wd->base, prev_it->title_obj);
853         if (prev_it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON])
854           edje_object_part_unswallow(wd->base, prev_it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON]);
855         if (prev_it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON])
856           edje_object_part_unswallow(wd->base, prev_it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON]);
857
858         _item_sizing_eval(it);
859         _transition_complete_cb(cb);
860
861         elm_pager_to_content_pop(wd->pager, content);
862      }
863 }
864
865 /**
866  * Set the title string for the pushed content
867  *
868  * @param[in] obj The NavigationBar object
869  * @param[in] content The object to push or pushed
870  * @param[in] title The title string
871  *
872  * @ingroup NavigationBar
873  */
874 EAPI void
875 elm_navigationbar_title_label_set(Evas_Object *obj, Evas_Object *content, const char *title)
876 {
877    ELM_CHECK_WIDTYPE(obj, widtype);
878    Widget_Data *wd;
879    Elm_Navigationbar_Item *it;
880
881    if (!content) return;
882
883    wd = elm_widget_data_get(obj);
884    if (!wd) return;
885
886    it = evas_object_data_get(content, _navigationbar_key);
887    if (!it) return;
888
889    eina_stringshare_replace(&it->title, title);
890    edje_object_part_text_set(wd->base, "elm.text", title);
891    _item_sizing_eval(it);
892 }
893
894 /**
895  * Return the title string of the pushed content
896  *
897  * @param[in] obj The NavigationBar object
898  * @param[in] content The object to push or pushed
899  * @return The title string or NULL if none
900  *
901  * @ingroup NavigationBar
902  */
903 EAPI const char *
904 elm_navigationbar_title_label_get(Evas_Object *obj, Evas_Object *content)
905 {
906    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
907    Widget_Data *wd;
908    Elm_Navigationbar_Item *it;
909
910    if (!content) return NULL;
911
912    wd = elm_widget_data_get(obj);
913    if (!wd) return NULL;
914
915    it = evas_object_data_get(content, _navigationbar_key);
916    if (!it) return NULL;
917    return it->title;
918 }
919
920 /**
921  * Set the title icon for the pushed content
922  *
923  * @param[in] obj The NavigationBar object
924  * @param[in] content The object to push or pushed
925  * @param[in] icon The icon object
926  *
927  * @ingroup NavigationBar
928  */
929 EAPI void
930 elm_navigationbar_title_icon_set(Evas_Object *obj, Evas_Object *content, Evas_Object *icon)
931 {
932    ELM_CHECK_WIDTYPE(obj, widtype);
933    Widget_Data *wd;
934    Elm_Navigationbar_Item *it;
935    Evas_Object *swallow;
936
937    if (!content) return;
938
939     wd = elm_widget_data_get(obj);
940     if (!wd) return;
941
942    it = evas_object_data_get(content, _navigationbar_key);
943    if (!it) return;
944
945    if (it->icon == icon) return;
946    if (it->icon) evas_object_del(it->icon);
947    it->icon = icon;
948
949    if (!icon) return;
950
951    elm_widget_sub_object_add(obj, icon);
952    evas_object_event_callback_add(icon, EVAS_CALLBACK_DEL, _title_icon_del, it);
953    _item_sizing_eval(it);
954    //update if the content is the top item
955    if (elm_navigationbar_content_top_get(obj) != content)
956      return;
957
958    swallow = edje_object_part_swallow_get(wd->base, "elm.swallow.icon");
959    if (swallow)
960      {
961         edje_object_signal_emit(wd->base, "elm,state,icon,hidden", "elm");
962         edje_object_part_unswallow(wd->base, swallow);
963         evas_object_hide(swallow);
964      }
965    if (wd->title_visible)
966      {
967         edje_object_part_swallow(wd->base, "elm.swallow.icon", icon);
968         edje_object_signal_emit(wd->base, "elm,state,icon,visible", "elm");
969         edje_object_message_signal_process(wd->base);
970      }
971    else
972       edje_object_signal_emit(wd->base, "elm,state,icon,hidden", "elm");
973 }
974
975 /**
976  * Get the title icon for the pushed content
977  *
978  * @param[in] obj The NavigationBar object
979  * @param[in] content The object to push or pushed
980  * @return The icon object or NULL if none
981  *
982  * @ingroup NavigationBar
983  */
984 EAPI Evas_Object *
985 elm_navigationbar_title_icon_get(Evas_Object *obj, Evas_Object *content)
986 {
987    ELM_CHECK_WIDTYPE(obj, widtype)NULL;
988    Widget_Data *wd;
989    Elm_Navigationbar_Item *it;
990
991    if (!content) return NULL;
992
993    wd = elm_widget_data_get(obj);
994    if (!wd) return NULL;
995
996    it = evas_object_data_get(content, _navigationbar_key);
997    if (!it) return NULL;
998
999    return it->icon;
1000 }
1001
1002 /**
1003  * Add a title object for the content.
1004  *
1005  * @param[in] obj The NavigationBar object
1006  * @param[in] content The object pushed
1007  * @param[in] title_obj a title object (normally button or segment_control)
1008  *
1009  * @ingroup NavigationBar
1010  */
1011 //TODO: elm_navigationbar_title_object_set ( .... )
1012 EAPI void
1013 elm_navigationbar_title_object_add(Evas_Object *obj, Evas_Object *content, Evas_Object *title_obj)
1014 {
1015    ELM_CHECK_WIDTYPE(obj, widtype);
1016    Widget_Data *wd;
1017    Elm_Navigationbar_Item *it;
1018
1019    if ((!title_obj) || (!content)) return;
1020
1021    wd = elm_widget_data_get(obj);
1022    if (!wd) return;
1023
1024    it = evas_object_data_get(content, _navigationbar_key);
1025    if (!it) return;
1026
1027    if (it->title_obj)
1028      {
1029        evas_object_event_callback_del(it->title_obj, EVAS_CALLBACK_DEL, _title_obj_del);
1030        evas_object_del(it->title_obj);
1031      }
1032
1033    it->title_obj = title_obj;
1034    elm_widget_sub_object_add(obj, title_obj);
1035    evas_object_event_callback_add(title_obj, EVAS_CALLBACK_DEL, _title_obj_del, it);
1036
1037    //TODO: Conserve this line for a while the object list get API is alive.
1038    eina_list_free(it->title_obj_list);
1039    it->title_obj_list = eina_list_append(NULL, title_obj);
1040
1041    if (elm_navigationbar_content_top_get(obj) != content)
1042      return;
1043
1044    edje_object_part_swallow(wd->base, "elm.swallow.title", title_obj);
1045
1046    //TODO: Looks something incorrect.
1047    if (wd->title_visible)
1048      {
1049        if (it->title)
1050          {
1051             edje_object_signal_emit(wd->base, "elm,state,show,extended", "elm");
1052             //TODO: for before nbeat?
1053             edje_object_signal_emit(wd->base, "elm,state,show,noanimate,title", "elm");
1054             it->titleobj_visible = EINA_TRUE;
1055          }
1056      }
1057    _item_sizing_eval(it);
1058 }
1059
1060 /**
1061  * Unset the list of title objects corresponding to given content and returns it to
1062  * the application.
1063  * @param[in] obj The NavigationBar object
1064  * @param[in] content The content object pushed
1065  * @param[out] list updates the list with title objects list, this list has to be freed and the
1066  * objects have to be deleted by application.
1067  * @ingroup NavigationBar
1068  */
1069 //TODO: remove!
1070 EAPI void
1071 elm_navigationbar_title_object_list_unset(Evas_Object *obj, Evas_Object *content, Eina_List **list)
1072 {
1073    ELM_CHECK_WIDTYPE(obj, widtype);
1074    Widget_Data *wd;
1075    Elm_Navigationbar_Item *it;
1076    Evas_Object *swallow;
1077
1078    if ((!list) || (!content)) return;
1079
1080    wd = elm_widget_data_get(obj);
1081    if (!wd) return;
1082
1083    it = evas_object_data_get(content, _navigationbar_key);
1084    if (!it) return;
1085
1086    *list = eina_list_append(*list, it->title_obj);
1087    it->title_obj = NULL;
1088
1089    if (elm_navigationbar_content_top_get(obj) != content)
1090      return;
1091
1092    //In this case, the content is in the last of the stack
1093    swallow = edje_object_part_swallow_get(wd->base, "elm.swallow.title");
1094    if (!swallow) return;
1095
1096    if (wd->title_visible)
1097     {
1098       if(it->titleobj_visible)
1099         {
1100           //TODO: remove the dependency on these signals as related to nbeat?
1101           edje_object_signal_emit(wd->base, "elm,state,hide,noanimate,title", "elm");
1102           it->titleobj_visible = EINA_FALSE;
1103         }
1104        edje_object_signal_emit(wd->base, "elm,state,hide,extended", "elm");
1105    }
1106    _item_sizing_eval(it);
1107 }
1108
1109 EAPI Evas_Object *
1110 elm_navigationbar_title_object_get(Evas_Object *obj, Evas_Object *content)
1111 {
1112    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1113    Widget_Data *wd;
1114    Elm_Navigationbar_Item *it;
1115
1116    if (!content) return NULL;
1117
1118    wd = elm_widget_data_get(obj);
1119    if (!wd) return NULL;
1120
1121    it = evas_object_data_get(content, _navigationbar_key);
1122    if (!it) return NULL;
1123
1124    return it->title_obj;
1125 }
1126
1127 /**
1128  * Return the list of title objects of the pushed content.
1129  *
1130  * @param[in] obj The NavigationBar object
1131  * @param[in] content The object to push or pushed
1132  * @return The list of title objects
1133  *
1134  * @ingroup NavigationBar
1135  */
1136 //TODO: Remove!!
1137 EAPI Eina_List *
1138 elm_navigationbar_title_object_list_get(Evas_Object *obj, Evas_Object *content)
1139 {
1140    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1141    Widget_Data *wd;
1142    Elm_Navigationbar_Item *it;
1143
1144    if (!content) return NULL;
1145
1146    wd = elm_widget_data_get(obj);
1147    if (!wd) return NULL;
1148
1149    it = evas_object_data_get(content, _navigationbar_key);
1150    if (!it) return NULL;
1151
1152    return it->title_obj_list;
1153 }
1154
1155 /**
1156  * Return the content object at the top of the NavigationBar stack
1157  *
1158  * @param[in] obj The NavigationBar object
1159  * @return The top content object or NULL if none
1160  *
1161  * @ingroup NavigationBar
1162  */
1163 EAPI Evas_Object *
1164 elm_navigationbar_content_top_get(Evas_Object *obj)
1165 {
1166    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1167    Widget_Data *wd = elm_widget_data_get(obj);
1168    if (!wd) return NULL;
1169    return elm_pager_content_top_get(wd->pager);
1170 }
1171
1172 /**
1173  * Return the content object at the bottom of the NavigationBar stack
1174  *
1175  * @param[in] obj The NavigationBar object
1176  * @return The bottom content object or NULL if none
1177  *
1178  * @ingroup NavigationBar
1179  */
1180 EAPI Evas_Object *
1181 elm_navigationbar_content_bottom_get(Evas_Object *obj)
1182 {
1183    ELM_CHECK_WIDTYPE(obj, widtype)NULL;
1184    Widget_Data *wd = elm_widget_data_get(obj);
1185    if (!wd) return NULL;
1186    return elm_pager_content_bottom_get(wd->pager);
1187 }
1188
1189 /**
1190  * This hides the title area of navigationbar.
1191  *
1192  * @param[in] obj The NavigationBar object
1193  * @param[in] hidden if EINA_TRUE the title area is hidden.
1194  *
1195  * @ingroup NavigationBar
1196  */
1197 //TODO: does not provide hidden get ?
1198 EAPI void
1199 elm_navigationbar_hidden_set(Evas_Object *obj,
1200                         Eina_Bool hidden)
1201 {
1202    ELM_CHECK_WIDTYPE(obj, widtype);
1203    Widget_Data *wd = elm_widget_data_get(obj);
1204    if (!wd) return;
1205
1206    if (hidden)
1207      edje_object_signal_emit(wd->base, "elm,state,item,moveup", "elm");
1208    else
1209      edje_object_signal_emit(wd->base, "elm,state,item,movedown", "elm");
1210
1211    wd->title_visible = !hidden;
1212 }
1213
1214 /**
1215  * Set the button object of the pushed content.
1216  *
1217  * @param[in] obj The NavigationBar object
1218  * @param[in] content The object to push or pushed
1219  * @param[in] button The button
1220  * @param[in] button_type Indicates the position
1221  *
1222  * @ingroup NavigationBar
1223  */
1224 EAPI void
1225 elm_navigationbar_title_button_set(Evas_Object *obj, Evas_Object *content, Evas_Object *button, Elm_Navi_Button_Type button_type)
1226 {
1227    ELM_CHECK_WIDTYPE(obj, widtype);
1228
1229    Widget_Data *wd;
1230    Elm_Navigationbar_Item *it;
1231
1232    if (!content) return;
1233
1234    wd = elm_widget_data_get(obj);
1235    if (!wd) return;
1236
1237    it = evas_object_data_get(content, _navigationbar_key);
1238    if (!it) return;
1239
1240    switch(button_type)
1241      {
1242       case ELM_NAVIGATIONBAR_PREV_BUTTON:
1243         _elm_navigationbar_prev_btn_set(obj, content, button, it);
1244         break;
1245       case ELM_NAVIGATIONBAR_NEXT_BUTTON:
1246         _elm_navigationbar_next_btn_set(obj, content, button, it);
1247         break;
1248       default:
1249         _elm_navigationbar_prev_btn_set(obj, content, button, it);
1250         break;
1251      }
1252    _sizing_eval(obj);
1253 }
1254
1255 /**
1256  * Return the button object of the pushed content
1257  *
1258  * @param[in] obj The NavigationBar object
1259  * @param[in] content The object to push or pushed
1260  * @param[in] button_type Indicates the position
1261  * @return The button object or NULL if none
1262  *
1263  * @ingroup NavigationBar
1264  */
1265 EAPI Evas_Object *
1266 elm_navigationbar_title_button_get(Evas_Object *obj, Evas_Object *content, Elm_Navi_Button_Type button_type)
1267 {
1268    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1269    Widget_Data *wd;
1270    Elm_Navigationbar_Item *it;
1271
1272    if (!content) return NULL;
1273
1274    wd = elm_widget_data_get(obj);
1275    if (!wd) return NULL;
1276
1277    it = evas_object_data_get(content, _navigationbar_key);
1278    if (!it) return NULL;
1279
1280    switch(button_type)
1281      {
1282         case ELM_NAVIGATIONBAR_PREV_BUTTON:
1283            return it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON];
1284         case ELM_NAVIGATIONBAR_NEXT_BUTTON:
1285            return it->title_btns[ELM_NAVIGATIONBAR_NEXT_BUTTON];
1286         default:
1287            return it->title_btns[ELM_NAVIGATIONBAR_PREV_BUTTON];
1288      }
1289    return NULL;
1290 }
1291
1292 /**
1293  * Set the sub title string for the pushed content.
1294  *
1295  * @param[in] obj The NavigationBar object
1296  * @param[in] content The object to push or pushed
1297  * @param[in] subtitle The subtitle string
1298  *
1299  * @ingroup NavigationBar
1300  */
1301 EAPI void
1302 elm_navigationbar_subtitle_label_set(Evas_Object *obj, Evas_Object *content, const char *subtitle)
1303 {
1304    ELM_CHECK_WIDTYPE(obj, widtype);
1305    Widget_Data *wd;
1306    Elm_Navigationbar_Item *it;
1307
1308    wd = elm_widget_data_get(obj);
1309    if (!wd) return;
1310
1311    it = evas_object_data_get(content, _navigationbar_key);
1312    if (!it) return;
1313
1314    eina_stringshare_replace(&it->subtitle, subtitle);
1315    edje_object_part_text_set(wd->base, "elm.text.sub", subtitle);
1316    _item_sizing_eval(it);
1317 }
1318
1319 /**
1320  * Return the subtitle string of the pushed content.
1321  *
1322  * @param[in] obj The NavigationBar object
1323  * @param[in] content The object to push or pushed
1324  * @return The subtitle string or NULL if none
1325  *
1326  * @ingroup NavigationBar
1327  */
1328 EAPI const char *
1329 elm_navigationbar_subtitle_label_get(Evas_Object *obj, Evas_Object *content)
1330 {
1331    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1332    Widget_Data *wd;
1333    Elm_Navigationbar_Item *it;
1334
1335    wd = elm_widget_data_get(obj);
1336    if (!wd) return NULL;
1337
1338    it = evas_object_data_get(content, _navigationbar_key);
1339    if (!it) return NULL;
1340    return it->subtitle;
1341 }
1342
1343 /**
1344  * This disables content area animation on push/pop.
1345  *
1346  * @param[in] obj The NavigationBar object
1347  * @param[in] disable  if EINA_TRUE animation is disabled.
1348  *
1349  * @ingroup NavigationBar
1350  */
1351 //TODO: Let's check to remove this API.
1352 EAPI void
1353 elm_navigationbar_animation_disabled_set(Evas_Object *obj, Eina_Bool disable)
1354 {
1355    ELM_CHECK_WIDTYPE(obj, widtype);
1356    Widget_Data *wd = elm_widget_data_get(obj);
1357    if (!wd) return;
1358    elm_pager_animation_disabled_set(wd->pager, disable);
1359 }
1360
1361 /**
1362  * This shows/hides title object area.
1363  *
1364  * @param[in] obj The NavigationBar object
1365  * @param[in] show  if EINA_TRUE title object is shown else its hidden.
1366  * @param[in] content  The content object packed in navigationbar.
1367  * @ingroup NavigationBar
1368  */
1369 EAPI void
1370 elm_navigationbar_title_object_visible_set(Evas_Object *obj, Evas_Object *content, Eina_Bool visible)
1371 {
1372     ELM_CHECK_WIDTYPE(obj, widtype);
1373     Elm_Navigationbar_Item *it;
1374     Widget_Data *wd;
1375
1376     if (!content) return;
1377
1378     wd = elm_widget_data_get(obj);
1379     if (!wd) return;
1380
1381     it = evas_object_data_get(content, _navigationbar_key);
1382     if (!it) return;
1383     if (it->titleobj_visible == visible) return;
1384     it->titleobj_visible = visible;
1385     _titleobj_switching(obj, it);
1386 }
1387
1388 /**
1389  * This gets the status whether title object is shown/hidden.
1390  *
1391  * @param[in] obj The NavigationBar object
1392  * @param[in] content  The content object packed in navigationbar.
1393  * @return The status whether title object is shown/hidden.
1394  * @ingroup NavigationBar
1395  */
1396 Eina_Bool
1397 elm_navigationbar_title_object_visible_get(Evas_Object *obj, Evas_Object *content)
1398 {
1399    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1400    Elm_Navigationbar_Item *it;
1401    Widget_Data *wd;
1402
1403    if (!content) return EINA_FALSE;
1404
1405    wd = elm_widget_data_get(obj);
1406    if (!wd) return EINA_FALSE;
1407
1408    it = evas_object_data_get(content, _navigationbar_key);
1409    if (!it) return EINA_FALSE;
1410
1411    return it->titleobj_visible;
1412 }