Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bootloader/gfx/tui.h
1476 views
1
/*
2
* Copyright (c) 2018 naehrwert
3
* Copyright (c) 2018 CTCaer
4
*
5
* This program is free software; you can redistribute it and/or modify it
6
* under the terms and conditions of the GNU General Public License,
7
* version 2, as published by the Free Software Foundation.
8
*
9
* This program is distributed in the hope it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef _TUI_H_
19
#define _TUI_H_
20
21
#include <bdk.h>
22
23
#define MENT_END 0
24
#define MENT_HANDLER 1
25
#define MENT_MENU 2
26
#define MENT_DATA 3
27
#define MENT_BACK 4
28
#define MENT_CAPTION 5
29
#define MENT_CHGLINE 6
30
#define MENT_HDLR_RE 7
31
32
typedef struct _ment_t
33
{
34
u32 type;
35
const char *caption;
36
u32 color;
37
void *data;
38
union
39
{
40
void(*handler)(void *);
41
struct _menu_t *menu;
42
};
43
} ment_t;
44
45
typedef struct _menu_t
46
{
47
ment_t *ents;
48
const char *caption;
49
u32 x;
50
u32 y;
51
} menu_t;
52
53
#define MDEF_END() {MENT_END}
54
#define MDEF_HANDLER(caption, _handler) { MENT_HANDLER, caption, 0, NULL, { .handler = _handler } }
55
#define MDEF_HANDLER_EX(caption, data, _handler) { MENT_HANDLER, caption, 0, data, { .handler = _handler } }
56
#define MDEF_MENU(caption, _menu) { MENT_MENU, caption, 0, NULL, { .menu = _menu } }
57
#define MDEF_BACK() { MENT_BACK, "Back" }
58
#define MDEF_CAPTION(caption, color) { MENT_CAPTION, caption, color }
59
#define MDEF_CHGLINE() {MENT_CHGLINE}
60
61
void tui_sbar(bool force_update);
62
void tui_pbar(int x, int y, u32 val, u32 fgcol, u32 bgcol);
63
void *tui_do_menu(menu_t *menu);
64
65
#endif
66
67