Merge remote-tracking branch 'remotes/origin/upstream'
[framework/uifw/elementary.git] / src / lib / elc_naviframe.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3
4 typedef struct _Widget_Data Widget_Data;
5 typedef struct _Elm_Naviframe_Item Elm_Naviframe_Item;
6 typedef struct _Elm_Naviframe_Content_Item_Pair Elm_Naviframe_Content_Item_Pair;
7 typedef struct _Elm_Naviframe_Text_Item_Pair Elm_Naviframe_Text_Item_Pair;
8
9 struct _Widget_Data
10 {
11    Eina_Inlist  *stack;
12    Evas_Object  *base;
13    Eina_Bool     preserve: 1;
14    Eina_Bool     auto_pushed: 1;
15    Eina_Bool     freeze_events: 1;
16 };
17
18 struct _Elm_Naviframe_Content_Item_Pair
19 {
20    EINA_INLIST;
21    const char *part;
22 <<<<<<< HEAD
23    Evas_Object *content;
24 =======
25 >>>>>>> remotes/origin/upstream
26    Elm_Naviframe_Item *it;
27 };
28
29 struct _Elm_Naviframe_Text_Item_Pair
30 {
31    EINA_INLIST;
32    const char *part;
33 <<<<<<< HEAD
34    const char *text;
35 =======
36 >>>>>>> remotes/origin/upstream
37 };
38
39 struct _Elm_Naviframe_Item
40 {
41    ELM_WIDGET_ITEM;
42    EINA_INLIST;
43    Eina_Inlist       *content_list;
44    Eina_Inlist       *text_list;
45    Evas_Object       *content;
46    Evas_Object       *title_prev_btn;
47    Evas_Object       *title_next_btn;
48    Evas_Object       *title_icon;
49    const char        *style;
50    Evas_Coord         minw;
51    Evas_Coord         minh;
52    Eina_Bool          back_btn: 1;
53    Eina_Bool          title_visible: 1;
54 };
55
56 static const char *widtype = NULL;
57
58 <<<<<<< HEAD
59 static const char SIG_TRANSITION_FINISHED[] = "transition,finished";
60 static const char SIG_PUSH_FINISHED[] = "push,finished";
61 static const char SIG_POP_FINISHED[] = "pop,finished";
62 static const char SIG_TITLE_CLICKED[] = "title,clicked";
63
64 static const Evas_Smart_Cb_Description _signals[] = {
65        {SIG_TRANSITION_FINISHED, ""},
66        {SIG_TITLE_CLICKED, ""},
67        {NULL, NULL}
68 };
69
70 =======
71 //widget signals
72 static const char SIG_TRANSITION_FINISHED[] = "transition,finished";
73 static const char SIG_TITLE_CLICKED[] = "title,clicked";
74
75 //widget item signals
76 static const char SIG_ITEM_SHOW_BEGIN[] = "show,begin";
77 static const char SIG_ITEM_HIDE_FINISHED[] = "hide,finished";
78
79 static const Evas_Smart_Cb_Description _signals[] = {
80        {SIG_TRANSITION_FINISHED, ""},
81        {SIG_TITLE_CLICKED, ""},
82        {SIG_ITEM_SHOW_BEGIN, ""},
83        {SIG_ITEM_HIDE_FINISHED, ""},
84        {NULL, NULL}
85 };
86
87 static void _text_set_hook(Evas_Object *obj,
88                            const char *part,
89                            const char *label);
90 static const char *_text_get_hook(const Evas_Object *obj, const char *part);
91 static void _content_set_hook(Evas_Object *obj,
92                               const char *part,
93                               Evas_Object *content);
94 static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part);
95 static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part);
96 >>>>>>> remotes/origin/upstream
97 static void _del_hook(Evas_Object *obj);
98 static void _theme_hook(Evas_Object *obj);
99 static void _emit_hook(Evas_Object *obj,
100                        const char *emission,
101                        const char *source);
102 static void _disable_hook(Evas_Object *obj);
103 <<<<<<< HEAD
104 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
105 =======
106 >>>>>>> remotes/origin/upstream
107 static void _item_text_set_hook(Elm_Object_Item *it,
108                                 const char *part,
109                                 const char *label);
110 static const char *_item_text_get_hook(const Elm_Object_Item *it,
111                                        const char *part);
112 static void _item_content_set_hook(Elm_Object_Item *it,
113                                    const char *part,
114                                    Evas_Object *content);
115 static Evas_Object *_item_content_get_hook(const Elm_Object_Item *it,
116                                            const char *part);
117 static Evas_Object *_item_content_unset_hook(Elm_Object_Item *it,
118                                              const char *part);
119 static void _item_signal_emit_hook(Elm_Object_Item *it,
120                                    const char *emission,
121                                    const char *source);
122 static void _item_title_visible_update(Elm_Naviframe_Item *navi_it);
123 static void _sizing_eval(Evas_Object *obj);
124 static void _move(void *data, Evas *e, Evas_Object *obj, void *event_info);
125 static void _resize(void *data,
126                     Evas *e,
127                     Evas_Object *obj,
128                     void *event_info);
129 static void _title_clicked(void *data, Evas_Object *obj,
130                            const char *emission,
131                            const char *source);
132 static void _back_btn_clicked(void *data,
133                               Evas_Object *obj,
134                               void *event_info);
135 static Evas_Object *_back_btn_new(Evas_Object *obj);
136 static void _item_content_del(void *data,
137                               Evas *e,
138                               Evas_Object *obj,
139                               void *event_info);
140 static void _title_content_del(void *data,
141                                Evas *e,
142                                Evas_Object *obj,
143                                void *event_info);
144 static void _title_prev_btn_del(void *data,
145                                 Evas *e,
146                                 Evas_Object *obj,
147                                 void *event_info);
148 static void _title_next_btn_del(void *data,
149                                 Evas *e,
150                                 Evas_Object *obj,
151                                 void *event_info);
152 static void _title_icon_del(void *data,
153                             Evas *e,
154                             Evas_Object *obj,
155                             void *event_info);
156 static void _title_content_set(Elm_Naviframe_Item *it,
157                                const char *part,
158                                Evas_Object *content);
159 static void _title_prev_btn_set(Elm_Naviframe_Item *it,
160                                 Evas_Object *btn,
161                                 Eina_Bool back_btn);
162 static void _title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn);
163 static void _title_icon_set(Elm_Naviframe_Item *it, Evas_Object *icon);
164 static Evas_Object * _item_content_unset(Elm_Naviframe_Item *it);
165 static Evas_Object * _title_prev_btn_unset(Elm_Naviframe_Item *it);
166 static Evas_Object * _title_next_btn_unset(Elm_Naviframe_Item *it);
167 static Evas_Object * _title_icon_unset(Elm_Naviframe_Item *it);
168 static Evas_Object * _title_content_unset(Elm_Naviframe_Item *it,
169                                           const char *part);
170 static void _item_del(Elm_Naviframe_Item *it);
171 static Eina_Bool _item_del_pre_hook(Elm_Object_Item *it);
172 static void _pushed_finished(void *data,
173                              Evas_Object *obj,
174                              const char *emission,
175                              const char *source);
176 static void _popped_finished(void *data,
177                              Evas_Object *obj,
178                              const char *emission,
179                              const char *source);
180 static void _show_finished(void *data,
181                            Evas_Object *obj,
182                            const char *emission,
183                            const char *source);
184 static void _changed_size_hints(void *data,
185                                 Evas *e,
186                                 Evas_Object *obj,
187                                 void *event_info);
188 static void _item_content_set(Elm_Naviframe_Item *navi_it,
189                               Evas_Object *content);
190 static void _item_style_set(Elm_Naviframe_Item *navi_it,
191                             const char *item_style);
192 static Elm_Naviframe_Item * _item_new(Evas_Object *obj,
193                                       const char *title_label,
194                                       Evas_Object *prev_btn,
195                                       Evas_Object *next_btn,
196                                       Evas_Object *content,
197                                       const char *item_style);
198 <<<<<<< HEAD
199 =======
200 static Eina_Bool _focus_next_hook(const Evas_Object *obj,
201                                   Elm_Focus_Direction dir,
202                                   Evas_Object **next);
203 >>>>>>> remotes/origin/upstream
204
205 static void
206 _del_hook(Evas_Object *obj)
207 {
208    Widget_Data *wd;
209    Elm_Naviframe_Item *it;
210
211    wd = elm_widget_data_get(obj);
212    if (!wd) return;
213
214    if (wd->stack)
215      {
216         while (wd->stack->last)
217           {
218              it = EINA_INLIST_CONTAINER_GET(wd->stack->last,
219                                             Elm_Naviframe_Item);
220              wd->stack = eina_inlist_remove(wd->stack, wd->stack->last);
221              _item_del(it);
222 <<<<<<< HEAD
223 =======
224              elm_widget_item_free(it);
225 >>>>>>> remotes/origin/upstream
226              if (!wd->stack) break;
227           }
228      }
229    free(wd);
230 }
231
232 static void
233 _theme_hook(Evas_Object *obj)
234 {
235    Widget_Data *wd;
236    Elm_Naviframe_Item *it;
237
238    wd  = elm_widget_data_get(obj);
239    if (!wd) return;
240
241    _elm_theme_object_set(obj,
242                          wd->base,
243                          "naviframe",
244                          "base",
245                          elm_widget_style_get(obj));
246
247    EINA_INLIST_FOREACH(wd->stack, it)
248      {
249         _item_style_set(it, it->style);
250         _item_title_visible_update(it);
251      }
252 <<<<<<< HEAD
253
254    _elm_widget_mirrored_reload(obj);
255    _mirrored_set(obj, elm_widget_mirrored_get(obj));
256 =======
257 >>>>>>> remotes/origin/upstream
258 }
259
260 static void _emit_hook(Evas_Object *obj,
261                        const char *emission,
262                        const char *source)
263 {
264 <<<<<<< HEAD
265    ELM_CHECK_WIDTYPE(obj, widtype);
266
267    Widget_Data *wd = elm_widget_data_get(obj);
268    if (!wd) return;
269
270    edje_object_signal_emit(wd->base, emission, source);
271 =======
272    Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
273    if (!it) return;
274    return elm_object_item_signal_emit(it, emission, source);
275 >>>>>>> remotes/origin/upstream
276 }
277
278 static void
279 _disable_hook(Evas_Object *obj __UNUSED__)
280 {
281    //FIXME:
282 }
283
284 static void
285 <<<<<<< HEAD
286 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
287 {
288    Widget_Data *wd;
289    Elm_Naviframe_Item *it;
290
291    wd  = elm_widget_data_get(obj);
292    if (!wd) return;
293
294    EINA_INLIST_FOREACH(wd->stack, it)
295      edje_object_mirrored_set(VIEW(it), rtl);
296    edje_object_mirrored_set(wd->base, rtl);
297 }
298
299 static void
300 =======
301 >>>>>>> remotes/origin/upstream
302 _item_text_set_hook(Elm_Object_Item *it,
303                     const char *part,
304                     const char *label)
305 {
306 <<<<<<< HEAD
307    ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
308
309    Elm_Naviframe_Text_Item_Pair *pair = NULL;
310    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
311 =======
312    Elm_Naviframe_Text_Item_Pair *pair = NULL;
313    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
314 >>>>>>> remotes/origin/upstream
315    char buf[1024];
316
317    if (!part || !strcmp(part, "default"))
318      snprintf(buf, sizeof(buf), "elm.text.title");
319    else if(!strcmp("subtitle", part))
320      snprintf(buf, sizeof(buf), "elm.text.subtitle");
321    else
322      snprintf(buf, sizeof(buf), "%s", part);
323
324    EINA_INLIST_FOREACH(navi_it->text_list, pair)
325      if (!strcmp(buf, pair->part)) break;
326
327    if (!pair)
328      {
329         pair = ELM_NEW(Elm_Naviframe_Text_Item_Pair);
330         if (!pair)
331           {
332              ERR("Failed to allocate new text part of the item! : naviframe=%p",
333              WIDGET(navi_it));
334              return;
335           }
336         eina_stringshare_replace(&pair->part, buf);
337         navi_it->text_list = eina_inlist_append(navi_it->text_list,
338                                                 EINA_INLIST_GET(pair));
339      }
340 <<<<<<< HEAD
341
342    eina_stringshare_replace(&pair->text, label);
343    edje_object_part_text_set(VIEW(navi_it), buf, label);
344 =======
345    elm_object_part_text_set(VIEW(navi_it), buf, label);
346 >>>>>>> remotes/origin/upstream
347
348    if (label)
349      {
350         snprintf(buf, sizeof(buf), "elm,state,%s,show", buf);
351 <<<<<<< HEAD
352         edje_object_signal_emit(VIEW(navi_it), buf, "elm");
353 =======
354         elm_object_signal_emit(VIEW(navi_it), buf, "elm");
355 >>>>>>> remotes/origin/upstream
356      }
357    else
358      {
359         snprintf(buf, sizeof(buf), "elm,state,%s,hide", buf);
360 <<<<<<< HEAD
361         edje_object_signal_emit(VIEW(navi_it), buf, "elm");
362 =======
363         elm_object_signal_emit(VIEW(navi_it), buf, "elm");
364 >>>>>>> remotes/origin/upstream
365      }
366
367    _sizing_eval(WIDGET(navi_it));
368 }
369
370 static const char *
371 _item_text_get_hook(const Elm_Object_Item *it, const char *part)
372 {
373 <<<<<<< HEAD
374    ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
375    Elm_Naviframe_Text_Item_Pair *pair = NULL;
376    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
377 =======
378 >>>>>>> remotes/origin/upstream
379    char buf[1024];
380
381    if (!part || !strcmp(part, "default"))
382      snprintf(buf, sizeof(buf), "elm.text.title");
383    else if(!strcmp("subtitle", part))
384      snprintf(buf, sizeof(buf), "elm.text.subtitle");
385    else
386      snprintf(buf, sizeof(buf), "%s", part);
387
388 <<<<<<< HEAD
389    EINA_INLIST_FOREACH(navi_it->text_list, pair)
390      {
391         if (!strcmp(buf, pair->part))
392           return pair->text;
393      }
394    return NULL;
395 =======
396    return elm_object_part_text_get(VIEW(it), buf);
397 >>>>>>> remotes/origin/upstream
398 }
399
400 static void
401 _item_content_set_hook(Elm_Object_Item *it,
402                        const char *part,
403                        Evas_Object *content)
404 {
405 <<<<<<< HEAD
406    ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
407
408    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
409
410    //specified parts
411    if ((!part) || (!strcmp(part, "elm.swallow.content")))
412 =======
413    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
414
415    //specified parts
416    if (!part || !strcmp("default", part))
417 >>>>>>> remotes/origin/upstream
418      {
419         _item_content_set(navi_it, content);
420         return;
421      }
422 <<<<<<< HEAD
423    else if (!strcmp(part, "elm.swallow.prev_btn"))
424 =======
425    else if (!strcmp(part, "prev_btn"))
426 >>>>>>> remotes/origin/upstream
427      {
428         _title_prev_btn_set(navi_it, content, EINA_FALSE);
429         return;
430      }
431 <<<<<<< HEAD
432    else if (!strcmp(part, "elm.swallow.next_btn"))
433 =======
434    else if (!strcmp(part, "next_btn"))
435 >>>>>>> remotes/origin/upstream
436      {
437         _title_next_btn_set(navi_it, content);
438         return;
439      }
440    else if (!strcmp(part, "icon"))
441      {
442         _title_icon_set(navi_it, content);
443         return;
444      }
445
446    //common part
447    _title_content_set(navi_it, part, content);
448 }
449
450 static Evas_Object *
451 _item_content_get_hook(const Elm_Object_Item *it, const char *part)
452 {
453 <<<<<<< HEAD
454    ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
455    Elm_Naviframe_Content_Item_Pair *pair = NULL;
456    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
457
458    //specified parts
459    if ((!part) || (!strcmp(part, "elm.swallow.content")))
460      return navi_it->content;
461    else if (!strcmp(part, "elm.swallow.prev_btn"))
462      return navi_it->title_prev_btn;
463    else if (!strcmp(part, "elm.swallow.next_btn"))
464 =======
465    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
466
467    //specified parts
468    if (!part || !strcmp("default", part))
469      return navi_it->content;
470    else if (!strcmp(part, "prev_btn"))
471      return navi_it->title_prev_btn;
472    else if (!strcmp(part, "next_btn"))
473 >>>>>>> remotes/origin/upstream
474      return navi_it->title_next_btn;
475    else if (!strcmp(part, "icon"))
476      return navi_it->title_icon;
477
478    //common parts
479 <<<<<<< HEAD
480    EINA_INLIST_FOREACH(navi_it->content_list, pair)
481      {
482         if (!strcmp(part, pair->part))
483           return pair->content;
484      }
485    return NULL;
486 =======
487    return elm_object_part_content_get(VIEW(navi_it), part);
488 >>>>>>> remotes/origin/upstream
489 }
490
491 static Evas_Object *
492 _item_content_unset_hook(Elm_Object_Item *it, const char *part)
493 {
494 <<<<<<< HEAD
495    ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
496    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
497
498    //specified parts
499    if (!part || !strcmp("elm.swallow.content", part))
500      return _item_content_unset(navi_it);
501    else if (!strcmp(part, "elm.swallow.prev_btn"))
502      return _title_prev_btn_unset(navi_it);
503    else if (!strcmp(part, "elm.swallow.next_btn"))
504 =======
505    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
506
507    //specified parts
508    if (!part || !strcmp("default", part))
509      return _item_content_unset(navi_it);
510    else if (!strcmp(part, "prev_btn"))
511      return _title_prev_btn_unset(navi_it);
512    else if (!strcmp(part, "next_btn"))
513 >>>>>>> remotes/origin/upstream
514      return _title_next_btn_unset(navi_it);
515    else if (!strcmp(part, "icon"))
516      return _title_icon_unset(navi_it);
517
518    return _title_content_unset(navi_it, part);
519 }
520
521 static void
522 _item_signal_emit_hook(Elm_Object_Item *it,
523                        const char *emission,
524                        const char *source)
525 {
526 <<<<<<< HEAD
527    ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
528    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
529    edje_object_signal_emit(VIEW(navi_it), emission, source);
530 =======
531    elm_object_signal_emit(VIEW(it), emission, source);
532 >>>>>>> remotes/origin/upstream
533 }
534
535 static void
536 _item_title_visible_update(Elm_Naviframe_Item *navi_it)
537 {
538    if (navi_it->title_visible)
539 <<<<<<< HEAD
540      edje_object_signal_emit(VIEW(navi_it), "elm,state,title,show", "elm");
541    else
542      edje_object_signal_emit(VIEW(navi_it), "elm,state,title,hide", "elm");
543 =======
544      elm_object_signal_emit(VIEW(navi_it), "elm,state,title,show", "elm");
545    else
546      elm_object_signal_emit(VIEW(navi_it), "elm,state,title,hide", "elm");
547 >>>>>>> remotes/origin/upstream
548 }
549
550 static void
551 _sizing_eval(Evas_Object *obj)
552 {
553    Widget_Data *wd;
554    Elm_Naviframe_Item *it;
555    Evas_Coord x, y, w, h;
556    Evas_Coord minw = -1, minh = -1;
557
558    wd = elm_widget_data_get(obj);
559    if (!wd) return;
560
561    evas_object_geometry_get(obj, &x, &y, &w, &h);
562
563    EINA_INLIST_FOREACH(wd->stack, it)
564      {
565         evas_object_move(VIEW(it), x, y);
566         evas_object_resize(VIEW(it), w, h);
567 <<<<<<< HEAD
568         edje_object_size_min_calc(VIEW(it), &it->minw, &it->minh);
569 =======
570         edje_object_size_min_calc(elm_layout_edje_get(VIEW(it)),
571                                   &it->minw,
572                                   &it->minh);
573 >>>>>>> remotes/origin/upstream
574         if (it->minw > minw) minw = it->minw;
575         if (it->minh > minh) minh = it->minh;
576      }
577    evas_object_size_hint_min_set(obj, minw, minh);
578    evas_object_size_hint_max_set(obj, -1, -1);
579 }
580
581 static void
582 _move(void *data __UNUSED__,
583       Evas *e __UNUSED__,
584       Evas_Object *obj,
585       void *event_info __UNUSED__)
586 {
587    _sizing_eval(obj);
588 }
589
590 static void
591 _resize(void *data __UNUSED__,
592         Evas *e __UNUSED__,
593         Evas_Object *obj,
594         void *event_info __UNUSED__)
595 {
596    _sizing_eval(obj);
597 }
598
599 static void
600 _title_clicked(void *data,
601                Evas_Object *obj __UNUSED__,
602                const char *emission __UNUSED__,
603                const char *source __UNUSED__)
604 {
605    Elm_Naviframe_Item *it = data;
606    evas_object_smart_callback_call(WIDGET(it), SIG_TITLE_CLICKED, it);
607 }
608
609 static void
610 _back_btn_clicked(void *data,
611                   Evas_Object *obj,
612                   void *event_info __UNUSED__)
613 {
614 /* Since edje has the event queue, clicked event could be happend multiple times
615    on some heavy environment. This callback del will prevent those  scenario and
616    guarantee only one clicked for it's own page. */
617    evas_object_smart_callback_del(obj, "clicked", _back_btn_clicked);
618    elm_naviframe_item_pop(data);
619 }
620
621 static Evas_Object *
622 _back_btn_new(Evas_Object *obj)
623 {
624    Evas_Object *btn;
625    char buf[1024];
626    btn = elm_button_add(obj);
627    if (!btn) return NULL;
628    evas_object_smart_callback_add(btn, "clicked", _back_btn_clicked, obj);
629 <<<<<<< HEAD
630    snprintf(buf, sizeof(buf), "naviframe/back_btn/%s", elm_widget_style_get(obj));
631 =======
632    snprintf(buf, sizeof(buf), "naviframe/back_btn/%s",
633             elm_widget_style_get(obj));
634 >>>>>>> remotes/origin/upstream
635    elm_object_style_set(btn, buf);
636    return btn;
637 }
638
639 <<<<<<< HEAD
640 =======
641 static void _text_set_hook(Evas_Object *obj,
642                            const char *part,
643                            const char *label)
644 {
645    Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
646    if (!it) return;
647    elm_object_item_part_text_set(it, part, label);
648 }
649
650 static const char *_text_get_hook(const Evas_Object *obj, const char *part)
651 {
652    Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
653    if (!it) return NULL;
654    return elm_object_item_part_text_get(it, part);
655 }
656
657 static void
658 _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
659 {
660    Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
661    if (!it) return;
662    elm_object_item_part_content_set(it, part, content);
663 }
664
665 static Evas_Object *
666 _content_unset_hook(Evas_Object *obj, const char *part)
667 {
668    Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
669    if (!it) return NULL;
670    return elm_object_item_part_content_unset(it, part);
671 }
672
673 static Evas_Object *
674 _content_get_hook(const Evas_Object *obj, const char *part)
675 {
676    Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
677    if (!it) return NULL;
678    return elm_object_item_part_content_get(it, part);
679 }
680
681 >>>>>>> remotes/origin/upstream
682 static void
683 _title_content_del(void *data,
684                    Evas *e __UNUSED__,
685                    Evas_Object *obj __UNUSED__,
686                    void *event_info __UNUSED__)
687 {
688    char buf[1024];
689    Elm_Naviframe_Content_Item_Pair *pair = data;
690    Elm_Naviframe_Item *it = pair->it;
691    snprintf(buf, sizeof(buf), "elm,state,%s,hide", pair->part);
692 <<<<<<< HEAD
693    edje_object_signal_emit(VIEW(it), buf, "elm");
694 =======
695    elm_object_signal_emit(VIEW(it), buf, "elm");
696 >>>>>>> remotes/origin/upstream
697    it->content_list = eina_inlist_remove(it->content_list,
698                                          EINA_INLIST_GET(pair));
699    eina_stringshare_del(pair->part);
700    free(pair);
701 }
702
703 static void
704 _title_prev_btn_del(void *data,
705                     Evas *e __UNUSED__,
706                     Evas_Object *obj __UNUSED__,
707                     void *event_info __UNUSED__)
708 {
709    Elm_Naviframe_Item *it = data;
710    it->back_btn = EINA_FALSE;
711    it->title_prev_btn = NULL;
712 <<<<<<< HEAD
713    edje_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm");
714 =======
715    elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm");
716 >>>>>>> remotes/origin/upstream
717 }
718
719 static void
720 _title_next_btn_del(void *data,
721                     Evas *e __UNUSED__,
722                     Evas_Object *obj __UNUSED__,
723                     void *event_info __UNUSED__)
724 {
725    Elm_Naviframe_Item *it = data;
726    it->title_next_btn = NULL;
727 <<<<<<< HEAD
728    edje_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm");
729 =======
730    elm_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm");
731 >>>>>>> remotes/origin/upstream
732 }
733
734 static void
735 _title_icon_del(void *data,
736                 Evas *e __UNUSED__,
737                 Evas_Object *obj __UNUSED__,
738                 void *event_info __UNUSED__)
739 {
740    Elm_Naviframe_Item *it = data;
741    it->title_icon = NULL;
742 <<<<<<< HEAD
743    edje_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm");
744 =======
745    elm_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm");
746 >>>>>>> remotes/origin/upstream
747 }
748
749 static void
750 _item_content_del(void *data,
751                   Evas *e __UNUSED__,
752                   Evas_Object *obj __UNUSED__,
753                   void *event_info __UNUSED__)
754 {
755    Elm_Naviframe_Item *it = data;
756    it->content = NULL;
757 <<<<<<< HEAD
758    edje_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm");
759 =======
760    elm_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm");
761 >>>>>>> remotes/origin/upstream
762 }
763
764 static void
765 _title_content_set(Elm_Naviframe_Item *it,
766                    const char *part,
767                    Evas_Object *content)
768 {
769    char buf[1024];
770    Elm_Naviframe_Content_Item_Pair *pair = NULL;
771 <<<<<<< HEAD
772 =======
773    Evas_Object *prev_content = NULL;
774 >>>>>>> remotes/origin/upstream
775
776    EINA_INLIST_FOREACH(it->content_list, pair)
777      if (!strcmp(part, pair->part)) break;
778
779    if (pair)
780      {
781 <<<<<<< HEAD
782         if (pair->content != content)
783           {
784              if (content)
785                {
786                   evas_object_event_callback_del(pair->content,
787                                                  EVAS_CALLBACK_DEL,
788                                                  _title_content_del);
789                   evas_object_event_callback_del(pair->content,
790                                                  EVAS_CALLBACK_CHANGED_SIZE_HINTS,
791                                                  _changed_size_hints);
792                   snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
793                   edje_object_signal_emit(VIEW(it), buf, "elm");
794                }
795              evas_object_del(pair->content);
796 =======
797         prev_content = elm_object_part_content_get(VIEW(it), part);
798         if (prev_content != content)
799           {
800              if (content)
801                {
802                   evas_object_event_callback_del(prev_content,
803                                                  EVAS_CALLBACK_DEL,
804                                                  _title_content_del);
805                   snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
806                   elm_object_signal_emit(VIEW(it), buf, "elm");
807                }
808              evas_object_del(prev_content);
809 >>>>>>> remotes/origin/upstream
810              if (!content) return;
811           }
812      }
813    else
814      {
815         if (!content) return;
816         pair = ELM_NEW(Elm_Naviframe_Content_Item_Pair);
817         if (!pair)
818           {
819              ERR("Failed to allocate new content part of the item! : naviframe=%p", WIDGET(it));
820              return;
821           }
822         pair->it = it;
823         eina_stringshare_replace(&pair->part, part);
824         it->content_list = eina_inlist_append(it->content_list,
825                                               EINA_INLIST_GET(pair));
826      }
827 <<<<<<< HEAD
828    if (pair->content != content)
829      {
830         elm_widget_sub_object_add(WIDGET(it), content);
831 =======
832    if (prev_content != content)
833      {
834 >>>>>>> remotes/origin/upstream
835         evas_object_event_callback_add(content,
836                                        EVAS_CALLBACK_DEL,
837                                        _title_content_del,
838                                        pair);
839 <<<<<<< HEAD
840         evas_object_event_callback_add(content,
841                                        EVAS_CALLBACK_CHANGED_SIZE_HINTS,
842                                        _changed_size_hints,
843                                        WIDGET(it));
844      }
845    edje_object_part_swallow(VIEW(it), part, content);
846    snprintf(buf, sizeof(buf), "elm,state,%s,show", part);
847    edje_object_signal_emit(VIEW(it), buf, "elm");
848    pair->content = content;
849 =======
850      }
851    elm_object_part_content_set(VIEW(it), part, content);
852    snprintf(buf, sizeof(buf), "elm,state,%s,show", part);
853    elm_object_signal_emit(VIEW(it), buf, "elm");
854 >>>>>>> remotes/origin/upstream
855
856    _sizing_eval(WIDGET(it));
857 }
858
859 static void
860 _title_prev_btn_set(Elm_Naviframe_Item *it,
861                     Evas_Object *btn,
862                     Eina_Bool back_btn)
863 {
864    if (it->title_prev_btn == btn) return;
865 <<<<<<< HEAD
866
867    if (it->title_prev_btn)
868      evas_object_del(it->title_prev_btn);
869
870    it->title_prev_btn = btn;
871    if (!btn) return;
872
873    elm_widget_sub_object_add(WIDGET(it), btn);
874 =======
875    if (it->title_prev_btn) evas_object_del(it->title_prev_btn);
876    it->title_prev_btn = btn;
877    if (!btn) return;
878
879 >>>>>>> remotes/origin/upstream
880    evas_object_event_callback_add(btn,
881                                   EVAS_CALLBACK_DEL,
882                                   _title_prev_btn_del,
883                                   it);
884 <<<<<<< HEAD
885    evas_object_event_callback_add(btn,
886                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
887                                   _changed_size_hints,
888                                   WIDGET(it));
889    edje_object_part_swallow(VIEW(it), "elm.swallow.prev_btn", btn);
890    edje_object_signal_emit(VIEW(it), "elm,state,prev_btn,show", "elm");
891 =======
892    elm_object_part_content_set(VIEW(it), "elm.swallow.prev_btn", btn);
893    elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,show", "elm");
894 >>>>>>> remotes/origin/upstream
895    it->back_btn = back_btn;
896
897    _sizing_eval(WIDGET(it));
898 }
899
900 static void
901 _title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn)
902 {
903    if (it->title_next_btn == btn) return;
904 <<<<<<< HEAD
905
906    if (it->title_next_btn)
907      evas_object_del(it->title_next_btn);
908
909    it->title_next_btn = btn;
910    if (!btn) return;
911
912    elm_widget_sub_object_add(WIDGET(it), btn);
913 =======
914    if (it->title_next_btn) evas_object_del(it->title_next_btn);
915    it->title_next_btn = btn;
916    if (!btn) return;
917
918 >>>>>>> remotes/origin/upstream
919    evas_object_event_callback_add(btn,
920                                   EVAS_CALLBACK_DEL,
921                                   _title_next_btn_del,
922                                   it);
923 <<<<<<< HEAD
924    evas_object_event_callback_add(btn,
925                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
926                                   _changed_size_hints,
927                                   WIDGET(it));
928    edje_object_part_swallow(VIEW(it), "elm.swallow.next_btn", btn);
929    edje_object_signal_emit(VIEW(it), "elm,state,next_btn,show", "elm");
930 =======
931    elm_object_part_content_set(VIEW(it), "elm.swallow.next_btn", btn);
932    elm_object_signal_emit(VIEW(it), "elm,state,next_btn,show", "elm");
933 >>>>>>> remotes/origin/upstream
934
935    _sizing_eval(WIDGET(it));
936 }
937
938 static void
939 _title_icon_set(Elm_Naviframe_Item *it, Evas_Object *icon)
940 {
941    if (it->title_icon == icon) return;
942 <<<<<<< HEAD
943
944    if (it->title_icon)
945      evas_object_del(it->title_icon);
946
947    it->title_icon = icon;
948    if (!icon) return;
949
950    elm_widget_sub_object_add(WIDGET(it), icon);
951 =======
952    if (it->title_icon) evas_object_del(it->title_icon);
953    it->title_icon = icon;
954    if (!icon) return;
955
956 >>>>>>> remotes/origin/upstream
957    evas_object_event_callback_add(icon,
958                                   EVAS_CALLBACK_DEL,
959                                   _title_icon_del,
960                                   it);
961 <<<<<<< HEAD
962    evas_object_event_callback_add(icon,
963                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
964                                   _changed_size_hints,
965                                   WIDGET(it));
966    edje_object_part_swallow(VIEW(it), "elm.swallow.icon", icon);
967    edje_object_signal_emit(VIEW(it), "elm,state,icon,show", "elm");
968 =======
969    elm_object_part_content_set(VIEW(it), "elm.swallow.icon", icon);
970    elm_object_signal_emit(VIEW(it), "elm,state,icon,show", "elm");
971 >>>>>>> remotes/origin/upstream
972
973    _sizing_eval(WIDGET(it));
974 }
975
976 static Evas_Object *
977 _item_content_unset(Elm_Naviframe_Item *it)
978 {
979    Evas_Object *content = it->content;
980    if (!content) return NULL;
981
982 <<<<<<< HEAD
983    elm_widget_sub_object_del(WIDGET(it), content);
984    edje_object_part_unswallow(VIEW(it), content);
985    edje_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm");
986    evas_object_event_callback_del(content,
987                                   EVAS_CALLBACK_DEL,
988                                   _item_content_del);
989    evas_object_event_callback_del(content,
990                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
991                                   _changed_size_hints);
992 =======
993    elm_object_part_content_unset(VIEW(it), "elm.swallow.content");
994    elm_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm");
995    evas_object_event_callback_del(content,
996                                   EVAS_CALLBACK_DEL,
997                                   _item_content_del);
998 >>>>>>> remotes/origin/upstream
999    _sizing_eval(WIDGET(it));
1000
1001    it->content = NULL;
1002    return content;
1003 }
1004
1005 static Evas_Object *
1006 _title_prev_btn_unset(Elm_Naviframe_Item *it)
1007 {
1008    Evas_Object *content = it->title_prev_btn;
1009    if (!content) return NULL;
1010
1011 <<<<<<< HEAD
1012    elm_widget_sub_object_del(WIDGET(it), content);
1013    edje_object_part_unswallow(VIEW(it), content);
1014    edje_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm");
1015    evas_object_event_callback_del(content,
1016                                   EVAS_CALLBACK_DEL,
1017                                   _title_prev_btn_del);
1018    evas_object_event_callback_del(content,
1019                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1020                                   _changed_size_hints);
1021 =======
1022    elm_object_part_content_unset(VIEW(it), "elm.swallow.prev_btn");
1023    elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm");
1024    evas_object_event_callback_del(content,
1025                                   EVAS_CALLBACK_DEL,
1026                                   _title_prev_btn_del);
1027 >>>>>>> remotes/origin/upstream
1028    _sizing_eval(WIDGET(it));
1029
1030    it->title_prev_btn = NULL;
1031    return content;
1032 }
1033
1034 static Evas_Object *
1035 _title_next_btn_unset(Elm_Naviframe_Item *it)
1036 {
1037    Evas_Object *content = it->title_next_btn;
1038    if (!content) return NULL;
1039
1040 <<<<<<< HEAD
1041    elm_widget_sub_object_del(WIDGET(it), content);
1042    edje_object_part_unswallow(VIEW(it), content);
1043    edje_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm");
1044    evas_object_event_callback_del(content,
1045                                   EVAS_CALLBACK_DEL,
1046                                   _title_next_btn_del);
1047    evas_object_event_callback_del(content,
1048                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1049                                   _changed_size_hints);
1050 =======
1051    elm_object_part_content_unset(VIEW(it), "elm.swallow.next_btn");
1052    elm_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm");
1053    evas_object_event_callback_del(content,
1054                                   EVAS_CALLBACK_DEL,
1055                                   _title_next_btn_del);
1056 >>>>>>> remotes/origin/upstream
1057    _sizing_eval(WIDGET(it));
1058
1059    it->title_next_btn = NULL;
1060    return content;
1061 }
1062
1063 static Evas_Object *
1064 _title_icon_unset(Elm_Naviframe_Item *it)
1065 {
1066    Evas_Object *content = it->title_icon;
1067    if (!content) return NULL;
1068
1069 <<<<<<< HEAD
1070    elm_widget_sub_object_del(WIDGET(it), content);
1071    edje_object_part_unswallow(VIEW(it), content);
1072    edje_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm");
1073    evas_object_event_callback_del(content,
1074                                   EVAS_CALLBACK_DEL,
1075                                   _title_icon_del);
1076    evas_object_event_callback_del(content,
1077                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1078                                   _changed_size_hints);
1079 =======
1080    elm_object_part_content_unset(VIEW(it), "elm.swallow.icon");
1081    elm_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm");
1082    evas_object_event_callback_del(content,
1083                                   EVAS_CALLBACK_DEL,
1084                                   _title_icon_del);
1085 >>>>>>> remotes/origin/upstream
1086    _sizing_eval(WIDGET(it));
1087    it->title_icon = NULL;
1088
1089    return content;
1090 }
1091
1092 static Evas_Object *
1093 _title_content_unset(Elm_Naviframe_Item *it, const char *part)
1094 {
1095    Elm_Naviframe_Content_Item_Pair *pair = NULL;
1096    char buf[1028];
1097    Evas_Object *content = NULL;
1098
1099    EINA_INLIST_FOREACH(it->content_list, pair)
1100      {
1101         if (!strcmp(part, pair->part))
1102           {
1103 <<<<<<< HEAD
1104              content = pair->content;
1105 =======
1106              content = elm_object_part_content_get(VIEW(it), part);
1107 >>>>>>> remotes/origin/upstream
1108              eina_stringshare_del(pair->part);
1109              it->content_list = eina_inlist_remove(it->content_list,
1110                                                    EINA_INLIST_GET(pair));
1111              free(pair);
1112              break;
1113           }
1114      }
1115
1116    if (!content) return NULL;
1117
1118 <<<<<<< HEAD
1119    elm_widget_sub_object_del(WIDGET(it), content);
1120    edje_object_part_unswallow(VIEW(it), content);
1121    snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
1122    edje_object_signal_emit(VIEW(it), buf, "elm");
1123    evas_object_event_callback_del(content,
1124                                   EVAS_CALLBACK_DEL,
1125                                   _title_content_del);
1126    evas_object_event_callback_del(content,
1127                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1128                                   _changed_size_hints);
1129 =======
1130    elm_object_part_content_unset(VIEW(it), part);
1131    snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
1132    elm_object_signal_emit(VIEW(it), buf, "elm");
1133    evas_object_event_callback_del(content,
1134                                   EVAS_CALLBACK_DEL,
1135                                   _title_content_del);
1136 >>>>>>> remotes/origin/upstream
1137    _sizing_eval(WIDGET(it));
1138
1139    return content;
1140 }
1141
1142 static void
1143 _item_del(Elm_Naviframe_Item *it)
1144 {
1145    Widget_Data *wd;
1146    Elm_Naviframe_Content_Item_Pair *content_pair;
1147    Elm_Naviframe_Text_Item_Pair *text_pair;
1148 <<<<<<< HEAD
1149 =======
1150    Evas_Object *content;
1151 >>>>>>> remotes/origin/upstream
1152
1153    if (!it) return;
1154
1155    wd = elm_widget_data_get(WIDGET(it));
1156    if (!wd) return;
1157
1158 <<<<<<< HEAD
1159    if (it->title_prev_btn)
1160      evas_object_del(it->title_prev_btn);
1161    if (it->title_next_btn)
1162      evas_object_del(it->title_next_btn);
1163    if (it->title_icon)
1164      evas_object_del(it->title_icon);
1165    if ((it->content) && (!wd->preserve))
1166      evas_object_del(it->content);
1167
1168    while (it->content_list)
1169      {
1170         content_pair = EINA_INLIST_CONTAINER_GET(it->content_list,
1171                                                  Elm_Naviframe_Content_Item_Pair);
1172         evas_object_event_callback_del(content_pair->content,
1173                                        EVAS_CALLBACK_DEL,
1174                                        _title_content_del);
1175         evas_object_event_callback_del(content_pair->content,
1176                                        EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1177                                        _changed_size_hints);
1178         evas_object_del(content_pair->content);
1179 =======
1180    while (it->content_list)
1181      {
1182         content_pair =
1183            EINA_INLIST_CONTAINER_GET(it->content_list,
1184                                      Elm_Naviframe_Content_Item_Pair);
1185         content = elm_object_part_content_get(VIEW(it), content_pair->part);
1186         evas_object_event_callback_del(content,
1187                                        EVAS_CALLBACK_DEL,
1188                                        _title_content_del);
1189 >>>>>>> remotes/origin/upstream
1190         eina_stringshare_del(content_pair->part);
1191         it->content_list = eina_inlist_remove(it->content_list,
1192                                               it->content_list);
1193         free(content_pair);
1194      }
1195
1196    while (it->text_list)
1197      {
1198         text_pair = EINA_INLIST_CONTAINER_GET(it->text_list,
1199                                               Elm_Naviframe_Text_Item_Pair);
1200         eina_stringshare_del(text_pair->part);
1201 <<<<<<< HEAD
1202         eina_stringshare_del(text_pair->text);
1203 =======
1204 >>>>>>> remotes/origin/upstream
1205         it->text_list = eina_inlist_remove(it->text_list,
1206                                            it->text_list);
1207         free(text_pair);
1208      }
1209
1210    eina_stringshare_del(it->style);
1211 }
1212
1213 static Eina_Bool
1214 _item_del_pre_hook(Elm_Object_Item *it)
1215 {
1216 <<<<<<< HEAD
1217    ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
1218    Elm_Naviframe_Item *navi_it;
1219    Widget_Data *wd;
1220
1221    navi_it =(Elm_Naviframe_Item *) it;
1222 =======
1223    Elm_Naviframe_Item *navi_it;
1224    Widget_Data *wd;
1225
1226    navi_it =(Elm_Naviframe_Item *)it;
1227 >>>>>>> remotes/origin/upstream
1228    wd = elm_widget_data_get(WIDGET(navi_it));
1229    if (!wd) return EINA_FALSE;
1230
1231    if (it == elm_naviframe_top_item_get(WIDGET(navi_it)))
1232      {
1233         wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it));
1234         _item_del(navi_it);
1235         //If the item is only one, the stack will be empty
1236         if (!wd->stack) return EINA_TRUE;
1237         navi_it = EINA_INLIST_CONTAINER_GET(wd->stack->last,
1238                                             Elm_Naviframe_Item);
1239         evas_object_show(VIEW(navi_it));
1240         evas_object_raise(VIEW(navi_it));
1241         elm_object_signal_emit(VIEW(navi_it), "elm,state,visible", "elm");
1242      }
1243    else
1244      {
1245         wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it));
1246         _item_del(navi_it);
1247      }
1248
1249    return EINA_TRUE;
1250 }
1251
1252 static void
1253 _pushed_finished(void *data,
1254                  Evas_Object *obj __UNUSED__,
1255                  const char *emission __UNUSED__,
1256                  const char *source __UNUSED__)
1257 {
1258    Widget_Data *wd;
1259    Elm_Naviframe_Item *it = data;
1260    if (!it) return;
1261
1262    wd = elm_widget_data_get(WIDGET(it));
1263    if (!wd) return;
1264
1265    evas_object_hide(VIEW(it));
1266 <<<<<<< HEAD
1267    evas_object_smart_callback_call(WIDGET(it),
1268                                    SIG_PUSH_FINISHED,
1269                                    data);
1270    if (wd->freeze_events)
1271      evas_object_freeze_events_set(VIEW(it), EINA_FALSE);
1272 =======
1273    if (wd->freeze_events)
1274      evas_object_freeze_events_set(VIEW(it), EINA_FALSE);
1275
1276    elm_widget_item_smart_callback_call(it,
1277                                        SIG_ITEM_HIDE_FINISHED,
1278                                        NULL);
1279 >>>>>>> remotes/origin/upstream
1280 }
1281
1282 static void
1283 _popped_finished(void *data,
1284                  Evas_Object *obj __UNUSED__,
1285                  const char *emission __UNUSED__,
1286                  const char *source __UNUSED__)
1287 {
1288    Elm_Naviframe_Item *it = data;
1289    if (!it) return;
1290 <<<<<<< HEAD
1291    evas_object_smart_callback_call(WIDGET(it),
1292                                    SIG_POP_FINISHED,
1293                                    data);
1294 =======
1295 >>>>>>> remotes/origin/upstream
1296    _item_del(data);
1297    elm_widget_item_free(data);
1298 }
1299
1300 static void
1301 _show_finished(void *data,
1302                Evas_Object *obj __UNUSED__,
1303                const char *emission __UNUSED__,
1304                const char *source __UNUSED__)
1305 {
1306    Elm_Naviframe_Item *it;
1307    Widget_Data *wd;
1308
1309    it = data;
1310    if (!it) return;
1311    wd =  elm_widget_data_get(WIDGET(it));
1312    if (!wd) return;
1313
1314    evas_object_smart_callback_call(WIDGET(it),
1315                                    SIG_TRANSITION_FINISHED,
1316                                    data);
1317    if (wd->freeze_events)
1318      evas_object_freeze_events_set(VIEW(it), EINA_FALSE);
1319 }
1320
1321 static void
1322 _changed_size_hints(void *data,
1323                     Evas *e __UNUSED__,
1324                     Evas_Object *obj __UNUSED__,
1325                     void *event_info __UNUSED__)
1326 {
1327    _sizing_eval(data);
1328 }
1329
1330 static void
1331 _item_content_set(Elm_Naviframe_Item *navi_it, Evas_Object *content)
1332 {
1333    if (navi_it->content == content) return;
1334    if (navi_it->content) evas_object_del(navi_it->content);
1335 <<<<<<< HEAD
1336    elm_widget_sub_object_add(WIDGET(navi_it), content);
1337    edje_object_part_swallow(VIEW(navi_it),
1338                             "elm.swallow.content",
1339                             content);
1340    if (content)
1341      edje_object_signal_emit(VIEW(navi_it),
1342                              "elm,state,content,show",
1343                              "elm");
1344    else
1345      edje_object_signal_emit(VIEW(navi_it),
1346                              "elm,state,content,hide",
1347                              "elm");
1348 =======
1349    elm_object_part_content_set(VIEW(navi_it), "elm.swallow.content", content);
1350
1351    if (content)
1352      elm_object_signal_emit(VIEW(navi_it), "elm,state,content,show", "elm");
1353    else
1354      elm_object_signal_emit(VIEW(navi_it), "elm,state,content,hide", "elm");
1355
1356 >>>>>>> remotes/origin/upstream
1357    evas_object_event_callback_add(content,
1358                                   EVAS_CALLBACK_DEL,
1359                                   _item_content_del,
1360                                   navi_it);
1361 <<<<<<< HEAD
1362    evas_object_event_callback_add(content,
1363                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1364                                   _changed_size_hints,
1365                                   WIDGET(navi_it));
1366 =======
1367 >>>>>>> remotes/origin/upstream
1368    navi_it->content = content;
1369    _sizing_eval(WIDGET(navi_it));
1370 }
1371
1372 //FIXME: need to handle if this function is called while transition
1373 static void
1374 _item_style_set(Elm_Naviframe_Item *navi_it, const char *item_style)
1375 {
1376    Elm_Naviframe_Content_Item_Pair *content_pair;
1377    Elm_Naviframe_Text_Item_Pair *text_pair;
1378    Widget_Data *wd;
1379
1380    char buf[256];
1381
1382    if (!item_style)
1383      {
1384         strcpy(buf, "item/basic");
1385         eina_stringshare_replace(&navi_it->style, "basic");
1386      }
1387    else
1388      {
1389         snprintf(buf, sizeof(buf), "item/%s", item_style);
1390         eina_stringshare_replace(&navi_it->style, item_style);
1391      }
1392 <<<<<<< HEAD
1393    _elm_theme_object_set(WIDGET(navi_it),
1394                          VIEW(navi_it),
1395                          "naviframe",
1396                          buf,
1397                          elm_widget_style_get(WIDGET(navi_it)));
1398    //recover item
1399    EINA_INLIST_FOREACH(navi_it->text_list, text_pair)
1400       _item_text_set_hook((Elm_Object_Item *) navi_it,
1401                           text_pair->part,
1402                           text_pair->text);
1403
1404    EINA_INLIST_FOREACH(navi_it->content_list, content_pair)
1405       _item_content_set_hook((Elm_Object_Item *) navi_it,
1406                              content_pair->part,
1407                              content_pair->content);
1408    //content
1409    if (navi_it->content)
1410      {
1411         edje_object_part_swallow(VIEW(navi_it),
1412                                  "elm.swallow.content",
1413                                  navi_it->content);
1414         edje_object_signal_emit(VIEW(navi_it),
1415                                 "elm,state,content,show",
1416                                 "elm");
1417      }
1418
1419    //prev button
1420    if (navi_it->title_prev_btn)
1421      {
1422         edje_object_part_swallow(VIEW(navi_it),
1423                                  "elm.swallow.prev_btn",
1424                                  navi_it->title_prev_btn);
1425         edje_object_signal_emit(VIEW(navi_it),
1426                                 "elm,state,prev_btn,show",
1427                                 "elm");
1428      }
1429
1430    //next button
1431    if (navi_it->title_next_btn)
1432      {
1433         edje_object_part_swallow(VIEW(navi_it),
1434                                  "elm.swallow.next_btn",
1435                                  navi_it->title_next_btn);
1436         edje_object_signal_emit(VIEW(navi_it),
1437                                 "elm,state,next_btn,show",
1438                                 "elm");
1439      }
1440
1441    navi_it->title_visible = EINA_TRUE;
1442 =======
1443    elm_layout_theme_set(VIEW(navi_it),
1444                         "naviframe",
1445                         buf,
1446                         elm_widget_style_get(WIDGET(navi_it)));
1447    //recover item
1448    EINA_INLIST_FOREACH(navi_it->text_list, text_pair)
1449      _item_text_set_hook((Elm_Object_Item *) navi_it,
1450                          text_pair->part,
1451                          elm_object_part_text_get(VIEW(navi_it),
1452                                                   text_pair->part));
1453
1454    EINA_INLIST_FOREACH(navi_it->content_list, content_pair)
1455      _item_content_set_hook((Elm_Object_Item *) navi_it,
1456                             content_pair->part,
1457                             elm_object_part_content_get(VIEW(navi_it),
1458                                                         content_pair->part));
1459    //content
1460    if (navi_it->content)
1461      elm_object_signal_emit(VIEW(navi_it), "elm,state,content,show", "elm");
1462
1463    //prev button
1464    if (navi_it->title_prev_btn)
1465      elm_object_signal_emit(VIEW(navi_it), "elm,state,prev_btn,show", "elm");
1466
1467    //next button
1468    if (navi_it->title_next_btn)
1469      elm_object_signal_emit(VIEW(navi_it), "elm,state,next_btn,show", "elm");
1470
1471 // why does this forcibly enable title? isnt that separate to style?   
1472 //   navi_it->title_visible = EINA_TRUE;
1473 >>>>>>> remotes/origin/upstream
1474    _sizing_eval(WIDGET(navi_it));
1475
1476    wd = elm_widget_data_get(WIDGET(navi_it));
1477    if (!wd) return;
1478
1479    if (wd->freeze_events)
1480      evas_object_freeze_events_set(VIEW(navi_it), EINA_FALSE);
1481 }
1482
1483 static Elm_Naviframe_Item *
1484 _item_new(Evas_Object *obj,
1485           const char *title_label,
1486           Evas_Object *prev_btn,
1487           Evas_Object *next_btn,
1488           Evas_Object *content,
1489           const char *item_style)
1490 {
1491    Widget_Data *wd = elm_widget_data_get(obj);
1492
1493    //create item
1494    Elm_Naviframe_Item *it = elm_widget_item_new(obj, Elm_Naviframe_Item);
1495    if (!it)
1496      {
1497         ERR("Failed to allocate new item! : naviframe=%p", obj);
1498         return NULL;
1499      }
1500
1501    elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
1502    elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
1503    elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
1504    elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
1505    elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
1506    elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook);
1507    elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook);
1508
1509    //item base layout
1510 <<<<<<< HEAD
1511    VIEW(it) = edje_object_add(evas_object_evas_get(obj));
1512    edje_object_mirrored_set(VIEW(it), elm_widget_mirrored_get(obj));
1513    evas_object_smart_member_add(VIEW(it), wd->base);
1514    elm_widget_sub_object_add(obj, VIEW(it));
1515    edje_object_signal_callback_add(VIEW(it),
1516                                    "elm,action,show,finished",
1517                                    "",
1518                                    _show_finished, it);
1519    edje_object_signal_callback_add(VIEW(it),
1520                                    "elm,action,pushed,finished",
1521                                    "",
1522                                    _pushed_finished, it);
1523    edje_object_signal_callback_add(VIEW(it),
1524                                    "elm,action,popped,finished",
1525                                    "",
1526                                    _popped_finished, it);
1527    edje_object_signal_callback_add(VIEW(it),
1528 =======
1529    VIEW(it) = elm_layout_add(obj);
1530    evas_object_smart_member_add(VIEW(it), wd->base);
1531
1532    evas_object_event_callback_add(VIEW(it),
1533                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1534                                   _changed_size_hints,
1535                                   obj);
1536    elm_object_signal_callback_add(VIEW(it),
1537                                    "elm,action,show,finished",
1538                                    "",
1539                                    _show_finished, it);
1540    elm_object_signal_callback_add(VIEW(it),
1541                                    "elm,action,pushed,finished",
1542                                    "",
1543                                    _pushed_finished, it);
1544    elm_object_signal_callback_add(VIEW(it),
1545                                    "elm,action,popped,finished",
1546                                    "",
1547                                    _popped_finished, it);
1548    elm_object_signal_callback_add(VIEW(it),
1549 >>>>>>> remotes/origin/upstream
1550                                    "elm,action,title,clicked",
1551                                    "",
1552                                    _title_clicked, it);
1553
1554    _item_style_set(it, item_style);
1555 <<<<<<< HEAD
1556    _item_text_set_hook((Elm_Object_Item *) it, "elm.text.title", title_label);
1557 =======
1558    _item_text_set_hook((Elm_Object_Item *)it, "elm.text.title", title_label);
1559 >>>>>>> remotes/origin/upstream
1560
1561    //title buttons
1562    if ((!prev_btn) && wd->auto_pushed && eina_inlist_count(wd->stack))
1563      {
1564         prev_btn = _back_btn_new(obj);
1565         _title_prev_btn_set(it, prev_btn, EINA_TRUE);
1566      }
1567    else
1568      _title_prev_btn_set(it, prev_btn, EINA_FALSE);
1569
1570    _title_next_btn_set(it, next_btn);
1571    _item_content_set(it, content);
1572    it->title_visible = EINA_TRUE;
1573    return it;
1574 }
1575
1576 <<<<<<< HEAD
1577 =======
1578 static Eina_Bool
1579 _focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
1580 {
1581    Widget_Data *wd = elm_widget_data_get(obj);
1582    if (!wd || !wd->stack) return EINA_FALSE;
1583    return elm_widget_focus_next_get(VIEW(elm_naviframe_top_item_get(obj)),
1584                                     dir,
1585                                     next);
1586 }
1587
1588 >>>>>>> remotes/origin/upstream
1589 EAPI Evas_Object *
1590 elm_naviframe_add(Evas_Object *parent)
1591 {
1592    Evas_Object *obj;
1593    Evas *e;
1594    Widget_Data *wd;
1595
1596    ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
1597    ELM_SET_WIDTYPE(widtype, "naviframe");
1598    elm_widget_type_set(obj, "naviframe");
1599    elm_widget_sub_object_add(parent, obj);
1600    elm_widget_data_set(obj, wd);
1601    elm_widget_del_hook_set(obj, _del_hook);
1602    elm_widget_disable_hook_set(obj, _disable_hook);
1603    elm_widget_theme_hook_set(obj, _theme_hook);
1604 <<<<<<< HEAD
1605    elm_widget_signal_emit_hook_set(obj, _emit_hook);
1606
1607    //base
1608    wd->base = edje_object_add(e);
1609    edje_object_mirrored_set(wd->base, elm_widget_mirrored_get(obj));
1610    elm_widget_resize_object_set(obj, wd->base);
1611    _elm_theme_object_set(obj, wd->base, "naviframe", "base", "default");
1612 =======
1613    elm_widget_text_set_hook_set(obj, _text_set_hook);
1614    elm_widget_text_get_hook_set(obj, _text_get_hook);
1615    elm_widget_content_set_hook_set(obj, _content_set_hook);
1616    elm_widget_content_get_hook_set(obj, _content_get_hook);
1617    elm_widget_content_unset_hook_set(obj, _content_unset_hook);
1618    elm_widget_signal_emit_hook_set(obj, _emit_hook);
1619    elm_widget_can_focus_set(obj, EINA_FALSE);
1620    elm_widget_focus_next_hook_set(obj, _focus_next_hook);
1621
1622    //base
1623    //FIXME: Is this base layout really needed?
1624    wd->base = elm_layout_add(parent);
1625    evas_object_event_callback_add(wd->base,
1626                                   EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1627                                   _changed_size_hints,
1628                                   obj);
1629    elm_widget_resize_object_set(obj, wd->base);
1630    elm_layout_theme_set(wd->base, "naviframe", "base", "default");
1631 >>>>>>> remotes/origin/upstream
1632
1633    evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, obj);
1634    evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
1635    evas_object_smart_callbacks_descriptions_set(obj, _signals);
1636
1637    wd->auto_pushed = EINA_TRUE;
1638    wd->freeze_events = EINA_TRUE;
1639
1640    return obj;
1641 }
1642
1643 EAPI Elm_Object_Item *
1644 elm_naviframe_item_push(Evas_Object *obj,
1645                         const char *title_label,
1646                         Evas_Object *prev_btn,
1647                         Evas_Object *next_btn,
1648                         Evas_Object *content,
1649                         const char *item_style)
1650 {
1651    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1652    Widget_Data *wd;
1653    Elm_Naviframe_Item *prev_it, *it;
1654
1655    wd = elm_widget_data_get(obj);
1656    if (!wd) return NULL;
1657
1658    it = _item_new(obj, title_label, prev_btn, next_btn, content, item_style);
1659    if (!it) return NULL;
1660
1661    evas_object_show(VIEW(it));
1662
1663    prev_it = (Elm_Naviframe_Item *) elm_naviframe_top_item_get(obj);
1664    if (prev_it)
1665      {
1666         if (wd->freeze_events)
1667           {
1668              evas_object_freeze_events_set(VIEW(it), EINA_TRUE);
1669              evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE);
1670           }
1671 <<<<<<< HEAD
1672         edje_object_signal_emit(VIEW(prev_it),
1673                                 "elm,state,cur,pushed",
1674                                 "elm");
1675         edje_object_signal_emit(VIEW(it),
1676                                 "elm,state,new,pushed",
1677                                 "elm");
1678         edje_object_message_signal_process(VIEW(prev_it));
1679         edje_object_message_signal_process(VIEW(it));
1680      }
1681    wd->stack = eina_inlist_append(wd->stack, EINA_INLIST_GET(it));
1682    _sizing_eval(obj);
1683    return (Elm_Object_Item *) it;
1684 }
1685
1686 EAPI Elm_Object_Item *
1687 elm_naviframe_item_insert_before(Elm_Object_Item *before,
1688 =======
1689         elm_object_signal_emit(VIEW(prev_it), "elm,state,cur,pushed", "elm");
1690         elm_object_signal_emit(VIEW(it), "elm,state,new,pushed", "elm");
1691         edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it)));
1692         elm_widget_tree_unfocusable_set(it->content, EINA_TRUE);
1693         edje_object_message_signal_process(elm_layout_edje_get(VIEW(it)));
1694      }
1695    wd->stack = eina_inlist_append(wd->stack, EINA_INLIST_GET(it));
1696    _sizing_eval(obj);
1697    return (Elm_Object_Item *)it;
1698 }
1699
1700 EAPI Elm_Object_Item *
1701 elm_naviframe_item_insert_before(Evas_Object *obj,
1702                                  Elm_Object_Item *before,
1703 >>>>>>> remotes/origin/upstream
1704                                  const char *title_label,
1705                                  Evas_Object *prev_btn,
1706                                  Evas_Object *next_btn,
1707                                  Evas_Object *content,
1708                                  const char *item_style)
1709 {
1710 <<<<<<< HEAD
1711 =======
1712    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1713 >>>>>>> remotes/origin/upstream
1714    ELM_OBJ_ITEM_CHECK_OR_RETURN(before, NULL);
1715    Elm_Naviframe_Item *it;
1716    Widget_Data *wd;
1717
1718 <<<<<<< HEAD
1719    wd = elm_widget_data_get(WIDGET(before));
1720 =======
1721    wd = elm_widget_data_get(obj);
1722 >>>>>>> remotes/origin/upstream
1723    if (!wd) return NULL;
1724
1725    it = _item_new(WIDGET(before), title_label, prev_btn, next_btn, content,
1726                   item_style);
1727    if (!it) return NULL;
1728
1729    wd->stack =
1730 <<<<<<< HEAD
1731       eina_inlist_prepend_relative(wd->stack, EINA_INLIST_GET(it),
1732                                    EINA_INLIST_GET(((Elm_Naviframe_Item *) before)));
1733    _sizing_eval(WIDGET(before));
1734    return (Elm_Object_Item *) it;
1735 }
1736
1737 EAPI Elm_Object_Item *
1738 elm_naviframe_item_insert_after(Elm_Object_Item *after,
1739 =======
1740       eina_inlist_prepend_relative(wd->stack,
1741                                    EINA_INLIST_GET(it),
1742                                    EINA_INLIST_GET(((Elm_Naviframe_Item *) before)));
1743    _sizing_eval(WIDGET(before));
1744    return (Elm_Object_Item *)it;
1745 }
1746
1747 EAPI Elm_Object_Item *
1748 elm_naviframe_item_insert_after(Evas_Object *obj,
1749                                 Elm_Object_Item *after,
1750 >>>>>>> remotes/origin/upstream
1751                                 const char *title_label,
1752                                 Evas_Object *prev_btn,
1753                                 Evas_Object *next_btn,
1754                                 Evas_Object *content,
1755                                 const char *item_style)
1756 {
1757 <<<<<<< HEAD
1758 =======
1759    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1760 >>>>>>> remotes/origin/upstream
1761    ELM_OBJ_ITEM_CHECK_OR_RETURN(after, NULL);
1762    Elm_Naviframe_Item *it;
1763    Widget_Data *wd;
1764
1765 <<<<<<< HEAD
1766    wd = elm_widget_data_get(WIDGET(after));
1767 =======
1768    wd = elm_widget_data_get(obj);
1769 >>>>>>> remotes/origin/upstream
1770    if (!wd) return NULL;
1771
1772    it = _item_new(WIDGET(after), title_label, prev_btn, next_btn, content,
1773                   item_style);
1774    if (!it) return NULL;
1775
1776    if (elm_naviframe_top_item_get(WIDGET(after)) == after)
1777      {
1778         evas_object_hide(VIEW(after));
1779         evas_object_show(VIEW(it));
1780      }
1781    wd->stack =
1782 <<<<<<< HEAD
1783       eina_inlist_append_relative(wd->stack, EINA_INLIST_GET(it),
1784                                   EINA_INLIST_GET(((Elm_Naviframe_Item *) after)));
1785    _sizing_eval(WIDGET(after));
1786    return (Elm_Object_Item *) it;
1787 =======
1788       eina_inlist_append_relative(wd->stack,
1789                                   EINA_INLIST_GET(it),
1790                                   EINA_INLIST_GET(((Elm_Naviframe_Item *) after)));
1791    _sizing_eval(WIDGET(after));
1792    return (Elm_Object_Item *)it;
1793 >>>>>>> remotes/origin/upstream
1794 }
1795
1796 EAPI Evas_Object *
1797 elm_naviframe_item_pop(Evas_Object *obj)
1798 {
1799    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1800    Elm_Naviframe_Item *it, *prev_it = NULL;
1801    Widget_Data *wd;
1802    Evas_Object *content = NULL;
1803
1804    wd = elm_widget_data_get(obj);
1805    if (!wd) return NULL;
1806
1807    it = (Elm_Naviframe_Item *) elm_naviframe_top_item_get(obj);
1808    if (!it) return NULL;
1809 <<<<<<< HEAD
1810    elm_widget_tree_unfocusable_set(it->content, EINA_TRUE);
1811 =======
1812 >>>>>>> remotes/origin/upstream
1813    if (wd->preserve)
1814      content = it->content;
1815
1816    if (wd->stack->last->prev)
1817      prev_it = EINA_INLIST_CONTAINER_GET(wd->stack->last->prev,
1818                                          Elm_Naviframe_Item);
1819    wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(it));
1820    if (prev_it)
1821      {
1822         if (wd->freeze_events)
1823           {
1824              evas_object_freeze_events_set(VIEW(it), EINA_TRUE);
1825              evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE);
1826           }
1827 <<<<<<< HEAD
1828         edje_object_signal_emit(VIEW(it), "elm,state,cur,popped", "elm");
1829         evas_object_show(VIEW(prev_it));
1830         evas_object_raise(VIEW(prev_it));
1831         edje_object_signal_emit(VIEW(prev_it),
1832                                 "elm,state,prev,popped",
1833                                 "elm");
1834         edje_object_message_signal_process(VIEW(it));
1835         edje_object_message_signal_process(VIEW(prev_it));
1836 =======
1837         elm_object_signal_emit(VIEW(it), "elm,state,cur,popped", "elm");
1838         evas_object_show(VIEW(prev_it));
1839         evas_object_raise(VIEW(prev_it));
1840         elm_object_signal_emit(VIEW(prev_it),
1841                                "elm,state,prev,popped",
1842                                "elm");
1843         edje_object_message_signal_process(elm_layout_edje_get(VIEW(it)));
1844         edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it)));
1845         elm_widget_item_smart_callback_call(prev_it,
1846                                             SIG_ITEM_SHOW_BEGIN,
1847                                             NULL);
1848 >>>>>>> remotes/origin/upstream
1849      }
1850    else
1851      {
1852         _item_del(it);
1853         elm_widget_item_free(it);
1854      }
1855
1856    return content;
1857 }
1858
1859 EAPI void
1860 elm_naviframe_item_pop_to(Elm_Object_Item *it)
1861 {
1862    ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1863    Elm_Naviframe_Item *navi_it;
1864    Widget_Data *wd;
1865    Eina_Inlist *l, *prev_l;
1866
1867 <<<<<<< HEAD
1868    navi_it = (Elm_Naviframe_Item *) it;
1869 =======
1870    navi_it = (Elm_Naviframe_Item *)it;
1871 >>>>>>> remotes/origin/upstream
1872    wd = elm_widget_data_get(WIDGET(navi_it));
1873    if (!wd) return;
1874
1875    if (it == elm_naviframe_top_item_get(WIDGET(navi_it))) return;
1876
1877    l = wd->stack->last->prev;
1878
1879    while(l)
1880      {
1881         if (EINA_INLIST_CONTAINER_GET(l, Elm_Naviframe_Item) ==
1882 <<<<<<< HEAD
1883             ((Elm_Naviframe_Item *) it)) break;
1884 =======
1885             ((Elm_Naviframe_Item *)it)) break;
1886 >>>>>>> remotes/origin/upstream
1887         prev_l = l->prev;
1888         wd->stack = eina_inlist_remove(wd->stack, l);
1889         _item_del(EINA_INLIST_CONTAINER_GET(l, Elm_Naviframe_Item));
1890         elm_widget_item_free(EINA_INLIST_CONTAINER_GET(l,
1891                                                        Elm_Naviframe_Item));
1892         l = prev_l;
1893      }
1894    elm_naviframe_item_pop(WIDGET(navi_it));
1895 }
1896
1897 EAPI void
1898 elm_naviframe_item_promote(Elm_Object_Item *it)
1899 {
1900    ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1901    Elm_Naviframe_Item *navi_it;
1902    Elm_Naviframe_Item *prev_it;
1903    Widget_Data *wd;
1904
1905 <<<<<<< HEAD
1906    navi_it = (Elm_Naviframe_Item *) it;
1907 =======
1908    navi_it = (Elm_Naviframe_Item *)it;
1909 >>>>>>> remotes/origin/upstream
1910    wd = elm_widget_data_get(navi_it->base.widget);
1911    if (!wd) return;
1912
1913    if (it == elm_naviframe_top_item_get(navi_it->base.widget)) return;
1914 <<<<<<< HEAD
1915    wd->stack = eina_inlist_demote(wd->stack, EINA_INLIST_GET(navi_it));
1916    prev_it = EINA_INLIST_CONTAINER_GET(wd->stack->last->prev,
1917                                          Elm_Naviframe_Item);
1918 =======
1919    elm_widget_tree_unfocusable_set(navi_it->content, EINA_FALSE);
1920    wd->stack = eina_inlist_demote(wd->stack, EINA_INLIST_GET(navi_it));
1921    prev_it = EINA_INLIST_CONTAINER_GET(wd->stack->last->prev,
1922                                          Elm_Naviframe_Item);
1923    elm_widget_tree_unfocusable_set(prev_it->content, EINA_FALSE);
1924 >>>>>>> remotes/origin/upstream
1925    if (wd->freeze_events)
1926      {
1927         evas_object_freeze_events_set(VIEW(it), EINA_TRUE);
1928         evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE);
1929      }
1930 <<<<<<< HEAD
1931    edje_object_signal_emit(VIEW(prev_it),
1932                            "elm,state,cur,pushed",
1933                            "elm");
1934    evas_object_show(VIEW(navi_it));
1935    evas_object_raise(VIEW(navi_it));
1936    edje_object_signal_emit(VIEW(navi_it),
1937                            "elm,state,new,pushed",
1938                            "elm");
1939    edje_object_message_signal_process(VIEW(prev_it));
1940    edje_object_message_signal_process(VIEW(navi_it));
1941 }
1942
1943 =======
1944    elm_object_signal_emit(VIEW(prev_it),
1945                           "elm,state,cur,pushed",
1946                           "elm");
1947    evas_object_show(VIEW(navi_it));
1948    evas_object_raise(VIEW(navi_it));
1949    elm_object_signal_emit(VIEW(navi_it),
1950                           "elm,state,new,pushed",
1951                           "elm");
1952    edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it)));
1953    edje_object_message_signal_process(elm_layout_edje_get(VIEW(navi_it)));
1954 }
1955
1956 EAPI void
1957 elm_naviframe_item_simple_promote(Evas_Object *obj, Evas_Object *content)
1958 {
1959    ELM_CHECK_WIDTYPE(obj, widtype);
1960    Widget_Data *wd = elm_widget_data_get(obj);
1961    if (!wd) return;
1962    Elm_Naviframe_Item *itr;
1963    EINA_INLIST_FOREACH(wd->stack, itr)
1964      {
1965         if (elm_object_item_content_get((Elm_Object_Item *)itr) == content)
1966           {
1967              elm_naviframe_item_promote((Elm_Object_Item *)itr);
1968              break;
1969           }
1970      }
1971 }
1972
1973
1974 >>>>>>> remotes/origin/upstream
1975 EAPI void
1976 elm_naviframe_item_del(Elm_Object_Item *it)
1977 {
1978    elm_object_item_del(it);
1979 }
1980
1981 EAPI void
1982 elm_naviframe_content_preserve_on_pop_set(Evas_Object *obj, Eina_Bool preserve)
1983 {
1984    ELM_CHECK_WIDTYPE(obj, widtype);
1985    Widget_Data *wd = elm_widget_data_get(obj);
1986    if (!wd) return;
1987    wd->preserve = !!preserve;
1988 }
1989
1990 EAPI Eina_Bool
1991 elm_naviframe_content_preserve_on_pop_get(const Evas_Object *obj)
1992 {
1993    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1994    Widget_Data *wd = elm_widget_data_get(obj);
1995    if (!wd) return EINA_FALSE;
1996    return wd->preserve;
1997 }
1998
1999 EAPI Elm_Object_Item*
2000 elm_naviframe_top_item_get(const Evas_Object *obj)
2001 {
2002    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2003    Widget_Data *wd = elm_widget_data_get(obj);
2004    if ((!wd) || (!wd->stack)) return NULL;
2005    return (Elm_Object_Item *) (EINA_INLIST_CONTAINER_GET(wd->stack->last,
2006                                                          Elm_Naviframe_Item));
2007 }
2008
2009 EAPI Elm_Object_Item*
2010 elm_naviframe_bottom_item_get(const Evas_Object *obj)
2011 {
2012    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2013    Widget_Data *wd = elm_widget_data_get(obj);
2014    if ((!wd) || (!wd->stack)) return NULL;
2015    return (Elm_Object_Item *) (EINA_INLIST_CONTAINER_GET(wd->stack,
2016                                                          Elm_Naviframe_Item));
2017 }
2018
2019 EAPI void
2020 elm_naviframe_item_style_set(Elm_Object_Item *it, const char *item_style)
2021 {
2022    ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
2023 <<<<<<< HEAD
2024    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
2025
2026    //Return if new style is exsiting one.
2027 =======
2028    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
2029
2030 >>>>>>> remotes/origin/upstream
2031    if (item_style)
2032      if (!strcmp(item_style, navi_it->style)) return;
2033
2034    if (!item_style)
2035      if (!strcmp("basic", navi_it->style)) return;
2036
2037    _item_style_set(navi_it, item_style);
2038 }
2039
2040 EAPI const char *
2041 elm_naviframe_item_style_get(const Elm_Object_Item *it)
2042 {
2043    ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
2044 <<<<<<< HEAD
2045    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
2046 =======
2047    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
2048 >>>>>>> remotes/origin/upstream
2049    return navi_it->style;
2050 }
2051
2052 EAPI void
2053 elm_naviframe_item_title_visible_set(Elm_Object_Item *it, Eina_Bool visible)
2054 {
2055    ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
2056 <<<<<<< HEAD
2057    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
2058 =======
2059    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
2060 >>>>>>> remotes/origin/upstream
2061
2062    visible = !!visible;
2063    if (navi_it->title_visible == visible) return;
2064
2065    navi_it->title_visible = visible;
2066    _item_title_visible_update(navi_it);
2067 }
2068
2069 EAPI Eina_Bool
2070 elm_naviframe_item_title_visible_get(const Elm_Object_Item *it)
2071 {
2072    ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
2073 <<<<<<< HEAD
2074    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
2075 =======
2076    Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
2077 >>>>>>> remotes/origin/upstream
2078    return navi_it->title_visible;
2079 }
2080
2081 EAPI void
2082 elm_naviframe_prev_btn_auto_pushed_set(Evas_Object *obj, Eina_Bool auto_pushed)
2083 {
2084    ELM_CHECK_WIDTYPE(obj, widtype);
2085    Widget_Data *wd = elm_widget_data_get(obj);
2086    if (!wd) return;
2087    wd->auto_pushed = !!auto_pushed;
2088 }
2089
2090 EAPI Eina_Bool
2091 elm_naviframe_prev_btn_auto_pushed_get(const Evas_Object *obj)
2092 {
2093    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2094    Widget_Data *wd = elm_widget_data_get(obj);
2095    if (!wd) return EINA_FALSE;
2096    return wd->auto_pushed;
2097 }
2098
2099 <<<<<<< HEAD
2100 EAPI Eina_Inlist *
2101 =======
2102 EAPI Eina_List *
2103 >>>>>>> remotes/origin/upstream
2104 elm_naviframe_items_get(const Evas_Object *obj)
2105 {
2106    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2107    Widget_Data *wd = elm_widget_data_get(obj);
2108    if (!wd) return NULL;
2109 <<<<<<< HEAD
2110    return wd->stack;
2111 =======
2112    Eina_List *ret = NULL;
2113    Elm_Naviframe_Item *itr;
2114    EINA_INLIST_FOREACH(wd->stack, itr)
2115      ret = eina_list_append(ret, itr);
2116    return ret;
2117 >>>>>>> remotes/origin/upstream
2118 }
2119
2120 EAPI void
2121 elm_naviframe_event_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2122 {
2123    ELM_CHECK_WIDTYPE(obj, widtype);
2124    Widget_Data *wd = elm_widget_data_get(obj);
2125    if (!wd) return;
2126    enabled = !!enabled;
2127    if (wd->freeze_events == !enabled) return;
2128    wd->freeze_events = !enabled;
2129 }
2130
2131 EAPI Eina_Bool
2132 elm_naviframe_event_enabled_get(const Evas_Object *obj)
2133 {
2134    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2135    Widget_Data *wd = elm_widget_data_get(obj);
2136    if (!wd) return EINA_FALSE;
2137    return !wd->freeze_events;
2138 }