Menu

Functions

Evas_Object * elm_menu_add (Evas_Object *parent)
 Add a new menu to the parent.
void elm_menu_parent_set (Evas_Object *obj, Evas_Object *parent)
 Set the parent for the given menu widget.
Evas_Object * elm_menu_parent_get (const Evas_Object *obj)
 Get the parent for the given menu widget.
void elm_menu_move (Evas_Object *obj, Evas_Coord x, Evas_Coord y)
 Move the menu to a new position.
void elm_menu_close (Evas_Object *obj)
 Close a opened menu.
const Eina_List * elm_menu_items_get (const Evas_Object *obj)
 Returns a list of item's items.
Evas_Object * elm_menu_item_object_get (const Elm_Object_Item *it)
 Get the Evas_Object of an Elm_Object_Item.
Elm_Object_Itemelm_menu_item_add (Evas_Object *obj, Elm_Object_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data)
 Add an item at the end of the given menu widget.
void elm_menu_item_icon_name_set (Elm_Object_Item *it, const char *icon)
 Set the icon of a menu item to the standard icon with name icon.
const char * elm_menu_item_icon_name_get (const Elm_Object_Item *it)
 Get the string representation from the icon of a menu item.
void elm_menu_item_selected_set (Elm_Object_Item *it, Eina_Bool selected)
 Set the selected state of item.
Eina_Bool elm_menu_item_selected_get (const Elm_Object_Item *it)
 Get the selected state of item.
Elm_Object_Itemelm_menu_item_separator_add (Evas_Object *obj, Elm_Object_Item *parent)
 Add a separator item to menu obj under parent.
Eina_Bool elm_menu_item_is_separator (Elm_Object_Item *it)
 Returns whether item is a separator.
const Eina_List * elm_menu_item_subitems_get (const Elm_Object_Item *it)
 Returns a list of item's subitems.
unsigned int elm_menu_item_index_get (const Elm_Object_Item *it)
 Get the position of a menu item.
Elm_Object_Itemelm_menu_selected_item_get (const Evas_Object *obj)
 Get the selected item in the menu.
Elm_Object_Itemelm_menu_last_item_get (const Evas_Object *obj)
 Get the last item in the menu.
Elm_Object_Itemelm_menu_first_item_get (const Evas_Object *obj)
 Get the first item in the menu.
Elm_Object_Itemelm_menu_item_next_get (const Elm_Object_Item *it)
 Get the next item in the menu.
Elm_Object_Itemelm_menu_item_prev_get (const Elm_Object_Item *it)
 Get the previous item in the menu.

Detailed Description

menu_inheritance_tree.png
preview-00.png

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:

  • "clicked" - the user clicked the empty space in the menu to dismiss.

Default content parts of the menu items that you can use for are:

  • "default" - A main content of the menu item

Default text parts of the menu items that you can use for are:

  • "default" - label in the menu item

Supported elm_object_item common APIs.

See also:
Menu Example

Function Documentation

Evas_Object* elm_menu_add ( Evas_Object *  parent)

Add a new menu to the parent.

Parameters:
parentThe parent object.
Returns:
The new object or NULL if it cannot be created.
void elm_menu_close ( Evas_Object *  obj)

Close a opened menu.

Parameters:
objthe menu object
Returns:
void

Hides the menu and all it's sub-menus.

Elm_Object_Item* elm_menu_first_item_get ( const Evas_Object *  obj)

Get the first item in the menu.

Parameters:
objThe menu object
Returns:
The first item, or NULL if none
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 
)

Add an item at the end of the given menu widget.

Parameters:
objThe menu object.
parentThe parent menu item (optional)
iconAn icon display on the item. The icon will be destroyed by the menu.
labelThe label of the item.
funcFunction called when the user select the item.
dataData sent by the callback.
Returns:
Returns the new item.

References elm_icon_add(), elm_menu_item_icon_name_set(), and elm_object_item_text_set.

const char* elm_menu_item_icon_name_get ( const Elm_Object_Item it)

Get the string representation from the icon of a menu item.

