idunn: menus: a card in a popup (the card colour, a border, the radius, the md shadow, 4 pixels inside) with items of 32 pixels: an icon, the text and a shortcut in the muted colour; check items, separators and sub-menus.
More...
|
| idunn_menu_t * | idunn_menu_new (void) |
| void | idunn_menu_free (idunn_menu_t *menu) |
| | free a menu (not while it is open) and its sub-menus
|
| int | idunn_menu_add (idunn_menu_t *menu, const char *icon, const char *text, const char *shortcut, idunn_callback_t on_choose, void *data) |
| | an item: a Lucide icon (or NULL), text and a shortcut to show (or NULL).
|
| int | idunn_menu_add_check (idunn_menu_t *menu, const char *text, bool checked, idunn_callback_t on_choose, void *data) |
| | an item with a check that a choice turns on and off
|
| void | idunn_menu_add_separator (idunn_menu_t *menu) |
| int | idunn_menu_add_sub (idunn_menu_t *menu, const char *icon, const char *text, idunn_menu_t *sub) |
| | an item that opens a sub-menu (the menu owns it)
|
| void | idunn_menu_set_disabled (idunn_menu_t *menu, int item, bool disabled) |
| bool | idunn_menu_checked (const idunn_menu_t *menu, int item) |
| void | idunn_menu_set_checked (idunn_menu_t *menu, int item, bool checked) |
| void | idunn_menu_set_min_width (idunn_menu_t *menu, int32_t width) |
| | the least width of the menu, in design pixels (160 by default)
|
| idunn_window_t * | idunn_menu_open (idunn_menu_t *menu, idunn_widget_t *owner, gfx_rect_t anchor, int current, void(*on_closed)(void *data), void *data) |
| | open a menu next to anchor (a rect in owner's window), with item current (or -1) as the current one; on_closed (or NULL) is called when it closes.
|
| void | idunn_menu_popup (idunn_menu_t *menu, idunn_widget_t *owner) |
| | open the menu under a widget (a button's on_click does it)
|
| void | idunn_menu_popup_at_pointer (idunn_menu_t *menu, idunn_widget_t *owner) |
| | open the menu where the last right click was (a context menu)
|
idunn: menus: a card in a popup (the card colour, a border, the radius, the md shadow, 4 pixels inside) with items of 32 pixels: an icon, the text and a shortcut in the muted colour; check items, separators and sub-menus.
keys: Up and Down (past separators and disabled items), Home and End, Enter and Space choose, Right opens a sub-menu, Left and Escape close a menu, a letter goes to the next item that starts with it. the mouse: the item under the pointer is the current one, a sub-menu opens after 150 ms over its item, a click chooses.