Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Menu_Item


Detailed Description

The Etk_Menu_Item widget is an item that can be packed in a menu shell (Etk_Menu or Etk_Menu_Bar).

menu_item.png
Several widgets inherits from Etk_Menu_Item:
  • Etk_Menu_Item_Separator: a menu item without label which used to separate two menu items
  • Etk_Menu_Item_Image: a menu item with a label and an icon on the left of the label
  • Etk_Menu_Item_Check: a menu item with a label and a checkbox on the left of the label
  • Etk_Menu_Item_Radio: a menu item with a label and a radio on the left of the label

    A menu can also be attached to the menu item with etk_menu_item_submenu_set(), and it will be popped up when the menu item is selected.

Object Hierarchy:
  • Etk_Object
    • Etk_Widget
      • Etk_Menu_Item
        • Etk_Menu_Item_Separator
        • Etk_Menu_Item_Image
        • Etk_Menu_Item_Check
          • Etk_Menu_Item_Radio
Signals:
  • "selected": Emitted when the menu item is selected
    • Callback: void callback(Etk_Menu_Item *menu_item, void *data)
      • menu_item: the menu item which has been selected
      • data: the user data set when the callback has been connected to the signal
  • "unselected": Emitted when the menu item is unselected
    • Callback: void callback(Etk_Menu_Item *menu_item, void *data)
      • menu_item: the menu item which has been unselected
      • data: the user data set when the callback has been connected to the signal
  • "activated": Emitted when the menu item is activated (mainly when it has been clicked)
    • Callback: void callback(Etk_Menu_Item *menu_item, void *data)
      • menu_item: the menu item which has been activated
      • data: the user data set when the callback has been connected to the signal
  • "toggled" (only for Etk_Menu_Item_Check and Etk_Menu_Item_Radio): Emitted when the menu item (check or radio) has been toggled
    • Callback: void callback(Etk_Menu_Item_Check *check_item, void *data)
      • menu_item: the menu item which has been toggled
      • data: the user data set when the callback has been connected to the signal
Properties:
  • "label": The text of the label of the menu item
    • Type: String (char *)
    • Access: Read/Write
    • Default Value: NULL
  • "submenu": The submenu attached to the menu item
    • Type: Pointer (Etk_Menu *)
    • Access: Read/Write
    • Default Value: NULL
  • "image" (only for Etk_Menu_Item_Image): The image widget of the menu item
    • Type: Pointer (Etk_Image *)
    • Access: Read/Write
    • Default Value: NULL
  • "active" (only for Etk_Menu_Item_Check and Etk_Menu_Item_Radio): Whether or not the menu item is active (i.e. toggled)
    • Type: Boolean
    • Access: Read/Write
    • Default Value: ETK_FALSE
  • "group" (only for Etk_Menu_Item_Radio): The group of menu items which the menu item belongs to
    • Type: Pointer (Evas_List *)
    • Access: Read/Write
    • Default Value: NULL


Data Structures

struct  Etk_Menu_Item
 [Widget] An item that can be packed in a menu shell More...
struct  Etk_Menu_Item_Separator
 [Widget] A menu-item used to separate two other items (looks like an horizontal bar in a menu) More...
struct  Etk_Menu_Item_Image
 [Widget] A menu-item with an image at the left of the label More...
struct  Etk_Menu_Item_Check
 [Widget] A menu-item with a checkbox at the left of the label More...
struct  Etk_Menu_Item_Radio
 [Widget] A menu-item with a radiobox at the left of the label More...

Defines

#define ETK_MENU_ITEM_TYPE   (etk_menu_item_type_get())
#define ETK_MENU_ITEM(obj)   (ETK_OBJECT_CAST((obj), ETK_MENU_ITEM_TYPE, Etk_Menu_Item))
#define ETK_IS_MENU_ITEM(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_ITEM_TYPE))
#define ETK_MENU_ITEM_SEPARATOR_TYPE   (etk_menu_item_separator_type_get())
#define ETK_MENU_ITEM_SEPARATOR(obj)   (ETK_OBJECT_CAST((obj), ETK_MENU_ITEM_SEPARATOR_TYPE, Etk_Menu_Item_Separator))
#define ETK_IS_MENU_ITEM_SEPARATOR(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_ITEM_SEPARATOR_TYPE))
#define ETK_MENU_ITEM_IMAGE_TYPE   (etk_menu_item_image_type_get())
#define ETK_MENU_ITEM_IMAGE(obj)   (ETK_OBJECT_CAST((obj), ETK_MENU_ITEM_IMAGE_TYPE, Etk_Menu_Item_Image))
#define ETK_IS_MENU_ITEM_IMAGE(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_ITEM_IMAGE_TYPE))
#define ETK_MENU_ITEM_CHECK_TYPE   (etk_menu_item_check_type_get())
#define ETK_MENU_ITEM_CHECK(obj)   (ETK_OBJECT_CAST((obj), ETK_MENU_ITEM_CHECK_TYPE, Etk_Menu_Item_Check))
#define ETK_IS_MENU_ITEM_CHECK(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_ITEM_CHECK_TYPE))
#define ETK_MENU_ITEM_RADIO_TYPE   (etk_menu_item_radio_type_get())
#define ETK_MENU_ITEM_RADIO(obj)   (ETK_OBJECT_CAST((obj), ETK_MENU_ITEM_RADIO_TYPE, Etk_Menu_Item_Radio))
#define ETK_IS_MENU_ITEM_RADIO(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_ITEM_RADIO_TYPE))

