DEADSOFTWARE

50e5e144717bbe1185625ec0bc96a466a4230bd0
[flatwaifu.git] / src / menu.h
1 /*
2 Copyright (C) Prikol Software 1996-1997
3 Copyright (C) Aleksey Volynskov 1996-1997
5 This file is part of the Doom2D:Rembo project.
7 Doom2D:Rembo is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as
9 published by the Free Software Foundation.
11 Doom2D:Rembo is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/> or
18 write to the Free Software Foundation, Inc.,
19 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
22 #ifndef MENU_H_INCLUDED
23 #define MENU_H_INCLUDED
25 #include "glob.h"
27 /* menu types */
28 #define GM_BIG 1
29 #define GM_SMALL 2
31 /* variant types */
32 #define GM_BUTTON 1
33 #define GM_SCROLLER 2
34 #define GM_TEXTFIELD 3
35 #define GM_SMALL_BUTTON 4
36 #define GM_TEXTFIELD_BUTTON 5
38 /* menu messages */
39 #define GM_GETINT 1
40 #define GM_SETINT 2
41 #define GM_GETSTR 3
42 #define GM_SETSTR 4
43 #define GM_SELECT 5 // buttons
44 #define GM_ENTER 6 // menu
45 #define GM_LEAVE 7 // menu
46 #define GM_BEGIN 8 // textfield
47 #define GM_END 9 // textfield
48 #define GM_CANCEL 10 // textfield
49 #define GM_QUERY 11 // menu
50 #define GM_GETTITLE 12 // menu
51 #define GM_GETENTRY 13 // entry
52 #define GM_GETCAPTION 14 // entry
54 typedef struct new_str_msg_t {
55 byte type;
56 char *s;
57 int maxlen;
58 } new_str_msg_t;
60 typedef struct new_int_msg_t {
61 byte type;
62 int i, a, b, s;
63 } new_int_msg_t;
65 typedef union new_msg_t {
66 byte type;
67 new_str_msg_t string;
68 new_int_msg_t integer;
69 } new_msg_t;
71 typedef struct new_var_t new_var_t;
72 typedef struct new_menu_t new_menu_t;
74 struct new_var_t {
75 byte type;
76 char *caption;
77 void *data;
78 int (*handler)(new_msg_t *msg, const new_menu_t *m, void *data);
79 const new_menu_t *submenu;
80 };
82 struct new_menu_t {
83 byte type;
84 char *title;
85 void *data;
86 int (*handler)(new_msg_t *msg, const new_menu_t *m, void *data);
87 new_var_t entries[];
88 };
90 extern byte _warp;
92 #define GM_MAX_INPUT 24
93 extern char ibuf[GM_MAX_INPUT];
94 extern byte input;
95 extern int icur;
96 extern int imax;
98 extern short lastkey;
100 int GM_init_int (new_msg_t *msg, int i, int a, int b, int s);
101 int GM_init_str (new_msg_t *msg, char *str, int maxlen);
103 void GM_push (const new_menu_t *m);
104 void GM_pop (void);
105 void GM_popall (void);
106 const new_menu_t *GM_get (void);
107 int GM_geti (void);
108 int GM_send_this (const new_menu_t *m, new_msg_t *msg);
109 int GM_send (const new_menu_t *m, int i, new_msg_t *msg);
111 void GM_key (int key, int down);
112 void GM_input (int ch);
113 void G_code (void);
114 int GM_act (void);
115 void GM_init (void);
117 #endif /* MENU_H_INCLUDED */