mirror of
https://codeberg.org/adnano/wmenu.git
synced 2025-10-29 05:40:20 -04:00
Streamline menu callbacks
This commit is contained in:
parent
a0df7959f9
commit
7d717b3696
5 changed files with 42 additions and 36 deletions
7
menu.h
7
menu.h
|
|
@ -6,6 +6,9 @@
|
|||
#include <xkbcommon/xkbcommon.h>
|
||||
#include <wayland-client.h>
|
||||
|
||||
struct menu;
|
||||
typedef void (*menu_callback)(struct menu *menu, char *text, bool exit);
|
||||
|
||||
// A menu item.
|
||||
struct item {
|
||||
char *text;
|
||||
|
|
@ -68,12 +71,12 @@ struct menu {
|
|||
struct item *sel; // selected item
|
||||
struct page *pages; // list of pages
|
||||
|
||||
void (*callback)(struct menu *menu);
|
||||
menu_callback callback;
|
||||
bool exit;
|
||||
bool failure;
|
||||
};
|
||||
|
||||
struct menu *menu_create();
|
||||
struct menu *menu_create(menu_callback callback);
|
||||
void menu_destroy(struct menu *menu);
|
||||
void menu_getopts(struct menu *menu, int argc, char *argv[]);
|
||||
void menu_add_item(struct menu *menu, char *text, bool sort);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue