Mercurial > molko
comparison libmlk-ui/mlk/ui/gridmenu.h @ 433:862b15c3a3ae
ui: cleanup hierarchy
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 15 Oct 2022 21:19:25 +0200 |
parents | src/libmlk-ui/ui/gridmenu.h@8f59201dc76b |
children | 773a082f0b91 |
comparison
equal
deleted
inserted
replaced
432:38cf60f5a1c4 | 433:862b15c3a3ae |
---|---|
1 /* | |
2 * gridmenu.h -- GUI grid menu | |
3 * | |
4 * Copyright (c) 2020-2022 David Demelier <markand@malikania.fr> | |
5 * | |
6 * Permission to use, copy, modify, and/or distribute this software for any | |
7 * purpose with or without fee is hereby granted, provided that the above | |
8 * copyright notice and this permission notice appear in all copies. | |
9 * | |
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
17 */ | |
18 | |
19 #ifndef MLK_UI_GRIDMENU_H | |
20 #define MLK_UI_GRIDMENU_H | |
21 | |
22 #include <stddef.h> | |
23 | |
24 #include <mlk/core/core.h> | |
25 | |
26 #include "label.h" | |
27 | |
28 struct theme; | |
29 | |
30 union event; | |
31 | |
32 struct gridmenu { | |
33 int x; | |
34 int y; | |
35 unsigned int w; | |
36 unsigned int h; | |
37 size_t selected; | |
38 const struct theme *theme; | |
39 const char * const *items; | |
40 size_t itemsz; | |
41 unsigned int nrows; | |
42 unsigned int ncols; | |
43 | |
44 /* Private fields. */ | |
45 unsigned int eltw; /* maximum entry label width */ | |
46 unsigned int elth; /* maximum entry label height */ | |
47 unsigned int spacew; /* space between element horizontally */ | |
48 unsigned int spaceh; /* and vertically */ | |
49 }; | |
50 | |
51 CORE_BEGIN_DECLS | |
52 | |
53 void | |
54 gridmenu_init(struct gridmenu *, unsigned int, unsigned int, const char * const *, size_t); | |
55 | |
56 void | |
57 gridmenu_resize(struct gridmenu *, int, int, unsigned int, unsigned int); | |
58 | |
59 int | |
60 gridmenu_handle(struct gridmenu *, const union event *); | |
61 | |
62 void | |
63 gridmenu_draw(const struct gridmenu *); | |
64 | |
65 CORE_END_DECLS | |
66 | |
67 #endif /* !MLK_UI_GRIDMENU_H */ |