Eina_Bool preserve: 1;
Eina_Bool auto_pushed: 1;
Eina_Bool freeze_events: 1;
- Eina_Stringshare *item_style;
};
struct _Elm_Naviframe_Content_Item_Pair
Evas_Coord minh;
Eina_Bool back_btn: 1;
Eina_Bool title_visible: 1;
+ Eina_Bool content_unfocusable : 1;
};
static const char *widtype = NULL;
+//widget signals
static const char SIG_TRANSITION_FINISHED[] = "transition,finished";
-static const char SIG_PUSH_FINISHED[] = "push,finished";
-static const char SIG_POP_FINISHED[] = "pop,finished";
static const char SIG_TITLE_CLICKED[] = "title,clicked";
static const Evas_Smart_Cb_Description _signals[] = {
{NULL, NULL}
};
-static Evas_Object *_content_get_hook(const Evas_Object *obj,
- const char *part);
+static void _text_set_hook(Evas_Object *obj,
+ const char *part,
+ const char *label);
+static const char *_text_get_hook(const Evas_Object *obj, const char *part);
+static void _content_set_hook(Evas_Object *obj,
+ const char *part,
+ Evas_Object *content);
+static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part);
+static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part);
static void _del_hook(Evas_Object *obj);
static void _theme_hook(Evas_Object *obj);
static void _emit_hook(Evas_Object *obj,
if (!wd->stack) break;
}
}
- eina_stringshare_del(wd->item_style);
free(wd);
}
const char *emission,
const char *source)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
-
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- elm_object_signal_emit(wd->base, emission, source);
+ Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
+ if (!it) return;
+ elm_object_item_signal_emit(it, emission, source);
}
static void
const char *part,
const char *label)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-
Elm_Naviframe_Text_Item_Pair *pair = NULL;
- Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
+ Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
char buf[1024];
if (!part || !strcmp(part, "default"))
snprintf(buf, sizeof(buf), "elm.text.title");
- else if(!strcmp("subtitle", part))
+ else if (!strcmp("subtitle", part))
snprintf(buf, sizeof(buf), "elm.text.subtitle");
else
snprintf(buf, sizeof(buf), "%s", part);
if (label)
{
- snprintf(buf, sizeof(buf), "elm,state,%s,show", buf);
+ snprintf(buf, sizeof(buf), "elm,state,%s,show", part);
elm_object_signal_emit(VIEW(navi_it), buf, "elm");
}
else
{
- snprintf(buf, sizeof(buf), "elm,state,%s,hide", buf);
+ snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
elm_object_signal_emit(VIEW(navi_it), buf, "elm");
}
static const char *
_item_text_get_hook(const Elm_Object_Item *it, const char *part)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
char buf[1024];
if (!part || !strcmp(part, "default"))
snprintf(buf, sizeof(buf), "elm.text.title");
- else if(!strcmp("subtitle", part))
+ else if (!strcmp("subtitle", part))
snprintf(buf, sizeof(buf), "elm.text.subtitle");
else
snprintf(buf, sizeof(buf), "%s", part);
const char *part,
Evas_Object *content)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-
- Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
+ Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
//specified parts
if (!part || !strcmp("default", part))
static Evas_Object *
_item_content_get_hook(const Elm_Object_Item *it, const char *part)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
+ Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
//specified parts
if (!part || !strcmp("default", part))
static Evas_Object *
_item_content_unset_hook(Elm_Object_Item *it, const char *part)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
+ Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
//specified parts
if (!part || !strcmp("default", part))
const char *emission,
const char *source)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
elm_object_signal_emit(VIEW(it), emission, source);
}
btn = elm_button_add(obj);
if (!btn) return NULL;
evas_object_smart_callback_add(btn, "clicked", _back_btn_clicked, obj);
- snprintf(buf, sizeof(buf), "naviframe/back_btn/%s", elm_widget_style_get(obj));
+ snprintf(buf, sizeof(buf), "naviframe/back_btn/%s",
+ elm_widget_style_get(obj));
elm_object_style_set(btn, buf);
return btn;
}
+static void _text_set_hook(Evas_Object *obj,
+ const char *part,
+ const char *label)
+{
+ Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
+ if (!it) return;
+ elm_object_item_part_text_set(it, part, label);
+}
+
+static const char *_text_get_hook(const Evas_Object *obj, const char *part)
+{
+ Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
+ if (!it) return NULL;
+ return elm_object_item_part_text_get(it, part);
+}
+
+static void
+_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
+{
+ Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
+ if (!it) return;
+ elm_object_item_part_content_set(it, part, content);
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part)
+{
+ Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
+ if (!it) return NULL;
+ return elm_object_item_part_content_unset(it, part);
+}
+
static Evas_Object *
_content_get_hook(const Evas_Object *obj, const char *part)
{
}
eina_stringshare_del(it->style);
+
+ if (wd->preserve && it->content)
+ {
+ elm_object_part_content_unset(VIEW(it), "elm.swallow.content");
+ evas_object_event_callback_del(it->content,
+ EVAS_CALLBACK_DEL,
+ _item_content_del);
+ }
}
static Eina_Bool
_item_del_pre_hook(Elm_Object_Item *it)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
Elm_Naviframe_Item *navi_it;
Widget_Data *wd;
- navi_it =(Elm_Naviframe_Item *) it;
+ navi_it =(Elm_Naviframe_Item *)it;
wd = elm_widget_data_get(WIDGET(navi_it));
if (!wd) return EINA_FALSE;
{
wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it));
_item_del(navi_it);
- elm_widget_item_free(navi_it);
//If the item is only one, the stack will be empty
if (!wd->stack) return EINA_TRUE;
navi_it = EINA_INLIST_CONTAINER_GET(wd->stack->last,
{
wd->stack = eina_inlist_remove(wd->stack, EINA_INLIST_GET(navi_it));
_item_del(navi_it);
- elm_widget_item_free(navi_it);
}
return EINA_TRUE;
if (!wd) return;
evas_object_hide(VIEW(it));
- evas_object_smart_callback_call(WIDGET(it),
- SIG_PUSH_FINISHED,
- data);
+
+ if (it->content)
+ elm_widget_tree_unfocusable_set(it->content, it->content_unfocusable);
+
if (wd->freeze_events)
evas_object_freeze_events_set(VIEW(it), EINA_FALSE);
}
const char *emission __UNUSED__,
const char *source __UNUSED__)
{
+ Widget_Data *wd;
Elm_Naviframe_Item *it = data;
if (!it) return;
- evas_object_smart_callback_call(WIDGET(it),
- SIG_POP_FINISHED,
- data);
+
+ wd = elm_widget_data_get(WIDGET(it));
+ if (!wd) return;
+
+ if (wd->preserve && it->content)
+ elm_widget_tree_unfocusable_set(it->content, it->content_unfocusable);
+
_item_del(data);
+
elm_widget_item_free(data);
}
wd = elm_widget_data_get(WIDGET(it));
if (!wd) return;
+ elm_widget_tree_unfocusable_set(it->content, it->content_unfocusable);
+
evas_object_smart_callback_call(WIDGET(it),
SIG_TRANSITION_FINISHED,
data);
Elm_Naviframe_Content_Item_Pair *content_pair;
Elm_Naviframe_Text_Item_Pair *text_pair;
Widget_Data *wd;
- wd = elm_widget_data_get(WIDGET(navi_it));
- if (!wd) return;
char buf[256];
if (!item_style)
{
- snprintf(buf, sizeof(buf), "item/%s", wd->item_style);
+ strcpy(buf, "item/basic");
+ eina_stringshare_replace(&navi_it->style, "basic");
}
else
{
if (navi_it->title_next_btn)
elm_object_signal_emit(VIEW(navi_it), "elm,state,next_btn,show", "elm");
- navi_it->title_visible = EINA_TRUE;
_sizing_eval(WIDGET(navi_it));
+ wd = elm_widget_data_get(WIDGET(navi_it));
+ if (!wd) return;
+
if (wd->freeze_events)
evas_object_freeze_events_set(VIEW(navi_it), EINA_FALSE);
}
//item base layout
VIEW(it) = elm_layout_add(obj);
- evas_object_smart_member_add(VIEW(it), wd->base);
+ evas_object_smart_member_add(VIEW(it), obj);
evas_object_event_callback_add(VIEW(it),
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_title_clicked, it);
_item_style_set(it, item_style);
- _item_text_set_hook((Elm_Object_Item *) it, "elm.text.title", title_label);
+ _item_text_set_hook((Elm_Object_Item *)it, "elm.text.title", title_label);
//title buttons
if ((!prev_btn) && wd->auto_pushed && eina_inlist_count(wd->stack))
static Eina_Bool
_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
{
+ Eina_Bool ret;
+ Elm_Naviframe_Item *top_it;
+ Eina_List *l = NULL;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd || !wd->stack) return EINA_FALSE;
- return elm_widget_focus_next_get(VIEW(elm_naviframe_top_item_get(obj)),
- dir,
- next);
+ void *(*list_data_get)(const Eina_List *list);
+ if (!wd) return EINA_FALSE;
+
+ top_it = (Elm_Naviframe_Item *)elm_naviframe_top_item_get(obj);
+ if (!top_it) return EINA_FALSE;
+
+ list_data_get = eina_list_data_get;
+
+ //Forcus order: prev button, next button, contents
+ if (top_it->title_prev_btn)
+ l = eina_list_append(l, top_it->title_prev_btn);
+ if (top_it->title_next_btn)
+ l = eina_list_append(l, top_it->title_next_btn);
+ l = eina_list_append(l, VIEW(top_it));
+
+ ret = elm_widget_focus_list_next_get(obj, l, list_data_get, dir, next);
+ eina_list_free(l);
+ return ret;
}
EAPI Evas_Object *
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_disable_hook_set(obj, _disable_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
+ elm_widget_text_set_hook_set(obj, _text_set_hook);
+ elm_widget_text_get_hook_set(obj, _text_get_hook);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
elm_widget_signal_emit_hook_set(obj, _emit_hook);
elm_widget_can_focus_set(obj, EINA_FALSE);
elm_widget_focus_next_hook_set(obj, _focus_next_hook);
//base
- wd->base = elm_layout_add(parent);
+ //FIXME: Is this base layout really needed?
+ wd->base = elm_layout_add(obj);
evas_object_event_callback_add(wd->base,
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints,
wd->auto_pushed = EINA_TRUE;
wd->freeze_events = EINA_TRUE;
- wd->item_style = eina_stringshare_add("basic");
return obj;
}
elm_object_signal_emit(VIEW(prev_it), "elm,state,cur,pushed", "elm");
elm_object_signal_emit(VIEW(it), "elm,state,new,pushed", "elm");
edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it)));
+ if (prev_it->content)
+ {
+ prev_it->content_unfocusable = elm_widget_tree_unfocusable_get(prev_it->content);
+ elm_widget_tree_unfocusable_set(prev_it->content, EINA_TRUE);
+ }
edje_object_message_signal_process(elm_layout_edje_get(VIEW(it)));
}
wd->stack = eina_inlist_append(wd->stack, EINA_INLIST_GET(it));
_sizing_eval(obj);
- return (Elm_Object_Item *) it;
+ return (Elm_Object_Item *)it;
}
EAPI Elm_Object_Item *
-elm_naviframe_item_insert_before(Elm_Object_Item *before,
+elm_naviframe_item_insert_before(Evas_Object *obj,
+ Elm_Object_Item *before,
const char *title_label,
Evas_Object *prev_btn,
Evas_Object *next_btn,
Evas_Object *content,
const char *item_style)
{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
ELM_OBJ_ITEM_CHECK_OR_RETURN(before, NULL);
Elm_Naviframe_Item *it;
Widget_Data *wd;
- wd = elm_widget_data_get(WIDGET(before));
+ wd = elm_widget_data_get(obj);
if (!wd) return NULL;
- it = _item_new(WIDGET(before), title_label, prev_btn, next_btn, content,
- item_style);
+ it = _item_new(obj, title_label, prev_btn, next_btn, content, item_style);
if (!it) return NULL;
wd->stack =
- eina_inlist_prepend_relative(wd->stack, EINA_INLIST_GET(it),
+ eina_inlist_prepend_relative(wd->stack,
+ EINA_INLIST_GET(it),
EINA_INLIST_GET(((Elm_Naviframe_Item *) before)));
- _sizing_eval(WIDGET(before));
- return (Elm_Object_Item *) it;
+ _sizing_eval(obj);
+ return (Elm_Object_Item *)it;
}
EAPI Elm_Object_Item *
-elm_naviframe_item_insert_after(Elm_Object_Item *after,
+elm_naviframe_item_insert_after(Evas_Object *obj,
+ Elm_Object_Item *after,
const char *title_label,
Evas_Object *prev_btn,
Evas_Object *next_btn,
Evas_Object *content,
const char *item_style)
{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
ELM_OBJ_ITEM_CHECK_OR_RETURN(after, NULL);
Elm_Naviframe_Item *it;
Widget_Data *wd;
+ Eina_Bool top_inserted;
- wd = elm_widget_data_get(WIDGET(after));
+ wd = elm_widget_data_get(obj);
if (!wd) return NULL;
- it = _item_new(WIDGET(after), title_label, prev_btn, next_btn, content,
- item_style);
+ it = _item_new(obj, title_label, prev_btn, next_btn, content, item_style);
if (!it) return NULL;
- if (elm_naviframe_top_item_get(WIDGET(after)) == after)
+ if (elm_naviframe_top_item_get(obj) == after) top_inserted = EINA_TRUE;
+
+ wd->stack =
+ eina_inlist_append_relative(wd->stack,
+ EINA_INLIST_GET(it),
+ EINA_INLIST_GET(((Elm_Naviframe_Item *) after)));
+ if (top_inserted)
{
- evas_object_hide(VIEW(after));
evas_object_show(VIEW(it));
+ evas_object_hide(VIEW(after));
}
- wd->stack =
- eina_inlist_append_relative(wd->stack, EINA_INLIST_GET(it),
- EINA_INLIST_GET(((Elm_Naviframe_Item *) after)));
- _sizing_eval(WIDGET(after));
- return (Elm_Object_Item *) it;
+
+ _sizing_eval(obj);
+
+ return (Elm_Object_Item *)it;
}
EAPI Evas_Object *
it = (Elm_Naviframe_Item *) elm_naviframe_top_item_get(obj);
if (!it) return NULL;
- elm_widget_tree_unfocusable_set(it->content, EINA_TRUE);
if (wd->preserve)
content = it->content;
+ if (it->content)
+ {
+ it->content_unfocusable = elm_widget_tree_unfocusable_get(it->content);
+ elm_widget_tree_unfocusable_set(it->content, EINA_TRUE);
+ }
+
if (wd->stack->last->prev)
prev_it = EINA_INLIST_CONTAINER_GET(wd->stack->last->prev,
Elm_Naviframe_Item);
}
elm_object_signal_emit(VIEW(it), "elm,state,cur,popped", "elm");
evas_object_show(VIEW(prev_it));
- evas_object_raise(VIEW(prev_it));
elm_object_signal_emit(VIEW(prev_it),
"elm,state,prev,popped",
"elm");
Widget_Data *wd;
Eina_Inlist *l, *prev_l;
- navi_it = (Elm_Naviframe_Item *) it;
+ navi_it = (Elm_Naviframe_Item *)it;
wd = elm_widget_data_get(WIDGET(navi_it));
if (!wd) return;
l = wd->stack->last->prev;
- while(l)
+ while (l)
{
if (EINA_INLIST_CONTAINER_GET(l, Elm_Naviframe_Item) ==
- ((Elm_Naviframe_Item *) it)) break;
+ ((Elm_Naviframe_Item *)it)) break;
prev_l = l->prev;
wd->stack = eina_inlist_remove(wd->stack, l);
_item_del(EINA_INLIST_CONTAINER_GET(l, Elm_Naviframe_Item));
Elm_Naviframe_Item *prev_it;
Widget_Data *wd;
- navi_it = (Elm_Naviframe_Item *) it;
+ navi_it = (Elm_Naviframe_Item *)it;
wd = elm_widget_data_get(navi_it->base.widget);
if (!wd) return;
wd->stack = eina_inlist_demote(wd->stack, EINA_INLIST_GET(navi_it));
prev_it = EINA_INLIST_CONTAINER_GET(wd->stack->last->prev,
Elm_Naviframe_Item);
+ if (prev_it->content)
+ {
+ prev_it->content_unfocusable = elm_widget_tree_unfocusable_get(prev_it->content);
+ elm_widget_tree_unfocusable_set(prev_it->content, EINA_TRUE);
+ }
+
if (wd->freeze_events)
{
evas_object_freeze_events_set(VIEW(it), EINA_TRUE);
Elm_Naviframe_Item *itr;
EINA_INLIST_FOREACH(wd->stack, itr)
{
- if (elm_object_item_content_get((Elm_Object_Item *) itr) == content)
+ if (elm_object_item_content_get((Elm_Object_Item *)itr) == content)
{
- elm_naviframe_item_promote((Elm_Object_Item *) itr);
+ elm_naviframe_item_promote((Elm_Object_Item *)itr);
break;
}
}
EAPI void
-elm_naviframe_item_del(Elm_Object_Item *it)
-{
- elm_object_item_del(it);
-}
-
-EAPI void
elm_naviframe_content_preserve_on_pop_set(Evas_Object *obj, Eina_Bool preserve)
{
ELM_CHECK_WIDTYPE(obj, widtype);
elm_naviframe_item_style_set(Elm_Object_Item *it, const char *item_style)
{
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
+ Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
- //Return if new style is exsiting one.
- if ((item_style && navi_it->style) && (!strcmp(item_style, navi_it->style)))
- return;
+ if (item_style)
+ if (!strcmp(item_style, navi_it->style)) return;
- if ((!item_style) && (!navi_it->style))
- return;
+ if (!item_style)
+ if (!strcmp("basic", navi_it->style)) return;
_item_style_set(navi_it, item_style);
+ _item_title_visible_update(navi_it);
}
EAPI const char *
elm_naviframe_item_style_get(const Elm_Object_Item *it)
{
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
+ Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
return navi_it->style;
}
elm_naviframe_item_title_visible_set(Elm_Object_Item *it, Eina_Bool visible)
{
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
+ Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
visible = !!visible;
if (navi_it->title_visible == visible) return;
elm_naviframe_item_title_visible_get(const Elm_Object_Item *it)
{
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
- Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *) it;
+ Elm_Naviframe_Item *navi_it = (Elm_Naviframe_Item *)it;
return navi_it->title_visible;
}
Eina_List *ret = NULL;
Elm_Naviframe_Item *itr;
EINA_INLIST_FOREACH(wd->stack, itr)
- {
- ret = eina_list_append(ret, itr);
- }
+ ret = eina_list_append(ret, itr);
return ret;
}
if (!wd) return EINA_FALSE;
return !wd->freeze_events;
}
-
-EAPI void
-elm_naviframe_item_style_default_set(Evas_Object *obj, const char *style)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- eina_stringshare_replace(&wd->item_style, style);
- _theme_hook(obj);
-}
-
-EAPI const char *
-elm_naviframe_item_style_default_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->item_style;
-}