Functions

Etk_Widget * etk_menu_item_new (void)
 Creates a new menu-item with an empty label.
Etk_Widget * etk_menu_item_new_with_label (const char *label)
 Creates a new menu-item and sets its label to label.
Etk_Widget * etk_menu_item_new_from_stock (Etk_Stock_Id stock_id)
 Creates a new menu-item with a label defined by the stock-id.
void etk_menu_item_label_set (Etk_Menu_Item *menu_item, const char *label)
 Sets the label of the menu-item.
const char * etk_menu_item_label_get (Etk_Menu_Item *menu_item)
 Gets the label of the menu-item.
void etk_menu_item_set_from_stock (Etk_Menu_Item *menu_item, Etk_Stock_Id stock_id)
 Sets the label of the menu-item from a stock-id. If the menu-item is an Etk_Menu_Item_Image, the image is also changed depending on the stock-id.
void etk_menu_item_submenu_set (Etk_Menu_Item *menu_item, Etk_Menu *submenu)
 Sets the submenu of the menu-item: the submenu will be popped up when the menu-item is selected.
Etk_Menu * etk_menu_item_submenu_get (Etk_Menu_Item *menu_item)
 Gets the submenu attached to the menu-item.
void etk_menu_item_select (Etk_Menu_Item *menu_item)
 Selects the menu-item.
void etk_menu_item_unselect (Etk_Menu_Item *menu_item)
 Unselects the menu-item.
void etk_menu_item_activate (Etk_Menu_Item *menu_item)
 Activates the menu-item.
Etk_Widget * etk_menu_item_separator_new (void)
 Creates a new separator menu-item.
Etk_Widget * etk_menu_item_image_new (void)
 Creates a new image menu-item with an empty label.
Etk_Widget * etk_menu_item_image_new_with_label (const char *label)
 Creates a new image menu-item and sets its label to label.
Etk_Widget * etk_menu_item_image_new_from_stock (Etk_Stock_Id stock_id)
 Creates a new image menu-item with the label and the image defined by the stock-id.
void etk_menu_item_image_set (Etk_Menu_Item_Image *image_item, Etk_Image *image)
 Sets the image of the menu-item. The image will be displayed on the left of the label.
Etk_Widget * etk_menu_item_check_new (void)
 Creates a new check menu-item with an empty label.
Etk_Widget * etk_menu_item_check_new_with_label (const char *label)
 Creates a new check menu-item and sets the label to label.
void etk_menu_item_check_active_set (Etk_Menu_Item_Check *check_item, Etk_Bool active)
 Sets whether or not the check menu item is active (i.e. checked).
Etk_Bool etk_menu_item_check_active_get (Etk_Menu_Item_Check *check_item)
 Gets whether the check menu-item is active.
Etk_Widget * etk_menu_item_radio_new (Evas_List **group)
 Creates a new radio menu-item with an empty label.
Etk_Widget * etk_menu_item_radio_new_from_widget (Etk_Menu_Item_Radio *radio_item)
 Creates a new radio menu-item with an empty label and adds it to the group of another radio menu-item.
Etk_Widget * etk_menu_item_radio_new_with_label (const char *label, Evas_List **group)
 Creates a new radio menu-item and sets its label to label.
Etk_Widget * etk_menu_item_radio_new_with_label_from_widget (const char *label, Etk_Menu_Item_Radio *radio_item)
 Creates a new radio menu-item and sets its label to label. It is then added to the group of radio_item.
void etk_menu_item_radio_group_set (Etk_Menu_Item_Radio *radio_item, Evas_List **group)
 Sets the group of the radio menu-item.
Evas_List ** etk_menu_item_radio_group_get (Etk_Menu_Item_Radio *radio_item)
 Gets the group of the radio menu-item.


Define Documentation

#define ETK_MENU_ITEM_TYPE   (etk_menu_item_type_get())

Gets the type of a menu item

#define ETK_MENU_ITEM ( obj   )     (ETK_OBJECT_CAST((obj), ETK_MENU_ITEM_TYPE, Etk_Menu_Item))

Casts the object to an Etk_Menu_Item

#define ETK_IS_MENU_ITEM ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_ITEM_TYPE))

Checks if the object is an Etk_Menu_Item

#define ETK_MENU_ITEM_SEPARATOR_TYPE   (etk_menu_item_separator_type_get())

Gets the type of a menu item separator

#define ETK_MENU_ITEM_SEPARATOR ( obj   )     (ETK_OBJECT_CAST((obj), ETK_MENU_ITEM_SEPARATOR_TYPE, Etk_Menu_Item_Separator))

Casts the object to an Etk_Menu_Item_Separator

#define ETK_IS_MENU_ITEM_SEPARATOR ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_ITEM_SEPARATOR_TYPE))

Checks if the object is an Etk_Menu_Item_Separator

#define ETK_MENU_ITEM_IMAGE_TYPE   (etk_menu_item_image_type_get())

Gets the type of a menu item image

#define ETK_MENU_ITEM_IMAGE ( obj   )     (ETK_OBJECT_CAST((obj), ETK_MENU_ITEM_IMAGE_TYPE, Etk_Menu_Item_Image))

Casts the object to an Etk_Menu_Item_Image

#define ETK_IS_MENU_ITEM_IMAGE ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_ITEM_IMAGE_TYPE))

Checks if the object is an Etk_Menu_Item_Image

#define ETK_MENU_ITEM_CHECK_TYPE   (etk_menu_item_check_type_get())

Gets the type of a menu item check

#define ETK_MENU_ITEM_CHECK ( obj   )     (ETK_OBJECT_CAST((obj), ETK_MENU_ITEM_CHECK_TYPE, Etk_Menu_Item_Check))

Casts the object to an Etk_Menu_Item_Check

#define ETK_IS_MENU_ITEM_CHECK ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_ITEM_CHECK_TYPE))

Checks if the object is an Etk_Menu_Item_Check

#define ETK_MENU_ITEM_RADIO_TYPE   (etk_menu_item_radio_type_get())

Gets the type of a menu item radio

#define ETK_MENU_ITEM_RADIO ( obj   )     (ETK_OBJECT_CAST((obj), ETK_MENU_ITEM_RADIO_TYPE, Etk_Menu_Item_Radio))

Casts the object to an Etk_Menu_Item_Radio

#define ETK_IS_MENU_ITEM_RADIO ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_ITEM_RADIO_TYPE))

Radios if the object is an Etk_Menu_Item_Radio


Function Documentation

Etk_Widget * etk_menu_item_new ( void   ) 

Creates a new menu-item with an empty label.

Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation

Etk_Widget * etk_menu_item_new_with_label ( const char *  label  ) 

Creates a new menu-item and sets its label to label.

Parameters:
label the label to set to the new menu item
Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation

Etk_Widget * etk_menu_item_new_from_stock ( Etk_Stock_Id  stock_id  ) 

Creates a new menu-item with a label defined by the stock-id.

Parameters:
stock_id the stock-id corresponding to the label
Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation
See also:
Etk_Stock

void etk_menu_item_label_set ( Etk_Menu_Item *  menu_item,
const char *  label 
)

Sets the label of the menu-item.

Parameters:
menu_item a menu-item
label the label to set

const char * etk_menu_item_label_get ( Etk_Menu_Item *  menu_item  ) 

Gets the label of the menu-item.

Parameters:
menu_item a menu-item
Returns:
Returns the label of the menu-item

void etk_menu_item_set_from_stock ( Etk_Menu_Item *  menu_item,
Etk_Stock_Id  stock_id 
)

Sets the label of the menu-item from a stock-id. If the menu-item is an Etk_Menu_Item_Image, the image is also changed depending on the stock-id.

Parameters:
menu_item a menu-item
stock_id the stock-id corresponding to the label and the image you want to use
See also:
Etk_Stock

void etk_menu_item_submenu_set ( Etk_Menu_Item *  menu_item,
Etk_Menu *  submenu 
)

