-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwin.h
46 lines (38 loc) · 1.73 KB
/
win.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef _WIN_H_
#define _WIN_H_
#include "common/datatype.h"
#include "display.h"
// Menu item structure
typedef struct {
char compname[256];
char shortname[256];
char name[64]; // item name
dword width; // display width in bytes (for align/span)
pixel icolor; // font color
pixel selicolor; // selected font color
pixel selrcolor; // selected rectangle line color
pixel selbcolor; // selected background filling color
bool selected; // item selected
void * data; // custom data for user processing
word data2[4];
dword data3;
} t_win_menuitem, * p_win_menuitem;
// Menu callback
typedef enum {
win_menu_op_continue = 0,
win_menu_op_redraw,
win_menu_op_ok,
win_menu_op_cancel,
win_menu_op_force_redraw
} t_win_menu_op;
typedef t_win_menu_op (*t_win_menu_callback)(dword key, p_win_menuitem item, dword * count, dword page_count, dword * topindex, dword * index);
typedef void (*t_win_menu_draw)(p_win_menuitem item, dword index, dword topindex, dword max_height);
// Default callback for menu
extern t_win_menu_op win_menu_defcb(dword key, p_win_menuitem item, dword * count, dword page_count, dword * topindex, dword * index);
// Menu show & wait for input with callback supported
extern dword win_menu(dword x, dword y, dword max_width, dword max_height, p_win_menuitem item, dword count, dword initindex, dword linespace, pixel bgcolor, bool redraw, t_win_menu_draw predraw, t_win_menu_draw postdraw, t_win_menu_callback cb);
// Messagebox with yes/no
extern bool win_msgbox(const char * prompt, const char * yesstr, const char * nostr, pixel fontcolor, pixel bordercolor, pixel bgcolor);
// Message with any key pressed to close
extern void win_msg(const char * prompt, pixel fontcolor, pixel bordercolor, pixel bgcolor);
#endif