inwin:preview-02.png:widget_preview_inwin3:200:160 \
scroller:preview-00.png:widget_preview_scroller:100:30 \
table::preview-00.png:widget_preview_table:100:100 \
- win:preview-00.png:widget_preview_win:200:200
+ win:preview-00.png:widget_preview_win:200:200 \
+ table:preview-00.png:widget_preview_table:100:100 \
+ menu:preview-00.png:widget_preview_menu:100:100
widget-build:
@$(MAKE) -C widgets
*/
/**
+ * @page tutorial_menu Menu Example
+ * @dontinclude menu_example_01.c
+ *
+ * This example shows how to create a menu with regular items, object items,
+ * submenus and how to delete items from a menu. The full source for this
+ * example is @ref menu_example_01.c "menu_example_01.c".
+ *
+ * We'll start looking at the menu creation and how to create a very simple
+ * item:
+ * @skip menu_add
+ * @until item_add
+ *
+ * For our next item we are going to add an icon:
+ * @until item_add
+ *
+ * Now we are going to add more items, but these icons are going to have a
+ * parent, which will put them in a sub-menu. First just another item with an
+ * icon:
+ * @until item_add
+ *
+ * Next we are going to add a button to our menu(any elm widget can be added to
+ * a menu):
+ * @until item_add
+ *
+ * We are also going to have the button delete the first item of our
+ * sub-menu when clicked:
+ * @until smart_callback
+ * @dontinclude menu_example_01.c
+ * @skip static
+ * @until }
+ *
+ * We now add a separator and three more regular items:
+ * @until item_add
+ * @until item_add
+ * @until item_add
+ *
+ * We now add another item, however this time it won't go the sub-menu and it'll
+ * be disabled:
+ * @until disabled_set
+ *
+ * To make sure that our menu is shown whenever the window is clicked(and where
+ * clicked) we use the following callback:
+ * @dontinclude menu_example_01.c
+ * @skip static
+ * @skipline static
+ * @until }
+ *
+ * Our example will look like this:
+ *
+ * @image html screenshots/menu_example_01.png
+ * @image latex screenshots/menu_example_01.eps width=\textwidth
+ *
+ * @example menu_example_01.c
+ */
+
+/**
* @page bg_example_01_c bg_example_01.c
* @include bg_example_01.c
* @example bg_example_01.c
* @li @ref Map
* @li @ref Mapbuf
* @li @ref Menu
+ *
+ * @image html img/widget/menu/preview-00.png
+ * @image latex img/widget/menu/preview-00.eps
* @li @ref Notify
*
* @image html img/widget/notify/preview-00.png
widget_preview_inwin3 \
widget_preview_scroller \
widget_preview_table \
-widget_preview_win
+widget_preview_win \
+widget_preview_menu
LDADD = $(top_builddir)/src/lib/libelementary.la @ELEMENTARY_EWEATHER_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_EMAP_LIBS@ @ELEMENTARY_LIBS@ @EIO_LIBS@ @my_libs@
widget_preview_scroller.c \
widget_preview_table.c \
widget_preview_win.c \
+ widget_preview_menu.c \
widget_preview_tmpl_foot.c \
widget_preview_tmpl_head.c
--- /dev/null
+#include "widget_preview_tmpl_head.c"
+
+Evas_Object *o = elm_menu_add(win);
+evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+elm_win_resize_object_add(win, o);
+evas_object_show(o);
+
+elm_menu_item_add(o, NULL, "file", "item", NULL, NULL);
+elm_menu_item_add(o, NULL, NULL, "item", NULL, NULL);
+
+#include "widget_preview_tmpl_foot.c"
inwin_example.c \
scroller_example_01.c \
table_example_01.c \
- table_example_02.c
+ table_example_02.c \
+ menu_example_01.c
pkglib_PROGRAMS =
inwin_example \
scroller_example_01 \
table_example_01 \
- table_example_02
+ table_example_02 \
+ menu_example_01
# This variable will hold the list of screenshots that will be made
# by "make screenshots". Each item in the list is of the form:
inwin_example:inwin_example.png:0.0 \
inwin_example:inwin_example_a.png:0.2 \
table_example_01:table_example_01.png:0.0 \
- table_example_02:table_example_02.png:0.0
+ table_example_02:table_example_02.png:0.0 \
+ menu_example_01:menu_example_01.png:0.5
HTML_SS_DIR=$(top_builddir)/doc/html/screenshots
LATEX_SS_DIR=$(top_builddir)/doc/latex/screenshots
--- /dev/null
+//Compile with:
+//gcc -g `pkg-config --cflags --libs elementary` menu_example_01.c -o menu_example_01
+
+#include <Elementary.h>
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+static void
+_del_it(void *data, Evas_Object *obj, void *event_info)
+{
+ Eina_List *l;
+ Elm_Menu_Item *it = elm_menu_first_item_get(data);
+ it = elm_menu_item_next_get(it);
+ l = elm_menu_item_subitems_get(it);
+ elm_menu_item_del(eina_list_data_get(l));
+}
+
+static void
+_show(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ Evas_Event_Mouse_Down *ev = event_info;
+ elm_menu_move(data, ev->canvas.x, ev->canvas.y);
+ evas_object_show(data);
+}
+
+EAPI int
+elm_main(int argc, char **argv)
+{
+ Evas_Object *win, *bg, *menu, *button, *rect;
+ Elm_Menu_Item *item;
+
+ win = elm_win_add(NULL, "menu", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Menu");
+ elm_win_autodel_set(win, EINA_TRUE);
+ elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
+
+ bg = elm_bg_add(win);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ rect = evas_object_rectangle_add(evas_object_evas_get(win));
+ elm_win_resize_object_add(win, rect);
+ evas_object_color_set(rect, 0, 0, 0, 0);
+ evas_object_show(rect);
+
+ menu = elm_menu_add(win);
+ elm_menu_item_add(menu, NULL, NULL, "first item", NULL, NULL);
+ item = elm_menu_item_add(menu, NULL, "mail-reply-all", "second item", NULL, NULL);
+
+ elm_menu_item_add(menu, item, "object-rotate-left", "menu 1", NULL, NULL);
+ button = elm_button_add(win);
+ elm_object_text_set(button, "button - delete items");
+ elm_menu_item_add_object(menu, item, button, NULL, NULL);
+ evas_object_smart_callback_add(button, "clicked", _del_it, menu);
+ elm_menu_item_separator_add(menu, item);
+ elm_menu_item_add(menu, item, NULL, "third item", NULL, NULL);
+ elm_menu_item_add(menu, item, NULL, "fourth item", NULL, NULL);
+ elm_menu_item_add(menu, item, "window-new", "sub menu", NULL, NULL);
+
+ item = elm_menu_item_add(menu, NULL, NULL, "third item", NULL, NULL);
+ elm_menu_item_disabled_set(item, EINA_TRUE);
+
+ evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_DOWN, _show, menu);
+ evas_object_show(menu);
+
+ evas_object_resize(win, 250, 350);
+ evas_object_show(win);
+
+ elm_run();
+
+ return 0;
+}
+ELM_MAIN()
EAPI int elm_cursor_engine_only_get(void);
EAPI Eina_Bool elm_cursor_engine_only_set(int engine_only);
- /* menu */
+ /**
+ * @defgroup Menu Menu
+ *
+ * @image html img/widget/menu/preview-00.png
+ * @image latex img/widget/menu/preview-00.eps
+ *
+ * A menu is a list of items displayed above its parent. When the menu is
+ * showing its parent is darkened. Each item can have a sub-menu. The menu
+ * object can be used to display a menu on a right click event, in a toolbar,
+ * anywhere.
+ *
+ * Signals that you can add callbacks for are:
+ * @li "clicked" - the user clicked the empty space in the menu to dismiss.
+ * event_info is NULL.
+ *
+ * @see @ref tutorial_menu
+ * @{
+ */
typedef struct _Elm_Menu_Item Elm_Menu_Item; /**< Item of Elm_Menu. Sub-type of Elm_Widget_Item */
+ /**
+ * @brief Add a new menu to the parent
+ *
+ * @param parent The parent object.
+ * @return The new object or NULL if it cannot be created.
+ */
EAPI Evas_Object *elm_menu_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Set the parent for the given menu widget
+ *
+ * @param obj The menu object.
+ * @param parent The new parent.
+ */
EAPI void elm_menu_parent_set(Evas_Object *obj, Evas_Object *parent) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Get the parent for the given menu widget
+ *
+ * @param obj The menu object.
+ * @return The parent.
+ *
+ * @see elm_menu_parent_set()
+ */
EAPI Evas_Object *elm_menu_parent_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Move the menu to a new position
+ *
+ * @param obj The menu object.
+ * @param x The new position.
+ * @param y The new position.
+ *
+ * Sets the top-left position of the menu to (@p x,@p y).
+ *
+ * @note @p x and @p y coordinates are relative to parent.
+ */
EAPI void elm_menu_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Close a opened menu
+ *
+ * @param obj the menu object
+ * @return void
+ *
+ * Hides the menu and all it's sub-menus.
+ */
EAPI void elm_menu_close(Evas_Object *obj) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Returns a list of @p item's items.
+ *
+ * @param obj The menu object
+ * @return An Eina_List* of @p item's items
+ */
EAPI const Eina_List *elm_menu_items_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Get the Evas_Object of an Elm_Menu_Item
+ *
+ * @param item The menu item object.
+ * @return The edje object containing the swallowed content
+ *
+ * @warning Don't manipulate this object!
+ */
EAPI Evas_Object *elm_menu_item_object_get(const Elm_Menu_Item *it) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Add an item at the end of the given menu widget
+ *
+ * @param obj The menu object.
+ * @param parent The parent menu item (optional)
+ * @param icon A icon display on the item. The icon will be destryed by the menu.
+ * @param label The label of the item.
+ * @param func Function called when the user select the item.
+ * @param data Data sent by the callback.
+ * @return Returns the new item.
+ */
EAPI Elm_Menu_Item *elm_menu_item_add(Evas_Object *obj, Elm_Menu_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Add an object swallowed in an item at the end of the given menu
+ * widget
+ *
+ * @param obj The menu object.
+ * @param parent The parent menu item (optional)
+ * @param subobj The object to swallow
+ * @param func Function called when the user select the item.
+ * @param data Data sent by the callback.
+ * @return Returns the new item.
+ *
+ * Add an evas object as an item to the menu.
+ */
EAPI Elm_Menu_Item *elm_menu_item_add_object(Evas_Object *obj, Elm_Menu_Item *parent, Evas_Object *subobj, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Set the label of a menu item
+ *
+ * @param item The menu item object.
+ * @param label The label to set for @p item
+ *
+ * @warning Don't use this funcion on items created with
+ * elm_menu_item_add_object() or elm_menu_item_separator_add().
+ */
EAPI void elm_menu_item_label_set(Elm_Menu_Item *item, const char *label) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Get the label of a menu item
+ *
+ * @param item The menu item object.
+ * @return The label of @p item
+ */
EAPI const char *elm_menu_item_label_get(const Elm_Menu_Item *item) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Set the icon of a menu item to the standard icon with name @p icon
+ *
+ * @param item The menu item object.
+ * @param icon The icon object to set for the content of @p item
+ *
+ * Once this icon is set, any previously set icon will be deleted.
+ */
EAPI void elm_menu_item_object_icon_name_set(Elm_Menu_Item *item, const char *icon) EINA_ARG_NONNULL(1, 2);
+ /**
+ * @brief Get the string representation from the icon of a menu item
+ *
+ * @param item The menu item object.
+ * @return The string representation of @p item's icon or NULL
+ *
+ * @see elm_menu_item_object_icon_name_set()
+ */
EAPI const char *elm_menu_item_object_icon_name_get(const Elm_Menu_Item *item) EINA_ARG_NONNULL(1);
+ /**
+ * @deprecated Use elm_menu_item_object_icon_name_set()
+ */
EAPI void elm_menu_item_icon_set(Elm_Menu_Item *item, const char *icon) EINA_ARG_NONNULL(1, 2) EINA_DEPRECATED;
+ /**
+ * @deprecated Use elm_menu_item_object_icon_name_get()
+ */
EAPI const char *elm_menu_item_icon_get(const Elm_Menu_Item *item) EINA_ARG_NONNULL(1) EINA_DEPRECATED;
+ /**
+ * @brief Set the content object of a menu item
+ *
+ * @param item The menu item object
+ * @param The content object or NULL
+ * @return EINA_TRUE on success, else EINA_FALSE
+ *
+ * Use this function to change the object swallowed by a menu item, deleting
+ * any previously swallowed object.
+ */
EAPI Eina_Bool elm_menu_item_object_content_set(Elm_Menu_Item *item, Evas_Object *obj) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Get the content object of a menu item
+ *
+ * @param item The menu item object
+ * @return The content object or NULL
+ * @note If @p item was added with elm_menu_item_add_object, this
+ * function will return the object passed, else it will return the
+ * icon object.
+ *
+ * @see elm_menu_item_object_content_set()
+ */
EAPI Evas_Object *elm_menu_item_object_content_get(const Elm_Menu_Item *item) EINA_ARG_NONNULL(1);
+ /**
+ * @deprecated Use elm_menu_item_object_content_get() instead.
+ */
EAPI Evas_Object *elm_menu_item_object_icon_get(const Elm_Menu_Item *item) EINA_ARG_NONNULL(1) EINA_DEPRECATED;
+ /**
+ * @brief Set the selected state of @p item.
+ *
+ * @param item The menu item object.
+ * @param selected The selected/unselected state of the item
+ */
EAPI void elm_menu_item_selected_set(Elm_Menu_Item *item, Eina_Bool selected) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Get the selected state of @p item.
+ *
+ * @param item The menu item object.
+ * @return The selected/unselected state of the item
+ *
+ * @see elm_menu_item_selected_set()
+ */
EAPI Eina_Bool elm_menu_item_selected_get(const Elm_Menu_Item *item) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Set the disabled state of @p item.
+ *
+ * @param item The menu item object.
+ * @param disabled The enabled/disabled state of the item
+ */
EAPI void elm_menu_item_disabled_set(Elm_Menu_Item *item, Eina_Bool disabled) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Get the disabled state of @p item.
+ *
+ * @param item The menu item object.
+ * @return The enabled/disabled state of the item
+ *
+ * @see elm_menu_item_disabled_set()
+ */
EAPI Eina_Bool elm_menu_item_disabled_get(const Elm_Menu_Item *item) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Add a separator item to menu @p obj under @p parent.
+ *
+ * @param obj The menu object
+ * @param parent The item to add the separator under
+ * @return The created item or NULL on failure
+ *
+ * This is item is a @ref Separator.
+ */
EAPI Elm_Menu_Item *elm_menu_item_separator_add(Evas_Object *obj, Elm_Menu_Item *parent) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Returns whether @p item is a separator.
+ *
+ * @param item The item to check
+ * @return If true, @p item is a separator
+ *
+ * @see elm_menu_item_separator_add()
+ */
EAPI Eina_Bool elm_menu_item_is_separator(Elm_Menu_Item *item) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Deletes an item from the menu.
+ *
+ * @param item The item to delete.
+ *
+ * @see elm_menu_item_add()
+ */
EAPI void elm_menu_item_del(Elm_Menu_Item *item) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Set the function called when a menu item is deleted.
+ *
+ * @param item The item to set the callback on
+ * @param func The function called
+ *
+ * @see elm_menu_item_add()
+ * @see elm_menu_item_del()
+ */
EAPI void elm_menu_item_del_cb_set(Elm_Menu_Item *it, Evas_Smart_Cb func) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Returns the data associated with menu item @p item.
+ *
+ * @param item The item
+ * @return The data associated with @p item or NULL if none was set.
+ *
+ * This is the data set with elm_menu_add() or elm_menu_item_data_set().
+ */
EAPI void *elm_menu_item_data_get(const Elm_Menu_Item *it) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Sets the data to be associated with menu item @p item.
+ *
+ * @param item The item
+ * @param data The data to be associated with @p item
+ */
EAPI void elm_menu_item_data_set(Elm_Menu_Item *item, const void *data) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Returns a list of @p item's subitems.
+ *
+ * @param item The item
+ * @return An Eina_List* of @p item's subitems
+ *
+ * @see elm_menu_add()
+ */
EAPI const Eina_List *elm_menu_item_subitems_get(const Elm_Menu_Item *item) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Get the position of a menu item
+ *
+ * @param item The menu item
+ * @return The item's index
+ *
+ * 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.
+ *
+ * @note Index values begin with 0
+ */
EAPI unsigned int elm_menu_item_index_get(const Elm_Menu_Item *item) EINA_ARG_NONNULL(1) EINA_PURE;
+ /**
+ * @brief @brief Return a menu item's owner menu
+ *
+ * @param item The menu item
+ * @return The menu object owning @p item, or NULL on failure
+ *
+ * Use this function to get the menu object owning an item.
+ */
EAPI Evas_Object *elm_menu_item_menu_get(const Elm_Menu_Item *item) EINA_ARG_NONNULL(1) EINA_PURE;
+ /**
+ * @brief Get the selected item in the menu
+ *
+ * @param obj The menu object
+ * @return The selected item, or NULL if none
+ *
+ * @see elm_menu_item_selected_get()
+ * @see elm_menu_item_selected_set()
+ */
EAPI Elm_Menu_Item *elm_menu_selected_item_get(const Evas_Object * obj) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Get the last item in the menu
+ *
+ * @param obj The menu object
+ * @return The last item, or NULL if none
+ */
EAPI Elm_Menu_Item *elm_menu_last_item_get(const Evas_Object * obj) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Get the first item in the menu
+ *
+ * @param obj The menu object
+ * @return The first item, or NULL if none
+ */
EAPI Elm_Menu_Item *elm_menu_first_item_get(const Evas_Object * obj) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Get the next item in the menu.
+ *
+ * @param item The menu item object.
+ * @return The item after it, or NULL if none
+ */
EAPI Elm_Menu_Item *elm_menu_item_next_get(const Elm_Menu_Item *it) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Get the previous item in the menu.
+ *
+ * @param item The menu item object.
+ * @return The item before it, or NULL if none
+ */
EAPI Elm_Menu_Item *elm_menu_item_prev_get(const Elm_Menu_Item *it) EINA_ARG_NONNULL(1);
-
- /* smart callbacks called:
- * "clicked" - the user clicked the empty space in the menu to dismiss. event_info is NULL.
+ /**
+ * @}
*/
/**
#include <Elementary.h>
#include "elm_priv.h"
-/**
- * @defgroup Menu Menu
- *
- * A menu is a list of items displayed above the window. Each item can
- * have a sub-menu. The menu object can be used to display a menu on right
- * click, in a toolbar, anywhere.
- *
- * Signals that you can add callbacks for are:
- *
- * "clicked" - the user clicked the empty space in the menu to dismiss.
- * event_info is NULL.
- */
-
typedef struct _Widget_Data Widget_Data;
struct _Elm_Menu_Item
evas_object_event_callback_add(item->submenu.bx, EVAS_CALLBACK_RESIZE, _menu_resize, item->base.widget);
}
-/**
- * Add a new menu to the parent
- *
- * @param parent The parent object.
- * @return The new object or NULL if it cannot be created.
- *
- * @ingroup Menu
- */
EAPI Evas_Object *
elm_menu_add(Evas_Object *parent)
{
return obj;
}
-/**
- * Set the parent
- *
- * @param obj The menu object.
- * @param parent The new parent.
- *
- * @ingroup Menu
- */
EAPI void
elm_menu_parent_set(Evas_Object *obj, Evas_Object *parent)
{
_sizing_eval(obj);
}
-/**
- * Get the parent
- *
- * @param obj The menu object.
- * @return The parent.
- *
- * @ingroup Menu
- */
EAPI Evas_Object *
elm_menu_parent_get(const Evas_Object *obj)
{
return wd->parent;
}
-/**
- * Move the menu to a new position
- *
- * @param obj The menu object.
- * @param x The new position.
- * @param y The new position.
- *
- * @ingroup Menu
- */
EAPI void
elm_menu_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
_sizing_eval(obj);
}
-/**
- * Close a opened menu
- *
- * @param obj the menu object
- * @return void
- *
- * @ingroup Menu
- */
EAPI void
elm_menu_close(Evas_Object *obj)
{
_menu_hide(obj, wd->hv, NULL);
}
-/**
- * Get the Evas_Object of an Elm_Menu_Item
- *
- * @param item The menu item object.
- * @return The edje object containing the swallowed content
- *
- * @ingroup Menu
- */
EAPI Evas_Object *
elm_menu_item_object_get(const Elm_Menu_Item *item)
{
_sizing_eval(obj);
}
-/**
- * Add an item at the end
- *
- * @param obj The menu object.
- * @param parent The parent menu item (optional)
- * @param icon A icon display on the item. The icon will be destryed by the menu.
- * @param label The label of the item.
- * @param func Function called when the user select the item.
- * @param data Data sent by the callback.
- * @return Returns the new item.
- *
- * @ingroup Menu
- */
EAPI Elm_Menu_Item *
elm_menu_item_add(Evas_Object *obj, Elm_Menu_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
{
return subitem;
}
-/**
- * Add an object swallowed in an item at the end
- *
- * @param obj The menu object.
- * @param parent The parent menu item (optional)
- * @param subobj The object to swallow
- * @param func Function called when the user select the item.
- * @param data Data sent by the callback.
- * @return Returns the new item.
- *
- * @ingroup Menu
- */
EAPI Elm_Menu_Item *
elm_menu_item_add_object(Evas_Object *obj, Elm_Menu_Item *parent, Evas_Object *subobj, Evas_Smart_Cb func, const void *data)
{
return subitem;
}
-/**
- * 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)
{
return item->idx;
}
-/**
- * Set the label of a menu item
- *
- * @param item The menu item object.
- * @param label The label to set for @p item
- *
- * @ingroup Menu
- */
EAPI void
elm_menu_item_label_set(Elm_Menu_Item *item, const char *label)
{
_sizing_eval(item->base.widget);
}
-/**
- * Get the label of a menu item
- *
- * @param item The menu item object.
- * @return The label of @p item
- *
- * @ingroup Menu
- */
EAPI const char *
elm_menu_item_label_get(const Elm_Menu_Item *item)
{
return item->label;
}
-/**
- * Set the content of a menu item to an icon
- *
- * Once this content object is set, any previously set object will be deleted.
- *
- * @param item The menu item object.
- * @param icon The icon object to set for the content of @p item
- *
- * @ingroup Menu
- */
EAPI void
elm_menu_item_object_icon_name_set(Elm_Menu_Item *item, const char *icon)
{
elm_menu_item_object_icon_name_set(item, icon);
}
-/**
- * Set the disabled state of @p item.
- *
- * @param item The menu item object.
- * @param disabled The enabled/disabled state of the item
- *
- * @ingroup Menu
- */
EAPI void
elm_menu_item_disabled_set(Elm_Menu_Item *item, Eina_Bool disabled)
{
edje_object_message_signal_process(item->base.view);
}
-/**
- * Get the disabled state of @p item.
- *
- * @param item The menu item object.
- * @return The enabled/disabled state of the item
- *
- * @ingroup Menu
- */
EAPI Eina_Bool
elm_menu_item_disabled_get(const Elm_Menu_Item *item)
{
return item->disabled;
}
-/**
- * Add a separator item to menu @p obj under @p parent.
- *
- * @param obj The menu object
- * @param parent The item to add the separator under
- *
- * @return The created item or NULL on failure
- *
- * @ingroup Menu
- */
EAPI Elm_Menu_Item *
elm_menu_item_separator_add(Evas_Object *obj, Elm_Menu_Item *parent)
{
return subitem;
}
-/**
- * Set the content object of a menu item
- *
- * Use this function to change the object swallowed by a menu item,
- * deleting any previously swallowed object.
- * @param item The menu item object
- * @param The content object or NULL
- * @return EINA_TRUE on success, else EINA_FALSE
- *
- * @ingroup Menu
- */
EAPI Eina_Bool
elm_menu_item_object_content_set(Elm_Menu_Item *item, Evas_Object *obj)
{
return EINA_TRUE;
}
-/**
- * Get the content object of a menu item
- *
- * @param item The menu item object
- * @return The content object or NULL
- * @note If @p item was added with elm_menu_item_add_object, this
- * function will return the object passed, else it will return the
- * icon object.
- *
- * @ingroup Menu
- */
EAPI Evas_Object *
elm_menu_item_object_content_get(const Elm_Menu_Item *item)
{
return elm_menu_item_object_content_get(item);
}
-/**
- * Get the string representation from the icon of a menu item
- *
- * @param item The menu item object.
- * @return The string representation of @p item's icon or NULL
- *
- * @ingroup Menu
- */
EAPI const char *
elm_menu_item_object_icon_name_get(const Elm_Menu_Item *item)
{
return elm_menu_item_object_icon_name_get(item);
}
-/**
- * Returns whether @p item is a separator.
- *
- * @param item The item to check
- * @return If true, @p item is a separator
- *
- * @ingroup Menu
- */
EAPI Eina_Bool
elm_menu_item_is_separator(Elm_Menu_Item *item)
{
return item->separator;
}
-/**
- * Deletes an item from the menu.
- *
- * @param item The item to delete.
- *
- * @ingroup Menu
- */
EAPI void
elm_menu_item_del(Elm_Menu_Item *item)
{
elm_widget_item_del(item);
}
-/**
- * Set the function called when a menu item is freed.
- *
- * @param item The item to set the callback on
- * @param func The function called
- *
- * @ingroup Menu
- */
EAPI void
elm_menu_item_del_cb_set(Elm_Menu_Item *item, Evas_Smart_Cb func)
{
elm_widget_item_del_cb_set(item, func);
}
-/**
- * Returns the data associated with menu item @p item.
- *
- * @param item The item
- * @return The data associated with @p item
- *
- * @ingroup Menu
- */
EAPI void *
elm_menu_item_data_get(const Elm_Menu_Item *item)
{
return elm_widget_item_data_get(item);
}
-/**
- * Sets the data to be associated with menu item @p item.
- *
- * @param item The item
- * @param data The data to be associated with @p item
- *
- * @ingroup Menu
- */
EAPI void
elm_menu_item_data_set(Elm_Menu_Item *item, const void *data)
{
elm_widget_item_data_set(item, data);
}
-/**
- * Returns a list of @p item's subitems.
- *
- * @param item The item
- * @return An Eina_List* of @p item's subitems
- *
- * @ingroup Menu
- */
EAPI const Eina_List *
elm_menu_item_subitems_get(const Elm_Menu_Item *item)
{
return item->submenu.items;
}
-/**
- * Returns a list of @p item's items.
- *
- * @param obj The menu object
- * @return An Eina_List* of @p item's items
- *
- * @ingroup Menu
- */
EAPI const Eina_List *
elm_menu_items_get(const Evas_Object * obj)
{
return wd->items;
}
-/**
- * Set the selected state of @p item.
- *
- * @param item The menu item object.
- * @param selected The selected/unselected state of the item
- *
- * @ingroup Menu
- */
EAPI void
elm_menu_item_selected_set(Elm_Menu_Item *item, Eina_Bool selected)
{
edje_object_message_signal_process(item->base.view);
}
-/**
- * Get the selected state of @p item.
- *
- * @param item The menu item object.
- * @return The selected/unselected state of the item
- *
- * @ingroup Menu
- */
EAPI Eina_Bool
elm_menu_item_selected_get(const Elm_Menu_Item *item)
{
return item->selected;
}
-/**
- * Get the previous item in the menu.
- *
- * @param item The menu item object.
- * @return The item before it, or NULL if none
- *
- * @ingroup Menu
- */
EAPI Elm_Menu_Item *
elm_menu_item_prev_get(const Elm_Menu_Item *it)
{
return NULL;
}
-/**
- * Get the next item in the menu.
- *
- * @param item The menu item object.
- * @return The item after it, or NULL if none
- *
- * @ingroup Menu
- */
EAPI Elm_Menu_Item *
elm_menu_item_next_get(const Elm_Menu_Item *it)
{
return NULL;
}
-/**
- * @brief Return a menu item's owner menu
- *
- * Use this function to get the menu object owning an item.
- * @param item The menu item
- * @return The menu object owning @p item, or NULL on failure
- */
EAPI Evas_Object *
elm_menu_item_menu_get(const Elm_Menu_Item *item)
{
return item->base.widget;
}
-/**
- * Get the first item in the menu
- *
- * @param obj The menu object
- * @return The first item, or NULL if none
- *
- * @ingroup Menu
- */
EAPI Elm_Menu_Item *
elm_menu_first_item_get(const Evas_Object * obj)
{
return NULL;
}
-/**
- * Get the last item in the menu
- *
- * @param obj The menu object
- * @return The last item, or NULL if none
- *
- * @ingroup Menu
- */
EAPI Elm_Menu_Item *
elm_menu_last_item_get(const Evas_Object * obj)
{
return NULL;
}
-/**
- * Get the selected item in the menu
- *
- * @param obj The menu object
- * @return The selected item, or NULL if none
- *
- * @ingroup Menu
- */
EAPI Elm_Menu_Item *
elm_menu_selected_item_get(const Evas_Object * obj)
{