Mercurial > molko
comparison libmlk-ui/mlk/ui/gridmenu.h @ 506:e205625015ba
ui: gridmenu is stylable
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 02 Mar 2023 08:54:00 +0100 |
parents | 6100c643dba0 |
children | d49a05e7a5b5 |
comparison
equal
deleted
inserted
replaced
505:6100c643dba0 | 506:e205625015ba |
---|---|
25 | 25 |
26 #include "label.h" | 26 #include "label.h" |
27 | 27 |
28 union mlk_event; | 28 union mlk_event; |
29 | 29 |
30 struct mlk_font; | |
30 struct mlk_gridmenu; | 31 struct mlk_gridmenu; |
31 | 32 |
32 struct mlk_gridmenu_style { | 33 struct mlk_gridmenu_style { |
33 void *data; | 34 void *data; |
34 unsigned long bg_color; | |
35 unsigned long border_color; | |
36 unsigned int padding; | 35 unsigned int padding; |
36 unsigned long text_color; | |
37 unsigned long text_selected_color; | |
38 struct mlk_font *text_font; | |
37 void (*init)(struct mlk_gridmenu_style *, struct mlk_gridmenu *); | 39 void (*init)(struct mlk_gridmenu_style *, struct mlk_gridmenu *); |
38 void (*update)(struct mlk_gridmenu_style *, struct mlk_gridmenu *, unsigned int); | 40 void (*update)(struct mlk_gridmenu_style *, struct mlk_gridmenu *, unsigned int); |
39 void (*draw)(struct mlk_gridmenu_style *, const struct mlk_gridmenu *); | 41 void (*draw)(struct mlk_gridmenu_style *, const struct mlk_gridmenu *); |
40 void (*finish)(struct mlk_gridmenu_style *, struct mlk_gridmenu *); | 42 void (*finish)(struct mlk_gridmenu_style *, struct mlk_gridmenu *); |
41 }; | 43 }; |
42 | 44 |
43 struct mlk_gridmenu { | 45 struct mlk_gridmenu { |
44 /* public */ | 46 /* public */ |
45 int x, y; | 47 int x, y; |
46 unsigned int w, h; | 48 unsigned int w, h; |
47 | |
48 const char * const *items; | 49 const char * const *items; |
49 size_t itemsz; | 50 size_t itemsz; |
50 size_t selected; | 51 size_t selected; |
51 | |
52 unsigned int nrows; | 52 unsigned int nrows; |
53 unsigned int ncols; | 53 unsigned int ncols; |
54 | |
55 struct mlk_gridmenu_style *style; | 54 struct mlk_gridmenu_style *style; |
56 struct mlk_label_style *text_style; | |
57 struct mlk_label_style *text_selected_style; | |
58 | 55 |
59 /* private */ | 56 /* private */ |
60 unsigned int eltw; /* maximum entry label width */ | 57 unsigned int eltw; /* maximum entry label width */ |
61 unsigned int elth; /* maximum entry label height */ | 58 unsigned int elth; /* maximum entry label height */ |
62 unsigned int spacew; /* space between element horizontally */ | 59 unsigned int spacew; /* space between element horizontally */ |
66 extern struct mlk_gridmenu_style mlk_gridmenu_style; | 63 extern struct mlk_gridmenu_style mlk_gridmenu_style; |
67 | 64 |
68 MLK_CORE_BEGIN_DECLS | 65 MLK_CORE_BEGIN_DECLS |
69 | 66 |
70 void | 67 void |
71 mlk_gridmenu_init(struct mlk_gridmenu *, unsigned int, unsigned int, const char * const *, size_t); | 68 mlk_gridmenu_init(struct mlk_gridmenu *); |
69 | |
70 int | |
71 mlk_gridmenu_ok(const struct mlk_gridmenu *); | |
72 | 72 |
73 void | 73 void |
74 mlk_gridmenu_resize(struct mlk_gridmenu *, int, int, unsigned int, unsigned int); | 74 mlk_gridmenu_resize(struct mlk_gridmenu *, int, int, unsigned int, unsigned int); |
75 | 75 |
76 int | 76 int |
77 mlk_gridmenu_handle(struct mlk_gridmenu *, const union mlk_event *); | 77 mlk_gridmenu_handle(struct mlk_gridmenu *, const union mlk_event *); |
78 | |
79 void | |
80 mlk_gridmenu_update(struct mlk_gridmenu *, unsigned int); | |
78 | 81 |
79 void | 82 void |
80 mlk_gridmenu_draw(const struct mlk_gridmenu *); | 83 mlk_gridmenu_draw(const struct mlk_gridmenu *); |
81 | 84 |
82 void | 85 void |