Sets the submenu of the menu-item: the submenu will be popped up when the menu-item is selected.

Parameters:
menu_item a menu-item
submenu the submenu to attach to the menu-item

Etk_Menu * etk_menu_item_submenu_get ( Etk_Menu_Item *  menu_item  ) 

Gets the submenu attached to the menu-item.

Parameters:
menu_item a menu-item
Returns:
Returns the submenu attached to the menu-item

void etk_menu_item_select ( Etk_Menu_Item *  menu_item  ) 

Selects the menu-item.

Parameters:
menu_item a menu-item

void etk_menu_item_unselect ( Etk_Menu_Item *  menu_item  ) 

Unselects the menu-item.

Parameters:
menu_item a menu-item

void etk_menu_item_activate ( Etk_Menu_Item *  menu_item  ) 

Activates the menu-item.

Parameters:
menu_item a menu-item

Etk_Widget * etk_menu_item_separator_new ( void   ) 

Creates a new separator menu-item.

Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation

Etk_Widget * etk_menu_item_image_new ( void   ) 

Creates a new image menu-item with an empty label.

Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation

Etk_Widget * etk_menu_item_image_new_with_label ( const char *  label  ) 

Creates a new image menu-item and sets its label to label.

Parameters:
label the label to set to the new menu-item
Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation

Etk_Widget * etk_menu_item_image_new_from_stock ( Etk_Stock_Id  stock_id  ) 

Creates a new image menu-item with the label and the image defined by the stock-id.

Parameters:
stock_id the stock-id corresponding to the label and the image
Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation
See also:
Etk_Stock

void etk_menu_item_image_set ( Etk_Menu_Item_Image *  image_item,
Etk_Image *  image 
)

Sets the image of the menu-item. The image will be displayed on the left of the label.

Parameters:
image_item an image menu-item
image the image to set (NULL to remove the image)

Etk_Widget * etk_menu_item_check_new ( void   ) 

Creates a new check menu-item with an empty label.

Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation

Etk_Widget * etk_menu_item_check_new_with_label ( const char *  label  ) 

Creates a new check menu-item and sets the label to label.

Parameters:
label the label to set to the new menu-item
Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation

void etk_menu_item_check_active_set ( Etk_Menu_Item_Check *  check_item,
Etk_Bool  active 
)

Sets whether or not the check menu item is active (i.e. checked).

Parameters:
check_item a check menu-item
active if active == ETK_TRUE, the check menu-item will be active

Etk_Bool etk_menu_item_check_active_get ( Etk_Menu_Item_Check *  check_item  ) 

Gets whether the check menu-item is active.

Parameters:
check_item a check menu-item
Returns:
Returns ETK_TRUE if check_item is active, ETK_FALSE otherwise

Etk_Widget * etk_menu_item_radio_new ( Evas_List **  group  ) 

Creates a new radio menu-item with an empty label.

Parameters:
group the group which the radio menu-item will be added to (NULL if the radio menu-item should create its own group)
Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation

Etk_Widget * etk_menu_item_radio_new_from_widget ( Etk_Menu_Item_Radio *  radio_item  ) 

Creates a new radio menu-item with an empty label and adds it to the group of another radio menu-item.

Parameters:
radio_item the radio menu-item whose group will be used for the new radio menu-item
Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation

Etk_Widget * etk_menu_item_radio_new_with_label ( const char *  label,
Evas_List **  group 
)

Creates a new radio menu-item and sets its label to label.

Parameters:
label the label to set to the new menu-item
group the group which the radio menu-item will be added to (NULL if the radio menu-item should create its own group)
Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation

Etk_Widget * etk_menu_item_radio_new_with_label_from_widget ( const char *  label,
Etk_Menu_Item_Radio *  radio_item 
)

Creates a new radio menu-item and sets its label to label. It is then added to the group of radio_item.

Parameters:
label the label to set to the new menu-item
radio_item the radio menu-item whose group will be used for the new radio menu-item
Returns:
Returns the new menu-item widget
Note:
Unlike the other widgets, the menu-item will automatically shown at its creation

void etk_menu_item_radio_group_set ( Etk_Menu_Item_Radio *  radio_item,
Evas_List **  group 
)

Sets the group of the radio menu-item.

Parameters:
radio_item a radio menu-item
group the group to set

Evas_List ** etk_menu_item_radio_group_get ( Etk_Menu_Item_Radio *  radio_item  ) 

Gets the group of the radio menu-item.

Parameters:
radio_item a radio menu-item
Returns:
Returns the group of the radio menu-item