4 * @image html img/widget/menu/preview-00.png
5 * @image latex img/widget/menu/preview-00.eps
7 * A menu is a list of items displayed above its parent. When the menu is
8 * showing its parent is darkened. Each item can have a sub-menu. The menu
9 * object can be used to display a menu on a right click event, in a toolbar,
12 * Signals that you can add callbacks for are:
13 * @li "clicked" - the user clicked the empty space in the menu to dismiss.
15 * Default content parts of the menu items that you can use for are:
16 * @li "default" - A main content of the menu item
18 * Default text parts of the menu items that you can use for are:
19 * @li "default" - label in the menu item
21 * Supported elm_object_item common APIs.
22 * @li elm_object_item_part_text_set
23 * @li elm_object_item_part_text_get
24 * @li elm_object_item_part_content_set
25 * @li elm_object_item_part_content_get
26 * @li elm_object_item_disabled_set
27 * @li elm_object_item_disabled_get
29 * @see @ref tutorial_menu
34 * @brief Add a new menu to the parent
36 * @param parent The parent object.
37 * @return The new object or NULL if it cannot be created.
39 EAPI Evas_Object *elm_menu_add(Evas_Object *parent);
42 * @brief Set the parent for the given menu widget
44 * @param obj The menu object.
45 * @param parent The new parent.
47 EAPI void elm_menu_parent_set(Evas_Object *obj, Evas_Object *parent);
50 * @brief Get the parent for the given menu widget
52 * @param obj The menu object.
55 * @see elm_menu_parent_set()
57 EAPI Evas_Object *elm_menu_parent_get(const Evas_Object *obj);
60 * @brief Move the menu to a new position
62 * @param obj The menu object.
63 * @param x The new position.
64 * @param y The new position.
66 * Sets the top-left position of the menu to (@p x,@p y).
68 * @note @p x and @p y coordinates are relative to parent.
70 EAPI void elm_menu_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
73 * @brief Close a opened menu
75 * @param obj the menu object
78 * Hides the menu and all it's sub-menus.
80 EAPI void elm_menu_close(Evas_Object *obj);
83 * @brief Returns a list of @p item's items.
85 * @param obj The menu object
86 * @return An Eina_List* of @p item's items
88 EAPI const Eina_List *elm_menu_items_get(const Evas_Object *obj);
91 * @brief Get the Evas_Object of an Elm_Object_Item
93 * @param it The menu item object.
94 * @return The edje object containing the swallowed content
96 * @warning Don't manipulate this object!
99 EAPI Evas_Object *elm_menu_item_object_get(const Elm_Object_Item *it);
102 * @brief Add an item at the end of the given menu widget
104 * @param obj The menu object.
105 * @param parent The parent menu item (optional)
106 * @param icon An icon display on the item. The icon will be destroyed by the menu.
107 * @param label The label of the item.
108 * @param func Function called when the user select the item.
109 * @param data Data sent by the callback.
110 * @return Returns the new item.
112 EAPI Elm_Object_Item *elm_menu_item_add(Evas_Object *obj, Elm_Object_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data);
115 * @brief Add an object swallowed in an item at the end of the given menu
118 * @param obj The menu object.
119 * @param parent The parent menu item (optional)
120 * @param subobj The object to swallow
121 * @param func Function called when the user select the item.
122 * @param data Data sent by the callback.
123 * @return Returns the new item.
125 * Add an evas object as an item to the menu.
127 //XXX: Any better API name? "_item_add_object" looks not good enough.
128 EAPI Elm_Object_Item *elm_menu_item_add_object(Evas_Object *obj, Elm_Object_Item *parent, Evas_Object *subobj, Evas_Smart_Cb func, const void *data);
131 * @brief Set the icon of a menu item to the standard icon with name @p icon
133 * @param it The menu item object.
134 * @param icon The icon object to set for the content of @p item
136 * Once this icon is set, any previously set icon will be deleted.
138 EAPI void elm_menu_item_icon_name_set(Elm_Object_Item *it, const char *icon);
141 * @brief Get the string representation from the icon of a menu item
143 * @param it The menu item object.
144 * @return The string representation of @p item's icon or NULL
146 * @see elm_menu_item_icon_name_set()
148 EAPI const char *elm_menu_item_icon_name_get(const Elm_Object_Item *it);
151 * @brief Set the selected state of @p item.
153 * @param it The menu item object.
154 * @param selected The selected/unselected state of the item
156 EAPI void elm_menu_item_selected_set(Elm_Object_Item *it, Eina_Bool selected);
159 * @brief Get the selected state of @p item.
161 * @param it The menu item object.
162 * @return The selected/unselected state of the item
164 * @see elm_menu_item_selected_set()
166 EAPI Eina_Bool elm_menu_item_selected_get(const Elm_Object_Item *it);
169 * @brief Add a separator item to menu @p obj under @p parent.
171 * @param obj The menu object
172 * @param parent The item to add the separator under
173 * @return The created item or NULL on failure
175 * This is item is a @ref Separator.
177 EAPI Elm_Object_Item *elm_menu_item_separator_add(Evas_Object *obj, Elm_Object_Item *parent);
180 * @brief Returns whether @p item is a separator.
182 * @param it The item to check
183 * @return If true, @p item is a separator
185 * @see elm_menu_item_separator_add()
187 EAPI Eina_Bool elm_menu_item_is_separator(Elm_Object_Item *it);
190 * @brief Returns a list of @p item's subitems.
193 * @return An Eina_List* of @p item's subitems
195 * @see elm_menu_add()
197 EAPI const Eina_List *elm_menu_item_subitems_get(const Elm_Object_Item *it);
200 * @brief Get the position of a menu item
202 * @param it The menu item
203 * @return The item's index
205 * This function returns the index position of a menu item in a menu.
206 * For a sub-menu, this number is relative to the first item in the sub-menu.
208 * @note Index values begin with 0
210 EAPI unsigned int elm_menu_item_index_get(const Elm_Object_Item *it);
213 * @brief Get the selected item in the menu
215 * @param obj The menu object
216 * @return The selected item, or NULL if none
218 * @see elm_menu_item_selected_get()
219 * @see elm_menu_item_selected_set()
221 EAPI Elm_Object_Item *elm_menu_selected_item_get(const Evas_Object *obj);
224 * @brief Get the last item in the menu
226 * @param obj The menu object
227 * @return The last item, or NULL if none
229 EAPI Elm_Object_Item *elm_menu_last_item_get(const Evas_Object *obj);
232 * @brief Get the first item in the menu
234 * @param obj The menu object
235 * @return The first item, or NULL if none
237 EAPI Elm_Object_Item *elm_menu_first_item_get(const Evas_Object *obj);
240 * @brief Get the next item in the menu.
242 * @param it The menu item object.
243 * @return The item after it, or NULL if none
245 EAPI Elm_Object_Item *elm_menu_item_next_get(const Elm_Object_Item *it);
248 * @brief Get the previous item in the menu.
250 * @param it The menu item object.
251 * @return The item before it, or NULL if none
253 EAPI Elm_Object_Item *elm_menu_item_prev_get(const Elm_Object_Item *it);