forked from Yadciel/c_tray
added submenu
This commit is contained in:
22
example.c
22
example.c
@@ -39,15 +39,23 @@ static void quit_cb(struct tray_menu *item) {
|
||||
tray_exit();
|
||||
}
|
||||
|
||||
static void submenu_cb(struct tray_submenu *item) {
|
||||
(void)item;
|
||||
printf("submenu cb\n");
|
||||
tray_update(&tray);
|
||||
}
|
||||
|
||||
//struct tray_submenu *t_sm = (struct tray_submenu[]){{"First",submenu_cb}, {"Second",submenu_cb}, {NULL, NULL},};
|
||||
|
||||
static struct tray tray = {
|
||||
.icon = TRAY_ICON1,
|
||||
.menu = (struct tray_menu[]){{"Hello", 0, 0, hello_cb, NULL},
|
||||
{"Checked", 0, 1, toggle_cb, NULL},
|
||||
{"Disabled", 1, 0, NULL, NULL},
|
||||
{"-", 0, 0, NULL, NULL},
|
||||
{"+", 0, 0, NULL, NULL},
|
||||
{"Quit", 0, 0, quit_cb, NULL},
|
||||
{NULL, 0, 0, NULL, NULL}},
|
||||
.menu = (struct tray_menu[]){{"Hello", 0, 0, NULL, hello_cb, NULL},
|
||||
{"Checked", 0, 1, NULL, toggle_cb, NULL},
|
||||
{"Disabled", 1, 0, NULL, NULL, NULL},
|
||||
{"-", 0, 0, NULL, NULL, NULL},
|
||||
{"SubMenu", 0, 0, (struct tray_submenu[]){{"First",submenu_cb, NULL}, {"Second",submenu_cb, NULL}, {NULL, NULL, NULL},}, NULL, NULL},
|
||||
{"Quit", 0, 0, NULL, quit_cb, NULL},
|
||||
{NULL, 0, 0, NULL, NULL, NULL}},
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
Reference in New Issue
Block a user