1 #include <Elementary.h>
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;
14 Eina_Bool preserve: 1;
15 Eina_Bool auto_pushed: 1;
16 Eina_Bool freeze_events: 1;
19 struct _Elm_Naviframe_Content_Item_Pair
23 Elm_Naviframe_Item *it;
26 struct _Elm_Naviframe_Text_Item_Pair
32 struct _Elm_Naviframe_Item
36 Eina_List *content_list;
39 Evas_Object *title_prev_btn;
40 Evas_Object *title_next_btn;
42 Eina_Bool back_btn: 1;
43 Eina_Bool title_visible: 1;
46 static const char *widtype = NULL;
48 static const char SIG_TRANSITION_FINISHED[] = "transition,finished";
49 static const char SIG_TITLE_CLICKED[] = "title,clicked";
51 static const Evas_Smart_Cb_Description _signals[] = {
52 {SIG_TRANSITION_FINISHED, ""},
53 {SIG_TITLE_CLICKED, ""},
57 static void _del_hook(Evas_Object *obj);
58 static void _theme_hook(Evas_Object *obj);
59 static void _emit_hook(Evas_Object *obj,
62 static void _disable_hook(Evas_Object *obj);
63 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
64 static void _item_text_set_hook(Elm_Object_Item *it,
67 static const char *_item_text_get_hook(const Elm_Object_Item *it,
69 static void _item_content_set_hook(Elm_Object_Item *it,
71 Evas_Object *content);
72 static Evas_Object *_item_content_get_hook(const Elm_Object_Item *it,
74 static Evas_Object *_item_content_unset_hook(Elm_Object_Item *it,
76 static void _item_signal_emit_hook(Elm_Object_Item *it,
79 static void _sizing_eval(Evas_Object *obj);
80 static void _item_sizing_eval(Elm_Naviframe_Item *it);
81 static void _move(void *data, Evas *e, Evas_Object *obj, void *event_info);
82 static void _resize(void *data,
86 static void _hide(void *data, Evas *e, Evas_Object *obj, void *event_info);
87 static void _title_clicked(void *data, Evas_Object *obj,
90 static void _back_btn_clicked(void *data,
93 static Evas_Object *_back_btn_new(Evas_Object *obj);
94 static void _item_content_del(void *data,
98 static void _title_content_del(void *data,
102 static void _title_prev_btn_del(void *data,
106 static void _title_next_btn_del(void *data,
110 static void _title_content_set(Elm_Naviframe_Item *it,
111 Elm_Naviframe_Content_Item_Pair *pair,
113 Evas_Object *content);
114 static void _title_prev_btn_set(Elm_Naviframe_Item *it,
117 static void _title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn);
118 static void _item_del(Elm_Naviframe_Item *it);
119 static void _pushed_finished(void *data,
121 const char *emission,
123 static void _popped_finished(void *data,
125 const char *emission,
127 static void _show_finished(void *data,
129 const char *emission,
131 static void _item_content_set(Elm_Naviframe_Item *navi_it,
132 Evas_Object *content);
135 _del_hook(Evas_Object *obj)
138 Elm_Naviframe_Item *it;
140 wd = elm_widget_data_get(obj);
143 EINA_INLIST_REVERSE_FOREACH(wd->stack, it)
149 _theme_hook(Evas_Object *obj)
152 _elm_widget_mirrored_reload(obj);
153 _mirrored_set(obj, elm_widget_mirrored_get(obj));
156 static void _emit_hook(Evas_Object *obj,
157 const char *emission,
160 ELM_CHECK_WIDTYPE(obj, widtype);
162 Widget_Data *wd = elm_widget_data_get(obj);
165 edje_object_signal_emit(wd->base, emission, source);
169 _disable_hook(Evas_Object *obj __UNUSED__)
175 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
178 Elm_Naviframe_Item *it;
180 wd = elm_widget_data_get(obj);
183 EINA_INLIST_FOREACH(wd->stack, it)
184 edje_object_mirrored_set(it->base.view, rtl);
185 edje_object_mirrored_set(wd->base, rtl);
189 _item_text_set_hook(Elm_Object_Item *it,
193 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
196 Elm_Naviframe_Text_Item_Pair *pair = NULL;
197 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
201 snprintf(buf, sizeof(buf), "elm.text.title");
203 snprintf(buf, sizeof(buf), "%s", part);
205 EINA_LIST_FOREACH(navi_it->text_list, l, pair)
206 if (!strcmp(buf, pair->part)) break;
210 pair = ELM_NEW(Elm_Naviframe_Text_Item_Pair);
213 ERR("Failed to allocate new text part of the item! : naviframe=%p",
214 navi_it->base.widget);
217 eina_stringshare_replace(&pair->part, buf);
218 navi_it->text_list = eina_list_append(navi_it->text_list, pair);
221 eina_stringshare_replace(&pair->text, label);
222 edje_object_part_text_set(navi_it->base.view, buf, label);
226 snprintf(buf, sizeof(buf), "elm,state,%s,show", buf);
227 edje_object_signal_emit(navi_it->base.view, buf, "elm");
231 snprintf(buf, sizeof(buf), "elm,state,%s,hide", buf);
232 edje_object_signal_emit(navi_it->base.view, buf, "elm");
235 _item_sizing_eval(navi_it);
239 _item_text_get_hook(const Elm_Object_Item *it, const char *part)
241 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
243 Elm_Naviframe_Text_Item_Pair *pair = NULL;
244 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
248 snprintf(buf, sizeof(buf), "elm.text.title");
250 snprintf(buf, sizeof(buf), "%s", part);
252 EINA_LIST_FOREACH(navi_it->text_list, l, pair)
254 if (!strcmp(buf, pair->part))
261 _item_content_set_hook(Elm_Object_Item *it,
263 Evas_Object *content)
265 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
267 Elm_Naviframe_Content_Item_Pair *pair = NULL;
268 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
271 if ((!part) || (!strcmp(part, "elm.swallow.content")))
273 _item_content_set(navi_it, content);
276 else if (!strcmp(part, "elm.swallow.prev_btn"))
278 _title_prev_btn_set(navi_it, content, EINA_FALSE);
281 else if(!strcmp(part, "elm.swallow.next_btn"))
283 _title_next_btn_set(navi_it, content);
288 _title_content_set(navi_it, pair, part, content);
292 _item_content_get_hook(const Elm_Object_Item *it, const char *part)
294 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
296 Elm_Naviframe_Content_Item_Pair *pair = NULL;
297 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
300 if ((!part) || (!strcmp(part, "elm.swallow.content")))
301 return navi_it->content;
302 else if (!strcmp(part, "elm.swallow.prev_btn"))
303 return navi_it->title_prev_btn;
304 else if(!strcmp(part, "elm.swallow.next_btn"))
305 return navi_it->title_next_btn;
308 EINA_LIST_FOREACH(navi_it->content_list, l, pair)
310 if (!strcmp(part, pair->part))
311 return pair->content;
317 _item_content_unset_hook(Elm_Object_Item *it, const char *part)
319 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
321 Elm_Naviframe_Content_Item_Pair *pair = NULL;
322 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
323 Evas_Object *content = NULL;
327 //FIXME: could be unset the below specified contents also.
329 !strcmp(part, "elm.swallow.content") ||
330 !strcmp(part, "elm.swallow.prev_btn") ||
331 !strcmp(part, "elm.swallow.next_btn"))
333 WRN("You can not unset the content! : naviframe=%p",
334 navi_it->base.widget);
339 EINA_LIST_FOREACH(navi_it->content_list, l, pair)
341 if (!strcmp(part, pair->part))
343 content = pair->content;
344 eina_stringshare_del(pair->part);
345 navi_it->content_list = eina_list_remove(navi_it->content_list,
352 if (!content) return NULL;
354 elm_widget_sub_object_del(navi_it->base.widget, content);
355 edje_object_part_unswallow(navi_it->base.view, content);
356 snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
357 edje_object_signal_emit(navi_it->base.view, buf, "elm");
358 evas_object_event_callback_del(content,
361 _item_sizing_eval(navi_it);
367 _item_signal_emit_hook(Elm_Object_Item *it,
368 const char *emission,
371 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
372 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
373 edje_object_signal_emit(navi_it->base.view, emission, source);
377 _sizing_eval(Evas_Object *obj)
380 Elm_Naviframe_Item *it;
381 wd = elm_widget_data_get(obj);
384 EINA_INLIST_FOREACH(wd->stack, it)
385 _item_sizing_eval(it);
389 _item_sizing_eval(Elm_Naviframe_Item *it)
392 Evas_Coord x, y, w, h;
395 wd = elm_widget_data_get(it->base.widget);
398 evas_object_geometry_get(it->base.widget, &x, &y, &w, &h);
399 evas_object_move(it->base.view, x, y);
400 evas_object_resize(it->base.view, w, h);
404 _move(void *data __UNUSED__,
407 void *event_info __UNUSED__)
410 Widget_Data *wd = elm_widget_data_get(obj);
413 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
414 evas_object_move(wd->rect, x, y);
420 _resize(void *data __UNUSED__,
423 void *event_info __UNUSED__)
426 Widget_Data *wd = elm_widget_data_get(obj);
429 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
430 evas_object_resize(wd->rect, w, h);
436 _hide(void *data __UNUSED__,
439 void *event_info __UNUSED__)
441 Widget_Data *wd = elm_widget_data_get(obj);
443 if (wd->freeze_events)
444 evas_object_hide(wd->rect);
448 _title_clicked(void *data,
449 Evas_Object *obj __UNUSED__,
450 const char *emission __UNUSED__,
451 const char *source __UNUSED__)
453 Elm_Naviframe_Item *it = data;
454 evas_object_smart_callback_call(it->base.widget, SIG_TITLE_CLICKED, it);
458 _back_btn_clicked(void *data,
459 Evas_Object *obj __UNUSED__,
460 void *event_info __UNUSED__)
462 elm_naviframe_item_pop(data);
466 _back_btn_new(Evas_Object *obj)
470 btn = elm_button_add(obj);
471 if (!btn) return NULL;
472 evas_object_smart_callback_add(btn, "clicked", _back_btn_clicked, obj);
473 snprintf(buf, sizeof(buf), "naviframe/back_btn/%s", elm_widget_style_get(obj));
474 elm_object_style_set(btn, buf);
479 _title_content_del(void *data,
481 Evas_Object *obj __UNUSED__,
482 void *event_info __UNUSED__)
485 Elm_Naviframe_Content_Item_Pair *pair = data;
486 Elm_Naviframe_Item *it = pair->it;
487 snprintf(buf, sizeof(buf), "elm,state,%s,hide", pair->part);
488 edje_object_signal_emit(it->base.view, buf, "elm");
489 it->content_list = eina_list_remove(it->content_list, pair);
490 eina_stringshare_del(pair->part);
495 _title_prev_btn_del(void *data,
497 Evas_Object *obj __UNUSED__,
498 void *event_info __UNUSED__)
500 Elm_Naviframe_Item *it = data;
501 it->back_btn = EINA_FALSE;
502 it->title_prev_btn = NULL;
503 edje_object_signal_emit(it->base.view, "elm,state,prev_btn,hide", "elm");
507 _title_next_btn_del(void *data,
509 Evas_Object *obj __UNUSED__,
510 void *event_info __UNUSED__)
512 Elm_Naviframe_Item *it = data;
513 it->title_next_btn = NULL;
514 edje_object_signal_emit(it->base.view, "elm,state,next_btn,hide", "elm");
518 _item_content_del(void *data,
520 Evas_Object *obj __UNUSED__,
521 void *event_info __UNUSED__)
523 Elm_Naviframe_Item *it = data;
525 edje_object_signal_emit(it->base.view, "elm,state,content,hide", "elm");
529 _title_content_set(Elm_Naviframe_Item *it,
530 Elm_Naviframe_Content_Item_Pair *pair,
532 Evas_Object *content)
537 EINA_LIST_FOREACH(it->content_list, l, pair)
538 if (!strcmp(part, pair->part)) break;
542 pair = ELM_NEW(Elm_Naviframe_Content_Item_Pair);
545 ERR("Failed to allocate new content part of the item! : naviframe=%p", it->base.widget);
549 eina_stringshare_replace(&pair->part, part);
550 it->content_list = eina_list_append(it->content_list, pair);
553 if ((pair->content) && (pair->content != content))
554 evas_object_del(pair->content);
558 snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
559 edje_object_signal_emit(it->base.view, buf, "elm");
560 pair->content = NULL;
564 if (pair->content != content)
566 elm_widget_sub_object_add(it->base.widget, content);
567 evas_object_event_callback_add(content,
573 pair->content = content;
575 edje_object_part_swallow(it->base.view, part, content);
576 snprintf(buf, sizeof(buf), "elm,state,%s,show", part);
577 edje_object_signal_emit(it->base.view, buf, "elm");
578 _item_sizing_eval(it);
582 _title_prev_btn_set(Elm_Naviframe_Item *it,
586 if (it->title_prev_btn == btn) return;
588 if (it->title_prev_btn)
589 evas_object_del(it->title_prev_btn);
591 it->title_prev_btn = btn;
595 edje_object_signal_emit(it->base.view,
596 "elm,state,prev_btn,hide",
601 elm_widget_sub_object_add(it->base.widget, btn);
602 evas_object_event_callback_add(btn,
606 edje_object_part_swallow(it->base.view, "elm.swallow.prev_btn", btn);
607 edje_object_signal_emit(it->base.view, "elm,state,prev_btn,show", "elm");
608 it->back_btn = back_btn;
610 _item_sizing_eval(it);
614 _title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn)
616 if (it->title_next_btn == btn) return;
618 if (it->title_next_btn)
619 evas_object_del(it->title_next_btn);
621 it->title_next_btn = btn;
625 edje_object_signal_emit(it->base.view,
626 "elm,state,next_btn,hide",
631 elm_widget_sub_object_add(it->base.widget, btn);
632 evas_object_event_callback_add(btn,
636 edje_object_part_swallow(it->base.view, "elm.swallow.next_btn", btn);
637 edje_object_signal_emit(it->base.view, "elm,state,next_btn,show", "elm");
639 _item_sizing_eval(it);
643 _item_del(Elm_Naviframe_Item *it)
647 Elm_Naviframe_Content_Item_Pair *content_pair;
648 Elm_Naviframe_Text_Item_Pair *text_pair;
652 wd = elm_widget_data_get(it->base.widget);
655 if (it->title_prev_btn)
656 evas_object_del(it->title_prev_btn);
657 if (it->title_next_btn)
658 evas_object_del(it->title_next_btn);
659 if ((it->content) && (!wd->preserve))
660 evas_object_del(it->content);
662 EINA_LIST_FOREACH(it->content_list, l, content_pair)
664 evas_object_event_callback_del(content_pair->content, EVAS_CALLBACK_DEL, _title_content_del);
665 evas_object_del(content_pair->content);
666 eina_stringshare_del(content_pair->part);
670 EINA_LIST_FOREACH(it->text_list, l, text_pair)
672 eina_stringshare_del(text_pair->part);
673 eina_stringshare_del(text_pair->text);
677 eina_list_free(it->content_list);
678 eina_list_free(it->text_list);
680 wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(it));
682 elm_widget_item_del(it);
686 _pushed_finished(void *data,
687 Evas_Object *obj __UNUSED__,
688 const char *emission __UNUSED__,
689 const char *source __UNUSED__)
691 Elm_Naviframe_Item *it = data;
693 evas_object_hide(it->base.view);
697 _popped_finished(void *data,
698 Evas_Object *obj __UNUSED__,
699 const char *emission __UNUSED__,
700 const char *source __UNUSED__)
706 _show_finished(void *data,
707 Evas_Object *obj __UNUSED__,
708 const char *emission __UNUSED__,
709 const char *source __UNUSED__)
711 Elm_Naviframe_Item *it;
716 wd = elm_widget_data_get(it->base.widget);
719 evas_object_smart_callback_call(it->base.widget,
720 SIG_TRANSITION_FINISHED,
722 if (wd->freeze_events)
723 evas_object_hide(wd->rect);
727 _item_content_set(Elm_Naviframe_Item *navi_it, Evas_Object *content)
729 if (navi_it->content == content) return;
730 if (navi_it->content) evas_object_del(navi_it->content);
731 elm_widget_sub_object_add(navi_it->base.widget, content);
732 edje_object_part_swallow(navi_it->base.view,
733 "elm.swallow.content",
736 edje_object_signal_emit(navi_it->base.view,
737 "elm,state,content,show",
740 edje_object_signal_emit(navi_it->base.view,
741 "elm,state,content,hide",
743 evas_object_event_callback_add(content,
747 navi_it->content = content;
748 _item_sizing_eval(navi_it);
752 elm_naviframe_add(Evas_Object *parent)
758 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
759 ELM_SET_WIDTYPE(widtype, "naviframe");
760 elm_widget_type_set(obj, "naviframe");
761 elm_widget_sub_object_add(parent, obj);
762 elm_widget_data_set(obj, wd);
763 elm_widget_del_hook_set(obj, _del_hook);
764 elm_widget_disable_hook_set(obj, _disable_hook);
765 elm_widget_theme_hook_set(obj, _theme_hook);
766 elm_widget_signal_emit_hook_set(obj, _emit_hook);
769 wd->base = edje_object_add(e);
770 edje_object_mirrored_set(wd->base, elm_widget_mirrored_get(obj));
771 elm_widget_resize_object_set(obj, wd->base);
772 _elm_theme_object_set(obj, wd->base, "naviframe", "base", "default");
775 wd->rect = evas_object_rectangle_add(e);
776 evas_object_color_set(wd->rect, 0, 0, 0, 0);
777 elm_widget_sub_object_add(obj, wd->rect);
779 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, obj);
780 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
781 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, obj);
782 evas_object_smart_callbacks_descriptions_set(obj, _signals);
784 wd->auto_pushed = EINA_TRUE;
785 wd->freeze_events = EINA_TRUE;
790 EAPI Elm_Object_Item *
791 elm_naviframe_item_push(Evas_Object *obj,
792 const char *title_label,
793 Evas_Object *prev_btn,
794 Evas_Object *next_btn,
795 Evas_Object *content,
796 const char *item_style)
798 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
800 Elm_Naviframe_Item *prev_it, *it;
802 wd = elm_widget_data_get(obj);
803 if (!wd) return NULL;
806 it = elm_widget_item_new(obj, Elm_Naviframe_Item);
809 ERR("Failed to allocate new item! : naviframe=%p", obj);
813 elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
814 elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
815 elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
816 elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
817 elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook);
818 elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook);
821 it->base.view = edje_object_add(evas_object_evas_get(obj));
822 edje_object_mirrored_set(it->base.view, elm_widget_mirrored_get(obj));
823 evas_object_smart_member_add(it->base.view, wd->base);
824 elm_widget_sub_object_add(obj, it->base.view);
825 edje_object_signal_callback_add(it->base.view,
826 "elm,action,show,finished",
829 edje_object_signal_callback_add(it->base.view,
830 "elm,action,pushed,finished",
832 _pushed_finished, it);
833 edje_object_signal_callback_add(it->base.view,
834 "elm,action,popped,finished",
836 _popped_finished, it);
837 edje_object_signal_callback_add(it->base.view,
838 "elm,action,title,clicked",
842 elm_naviframe_item_style_set(ELM_CAST(it), item_style);
844 _item_text_set_hook(ELM_CAST(it), "elm.text.title", title_label);
847 if ((!prev_btn) && wd->auto_pushed && eina_inlist_count(wd->stack))
849 prev_btn = _back_btn_new(obj);
850 _title_prev_btn_set(it, prev_btn, EINA_TRUE);
853 _title_prev_btn_set(it, prev_btn, EINA_FALSE);
855 _title_next_btn_set(it, next_btn);
857 _item_content_set(it, content);
859 _item_sizing_eval(it);
860 evas_object_show(it->base.view);
862 prev_it = ELM_CAST(elm_naviframe_top_item_get(obj));
865 if (wd->freeze_events)
866 evas_object_show(wd->rect);
867 edje_object_signal_emit(prev_it->base.view,
868 "elm,state,cur,pushed",
870 edje_object_signal_emit(it->base.view,
871 "elm,state,new,pushed",
874 it->title_visible = EINA_TRUE;
875 wd->stack = eina_inlist_append(wd->stack, EINA_INLIST_GET(it));
880 elm_naviframe_item_pop(Evas_Object *obj)
882 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
883 Elm_Naviframe_Item *it, *prev_it;
885 Evas_Object *content = NULL;
887 wd = elm_widget_data_get(obj);
888 if (!wd) return NULL;
890 it = ELM_CAST(elm_naviframe_top_item_get(obj));
891 if (!it) return NULL;
893 content = it->content;
895 prev_it = EINA_INLIST_CONTAINER_GET(wd->stack->last->prev,
899 if (wd->freeze_events)
900 evas_object_show(wd->rect);
901 edje_object_signal_emit(it->base.view, "elm,state,cur,popped", "elm");
902 evas_object_show(prev_it->base.view);
903 evas_object_raise(prev_it->base.view);
904 edje_object_signal_emit(prev_it->base.view,
905 "elm,state,prev,popped",
915 elm_naviframe_item_pop_to(Elm_Object_Item *it)
917 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
918 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
919 Widget_Data *wd = elm_widget_data_get(navi_it->base.widget);
920 Eina_Inlist *l, *prev_l;
922 if (it == elm_naviframe_top_item_get(navi_it->base.widget)) return;
924 l = wd->stack->last->prev;
928 if (ELM_CAST(EINA_INLIST_CONTAINER_GET(l, Elm_Naviframe_Item)) == it)
931 _item_del(EINA_INLIST_CONTAINER_GET(l, Elm_Naviframe_Item));
934 elm_naviframe_item_pop(navi_it->base.widget);
938 elm_naviframe_item_del(Elm_Object_Item *it)
940 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
941 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
942 Widget_Data *wd = elm_widget_data_get(navi_it->base.widget);
943 if (it == elm_naviframe_top_item_get(navi_it->base.widget))
946 navi_it = ELM_CAST(EINA_INLIST_CONTAINER_GET(wd->stack->last, Elm_Naviframe_Item));
947 evas_object_show(navi_it->base.view);
948 evas_object_raise(navi_it->base.view);
949 edje_object_signal_emit(navi_it->base.view, "elm,state,visible", "elm");
956 elm_naviframe_content_preserve_on_pop_set(Evas_Object *obj, Eina_Bool preserve)
958 ELM_CHECK_WIDTYPE(obj, widtype);
959 Widget_Data *wd = elm_widget_data_get(obj);
961 wd->preserve = !!preserve;
965 elm_naviframe_content_preserve_on_pop_get(const Evas_Object *obj)
967 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
968 Widget_Data *wd = elm_widget_data_get(obj);
969 if (!wd) return EINA_FALSE;
973 EAPI Elm_Object_Item*
974 elm_naviframe_top_item_get(const Evas_Object *obj)
976 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
977 Widget_Data *wd = elm_widget_data_get(obj);
978 if ((!wd) || (!wd->stack)) return NULL;
979 return ELM_CAST(EINA_INLIST_CONTAINER_GET(wd->stack->last,
980 Elm_Naviframe_Item));
983 EAPI Elm_Object_Item*
984 elm_naviframe_bottom_item_get(const Evas_Object *obj)
986 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
987 Widget_Data *wd = elm_widget_data_get(obj);
988 if ((!wd) || (!wd->stack)) return NULL;
989 return ELM_CAST(EINA_INLIST_CONTAINER_GET(wd->stack,
990 Elm_Naviframe_Item));
994 elm_naviframe_item_style_set(Elm_Object_Item *it, const char *item_style)
996 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
997 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
999 Elm_Naviframe_Content_Item_Pair *content_pair;
1000 Elm_Naviframe_Text_Item_Pair *text_pair;
1005 if (!item_style) sprintf(buf, "item/basic");
1008 if (strlen(item_style) > sizeof(buf))
1009 WRN("too much long style name! : naviframe=%p", navi_it->base.widget);
1010 sprintf(buf, "item/%s", item_style);
1012 _elm_theme_object_set(navi_it->base.widget,
1016 elm_widget_style_get(navi_it->base.widget));
1018 EINA_LIST_FOREACH(navi_it->text_list, l, text_pair)
1019 _item_text_set_hook(it, text_pair->part, text_pair->text);
1021 EINA_LIST_FOREACH(navi_it->content_list, l, content_pair)
1022 _item_content_set_hook(it, content_pair->part, content_pair->content);
1025 if (navi_it->content)
1027 edje_object_part_swallow(navi_it->base.view,
1028 "elm.swallow.content",
1030 edje_object_signal_emit(navi_it->base.view,
1031 "elm,state,content,show",
1036 if (navi_it->title_prev_btn)
1037 edje_object_part_swallow(navi_it->base.view,
1038 "elm.swallow.prev_btn",
1039 navi_it->title_prev_btn);
1042 if (navi_it->title_next_btn)
1043 edje_object_part_swallow(navi_it->base.view,
1044 "elm.swallow.next_btn",
1045 navi_it->title_next_btn);
1047 navi_it->title_visible = EINA_TRUE;
1048 _item_sizing_eval(navi_it);
1050 wd = elm_widget_data_get(navi_it->base.widget);
1051 if (wd && wd->freeze_events)
1052 evas_object_hide(wd->rect);
1056 elm_naviframe_item_style_get(const Elm_Object_Item *it)
1058 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1059 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
1060 return navi_it->style;
1064 elm_naviframe_item_title_visible_set(Elm_Object_Item *it, Eina_Bool visible)
1066 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1067 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
1069 visible = !!visible;
1070 if (navi_it->title_visible == visible) return;
1073 edje_object_signal_emit(navi_it->base.view, "elm,state,title,show", "elm");
1075 edje_object_signal_emit(navi_it->base.view, "elm,state,title,hide", "elm");
1077 navi_it->title_visible = visible;
1081 elm_naviframe_item_title_visible_get(const Elm_Object_Item *it)
1083 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
1084 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
1085 return navi_it->title_visible;
1089 elm_naviframe_prev_btn_auto_pushed_set(Evas_Object *obj, Eina_Bool auto_pushed)
1091 ELM_CHECK_WIDTYPE(obj, widtype);
1092 Widget_Data *wd = elm_widget_data_get(obj);
1094 wd->auto_pushed = !!auto_pushed;
1098 elm_naviframe_prev_btn_auto_pushed_get(const Evas_Object *obj)
1100 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1101 Widget_Data *wd = elm_widget_data_get(obj);
1102 if (!wd) return EINA_FALSE;
1103 return wd->auto_pushed;