EAPI void *elm_menu_item_data_get(const Elm_Menu_Item *it) EINA_ARG_NONNULL(1);
EAPI void elm_menu_item_data_set(Elm_Menu_Item *item, const void *data) EINA_ARG_NONNULL(1);
EAPI const Eina_List *elm_menu_item_subitems_get(const Elm_Menu_Item *item) EINA_ARG_NONNULL(1);
+ EAPI unsigned int elm_menu_item_index_get(const Elm_Menu_Item *item) EINA_ARG_NONNULL(1) EINA_PURE;
EAPI Elm_Menu_Item *elm_menu_selected_item_get(const Evas_Object * obj) EINA_ARG_NONNULL(1);
EAPI Elm_Menu_Item *elm_menu_last_item_get(const Evas_Object * obj) EINA_ARG_NONNULL(1);
EAPI Elm_Menu_Item *elm_menu_first_item_get(const Evas_Object * obj) EINA_ARG_NONNULL(1);
const char *icon_str;
const char *label;
Evas_Smart_Cb func;
+ unsigned int idx;
struct {
Evas_Object *hv, *bx, *location;
if (!parent->submenu.bx) _item_submenu_obj_create(parent);
elm_box_pack_end(parent->submenu.bx, subitem->base.view);
parent->submenu.items = eina_list_append(parent->submenu.items, subitem);
+ subitem->idx = eina_list_count(parent->submenu.items) - 1;
}
else
{
elm_box_pack_end(wd->bx, subitem->base.view);
wd->items = eina_list_append(wd->items, subitem);
+ subitem->idx = eina_list_count(wd->items) - 1;
}
_sizing_eval(obj);
if (!parent->submenu.bx) _item_submenu_obj_create(parent);
elm_box_pack_end(parent->submenu.bx, subitem->base.view);
parent->submenu.items = eina_list_append(parent->submenu.items, subitem);
+ subitem->idx = eina_list_count(parent->submenu.items) - 1;
}
else
{
elm_box_pack_end(wd->bx, subitem->base.view);
wd->items = eina_list_append(wd->items, subitem);
+ subitem->idx = eina_list_count(wd->items) - 1;
}
_sizing_eval(obj);
}
/**
+ * Get the position of a menu item
+ *
+ * This function returns the index position of a menu item in a menu.
+ * For a sub-menu, this number is relative to the first item in the sub-menu.
+ * @param item The menu item
+ * @return The item's index
+ * @note Index values begin with 0
+ * @ingroup Menu
+ */
+EAPI unsigned int
+elm_menu_item_index_get(const Elm_Menu_Item *item)
+{
+ ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, 0);
+ return item->idx;
+}
+
+/**
* Set the label of a menu item
*
* @param item The menu item object.