Parameters:
itThe menu item object.
Returns:
The string representation of item's icon or NULL
See also:
elm_menu_item_icon_name_set()
void elm_menu_item_icon_name_set ( Elm_Object_Item it,
const char *  icon 
)

Set the icon of a menu item to the standard icon with name icon.

Parameters:
itThe menu item object.
iconThe name of icon object to set for the content of item

Once this icon is set, any previously set icon will be deleted.

References elm_icon_standard_set().

Referenced by elm_menu_item_add().

unsigned int elm_menu_item_index_get ( const Elm_Object_Item it)

Get the position of a menu item.

Parameters:
itThe menu item
Returns:
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
Eina_Bool elm_menu_item_is_separator ( Elm_Object_Item it)

Returns whether item is a separator.

Parameters:
itThe item to check
Returns:
If true, item is a separator
See also:
elm_menu_item_separator_add()
Elm_Object_Item* elm_menu_item_next_get ( const Elm_Object_Item it)

Get the next item in the menu.

Parameters:
itThe menu item object.
Returns:
The item after it, or NULL if none
Evas_Object* elm_menu_item_object_get ( const Elm_Object_Item it)

Get the Evas_Object of an Elm_Object_Item.

Parameters:
itThe menu item object.
Returns:
The edje object containing the swallowed content
Warning:
Don't manipulate this object!
Elm_Object_Item* elm_menu_item_prev_get ( const Elm_Object_Item it)

Get the previous item in the menu.

Parameters:
itThe menu item object.
Returns:
The item before it, or NULL if none
Eina_Bool elm_menu_item_selected_get ( const Elm_Object_Item it)

Get the selected state of item.

Parameters:
itThe menu item object.
Returns:
The selected/unselected state of the item
See also:
elm_menu_item_selected_set()
void elm_menu_item_selected_set ( Elm_Object_Item it,
Eina_Bool  selected 
)

Set the selected state of item.

Parameters:
itThe menu item object.
selectedThe selected/unselected state of the item
Elm_Object_Item* elm_menu_item_separator_add ( Evas_Object *  obj,
Elm_Object_Item parent 
)

Add a separator item to menu obj under parent.

Parameters:
objThe menu object
parentThe item to add the separator under
Returns:
The created item or NULL on failure

This is item is a Separator.

References elm_box_pack_end().

const Eina_List* elm_menu_item_subitems_get ( const Elm_Object_Item it)

Returns a list of item's subitems.

Parameters:
itThe item
Returns:
An Eina_List* of item's subitems
See also:
elm_menu_add()
const Eina_List* elm_menu_items_get ( const Evas_Object *  obj)

Returns a list of item's items.

Parameters:
objThe menu object
Returns:
An Eina_List* of item's items
Elm_Object_Item* elm_menu_last_item_get ( const Evas_Object *  obj)

Get the last item in the menu.

Parameters:
objThe menu object
Returns:
The last item, or NULL if none
void elm_menu_move ( Evas_Object *  obj,
Evas_Coord  x,
Evas_Coord  y 
)

Move the menu to a new position.

Parameters:
objThe menu object.
xThe new position.
yThe new position.

Sets the top-left position of the menu to (x,y).

Note:
x and y coordinates are relative to parent.
Evas_Object* elm_menu_parent_get ( const Evas_Object *  obj)

Get the parent for the given menu widget.

Parameters:
objThe menu object.
Returns:
The parent.
See also:
elm_menu_parent_set()
void elm_menu_parent_set ( Evas_Object *  obj,
Evas_Object *  parent 
)

Set the parent for the given menu widget.

Parameters:
objThe menu object.
parentThe new parent.

References elm_hover_parent_set().

Referenced by elm_toolbar_menu_parent_set().

Elm_Object_Item* elm_menu_selected_item_get ( const Evas_Object *  obj)

Get the selected item in the menu.

Parameters:
objThe menu object
Returns:
The selected item, or NULL if none
See also:
elm_menu_item_selected_get()
elm_menu_item_selected_set()