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
35 Eina_List *content_list;
38 Evas_Object *title_prev_btn;
39 Evas_Object *title_next_btn;
41 Eina_Bool back_btn: 1;
42 Eina_Bool title_visible: 1;
45 static const char *widtype = NULL;
47 static const char SIG_TRANSITION_FINISHED[] = "transition,finished";
48 static const char SIG_TITLE_CLICKED[] = "title,clicked";
50 static const Evas_Smart_Cb_Description _signals[] = {
51 {SIG_TRANSITION_FINISHED, ""},
52 {SIG_TITLE_CLICKED, ""},
56 static void _del_hook(Evas_Object *obj);
57 static void _theme_hook(Evas_Object *obj);
58 static void _emit_hook(Evas_Object *obj,
61 static void _disable_hook(Evas_Object *obj);
62 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
63 static void _item_text_set_hook(Elm_Object_Item *it,
66 static const char *_item_text_get_hook(const Elm_Object_Item *it,
68 static void _item_content_set_hook(Elm_Object_Item *it,
70 Evas_Object *content);
71 static Evas_Object *_item_content_get_hook(const Elm_Object_Item *it,
73 static Evas_Object *_item_content_unset_hook(Elm_Object_Item *it,
75 static void _item_signal_emit_hook(Elm_Object_Item *it,
78 static void _sizing_eval(Evas_Object *obj);
79 static void _item_sizing_eval(Elm_Naviframe_Item *it);
80 static void _move(void *data, Evas *e, Evas_Object *obj, void *event_info);
81 static void _resize(void *data,
85 static void _hide(void *data, Evas *e, Evas_Object *obj, void *event_info);
86 static void _title_clicked(void *data, Evas_Object *obj,
89 static void _back_btn_clicked(void *data,
92 static Evas_Object *_back_btn_new(Evas_Object *obj);
93 static void _item_content_del(void *data,
97 static void _title_content_del(void *data,
101 static void _title_prev_btn_del(void *data,
105 static void _title_next_btn_del(void *data,
109 static void _title_content_set(Elm_Naviframe_Item *it,
110 Elm_Naviframe_Content_Item_Pair *pair,
112 Evas_Object *content);
113 static void _title_prev_btn_set(Elm_Naviframe_Item *it,
116 static void _title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn);
117 static void _item_del(Elm_Naviframe_Item *it);
118 static void _pushed_finished(void *data,
120 const char *emission,
122 static void _popped_finished(void *data,
124 const char *emission,
126 static void _show_finished(void *data,
128 const char *emission,
130 static void _item_content_set(Elm_Naviframe_Item *navi_it,
131 Evas_Object *content);
134 _del_hook(Evas_Object *obj)
138 Elm_Naviframe_Item *it;
140 wd = elm_widget_data_get(obj);
143 EINA_LIST_REVERSE_FOREACH(wd->stack, list, it)
145 eina_list_free(wd->stack);
150 _theme_hook(Evas_Object *obj)
153 _elm_widget_mirrored_reload(obj);
154 _mirrored_set(obj, elm_widget_mirrored_get(obj));
157 static void _emit_hook(Evas_Object *obj,
158 const char *emission,
161 ELM_CHECK_WIDTYPE(obj, widtype);
163 Widget_Data *wd = elm_widget_data_get(obj);
166 edje_object_signal_emit(wd->base, emission, source);
170 _disable_hook(Evas_Object *obj __UNUSED__)
176 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
180 Elm_Naviframe_Item *it;
182 wd = elm_widget_data_get(obj);
185 EINA_LIST_FOREACH(wd->stack, l, it)
186 edje_object_mirrored_set(it->base.view, rtl);
187 edje_object_mirrored_set(wd->base, rtl);
191 _item_text_set_hook(Elm_Object_Item *it,
195 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
198 Elm_Naviframe_Text_Item_Pair *pair = NULL;
199 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
203 snprintf(buf, sizeof(buf), "elm.text.title");
205 snprintf(buf, sizeof(buf), "%s", part);
207 EINA_LIST_FOREACH(navi_it->text_list, l, pair)
208 if (!strcmp(buf, pair->part)) break;
212 pair = ELM_NEW(Elm_Naviframe_Text_Item_Pair);
215 ERR("Failed to allocate new text part of the item! : naviframe=%p",
216 navi_it->base.widget);
219 eina_stringshare_replace(&pair->part, buf);
220 navi_it->text_list = eina_list_append(navi_it->text_list, pair);
223 eina_stringshare_replace(&pair->text, label);
224 edje_object_part_text_set(navi_it->base.view, buf, label);
228 snprintf(buf, sizeof(buf), "elm,state,%s,show", buf);
229 edje_object_signal_emit(navi_it->base.view, buf, "elm");
233 snprintf(buf, sizeof(buf), "elm,state,%s,hide", buf);
234 edje_object_signal_emit(navi_it->base.view, buf, "elm");
237 _item_sizing_eval(navi_it);
241 _item_text_get_hook(const Elm_Object_Item *it, const char *part)
243 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
245 Elm_Naviframe_Text_Item_Pair *pair = NULL;
246 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
250 snprintf(buf, sizeof(buf), "elm.text.title");
252 snprintf(buf, sizeof(buf), "%s", part);
254 EINA_LIST_FOREACH(navi_it->text_list, l, pair)
256 if (!strcmp(buf, pair->part))
263 _item_content_set_hook(Elm_Object_Item *it,
265 Evas_Object *content)
267 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
269 Elm_Naviframe_Content_Item_Pair *pair = NULL;
270 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
273 if ((!part) || (!strcmp(part, "elm.swallow.content")))
275 _item_content_set(navi_it, content);
278 else if (!strcmp(part, "elm.swallow.prev_btn"))
280 _title_prev_btn_set(navi_it, content, EINA_FALSE);
283 else if(!strcmp(part, "elm.swallow.next_btn"))
285 _title_next_btn_set(navi_it, content);
290 _title_content_set(navi_it, pair, part, content);
294 _item_content_get_hook(const Elm_Object_Item *it, const char *part)
296 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
298 Elm_Naviframe_Content_Item_Pair *pair = NULL;
299 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
302 if ((!part) || (!strcmp(part, "elm.swallow.content")))
303 return navi_it->content;
304 else if (!strcmp(part, "elm.swallow.prev_btn"))
305 return navi_it->title_prev_btn;
306 else if(!strcmp(part, "elm.swallow.next_btn"))
307 return navi_it->title_next_btn;
310 EINA_LIST_FOREACH(navi_it->content_list, l, pair)
312 if (!strcmp(part, pair->part))
313 return pair->content;
319 _item_content_unset_hook(Elm_Object_Item *it, const char *part)
321 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
323 Elm_Naviframe_Content_Item_Pair *pair = NULL;
324 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
325 Evas_Object *content = NULL;
329 //FIXME: could be unset the below specified contents also.
331 !strcmp(part, "elm.swallow.content") ||
332 !strcmp(part, "elm.swallow.prev_btn") ||
333 !strcmp(part, "elm.swallow.next_btn"))
335 WRN("You can not unset the content! : naviframe=%p",
336 navi_it->base.widget);
341 EINA_LIST_FOREACH(navi_it->content_list, l, pair)
343 if (!strcmp(part, pair->part))
345 content = pair->content;
346 eina_stringshare_del(pair->part);
347 navi_it->content_list = eina_list_remove(navi_it->content_list,
354 if (!content) return NULL;
356 elm_widget_sub_object_del(navi_it->base.widget, content);
357 edje_object_part_unswallow(navi_it->base.view, content);
358 snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
359 edje_object_signal_emit(navi_it->base.view, buf, "elm");
360 evas_object_event_callback_del(content,
363 _item_sizing_eval(navi_it);
369 _item_signal_emit_hook(Elm_Object_Item *it,
370 const char *emission,
373 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
374 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
375 edje_object_signal_emit(navi_it->base.view, emission, source);
379 _sizing_eval(Evas_Object *obj)
383 Elm_Naviframe_Item *it;
384 wd = elm_widget_data_get(obj);
387 list = eina_list_last(wd->stack);
390 EINA_LIST_FOREACH(wd->stack, list, it)
391 _item_sizing_eval(it);
395 _item_sizing_eval(Elm_Naviframe_Item *it)
398 Evas_Coord x, y, w, h;
401 wd = elm_widget_data_get(it->base.widget);
404 evas_object_geometry_get(it->base.widget, &x, &y, &w, &h);
405 evas_object_move(it->base.view, x, y);
406 evas_object_resize(it->base.view, w, h);
410 _move(void *data __UNUSED__,
413 void *event_info __UNUSED__)
416 Widget_Data *wd = elm_widget_data_get(obj);
419 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
420 evas_object_move(wd->rect, x, y);
426 _resize(void *data __UNUSED__,
429 void *event_info __UNUSED__)
432 Widget_Data *wd = elm_widget_data_get(obj);
435 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
436 evas_object_resize(wd->rect, w, h);
442 _hide(void *data __UNUSED__,
445 void *event_info __UNUSED__)
447 Widget_Data *wd = elm_widget_data_get(obj);
449 if (wd->freeze_events)
450 evas_object_hide(wd->rect);
454 _title_clicked(void *data,
455 Evas_Object *obj __UNUSED__,
456 const char *emission __UNUSED__,
457 const char *source __UNUSED__)
459 Elm_Naviframe_Item *it = data;
460 evas_object_smart_callback_call(it->base.widget, SIG_TITLE_CLICKED, it);
464 _back_btn_clicked(void *data,
465 Evas_Object *obj __UNUSED__,
466 void *event_info __UNUSED__)
468 elm_naviframe_item_pop(data);
472 _back_btn_new(Evas_Object *obj)
476 btn = elm_button_add(obj);
477 if (!btn) return NULL;
478 evas_object_smart_callback_add(btn, "clicked", _back_btn_clicked, obj);
479 snprintf(buf, sizeof(buf), "naviframe/back_btn/%s", elm_widget_style_get(obj));
480 elm_object_style_set(btn, buf);
485 _title_content_del(void *data,
487 Evas_Object *obj __UNUSED__,
488 void *event_info __UNUSED__)
491 Elm_Naviframe_Content_Item_Pair *pair = data;
492 Elm_Naviframe_Item *it = pair->it;
493 snprintf(buf, sizeof(buf), "elm,state,%s,hide", pair->part);
494 edje_object_signal_emit(it->base.view, buf, "elm");
495 it->content_list = eina_list_remove(it->content_list, pair);
496 eina_stringshare_del(pair->part);
501 _title_prev_btn_del(void *data,
503 Evas_Object *obj __UNUSED__,
504 void *event_info __UNUSED__)
506 Elm_Naviframe_Item *it = data;
507 it->back_btn = EINA_FALSE;
508 it->title_prev_btn = NULL;
509 edje_object_signal_emit(it->base.view, "elm,state,prev_btn,hide", "elm");
513 _title_next_btn_del(void *data,
515 Evas_Object *obj __UNUSED__,
516 void *event_info __UNUSED__)
518 Elm_Naviframe_Item *it = data;
519 it->title_next_btn = NULL;
520 edje_object_signal_emit(it->base.view, "elm,state,next_btn,hide", "elm");
524 _item_content_del(void *data,
526 Evas_Object *obj __UNUSED__,
527 void *event_info __UNUSED__)
529 Elm_Naviframe_Item *it = data;
531 edje_object_signal_emit(it->base.view, "elm,state,content,hide", "elm");
535 _title_content_set(Elm_Naviframe_Item *it,
536 Elm_Naviframe_Content_Item_Pair *pair,
538 Evas_Object *content)
543 EINA_LIST_FOREACH(it->content_list, l, pair)
544 if (!strcmp(part, pair->part)) break;
548 pair = ELM_NEW(Elm_Naviframe_Content_Item_Pair);
551 ERR("Failed to allocate new content part of the item! : naviframe=%p", it->base.widget);
555 eina_stringshare_replace(&pair->part, part);
556 it->content_list = eina_list_append(it->content_list, pair);
559 if ((pair->content) && (pair->content != content))
560 evas_object_del(pair->content);
564 snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
565 edje_object_signal_emit(it->base.view, buf, "elm");
566 pair->content = NULL;
570 if (pair->content != content)
572 elm_widget_sub_object_add(it->base.widget, content);
573 evas_object_event_callback_add(content,
579 pair->content = content;
581 edje_object_part_swallow(it->base.view, part, content);
582 snprintf(buf, sizeof(buf), "elm,state,%s,show", part);
583 edje_object_signal_emit(it->base.view, buf, "elm");
584 _item_sizing_eval(it);
588 _title_prev_btn_set(Elm_Naviframe_Item *it,
592 if (it->title_prev_btn == btn) return;
594 if (it->title_prev_btn)
595 evas_object_del(it->title_prev_btn);
597 it->title_prev_btn = btn;
601 edje_object_signal_emit(it->base.view,
602 "elm,state,prev_btn,hide",
607 elm_widget_sub_object_add(it->base.widget, btn);
608 evas_object_event_callback_add(btn,
612 edje_object_part_swallow(it->base.view, "elm.swallow.prev_btn", btn);
613 edje_object_signal_emit(it->base.view, "elm,state,prev_btn,show", "elm");
614 it->back_btn = back_btn;
616 _item_sizing_eval(it);
620 _title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn)
622 if (it->title_next_btn == btn) return;
624 if (it->title_next_btn)
625 evas_object_del(it->title_next_btn);
627 it->title_next_btn = btn;
631 edje_object_signal_emit(it->base.view,
632 "elm,state,next_btn,hide",
637 elm_widget_sub_object_add(it->base.widget, btn);
638 evas_object_event_callback_add(btn,
642 edje_object_part_swallow(it->base.view, "elm.swallow.next_btn", btn);
643 edje_object_signal_emit(it->base.view, "elm,state,next_btn,show", "elm");
645 _item_sizing_eval(it);
649 _item_del(Elm_Naviframe_Item *it)
653 Elm_Naviframe_Content_Item_Pair *content_pair;
654 Elm_Naviframe_Text_Item_Pair *text_pair;
658 wd = elm_widget_data_get(it->base.widget);
661 if (it->title_prev_btn)
662 evas_object_del(it->title_prev_btn);
663 if (it->title_next_btn)
664 evas_object_del(it->title_next_btn);
665 if ((it->content) && (!wd->preserve))
666 evas_object_del(it->content);
668 EINA_LIST_FOREACH(it->content_list, l, content_pair)
670 evas_object_event_callback_del(content_pair->content, EVAS_CALLBACK_DEL, _title_content_del);
671 evas_object_del(content_pair->content);
672 eina_stringshare_del(content_pair->part);
676 EINA_LIST_FOREACH(it->text_list, l, text_pair)
678 eina_stringshare_del(text_pair->part);
679 eina_stringshare_del(text_pair->text);
683 eina_list_free(it->content_list);
684 eina_list_free(it->text_list);
686 wd->stack = eina_list_remove(wd->stack, it);
688 elm_widget_item_del(it);
692 _pushed_finished(void *data,
693 Evas_Object *obj __UNUSED__,
694 const char *emission __UNUSED__,
695 const char *source __UNUSED__)
697 Elm_Naviframe_Item *it = data;
699 evas_object_hide(it->base.view);
703 _popped_finished(void *data,
704 Evas_Object *obj __UNUSED__,
705 const char *emission __UNUSED__,
706 const char *source __UNUSED__)
712 _show_finished(void *data,
713 Evas_Object *obj __UNUSED__,
714 const char *emission __UNUSED__,
715 const char *source __UNUSED__)
717 Elm_Naviframe_Item *it;
722 wd = elm_widget_data_get(it->base.widget);
725 evas_object_smart_callback_call(it->base.widget,
726 SIG_TRANSITION_FINISHED,
728 if (wd->freeze_events)
730 evas_object_hide(wd->rect);
732 evas_object_pass_events_set(wd->base, EINA_FALSE);
737 _item_content_set(Elm_Naviframe_Item *navi_it, Evas_Object *content)
739 if (navi_it->content == content) return;
740 if (navi_it->content) evas_object_del(navi_it->content);
741 elm_widget_sub_object_add(navi_it->base.widget, content);
742 edje_object_part_swallow(navi_it->base.view,
743 "elm.swallow.content",
746 edje_object_signal_emit(navi_it->base.view,
747 "elm,state,content,show",
750 edje_object_signal_emit(navi_it->base.view,
751 "elm,state,content,hide",
753 evas_object_event_callback_add(content,
757 navi_it->content = content;
758 _item_sizing_eval(navi_it);
762 elm_naviframe_add(Evas_Object *parent)
768 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
769 ELM_SET_WIDTYPE(widtype, "naviframe");
770 elm_widget_type_set(obj, "naviframe");
771 elm_widget_sub_object_add(parent, obj);
772 elm_widget_data_set(obj, wd);
773 elm_widget_del_hook_set(obj, _del_hook);
774 elm_widget_disable_hook_set(obj, _disable_hook);
775 elm_widget_theme_hook_set(obj, _theme_hook);
776 elm_widget_signal_emit_hook_set(obj, _emit_hook);
779 wd->base = edje_object_add(e);
780 edje_object_mirrored_set(wd->base, elm_widget_mirrored_get(obj));
781 elm_widget_resize_object_set(obj, wd->base);
782 _elm_theme_object_set(obj, wd->base, "naviframe", "base", "default");
785 wd->rect = evas_object_rectangle_add(e);
786 evas_object_color_set(wd->rect, 0, 0, 0, 0);
787 elm_widget_sub_object_add(obj, wd->rect);
789 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, obj);
790 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
791 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, obj);
792 evas_object_smart_callbacks_descriptions_set(obj, _signals);
794 wd->auto_pushed = EINA_TRUE;
795 wd->freeze_events = EINA_TRUE;
800 EAPI Elm_Object_Item *
801 elm_naviframe_item_push(Evas_Object *obj,
802 const char *title_label,
803 Evas_Object *prev_btn,
804 Evas_Object *next_btn,
805 Evas_Object *content,
806 const char *item_style)
808 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
810 Elm_Naviframe_Item *prev_it, *it;
812 wd = elm_widget_data_get(obj);
813 if (!wd) return NULL;
816 it = elm_widget_item_new(obj, Elm_Naviframe_Item);
819 ERR("Failed to allocate new item! : naviframe=%p", obj);
823 elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
824 elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
825 elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
826 elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
827 elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook);
828 elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook);
831 it->base.view = edje_object_add(evas_object_evas_get(obj));
832 edje_object_mirrored_set(it->base.view, elm_widget_mirrored_get(obj));
833 evas_object_smart_member_add(it->base.view, wd->base);
834 elm_widget_sub_object_add(obj, it->base.view);
835 edje_object_signal_callback_add(it->base.view,
836 "elm,action,show,finished",
839 edje_object_signal_callback_add(it->base.view,
840 "elm,action,pushed,finished",
842 _pushed_finished, it);
843 edje_object_signal_callback_add(it->base.view,
844 "elm,action,popped,finished",
846 _popped_finished, it);
847 edje_object_signal_callback_add(it->base.view,
848 "elm,action,title,clicked",
852 elm_naviframe_item_style_set(ELM_CAST(it), item_style);
854 _item_text_set_hook(ELM_CAST(it), "elm.text.title", title_label);
857 if ((!prev_btn) && wd->auto_pushed && eina_list_count(wd->stack))
859 prev_btn = _back_btn_new(obj);
860 _title_prev_btn_set(it, prev_btn, EINA_TRUE);
863 _title_prev_btn_set(it, prev_btn, EINA_FALSE);
865 _title_next_btn_set(it, next_btn);
867 _item_content_set(it, content);
869 _item_sizing_eval(it);
870 evas_object_show(it->base.view);
872 prev_it = ELM_CAST(elm_naviframe_top_item_get(obj));
875 if (wd->freeze_events)
877 evas_object_show(wd->rect);
879 evas_object_pass_events_set(wd->base, EINA_TRUE);
881 edje_object_signal_emit(prev_it->base.view,
882 "elm,state,cur,pushed",
884 edje_object_signal_emit(it->base.view,
885 "elm,state,new,pushed",
888 it->title_visible = EINA_TRUE;
889 wd->stack = eina_list_append(wd->stack, it);
894 elm_naviframe_item_pop(Evas_Object *obj)
896 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
897 Elm_Naviframe_Item *it, *prev_it;
899 Evas_Object *content = NULL;
901 wd = elm_widget_data_get(obj);
902 if (!wd) return NULL;
904 it = ELM_CAST(elm_naviframe_top_item_get(obj));
905 if (!it) return NULL;
906 wd->stack = eina_list_remove(wd->stack, it);
909 content = it->content;
911 prev_it = ELM_CAST(elm_naviframe_top_item_get(obj));
914 if (wd->freeze_events)
916 evas_object_show(wd->rect);
918 evas_object_pass_events_set(wd->base, EINA_TRUE);
920 edje_object_signal_emit(it->base.view, "elm,state,cur,popped", "elm");
921 evas_object_show(prev_it->base.view);
922 evas_object_raise(prev_it->base.view);
923 edje_object_signal_emit(prev_it->base.view,
924 "elm,state,prev,popped",
934 elm_naviframe_item_pop_to(Elm_Object_Item *it)
936 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
937 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
938 Widget_Data *wd = elm_widget_data_get(navi_it->base.widget);
939 Eina_List *l, *prev_l;
941 if (it == elm_naviframe_top_item_get(navi_it->base.widget)) return;
943 l = eina_list_last(wd->stack)->prev;
947 if (l->data == it) break;
952 elm_naviframe_item_pop(navi_it->base.widget);
956 elm_naviframe_item_del(Elm_Object_Item *it)
958 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
959 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
960 Widget_Data *wd = elm_widget_data_get(navi_it->base.widget);
961 if (it == elm_naviframe_top_item_get(navi_it->base.widget))
964 navi_it = ELM_CAST(eina_list_last(wd->stack)->data);
965 evas_object_show(navi_it->base.view);
966 evas_object_raise(navi_it->base.view);
967 edje_object_signal_emit(navi_it->base.view, "elm,state,visible", "elm");
974 elm_naviframe_content_preserve_on_pop_set(Evas_Object *obj, Eina_Bool preserve)
976 ELM_CHECK_WIDTYPE(obj, widtype);
977 Widget_Data *wd = elm_widget_data_get(obj);
979 wd->preserve = !!preserve;
983 elm_naviframe_content_preserve_on_pop_get(const Evas_Object *obj)
985 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
986 Widget_Data *wd = elm_widget_data_get(obj);
987 if (!wd) return EINA_FALSE;
991 EAPI Elm_Object_Item*
992 elm_naviframe_top_item_get(const Evas_Object *obj)
994 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
995 Widget_Data *wd = elm_widget_data_get(obj);
996 if ((!wd) || (!wd->stack)) return NULL;
997 return eina_list_last(wd->stack)->data;
1000 EAPI Elm_Object_Item*
1001 elm_naviframe_bottom_item_get(const Evas_Object *obj)
1003 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1004 Widget_Data *wd = elm_widget_data_get(obj);
1005 if ((!wd) || (!wd->stack)) return NULL;
1006 return wd->stack->data;
1010 elm_naviframe_item_style_set(Elm_Object_Item *it, const char *item_style)
1012 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1013 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
1015 Elm_Naviframe_Content_Item_Pair *content_pair;
1016 Elm_Naviframe_Text_Item_Pair *text_pair;
1021 if (!item_style) sprintf(buf, "item/basic");
1024 if (strlen(item_style) > sizeof(buf))
1025 WRN("too much long style name! : naviframe=%p", navi_it->base.widget);
1026 sprintf(buf, "item/%s", item_style);
1028 _elm_theme_object_set(navi_it->base.widget,
1032 elm_widget_style_get(navi_it->base.widget));
1034 EINA_LIST_FOREACH(navi_it->text_list, l, text_pair)
1035 _item_text_set_hook(it, text_pair->part, text_pair->text);
1037 EINA_LIST_FOREACH(navi_it->content_list, l, content_pair)
1038 _item_content_set_hook(it, content_pair->part, content_pair->content);
1041 if (navi_it->content)
1043 edje_object_part_swallow(navi_it->base.view,
1044 "elm.swallow.content",
1046 edje_object_signal_emit(navi_it->base.view,
1047 "elm,state,content,show",
1052 if (navi_it->title_prev_btn)
1053 edje_object_part_swallow(navi_it->base.view,
1054 "elm.swallow.prev_btn",
1055 navi_it->title_prev_btn);
1058 if (navi_it->title_next_btn)
1059 edje_object_part_swallow(navi_it->base.view,
1060 "elm.swallow.next_btn",
1061 navi_it->title_next_btn);
1063 navi_it->title_visible = EINA_TRUE;
1064 _item_sizing_eval(navi_it);
1066 wd = elm_widget_data_get(navi_it->base.widget);
1067 if (wd && wd->freeze_events)
1069 evas_object_hide(wd->rect);
1071 evas_object_pass_events_set(wd->base, EINA_FALSE);
1076 elm_naviframe_item_style_get(const Elm_Object_Item *it)
1078 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
1079 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
1080 return navi_it->style;
1084 elm_naviframe_item_title_visible_set(Elm_Object_Item *it, Eina_Bool visible)
1086 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
1087 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
1089 visible = !!visible;
1090 if (navi_it->title_visible == visible) return;
1093 edje_object_signal_emit(navi_it->base.view, "elm,state,title,show", "elm");
1095 edje_object_signal_emit(navi_it->base.view, "elm,state,title,hide", "elm");
1097 navi_it->title_visible = visible;
1101 elm_naviframe_item_title_visible_get(const Elm_Object_Item *it)
1103 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
1104 Elm_Naviframe_Item *navi_it = ELM_CAST(it);
1105 return navi_it->title_visible;
1109 elm_naviframe_prev_btn_auto_pushed_set(Evas_Object *obj, Eina_Bool auto_pushed)
1111 ELM_CHECK_WIDTYPE(obj, widtype);
1112 Widget_Data *wd = elm_widget_data_get(obj);
1114 wd->auto_pushed = !!auto_pushed;
1118 elm_naviframe_prev_btn_auto_pushed_get(const Evas_Object *obj)
1120 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1121 Widget_Data *wd = elm_widget_data_get(obj);
1122 if (!wd) return EINA_FALSE;
1123 return wd->auto_pushed;