labwc/include/menu/menu.h

50 lines
1.2 KiB
C
Raw Normal View History

/* SPDX-License-Identifier: GPL-2.0-only */
2020-10-19 22:14:17 +01:00
#ifndef __LABWC_MENU_H
#define __LABWC_MENU_H
#include <wayland-server.h>
#include <wlr/render/wlr_renderer.h>
struct menuitem {
struct wl_list actions;
struct menu *submenu;
struct wlr_box box;
struct {
struct wlr_texture *active;
struct wlr_texture *inactive;
int offset_x;
int offset_y;
} texture;
2020-10-19 22:14:17 +01:00
bool selected;
2021-08-09 17:28:39 +01:00
struct wl_list link; /* menu::menuitems */
2020-10-19 22:14:17 +01:00
};
/* This could be the root-menu or a submenu */
2020-10-19 22:14:17 +01:00
struct menu {
char *id;
char *label;
bool visible;
struct menu *parent;
2021-08-09 17:28:39 +01:00
struct wlr_box box;
2020-10-19 22:14:17 +01:00
struct wl_list menuitems;
struct server *server;
2020-10-19 22:14:17 +01:00
};
void menu_init_rootmenu(struct server *server);
2022-01-26 00:07:10 +01:00
void menu_init_windowmenu(struct server *server);
void menu_finish(void);
2020-10-19 22:14:17 +01:00
/* menu_move - move to position (x, y) */
void menu_move(struct menu *menu, int x, int y);
/* menu_set_selected - select item at (x, y) */
void menu_set_selected(struct menu *menu, int x, int y);
/* menu_action_selected - select item at (x, y) */
void menu_action_selected(struct server *server, struct menu *menu);
2021-02-19 23:05:14 +00:00
/* menu_reconfigure - reload theme and content */
2021-02-19 23:31:14 +00:00
void menu_reconfigure(struct server *server, struct menu *menu);
2021-02-19 23:05:14 +00:00
2020-10-19 22:14:17 +01:00
#endif /* __LABWC_MENU_H */