2021-11-02 18:31:19 +00:00
|
|
|
/* 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 {
|
2022-01-05 09:11:24 +01:00
|
|
|
struct wl_list actions;
|
2021-11-02 18:31:19 +00:00
|
|
|
struct menu *submenu;
|
2021-08-07 08:35:46 +01:00
|
|
|
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
|
|
|
};
|
|
|
|
|
|
2021-11-02 18:31:19 +00:00
|
|
|
/* This could be the root-menu or a submenu */
|
2020-10-19 22:14:17 +01:00
|
|
|
struct menu {
|
2021-11-02 18:31:19 +00:00
|
|
|
char *id;
|
|
|
|
|
char *label;
|
|
|
|
|
bool visible;
|
2021-11-08 17:20:37 +00:00
|
|
|
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;
|
2021-11-02 18:31:19 +00:00
|
|
|
struct server *server;
|
2020-10-19 22:14:17 +01:00
|
|
|
};
|
|
|
|
|
|
2021-11-02 18:31:19 +00:00
|
|
|
void menu_init_rootmenu(struct server *server);
|
2022-01-26 00:07:10 +01:00
|
|
|
void menu_init_windowmenu(struct server *server);
|
2021-11-02 18:31:19 +00:00
|
|
|
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 */
|