Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Menu


Detailed Description

The Etk_Menu widget is a menu shell implemented in a popup window.

menu.png
The items of the menu are packed vertically.
To add or remove items, you have to use the functions provided by the Etk_Menu_Shell: etk_menu_shell_append(), etk_menu_shell_remove()...

A menu is usually popped up by clicking on an item of a menu bar, or by activating an item of another menu.
You can also pop up a menu at the mouse position with etk_menu_popup() or at a specific position with etk_menu_popup_at_xy().
The menu can then be popped down with etk_menu_popdown().
Never use etk_widget_show() and etk_widget_hide() on a menu to make it pop up/down.

Object Hierarchy:
  • Etk_Object
    • Etk_Widget
      • Etk_Menu_Shell
        • Etk_Menu
Signals:
  • "popped-up": Emitted when the the menu has been popped up
    • Callback: void callback(Etk_Menu *menu, void *data)
      • menu: the menu that has been popped up
      • data: the user data set when the callback has been connected to the signal
  • "popped-down": Emitted when the the menu has been popped down
    • Callback: void callback(Etk_Menu *menu, void *data)
      • menu: the menu that has been popped down
      • data: the user data set when the callback has been connected to the signal
Properties:
  • "parent-item": The menu-item which the menu is attached to
    • Type: Pointer (Etk_Menu_Item *)
    • Access: Read/Write
    • Default Value: NULL


Data Structures

struct  Etk_Menu
 [Widget] A menu shell implemented in a popup window More...

Defines

#define ETK_MENU_TYPE   (etk_menu_type_get())
#define ETK_MENU(obj)   (ETK_OBJECT_CAST((obj), ETK_MENU_TYPE, Etk_Menu))
#define ETK_IS_MENU(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_TYPE))

Functions

Etk_Widget * etk_menu_new (void)
 Creates a new menu.
Etk_Menu_Item * etk_menu_parent_item_get (Etk_Menu *menu)
 Gets the menu-item which the menu is attached to.
void etk_menu_popup (Etk_Menu *menu)
 Pops up the menu at the mouse position.
void etk_menu_popup_in_direction (Etk_Menu *menu, Etk_Popup_Direction direction)
 Pops up the menu at the mouse position, in the given direction.
void etk_menu_popup_at_xy (Etk_Menu *menu, int x, int y)
 Pops up the menu at the position (x, y).
void etk_menu_popup_at_xy_in_direction (Etk_Menu *menu, int x, int y, Etk_Popup_Direction direction)
 Pops up the menu at the position (x, y), in the given direction.
void etk_menu_popdown (Etk_Menu *menu)
 Pops down the menu and all its submenus (menus attached to its items).


Define Documentation

#define ETK_MENU_TYPE   (etk_menu_type_get())

Gets the type of a menu

#define ETK_MENU ( obj   )     (ETK_OBJECT_CAST((obj), ETK_MENU_TYPE, Etk_Menu))

Casts the object to an Etk_Menu

#define ETK_IS_MENU ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_MENU_TYPE))

Check if the object is an Etk_Menu


Function Documentation

Etk_Widget * etk_menu_new ( void   ) 

Creates a new menu.

Returns:
Returns the new menu widget

Etk_Menu_Item * etk_menu_parent_item_get ( Etk_Menu *  menu  ) 

Gets the menu-item which the menu is attached to.

Parameters:
menu a menu
Returns:
Returns the menu-item which the menu is attached to
See also:
etk_menu_item_submenu_set()

void etk_menu_popup ( Etk_Menu *  menu  ) 

Pops up the menu at the mouse position.

Parameters:
menu a menu

void etk_menu_popup_in_direction ( Etk_Menu *  menu,
Etk_Popup_Direction  direction 
)

Pops up the menu at the mouse position, in the given direction.

Parameters:
menu a menu
direction the direction to which the menu should be popped up

void etk_menu_popup_at_xy ( Etk_Menu *  menu,
int  x,
int  y 
)

Pops up the menu at the position (x, y).

Parameters:
menu a menu
x the x component of the position where to popup the menu
y the y component of the position where to popup the menu

void etk_menu_popup_at_xy_in_direction ( Etk_Menu *  menu,
int  x,
int  y,
Etk_Popup_Direction  direction 
)

Pops up the menu at the position (x, y), in the given direction.

Parameters:
menu a menu
x the x component of the position where to popup the menu
y the y component of the position where to popup the menu
direction the direction to which the menu should be popped up

void etk_menu_popdown ( Etk_Menu *  menu  ) 

Pops down the menu and all its submenus (menus attached to its items).

Parameters:
menu a menu