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 contents 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 * @see @ref tutorial_menu
26 * @brief Add a new menu to the parent
28 * @param parent The parent object.
29 * @return The new object or NULL if it cannot be created.
32 elm_menu_add(Evas_Object *parent)
36 * @brief Set the parent for the given menu widget
38 * @param obj The menu object.
39 * @param parent The new parent.
41 EAPI void elm_menu_parent_set(Evas_Object *obj, Evas_Object *parent) EINA_ARG_NONNULL(1);
44 * @brief Get the parent for the given menu widget
46 * @param obj The menu object.
49 * @see elm_menu_parent_set()
51 EAPI Evas_Object *elm_menu_parent_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
54 * @brief Move the menu to a new position
56 * @param obj The menu object.
57 * @param x The new position.
58 * @param y The new position.
60 * Sets the top-left position of the menu to (@p x,@p y).
62 * @note @p x and @p y coordinates are relative to parent.
64 EAPI void elm_menu_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) EINA_ARG_NONNULL(1);
67 * @brief Close a opened menu
69 * @param obj the menu object
72 * Hides the menu and all it's sub-menus.
74 EAPI void elm_menu_close(Evas_Object *obj) EINA_ARG_NONNULL(1);
77 * @brief Returns a list of @p item's items.
79 * @param obj The menu object
80 * @return An Eina_List* of @p item's items
82 EAPI const Eina_List *elm_menu_items_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
85 * @brief Get the Evas_Object of an Elm_Object_Item
87 * @param it The menu item object.
88 * @return The edje object containing the swallowed content
90 * @warning Don't manipulate this object!
93 EAPI Evas_Object *elm_menu_item_object_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
96 * @brief Add an item at the end of the given menu widget
98 * @param obj The menu object.
99 * @param parent The parent menu item (optional)
100 * @param icon An icon display on the item. The icon will be destryed by the menu.
101 * @param label The label of the item.
102 * @param func Function called when the user select the item.
103 * @param data Data sent by the callback.
104 * @return Returns the new item.
106 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) EINA_ARG_NONNULL(1);
109 * @brief Add an object swallowed in an item at the end of the given menu
112 * @param obj The menu object.
113 * @param parent The parent menu item (optional)
114 * @param subobj The object to swallow
115 * @param func Function called when the user select the item.
116 * @param data Data sent by the callback.
117 * @return Returns the new item.
119 * Add an evas object as an item to the menu.
121 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) EINA_ARG_NONNULL(1);
124 * @brief Set the label of a menu item
126 * @param it The menu item object.
127 * @param label The label to set for @p item
129 * @warning Don't use this funcion on items created with
130 * elm_menu_item_add_object() or elm_menu_item_separator_add().
132 * @deprecated Use elm_object_item_text_set() instead
134 EINA_DEPRECATED EAPI void elm_menu_item_label_set(Elm_Object_Item *it, const char *label) EINA_ARG_NONNULL(1);
137 * @brief Get the label of a menu item
139 * @param it The menu item object.
140 * @return The label of @p item
141 * @deprecated Use elm_object_item_text_get() instead
143 EINA_DEPRECATED EAPI const char *elm_menu_item_label_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
146 * @brief Set the icon of a menu item to the standard icon with name @p icon
148 * @param it The menu item object.
149 * @param icon The icon object to set for the content of @p item
151 * Once this icon is set, any previously set icon will be deleted.
153 EAPI void elm_menu_item_object_icon_name_set(Elm_Object_Item *it, const char *icon) EINA_ARG_NONNULL(1, 2);
156 * @brief Get the string representation from the icon of a menu item
158 * @param it The menu item object.
159 * @return The string representation of @p item's icon or NULL
161 * @see elm_menu_item_object_icon_name_set()
163 EAPI const char *elm_menu_item_object_icon_name_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
166 * @brief Set the content object of a menu item
168 * @param it The menu item object
169 * @param The content object or NULL
170 * @return EINA_TRUE on success, else EINA_FALSE
172 * Use this function to change the object swallowed by a menu item, deleting
173 * any previously swallowed object.
175 * @deprecated Use elm_object_item_content_set() instead
177 EINA_DEPRECATED EAPI Eina_Bool elm_menu_item_object_content_set(Elm_Object_Item *it, Evas_Object *obj) EINA_ARG_NONNULL(1);
180 * @brief Get the content object of a menu item
182 * @param it The menu item object
183 * @return The content object or NULL
184 * @note If @p item was added with elm_menu_item_add_object, this
185 * function will return the object passed, else it will return the
188 * @see elm_menu_item_object_content_set()
190 * @deprecated Use elm_object_item_content_get() instead
192 EINA_DEPRECATED EAPI Evas_Object *elm_menu_item_object_content_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
195 * @brief Set the selected state of @p item.
197 * @param it The menu item object.
198 * @param selected The selected/unselected state of the item
200 EAPI void elm_menu_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) EINA_ARG_NONNULL(1);
203 * @brief Get the selected state of @p item.
205 * @param it The menu item object.
206 * @return The selected/unselected state of the item
208 * @see elm_menu_item_selected_set()
210 EAPI Eina_Bool elm_menu_item_selected_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
213 * @brief Set the disabled state of @p item.
215 * @param it The menu item object.
216 * @param disabled The enabled/disabled state of the item
217 * @deprecated Use elm_object_item_disabled_set() instead
219 EINA_DEPRECATED EAPI void elm_menu_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled) EINA_ARG_NONNULL(1);
222 * @brief Get the disabled state of @p item.
224 * @param it The menu item object.
225 * @return The enabled/disabled state of the item
227 * @see elm_menu_item_disabled_set()
228 * @deprecated Use elm_object_item_disabled_get() instead
230 EINA_DEPRECATED EAPI Eina_Bool elm_menu_item_disabled_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
233 * @brief Add a separator item to menu @p obj under @p parent.
235 * @param obj The menu object
236 * @param parent The item to add the separator under
237 * @return The created item or NULL on failure
239 * This is item is a @ref Separator.
241 EAPI Elm_Object_Item *elm_menu_item_separator_add(Evas_Object *obj, Elm_Object_Item *parent) EINA_ARG_NONNULL(1);
244 * @brief Returns whether @p item is a separator.
246 * @param it The item to check
247 * @return If true, @p item is a separator
249 * @see elm_menu_item_separator_add()
251 EAPI Eina_Bool elm_menu_item_is_separator(Elm_Object_Item *it) EINA_ARG_NONNULL(1);
254 * @brief Deletes an item from the menu.
256 * @param it The item to delete.
258 * @see elm_menu_item_add()
260 EAPI void elm_menu_item_del(Elm_Object_Item *it) EINA_ARG_NONNULL(1);
263 * @brief Set the function called when a menu item is deleted.
265 * @param it The item to set the callback on
266 * @param func The function called
268 * @see elm_menu_item_add()
269 * @see elm_menu_item_del()
271 EAPI void elm_menu_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) EINA_ARG_NONNULL(1);
274 * @brief Returns the data associated with menu item @p item.
277 * @return The data associated with @p item or NULL if none was set.
279 * This is the data set with elm_menu_add() or elm_menu_item_data_set().
281 * @deprecated Use elm_object_item_data_get() instead
283 EINA_DEPRECATED EAPI void *elm_menu_item_data_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
286 * @brief Sets the data to be associated with menu item @p item.
289 * @param data The data to be associated with @p item
291 * @deprecated Use elm_object_item_data_set() instead
293 EINA_DEPRECATED EAPI void elm_menu_item_data_set(Elm_Object_Item *it, const void *data) EINA_ARG_NONNULL(1);
296 * @brief Returns a list of @p item's subitems.
299 * @return An Eina_List* of @p item's subitems
301 * @see elm_menu_add()
303 EAPI const Eina_List *elm_menu_item_subitems_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
306 * @brief Get the position of a menu item
308 * @param it The menu item
309 * @return The item's index
311 * This function returns the index position of a menu item in a menu.
312 * For a sub-menu, this number is relative to the first item in the sub-menu.
314 * @note Index values begin with 0
316 EAPI unsigned int elm_menu_item_index_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1) EINA_PURE;
319 * @brief @brief Return a menu item's owner menu
321 * @param it The menu item
322 * @return The menu object owning @p item, or NULL on failure
324 * Use this function to get the menu object owning an item.
326 EAPI Evas_Object *elm_menu_item_menu_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1) EINA_PURE;
329 * @brief Get the selected item in the menu
331 * @param obj The menu object
332 * @return The selected item, or NULL if none
334 * @see elm_menu_item_selected_get()
335 * @see elm_menu_item_selected_set()
337 EAPI Elm_Object_Item *elm_menu_selected_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
340 * @brief Get the last item in the menu
342 * @param obj The menu object
343 * @return The last item, or NULL if none
345 EAPI Elm_Object_Item *elm_menu_last_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
348 * @brief Get the first item in the menu
350 * @param obj The menu object
351 * @return The first item, or NULL if none
353 EAPI Elm_Object_Item *elm_menu_first_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
356 * @brief Get the next item in the menu.
358 * @param it The menu item object.
359 * @return The item after it, or NULL if none
361 EAPI Elm_Object_Item *elm_menu_item_next_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
364 * @brief Get the previous item in the menu.
366 * @param it The menu item object.
367 * @return The item before it, or NULL if none
369 EAPI Elm_Object_Item *elm_menu_item_prev_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);