elementary/naviframe - is updating according to elm_object_item.
[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
7 struct _Widget_Data
8 {
9    Eina_List    *stack;
10    Evas_Object  *base;
11    Eina_Bool     preserve: 1;
12    Eina_Bool     pass_events: 1;
13 };
14
15 struct _Elm_Naviframe_Item
16 {
17    Elm_Widget_Item    base;
18    Evas_Object       *title;
19    Evas_Object       *content;
20    const char        *title_label;
21    const char        *title_sublabel;
22    Evas_Object       *title_prev_btn;
23    Evas_Object       *title_next_btn;
24    Evas_Object       *title_icon;
25    const char        *style;
26    Eina_Bool          back_btn: 1;
27    Eina_Bool          title_visible: 1;
28 };
29
30 static const char *widtype = NULL;
31
32 static const char SIG_TRANSITION_FINISHED[] = "transition,finished";
33 static const char SIG_TITLE_CLICKED[] = "title,clicked";
34
35 static const Evas_Smart_Cb_Description _signals[] = {
36        {SIG_TRANSITION_FINISHED, ""},
37        {SIG_TITLE_CLICKED, ""},
38        {NULL, NULL}
39 };
40
41 #define ELM_NAVIFRAME_ITEM_CHECK_RETURN(it, ...) \
42    ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *) it, __VA_ARGS__); \
43    ELM_CHECK_WIDTYPE(it->base.widget, widtype) __VA_ARGS__;
44
45 static void _del_hook(Evas_Object *obj);
46 static void _theme_hook(Evas_Object *obj);
47 static void _disable_hook(Evas_Object *obj);
48 static void _sizing_eval(Evas_Object *obj);
49 static void _item_sizing_eval(Elm_Naviframe_Item *it);
50 static void _move(void *data, Evas *e, Evas_Object *obj, void *event_info);
51 static void _resize(void *data,
52                     Evas *e,
53                     Evas_Object *obj,
54                     void *event_info);
55 static void _title_clicked(void *data, Evas_Object *obj,
56                            const char *emission,
57                            const char *source);
58 static void _back_btn_clicked(void *data,
59                               Evas_Object *obj,
60                               void *event_info);
61 static Evas_Object *_back_btn_new(Evas_Object *obj);
62 static void _title_prev_btn_del(void *data,
63                                 Evas *e,
64                                 Evas_Object *obj,
65                                 void *event_info);
66 static void _title_next_btn_del(void *data,
67                                 Evas *e,
68                                 Evas_Object *obj,
69                                 void *event_info);
70 static void _title_icon_del(void *data,
71                             Evas *e,
72                             Evas_Object *obj,
73                             void *event_info);
74 static void _content_del(void *data,
75                          Evas *e,
76                          Evas_Object *obj,
77                          void *event_info);
78 static void _title_prev_btn_set(Elm_Naviframe_Item *it,
79                                 Evas_Object *btn,
80                                 Eina_Bool back_btn);
81 static void _title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn);
82 static void _item_del(Elm_Naviframe_Item *it);
83 static void _pushed_finished(void *data,
84                              Evas_Object *obj,
85                              const char *emission,
86                              const char *source);
87 static void _popped_finished(void *data,
88                              Evas_Object *obj,
89                              const char *emission,
90                              const char *source);
91 static void _show_finished(void *data,
92                            Evas_Object *obj,
93                            const char *emission,
94                            const char *source);
95
96 static void
97 _del_hook(Evas_Object *obj)
98 {
99    Widget_Data *wd;
100    Eina_List *list;
101    Elm_Naviframe_Item *it;
102
103    wd = elm_widget_data_get(obj);
104    if (!wd) return;
105
106    EINA_LIST_FOREACH(wd->stack, list, it)
107      _item_del(it);
108    eina_list_free(wd->stack);
109    free(wd);
110 }
111
112 static void
113 _theme_hook(Evas_Object *obj __UNUSED__)
114 {
115    //FIXME:
116 }
117
118 static void
119 _disable_hook(Evas_Object *obj __UNUSED__)
120 {
121    //FIXME:
122 }
123
124 static void
125 _sizing_eval(Evas_Object *obj)
126 {
127    Widget_Data *wd;
128    Eina_List *list;
129    Elm_Naviframe_Item *it;
130    wd  = elm_widget_data_get(obj);
131    if (!wd) return;
132
133    list = eina_list_last(wd->stack);
134    if (!list) return;
135
136    EINA_LIST_FOREACH(wd->stack, list, it)
137      _item_sizing_eval(it);
138 }
139
140 static void
141 _item_sizing_eval(Elm_Naviframe_Item *it)
142 {
143    Widget_Data *wd;
144    Evas_Coord x, y, w, h;
145    if (!it) return;
146
147    wd = elm_widget_data_get(it->base.widget);
148    if (!wd) return;
149
150    evas_object_geometry_get(it->base.widget, &x, &y, &w, &h);
151    evas_object_move(it->base.view, x, y);
152    evas_object_resize(it->base.view, w, h);
153 }
154
155 static void
156 _move(void *data __UNUSED__,
157       Evas *e __UNUSED__,
158       Evas_Object *obj,
159       void *event_info __UNUSED__)
160 {
161    _sizing_eval(obj);
162 }
163
164 static void
165 _resize(void *data __UNUSED__,
166         Evas *e __UNUSED__,
167         Evas_Object *obj,
168         void *event_info __UNUSED__)
169 {
170    _sizing_eval(obj);
171 }
172
173 static void
174 _title_clicked(void *data,
175                Evas_Object *obj __UNUSED__,
176                const char *emission __UNUSED__,
177                const char *source __UNUSED__)
178 {
179    Elm_Naviframe_Item *it = data;
180    evas_object_smart_callback_call(it->base.widget, SIG_TITLE_CLICKED, it);
181 }
182
183 static void
184 _back_btn_clicked(void *data,
185                   Evas_Object *obj __UNUSED__,
186                   void *event_info __UNUSED__)
187 {
188    elm_naviframe_item_pop(data);
189 }
190
191 static Evas_Object *
192 _back_btn_new(Evas_Object *obj)
193 {
194    Evas_Object *btn;
195    char buf[256];   //FIXME: How to guarantee the size of style name?
196    btn = elm_button_add(obj);
197    if (!btn) return NULL;
198    evas_object_smart_callback_add(btn, "clicked", _back_btn_clicked, obj);
199    snprintf(buf, sizeof(buf), "naviframe/back_btn/%s", elm_widget_style_get(obj));
200    elm_object_style_set(btn, buf);
201    return btn;
202 }
203
204 static void
205 _title_prev_btn_del(void *data,
206                     Evas *e __UNUSED__,
207                     Evas_Object *obj __UNUSED__,
208                     void *event_info __UNUSED__)
209 {
210    Elm_Naviframe_Item *it = data;
211    it->back_btn = EINA_FALSE;
212    it->title_prev_btn = NULL;
213 }
214
215 static void
216 _title_next_btn_del(void *data,
217                     Evas *e __UNUSED__,
218                     Evas_Object *obj __UNUSED__,
219                     void *event_info __UNUSED__)
220 {
221    Elm_Naviframe_Item *it = data;
222    it->title_next_btn = NULL;
223 }
224
225 static void
226 _title_icon_del(void *data,
227                 Evas *e __UNUSED__,
228                 Evas_Object *obj __UNUSED__,
229                 void *event_info __UNUSED__)
230 {
231    Elm_Naviframe_Item *it = data;
232    it->title_icon = NULL;
233    edje_object_signal_emit(it->base.view, "elm,state,icon,hide", "elm");
234 }
235
236 static void
237 _content_del(void *data,
238              Evas *e __UNUSED__,
239              Evas_Object *obj __UNUSED__,
240              void *event_info __UNUSED__)
241 {
242    Elm_Naviframe_Item *it = data;
243    it->content = NULL;
244    edje_object_signal_emit(it->base.view, "elm,state,content,hide", "elm");
245 }
246
247 static void
248 _title_prev_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn, Eina_Bool back_btn)
249 {
250    char buf[256];   //FIXME: How to guarantee the size of style name?
251
252    if (it->title_prev_btn == btn) return;
253
254    if (it->title_prev_btn)
255      evas_object_del(it->title_prev_btn);
256
257    it->title_prev_btn = btn;
258
259    if (!btn) return;
260
261    if (!back_btn)
262      {
263         snprintf(buf,
264                  sizeof(buf),
265                  "naviframe/prev_btn/%s",
266                  elm_widget_style_get(it->base.widget));
267         elm_object_style_set(btn, buf);
268      }
269    elm_widget_sub_object_add(it->base.widget, btn);
270    evas_object_event_callback_add(btn,
271                                   EVAS_CALLBACK_DEL,
272                                   _title_prev_btn_del,
273                                   it);
274    edje_object_part_swallow(it->title, "elm.swallow.prev_btn", btn);
275    it->back_btn = back_btn;
276 }
277
278 static void
279 _title_next_btn_set(Elm_Naviframe_Item *it, Evas_Object *btn)
280 {
281    char buf[256];   //FIXME: How to guarantee the size of style name?
282
283    if (it->title_next_btn == btn) return;
284
285    if (it->title_next_btn)
286      evas_object_del(it->title_next_btn);
287
288    it->title_next_btn = btn;
289
290    if (!btn) return;
291
292    snprintf(buf,
293             sizeof(buf),
294             "naviframe/next_btn/%s",
295             elm_widget_style_get(it->base.widget));
296    elm_object_style_set(btn, buf);
297    elm_widget_sub_object_add(it->base.widget, btn);
298    evas_object_event_callback_add(btn,
299                                   EVAS_CALLBACK_DEL,
300                                   _title_next_btn_del,
301                                   it);
302    edje_object_part_swallow(it->title, "elm.swallow.next_btn", btn);
303 }
304
305 static void
306 _item_del(Elm_Naviframe_Item *it)
307 {
308    Widget_Data *wd;
309
310    if (!it) return;
311
312    wd = elm_widget_data_get(it->base.widget);
313    if (!wd) return;
314
315    if (it->title_prev_btn)
316      evas_object_del(it->title_prev_btn);
317    if (it->title_next_btn)
318      evas_object_del(it->title_next_btn);
319    if (it->title_icon)
320      evas_object_del(it->title_icon);
321    if ((it->content) && (!wd->preserve))
322      evas_object_del(it->content);
323
324    evas_object_del(it->title);
325    evas_object_del(it->base.view);
326
327    wd->stack = eina_list_remove(wd->stack, it);
328
329    free(it);
330 }
331
332 static void
333 _pushed_finished(void *data,
334                  Evas_Object *obj __UNUSED__,
335                  const char *emission __UNUSED__,
336                  const char *source __UNUSED__)
337 {
338    Elm_Naviframe_Item *it = data;
339    if (!it) return;
340    evas_object_hide(it->base.view);
341 }
342
343 static void
344 _popped_finished(void *data,
345                  Evas_Object *obj __UNUSED__,
346                  const char *emission __UNUSED__,
347                  const char *source __UNUSED__)
348 {
349    _item_del(data);
350 }
351
352 static void
353 _show_finished(void *data,
354                Evas_Object *obj __UNUSED__,
355                const char *emission __UNUSED__,
356                const char *source __UNUSED__)
357 {
358    Elm_Naviframe_Item *it;
359    Widget_Data *wd;
360
361    it = data;
362    if (!it) return;
363    wd =  elm_widget_data_get(it->base.widget);
364    if (!wd) return;
365
366    evas_object_smart_callback_call(it->base.widget,
367                                    SIG_TRANSITION_FINISHED,
368                                    (void *) EINA_TRUE);
369    if (wd->pass_events)
370      evas_object_pass_events_set(wd->base, EINA_FALSE);
371 }
372
373 EAPI Evas_Object *
374 elm_naviframe_add(Evas_Object *parent)
375 {
376    Evas_Object *obj;
377    Evas *e;
378    Widget_Data *wd;
379
380    ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
381    ELM_SET_WIDTYPE(widtype, "naviframe");
382    elm_widget_type_set(obj, "naviframe");
383    elm_widget_sub_object_add(parent, obj);
384    elm_widget_data_set(obj, wd);
385    elm_widget_del_hook_set(obj, _del_hook);
386    elm_widget_disable_hook_set(obj, _disable_hook);
387    elm_widget_theme_hook_set(obj, _theme_hook);
388
389    //base
390    wd->base = edje_object_add(e);
391    elm_widget_resize_object_set(obj, wd->base);
392    _elm_theme_object_set(obj, wd->base, "naviframe", "base", "default");
393
394    evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, obj);
395    evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
396    evas_object_smart_callbacks_descriptions_set(obj, _signals);
397
398    wd->pass_events = EINA_TRUE;
399
400    return obj;
401 }
402
403 EAPI Elm_Object_Item *
404 elm_naviframe_item_push(Evas_Object *obj, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style)
405 {
406    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
407    Widget_Data *wd;
408    Elm_Naviframe_Item *prev_it, *it;
409
410    wd = elm_widget_data_get(obj);
411    if (!wd) return NULL;
412
413    //create item
414    it = elm_widget_item_new(obj, Elm_Naviframe_Item);
415    if (!it)
416      {
417         ERR("Failed to allocate new item! : naviframe=%p", obj);
418         return NULL;
419      }
420    //item base layout
421    it->base.view = edje_object_add(evas_object_evas_get(obj));
422    evas_object_smart_member_add(it->base.view, wd->base);
423    elm_widget_sub_object_add(obj, it->base.view);
424    edje_object_signal_callback_add(it->base.view,
425                                    "elm,action,show,finished",
426                                    "",
427                                    _show_finished, it);
428    edje_object_signal_callback_add(it->base.view,
429                                    "elm,action,pushed,finished",
430                                    "",
431                                    _pushed_finished, it);
432    edje_object_signal_callback_add(it->base.view,
433                                    "elm,action,popped,finished",
434                                    "",
435                                    _popped_finished, it);
436    elm_naviframe_item_style_set(ELM_CAST(it), item_style);
437
438    //title
439    it->title = edje_object_add(evas_object_evas_get(obj));
440    elm_widget_sub_object_add(obj, it->title);
441    _elm_theme_object_set(obj,
442                          it->title, "naviframe",
443                          "title",
444                          elm_widget_style_get(obj));
445    edje_object_signal_callback_add(it->title,
446                                    "elm,action,clicked",
447                                    "elm",
448                                    _title_clicked, it);
449
450    elm_naviframe_item_title_label_set(ELM_CAST(it), title_label);
451
452    //title buttons
453    if ((!prev_btn) && (eina_list_count(wd->stack)))
454      {
455         prev_btn = _back_btn_new(obj);
456         _title_prev_btn_set(it, prev_btn, EINA_TRUE);
457      }
458    else
459      _title_prev_btn_set(it, prev_btn, EINA_FALSE);
460
461    _title_next_btn_set(it, next_btn);
462    edje_object_part_swallow(it->base.view, "elm.swallow.title", it->title);
463
464    elm_naviframe_item_content_set(ELM_CAST(it), content);
465
466    _item_sizing_eval(it);
467    evas_object_show(it->base.view);
468
469    prev_it = ELM_CAST(elm_naviframe_top_item_get(obj));
470    if (prev_it)
471      {
472         if (wd->pass_events)
473           evas_object_pass_events_set(wd->base, EINA_TRUE);
474         edje_object_signal_emit(prev_it->base.view,
475                                 "elm,state,pushed",
476                                 "elm");
477         edje_object_signal_emit(it->base.view,
478                                 "elm,state,show",
479                                 "elm");
480      }
481    else
482      edje_object_signal_emit(it->base.view, "elm,state,visible", "elm");
483    it->title_visible = EINA_TRUE;
484    wd->stack = eina_list_append(wd->stack, it);
485    return ELM_CAST(it);
486 }
487
488 EAPI Evas_Object *
489 elm_naviframe_item_pop(Evas_Object *obj)
490 {
491    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
492    Elm_Naviframe_Item *it, *prev_it;
493    Widget_Data *wd;
494    Evas_Object *content = NULL;
495
496    wd = elm_widget_data_get(obj);
497    if (!wd) return NULL;
498
499    it = ELM_CAST(elm_naviframe_top_item_get(obj));
500    if (!it) return NULL;
501    wd->stack = eina_list_remove(wd->stack, it);
502
503    if (wd->preserve)
504      content = it->content;
505
506    prev_it = ELM_CAST(elm_naviframe_top_item_get(obj));
507    if (prev_it)
508      {
509         if (wd->pass_events)
510           evas_object_pass_events_set(wd->base, EINA_TRUE);
511         evas_object_show(prev_it->base.view);
512         evas_object_raise(prev_it->base.view);
513         edje_object_signal_emit(prev_it->base.view,
514                                 "elm,state,show",
515                                 "elm");
516         edje_object_signal_emit(it->base.view, "elm,state,popped", "elm");
517      }
518    else
519      _item_del(it);
520
521    return content;
522 }
523
524 EAPI void
525 elm_naviframe_content_preserve_on_pop_set(Evas_Object *obj, Eina_Bool preserve)
526 {
527    ELM_CHECK_WIDTYPE(obj, widtype);
528    Widget_Data *wd = elm_widget_data_get(obj);
529    if (!wd) return;
530    wd->preserve = !!preserve;
531 }
532
533 EAPI Eina_Bool
534 elm_naviframe_content_preserve_on_pop_get(const Evas_Object *obj)
535 {
536    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
537    Widget_Data *wd = elm_widget_data_get(obj);
538    if (!wd) return EINA_FALSE;
539    return wd->preserve;
540 }
541
542 EAPI void
543 elm_naviframe_item_content_set(Elm_Object_Item *it, Evas_Object *content)
544 {
545    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
546    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it);
547
548    if (navi_it->content == content) return;
549    if (navi_it->content) evas_object_del(navi_it->content);
550    elm_widget_sub_object_add(navi_it->base.widget, content);
551    edje_object_part_swallow(navi_it->base.view, "elm.swallow.content", content);
552    if (content)
553      edje_object_signal_emit(navi_it->base.view,
554                              "elm,state,content,show",
555                              "elm");
556    else
557      edje_object_signal_emit(navi_it->base.view,
558                              "elm,state,content,hide",
559                              "elm");
560    evas_object_event_callback_add(content,
561                                   EVAS_CALLBACK_DEL,
562                                   _content_del,
563                                   navi_it);
564    navi_it->content = content;
565    _item_sizing_eval(navi_it);
566 }
567
568 EAPI Evas_Object *
569 elm_naviframe_item_content_get(const Elm_Object_Item *it)
570 {
571    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
572    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it, NULL);
573    return navi_it->content;
574 }
575
576 EAPI void
577 elm_naviframe_item_title_label_set(Elm_Object_Item *it, const char *label)
578 {
579    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
580    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it);
581
582    edje_object_part_text_set(navi_it->title, "elm.text.title", label);
583    if (label)
584      edje_object_signal_emit(navi_it->title, "elm,state,title,show", "elm");
585    else
586      edje_object_signal_emit(navi_it->title, "elm,state,title,hidew", "elm");
587
588    eina_stringshare_replace(&navi_it->title_label, label);
589    _item_sizing_eval(navi_it);
590 }
591
592 EAPI const char *
593 elm_naviframe_item_title_label_get(const Elm_Object_Item *it)
594 {
595    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
596    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it, NULL);
597
598    return navi_it->title_label;
599 }
600
601 EAPI void
602 elm_naviframe_item_subtitle_label_set(Elm_Object_Item *it, const char *label)
603 {
604    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
605    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it);
606
607    edje_object_part_text_set(navi_it->title, "elm.text.subtitle", label);
608    if (label)
609      edje_object_signal_emit(navi_it->title, "elm,state,subtitle,show", "elm");
610    else
611      edje_object_signal_emit(navi_it->title, "elm,state,subtitle,hide", "elm");
612
613    eina_stringshare_replace(&navi_it->title_sublabel, label);
614    _item_sizing_eval(navi_it);
615 }
616
617 EAPI const char *
618 elm_naviframe_item_subtitle_label_get(const Elm_Object_Item *it)
619 {
620    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
621    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it, NULL);
622    return navi_it->title_sublabel;
623 }
624
625 EAPI Elm_Object_Item*
626 elm_naviframe_top_item_get(const Evas_Object *obj)
627 {
628    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
629    Widget_Data *wd = elm_widget_data_get(obj);
630    if ((!wd) || (!wd->stack)) return NULL;
631    return eina_list_last(wd->stack)->data;
632 }
633
634 EAPI Elm_Object_Item*
635 elm_naviframe_bottom_item_get(const Evas_Object *obj)
636 {
637    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
638    Widget_Data *wd = elm_widget_data_get(obj);
639    if (!wd) return NULL;
640    return NULL;
641 }
642
643 EAPI void
644 elm_naviframe_item_button_set(Elm_Object_Item *it, Evas_Object *btn, Elm_Naviframe_Button_Type btn_type)
645 {
646    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
647    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it);
648
649    switch(btn_type)
650      {
651         case ELM_NAVIFRAME_PREV_BUTTON:
652           _title_prev_btn_set(navi_it, btn, EINA_FALSE);
653           break;
654         case ELM_NAVIFRAME_NEXT_BUTTON:
655           _title_next_btn_set(navi_it, btn);
656           break;
657         default:
658           WRN("Button type is invalid! : naviframe=%p", navi_it->base.widget);
659           break;
660      }
661    _item_sizing_eval(navi_it);
662 }
663
664 EAPI Evas_Object *
665 elm_naviframe_item_button_get(const Elm_Object_Item *it, Elm_Naviframe_Button_Type btn_type)
666 {
667    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
668    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it, NULL);
669
670    switch(btn_type)
671      {
672         case ELM_NAVIFRAME_PREV_BUTTON:
673            return navi_it->title_prev_btn;
674         case ELM_NAVIFRAME_NEXT_BUTTON:
675            return navi_it->title_next_btn;
676         default:
677            WRN("Button type is invalid! : naviframe=%p", navi_it->base.widget);
678            break;
679      }
680    return NULL;
681 }
682
683 EAPI void
684 elm_naviframe_item_icon_set(Elm_Object_Item *it, Evas_Object *icon)
685 {
686    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
687    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it);
688
689    Widget_Data *wd = elm_widget_data_get(navi_it->base.widget);
690    if (!wd) return;
691
692    if (navi_it->title_icon == icon) return;
693    if (navi_it->title_icon) evas_object_del(navi_it->title_icon);
694    navi_it->title_icon = icon;
695    if (!icon)
696      {
697         edje_object_signal_emit(navi_it->title,
698                                 "elm,state,icon,hide",
699                                 "elm");
700         return;
701      }
702    elm_widget_sub_object_add(navi_it->base.widget, icon);
703    edje_object_part_swallow(navi_it->title, "elm.swallow.icon", icon);
704    edje_object_signal_emit(navi_it->title, "elm,state,icon,show", "elm");
705
706    evas_object_event_callback_add(icon, EVAS_CALLBACK_DEL, _title_icon_del, navi_it);
707    _item_sizing_eval(navi_it);
708 }
709
710 EAPI Evas_Object *
711 elm_naviframe_item_icon_get(const Elm_Object_Item *it)
712 {
713    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
714    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it, NULL);
715    return navi_it->title_icon;
716 }
717
718 EAPI void
719 elm_naviframe_item_style_set(Elm_Object_Item *it, const char *item_style)
720 {
721    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
722    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it);
723
724    char buf[256];
725
726    if (!item_style) sprintf(buf, "item/basic");
727    else
728      {
729         if (strlen(item_style) > sizeof(buf))
730           WRN("too much long style name! : naviframe=%p", navi_it->base.widget);
731         else
732           sprintf(buf, "item/%s", item_style);
733      }
734    _elm_theme_object_set(navi_it->base.widget,
735                          navi_it->base.view,
736                          "naviframe",
737                          buf,
738                          elm_widget_style_get(navi_it->base.widget));
739 }
740
741 EAPI const char *
742 elm_naviframe_item_style_get(const Elm_Object_Item *it)
743 {
744    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
745    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it, NULL);
746    return navi_it->style;
747 }
748
749 EAPI void
750 elm_naviframe_item_title_visible_set(Elm_Object_Item *it, Eina_Bool visible)
751 {
752    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
753    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it);
754
755    visible = !!visible;
756    if (navi_it->title_visible == visible) return;
757
758    if (visible)
759      edje_object_signal_emit(navi_it->base.view, "elm,state,title,show", "elm");
760    else
761      edje_object_signal_emit(navi_it->base.view, "elm,state,title,hide", "elm");
762
763    navi_it->title_visible = visible;
764 }
765
766 EAPI Eina_Bool
767 elm_naviframe_item_title_visible_get(const Elm_Object_Item *it)
768 {
769    Elm_Naviframe_Item *navi_it = ELM_CAST(it);
770    ELM_NAVIFRAME_ITEM_CHECK_RETURN(navi_it, EINA_FALSE);
771    return navi_it->title_visible;
772 }
773