elementary/naviframe - 3 more APIs.
elm_naviframe_items_get() elm_naviframe_item_insert_before() elm_naviframe_item_insert_after() SVN revision: 64679
This commit is contained in:
parent
450b21e73d
commit
58fc5676ff
|
@ -14662,7 +14662,7 @@ extern "C" {
|
|||
* Insert a new item into the toolbar object after item @p after.
|
||||
*
|
||||
* @param obj The toolbar object.
|
||||
* @param before The toolbar item to insert before.
|
||||
* @param after The toolbar item to insert after.
|
||||
* @param icon A string with icon name or the absolute path of an image file.
|
||||
* @param label The label of the item.
|
||||
* @param func The function to call when the item is clicked.
|
||||
|
@ -28371,6 +28371,8 @@ extern "C" {
|
|||
* deleted when it is popped.
|
||||
*
|
||||
* @see also elm_naviframe_item_style_set()
|
||||
* @see also elm_naviframe_item_insert_before()
|
||||
* @see also elm_naviframe_item_insert_after()
|
||||
*
|
||||
* The following styles are available for this item:
|
||||
* @li @c "default"
|
||||
|
@ -28378,6 +28380,66 @@ extern "C" {
|
|||
* @ingroup Naviframe
|
||||
*/
|
||||
EAPI Elm_Object_Item *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) EINA_ARG_NONNULL(1, 5);
|
||||
/**
|
||||
* @brief Insert a new item into the naviframe before item @p before.
|
||||
*
|
||||
* @param before The naviframe item to insert before.
|
||||
* @param title_label The label in the title area. The name of the title
|
||||
* label part is "elm.text.title"
|
||||
* @param prev_btn The button to go to the previous item. If it is NULL,
|
||||
* then naviframe will create a back button automatically. The name of
|
||||
* the prev_btn part is "elm.swallow.prev_btn"
|
||||
* @param next_btn The button to go to the next item. Or It could be just an
|
||||
* extra function button. The name of the next_btn part is
|
||||
* "elm.swallow.next_btn"
|
||||
* @param content The main content object. The name of content part is
|
||||
* "elm.swallow.content"
|
||||
* @param item_style The current item style name. @c NULL would be default.
|
||||
* @return The created item or @c NULL upon failure.
|
||||
*
|
||||
* The item is inserted into the naviframe straight away without any
|
||||
* transition operations. This item will be deleted when it is popped.
|
||||
*
|
||||
* @see also elm_naviframe_item_style_set()
|
||||
* @see also elm_naviframe_item_push()
|
||||
* @see also elm_naviframe_item_insert_after()
|
||||
*
|
||||
* The following styles are available for this item:
|
||||
* @li @c "default"
|
||||
*
|
||||
* @ingroup Naviframe
|
||||
*/
|
||||
EAPI Elm_Object_Item *elm_naviframe_item_insert_before(Elm_Object_Item *before, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style) EINA_ARG_NONNULL(1, 5);
|
||||
/**
|
||||
* @brief Insert a new item into the naviframe after item @p after.
|
||||
*
|
||||
* @param after The naviframe item to insert after.
|
||||
* @param title_label The label in the title area. The name of the title
|
||||
* label part is "elm.text.title"
|
||||
* @param prev_btn The button to go to the previous item. If it is NULL,
|
||||
* then naviframe will create a back button automatically. The name of
|
||||
* the prev_btn part is "elm.swallow.prev_btn"
|
||||
* @param next_btn The button to go to the next item. Or It could be just an
|
||||
* extra function button. The name of the next_btn part is
|
||||
* "elm.swallow.next_btn"
|
||||
* @param content The main content object. The name of content part is
|
||||
* "elm.swallow.content"
|
||||
* @param item_style The current item style name. @c NULL would be default.
|
||||
* @return The created item or @c NULL upon failure.
|
||||
*
|
||||
* The item is inserted into the naviframe straight away without any
|
||||
* transition operations. This item will be deleted when it is popped.
|
||||
*
|
||||
* @see also elm_naviframe_item_style_set()
|
||||
* @see also elm_naviframe_item_push()
|
||||
* @see also elm_naviframe_item_insert_before()
|
||||
*
|
||||
* The following styles are available for this item:
|
||||
* @li @c "default"
|
||||
*
|
||||
* @ingroup Naviframe
|
||||
*/
|
||||
EAPI Elm_Object_Item *elm_naviframe_item_insert_after(Elm_Object_Item *after, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style) EINA_ARG_NONNULL(1, 5);
|
||||
/**
|
||||
* @brief Pop an item that is on top of the stack
|
||||
*
|
||||
|
@ -28539,7 +28601,15 @@ extern "C" {
|
|||
* @see also elm_naviframe_item_push()
|
||||
* elm_naviframe_prev_btn_auto_pushed_set()
|
||||
*/
|
||||
EAPI Eina_Bool elm_naviframe_prev_btn_auto_pushed_get(const Evas_Object *obj); EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool elm_naviframe_prev_btn_auto_pushed_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* @brief Get a list of all the naviframe items.
|
||||
*
|
||||
* @param obj The naviframe object
|
||||
* @return An Eina_Inlist* of naviframe items, #Elm_Object_Item,
|
||||
* or @c NULL on failure.
|
||||
*/
|
||||
EAPI Eina_Inlist *elm_naviframe_items_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -135,6 +135,12 @@ static void _item_content_set(Elm_Naviframe_Item *navi_it,
|
|||
Evas_Object *content);
|
||||
static void _item_style_set(Elm_Naviframe_Item *navi_it,
|
||||
const char *item_style);
|
||||
static Elm_Naviframe_Item * _item_new(Evas_Object *obj,
|
||||
const char *title_label,
|
||||
Evas_Object *prev_btn,
|
||||
Evas_Object *next_btn,
|
||||
Evas_Object *content,
|
||||
const char *item_style);
|
||||
|
||||
static void
|
||||
_del_hook(Evas_Object *obj)
|
||||
|
@ -866,6 +872,73 @@ _item_style_set(Elm_Naviframe_Item *navi_it, const char *item_style)
|
|||
evas_object_freeze_events_set(VIEW(navi_it), EINA_FALSE);
|
||||
}
|
||||
|
||||
static Elm_Naviframe_Item *
|
||||
_item_new(Evas_Object *obj,
|
||||
const char *title_label,
|
||||
Evas_Object *prev_btn,
|
||||
Evas_Object *next_btn,
|
||||
Evas_Object *content,
|
||||
const char *item_style)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
|
||||
//create item
|
||||
Elm_Naviframe_Item *it = elm_widget_item_new(obj, Elm_Naviframe_Item);
|
||||
if (!it)
|
||||
{
|
||||
ERR("Failed to allocate new item! : naviframe=%p", obj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
|
||||
elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
|
||||
elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
|
||||
elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
|
||||
elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook);
|
||||
elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook);
|
||||
|
||||
//item base layout
|
||||
VIEW(it) = edje_object_add(evas_object_evas_get(obj));
|
||||
edje_object_mirrored_set(VIEW(it), elm_widget_mirrored_get(obj));
|
||||
evas_object_smart_member_add(VIEW(it), wd->base);
|
||||
elm_widget_sub_object_add(obj, VIEW(it));
|
||||
edje_object_signal_callback_add(VIEW(it),
|
||||
"elm,action,show,finished",
|
||||
"",
|
||||
_show_finished, it);
|
||||
edje_object_signal_callback_add(VIEW(it),
|
||||
"elm,action,pushed,finished",
|
||||
"",
|
||||
_pushed_finished, it);
|
||||
edje_object_signal_callback_add(VIEW(it),
|
||||
"elm,action,popped,finished",
|
||||
"",
|
||||
_popped_finished, it);
|
||||
edje_object_signal_callback_add(VIEW(it),
|
||||
"elm,action,title,clicked",
|
||||
"",
|
||||
_title_clicked, it);
|
||||
|
||||
_item_style_set(it, item_style);
|
||||
_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))
|
||||
{
|
||||
prev_btn = _back_btn_new(obj);
|
||||
_title_prev_btn_set(it, prev_btn, EINA_TRUE);
|
||||
}
|
||||
else
|
||||
_title_prev_btn_set(it, prev_btn, EINA_FALSE);
|
||||
|
||||
_title_next_btn_set(it, next_btn);
|
||||
_item_content_set(it, content);
|
||||
_item_sizing_eval(it);
|
||||
|
||||
it->title_visible = EINA_TRUE;
|
||||
return it;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_naviframe_add(Evas_Object *parent)
|
||||
{
|
||||
|
@ -914,61 +987,9 @@ elm_naviframe_item_push(Evas_Object *obj,
|
|||
wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
|
||||
//create item
|
||||
it = elm_widget_item_new(obj, Elm_Naviframe_Item);
|
||||
if (!it)
|
||||
{
|
||||
ERR("Failed to allocate new item! : naviframe=%p", obj);
|
||||
return NULL;
|
||||
}
|
||||
it = _item_new(obj, title_label, prev_btn, next_btn, content, item_style);
|
||||
if (!it) return NULL;
|
||||
|
||||
elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
|
||||
elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
|
||||
elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
|
||||
elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
|
||||
elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook);
|
||||
elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook);
|
||||
|
||||
//item base layout
|
||||
VIEW(it) = edje_object_add(evas_object_evas_get(obj));
|
||||
edje_object_mirrored_set(VIEW(it), elm_widget_mirrored_get(obj));
|
||||
evas_object_smart_member_add(VIEW(it), wd->base);
|
||||
elm_widget_sub_object_add(obj, VIEW(it));
|
||||
edje_object_signal_callback_add(VIEW(it),
|
||||
"elm,action,show,finished",
|
||||
"",
|
||||
_show_finished, it);
|
||||
edje_object_signal_callback_add(VIEW(it),
|
||||
"elm,action,pushed,finished",
|
||||
"",
|
||||
_pushed_finished, it);
|
||||
edje_object_signal_callback_add(VIEW(it),
|
||||
"elm,action,popped,finished",
|
||||
"",
|
||||
_popped_finished, it);
|
||||
edje_object_signal_callback_add(VIEW(it),
|
||||
"elm,action,title,clicked",
|
||||
"",
|
||||
_title_clicked, it);
|
||||
|
||||
_item_style_set(it, item_style);
|
||||
|
||||
_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))
|
||||
{
|
||||
prev_btn = _back_btn_new(obj);
|
||||
_title_prev_btn_set(it, prev_btn, EINA_TRUE);
|
||||
}
|
||||
else
|
||||
_title_prev_btn_set(it, prev_btn, EINA_FALSE);
|
||||
|
||||
_title_next_btn_set(it, next_btn);
|
||||
|
||||
_item_content_set(it, content);
|
||||
|
||||
_item_sizing_eval(it);
|
||||
evas_object_show(VIEW(it));
|
||||
|
||||
prev_it = (Elm_Naviframe_Item *) elm_naviframe_top_item_get(obj);
|
||||
|
@ -986,11 +1007,65 @@ elm_naviframe_item_push(Evas_Object *obj,
|
|||
"elm,state,new,pushed",
|
||||
"elm");
|
||||
}
|
||||
it->title_visible = EINA_TRUE;
|
||||
wd->stack = eina_inlist_append(wd->stack, EINA_INLIST_GET(it));
|
||||
return (Elm_Object_Item *) it;
|
||||
}
|
||||
|
||||
EAPI Elm_Object_Item *
|
||||
elm_naviframe_item_insert_before(Elm_Object_Item *before,
|
||||
const char *title_label,
|
||||
Evas_Object *prev_btn,
|
||||
Evas_Object *next_btn,
|
||||
Evas_Object *content,
|
||||
const char *item_style)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(before, NULL);
|
||||
Elm_Naviframe_Item *it;
|
||||
Widget_Data *wd;
|
||||
|
||||
wd = elm_widget_data_get(WIDGET(before));
|
||||
if (!wd) return NULL;
|
||||
|
||||
it = _item_new(WIDGET(before), 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_GET(((Elm_Naviframe_Item *) before)));
|
||||
return (Elm_Object_Item *) it;
|
||||
}
|
||||
|
||||
EAPI Elm_Object_Item *
|
||||
elm_naviframe_item_insert_after(Elm_Object_Item *after,
|
||||
const char *title_label,
|
||||
Evas_Object *prev_btn,
|
||||
Evas_Object *next_btn,
|
||||
Evas_Object *content,
|
||||
const char *item_style)
|
||||
{
|
||||
ELM_OBJ_ITEM_CHECK_OR_RETURN(after, NULL);
|
||||
Elm_Naviframe_Item *it;
|
||||
Widget_Data *wd;
|
||||
|
||||
wd = elm_widget_data_get(WIDGET(after));
|
||||
if (!wd) return NULL;
|
||||
|
||||
it = _item_new(WIDGET(after), title_label, prev_btn, next_btn, content,
|
||||
item_style);
|
||||
if (!it) return NULL;
|
||||
|
||||
if (elm_naviframe_top_item_get(WIDGET(after)) == after)
|
||||
{
|
||||
evas_object_hide(VIEW(after));
|
||||
evas_object_show(VIEW(it));
|
||||
}
|
||||
wd->stack =
|
||||
eina_inlist_append_relative(wd->stack, EINA_INLIST_GET(it),
|
||||
EINA_INLIST_GET(((Elm_Naviframe_Item *) after)));
|
||||
return (Elm_Object_Item *) it;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_naviframe_item_pop(Evas_Object *obj)
|
||||
{
|
||||
|
@ -1221,3 +1296,12 @@ elm_naviframe_prev_btn_auto_pushed_get(const Evas_Object *obj)
|
|||
return wd->auto_pushed;
|
||||
}
|
||||
|
||||
EAPI Eina_Inlist *
|
||||
elm_naviframe_items_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->stack;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue