Cross-platform C SDK logo

Cross-platform C SDK

Menu

❮ Back
Next ❯
This page has been automatically translated using the Google Translate API services. We are working on improving texts. Thank you for your understanding and patience.

Functions

Menu*menu_create (void)
voidmenu_destroy (...)
voidmenu_launch (...)
voidmenu_hide (...)
voidmenu_item (...)
voidmenu_off_items (...)
MenuItem*menu_get_item (...)
uint32_tmenu_size (...)

A Menu is nothing more than a container (or window) that integrates a series of options, also called items or MenuItems (Figure 1). Each one of them have a short text, optionally an icon and optionally also a keyboard shortcut, such as the classic Ctrl+C/Ctrl+V to copy and paste. Additionally, an item can house a submenu forming a hierarchy with different levels of depth. In Products you have a sample application that uses menus.

Capturing the menu bar of a desktop application.
Figure 1: Menu bar in Windows, macOS and Linux.

The concept of the menu, like that of the window, exists from the origin of the graphic interfaces. The first computer to incorporate them was the Xerox Alto that appeared in 1973 and its commercial successor the Xerox Star. Concepts still very alive today such as: Menu, Window, Icon, Desk, or Mouse were already present on these computers that served as inspiration to Steve Jobs in the creation of Apple Lisa (Figure 2), predecessor of Machintosh and inspirer of Microsoft Windows.

Apple Lisa desktop environment capture.
Figure 2: The Apple Lisa was one of the first systems to incorporate menus as part of the graphical interface.

menu_create ()

Create a new menu.

Menu*
menu_create(void);

Return

The new menu.


menu_destroy ()

Destroy a menu and its entire hierarchy.

void
menu_destroy(Menu **menu);
menu

The menu. Will be set to NULL after destruction.


menu_launch ()

Launch a menu as secondary or PopUp.

void
menu_launch(Menu *menu,
            const V2Df position);
menu

The menu.

position

Coordinates of the upper left corner.


menu_hide ()

Hides a secondary PopUp menu.

void
menu_hide(Menu *menu);
menu

The menu.


menu_item ()

Add an item to the menu.

void
menu_item(Menu *menu,
          MenuItem *item);
menu

The menu.

item

The item to add.


menu_off_items ()

Set status ekGUI_OFF for all menu items.

void
menu_off_items(Menu *menu);
menu

The menu.


menu_get_item ()

Get an item from the menu.

MenuItem*
menu_get_item(Menu *menu,
              const uint32_t index);
menu

The menu.

index

The index of the item.

Return

The item.


menu_size ()

Gets the number of items.

uint32_t
menu_size(const Menu *menu);
menu

The menu.

Return

Number of items.

❮ Back
Next ❯