Mercurial > molko
comparison src/libmlk-ui/ui/theme.h @ 320:8f9937403749
misc: improve loading of data
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 01 Oct 2021 20:30:00 +0200 |
parents | libmlk-ui/ui/theme.h@d01e83210ca2 |
children | 42a6710629f5 |
comparison
equal
deleted
inserted
replaced
319:b843eef4cc35 | 320:8f9937403749 |
---|---|
1 /* | |
2 * theme.h -- abstract theming | |
3 * | |
4 * Copyright (c) 2020-2021 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 MOLKO_UI_THEME_H | |
20 #define MOLKO_UI_THEME_H | |
21 | |
22 #include <core/core.h> | |
23 | |
24 struct button; | |
25 struct checkbox; | |
26 struct font; | |
27 struct frame; | |
28 struct label; | |
29 struct sprite; | |
30 | |
31 enum theme_font { | |
32 THEME_FONT_DEBUG, | |
33 THEME_FONT_INTERFACE, | |
34 THEME_FONT_NUM | |
35 }; | |
36 | |
37 enum theme_color { | |
38 THEME_COLOR_DEBUG, | |
39 THEME_COLOR_NORMAL, | |
40 THEME_COLOR_SELECTED, | |
41 THEME_COLOR_SHADOW, | |
42 THEME_COLOR_NUM | |
43 }; | |
44 | |
45 enum theme_sprite { | |
46 THEME_SPRITE_CURSOR, | |
47 THEME_SPRITE_NUM | |
48 }; | |
49 | |
50 struct theme { | |
51 struct font *fonts[THEME_FONT_NUM]; | |
52 const struct sprite *sprites[THEME_SPRITE_NUM]; | |
53 unsigned long colors[THEME_COLOR_NUM]; | |
54 unsigned int padding; | |
55 | |
56 void (*draw_frame)(const struct theme *, const struct frame *); | |
57 void (*draw_label)(const struct theme *, const struct label *); | |
58 void (*draw_button)(const struct theme *, const struct button *); | |
59 void (*draw_checkbox)(const struct theme *t, const struct checkbox *); | |
60 }; | |
61 | |
62 CORE_BEGIN_DECLS | |
63 | |
64 int | |
65 theme_init(void); | |
66 | |
67 struct theme * | |
68 theme_default(void); | |
69 | |
70 void | |
71 theme_shallow(struct theme *, const struct theme *); | |
72 | |
73 void | |
74 theme_draw_frame(const struct theme *, const struct frame *); | |
75 | |
76 void | |
77 theme_draw_label(const struct theme *, const struct label *); | |
78 | |
79 void | |
80 theme_draw_button(const struct theme *, const struct button *); | |
81 | |
82 void | |
83 theme_draw_checkbox(const struct theme *, const struct checkbox *); | |
84 | |
85 void | |
86 theme_finish(void); | |
87 | |
88 CORE_END_DECLS | |
89 | |
90 #endif /* !MOLKO_UI_THEME_H */ |