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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
|
/*
viDOOM - level editor for DOOM
Copyright (C) 2000 Ian Cowburn (ianc@noddybox.demon.co.uk)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-------------------------------------------------------------------------
Platform specific GUI routines
This is the platform specific routines for pop-up menus, dialogs and
file selectors. More DOOM graphics orientied GUI is handled by the
generic GUI (gui.h) that is built on top of gfx.
As with the platform specific GFX all calls can be differentiated from
the generic gui by starting with GUI_, rather than Gui.
Note that all these routines are expected to preserve screen contents.
$Id$
*/
#ifndef VIDOOM_PLATGUI_H
#define VIDOOM_PLATGUI_H
#include "gfx.h"
/* Type for a picklist, where each entry has an associated grahpic. If the
image is NULL then no picture should be shown for that entry.
*/
typedef struct
{
char *text;
GFX_IMAGE img;
int client_index; /* Returned by GUI_image_picklist() */
} PLAT_IMG_PICKLIST;
/* Type for a picklist
*/
typedef struct
{
char *text;
int client_index; /* Returned by GUI_client_picklist() */
} PLAT_PICKLIST;
/* Types to define a menu
*/
typedef struct PLATMENU
{
char *text; /* Text to display */
int client_index; /* Value returned by GUI_menu() */
struct PLATMENU *child; /* NULL if no child menu, else */
/* pointer to other menu array. */
} PLAT_MENU;
/* Types to define a radio box
*/
typedef struct
{
char *text; /* Label for this button. NULL = end */
int client_index; /* Value returned by GUI_radio() */
} PLAT_RADIO;
/* Types to define a multi flag box
*/
typedef struct
{
char *text; /* Label. NULL = end */
int group; /* To group flags (0 = don't group) */
int val; /* TRUE = set, FALSE = flag clear */
} PLAT_MULTI;
/* Types to define a simple dialog
*/
#define PLAT_DIAL_MAXSTRLEN 128
#define PLAT_DIAL_STRING 0
#define PLAT_DIAL_INTEGER 1
#define PLAT_DIAL_DOUBLE 2
#define PLAT_DIAL_PICKLIST 3
/* This is the picklist type that can be used inside a DIALOG. It matters
not how it's implemented, but it should be able to use large picklists
(eg. the amount of the list seen should be automatically limited).
*/
typedef struct
{
int no; /* No of items */
int current; /* Currently selected item */
char **text; /* Text for items - used as *item[] */
} PLAT_DIAL_PL;
typedef struct
{
char *text; /* Label for item. NULL = no label */
int type; /* Data type (PLAT_DIAL_xxx) */
union /* Data */
{
int i;
char s[PLAT_DIAL_MAXSTRLEN+1];
double d;
PLAT_DIAL_PL pl;
} data;
} PLAT_DIALOG;
/* Inform GUI of screen size if required
*/
void GUI_setscreen(int w,int h);
/* Display a Yes/No option box. Returns TRUE/FALSE accordingly. The text
defined by question should be split over lines where a '|' character appears.
*/
int GUI_yesno(char *question);
/* Starts a Yes/No/Yes to All/No to All cycle. After calling this
GUI_yesno_all() is reset to it's initial state.
*/
void GUI_start_yesno_all(void);
/* Works like GUI_yesno(), but displays to extra options - "Yes to All" and
"No to All". If either of these options are selected then further calls
to this function should return TRUE/FALSE accordingly, until
GUI_start_yesno__all() is called.
*/
int GUI_yesno_all(char *question);
/* Displays a dialog with the title and text supplied. This text should split
where a '|' character appears. A sole button containing the supplied
button_text should be displayed.
*/
void GUI_alert(char *title, char *text, char *button_text);
/* Pop-up/display a menu. Return the client_index of the selected item from the
menus, or defval for no selection. The co-ords can obviously be ignored or
honoured, though honouring is preferable.
MENU array is terminated by one with a NULL text entry.
*/
int GUI_menu(char *title, int x, int y, PLAT_MENU menu[], int defval);
/* Allow selection of a filename. Returns NULL if cancelled, otherwise the
selected path with must be Releas()'ed later.
If supported then files ending with filter should only be displayed. Filter
should be NULL to show all files.
*/
char *GUI_fsel(char *title, char *default_path, char *filter);
/* Display a picklist. The items are described by the array of pointers
passed in, which terminates with a NULL pointer. The index to the selected
item is returned, or -1 if the pickbox was cancelled.
*/
int GUI_picklist(char *title,char *opts[]);
/* Does a picklist as above, but works on structures cntaining client return
values, rather than simple array indexes.
*/
int GUI_client_picklist(char *title,PLAT_PICKLIST opts[],int defval);
/* Display a picklist with associated images. The items are described by the
array of structs passed in, which terminates with a NULL pointer in the
text field. The client index data in the selected item is returned, or
defval if the pickbox was cancelled.
If this cannot be supported on the platform then the minimum this should
do is a sideways call to GUI_client_picklist()
*/
int GUI_image_picklist(char *title,PLAT_IMG_PICKLIST opts[],int defval);
/* Display a radio box. The items are described by the array of structs
passed in, which terminates with a NULL pointer in the text field.
The client index data in the selected item is returned, or defval if the
radio box was cancelled.
If one of the entries client index values is the same as current then that
option will be the one selected when the radio box is displayed. Otherwise
the first item will be the selected one.
*/
int GUI_radio_box(char *title,PLAT_RADIO opts[],int current,int defval);
/* Display a mutli-selection radio box. The items are described by the array
of PLAT_MULTI passed in.
Returns TRUE if dialog accepted, otherwise FALSE.
*/
int GUI_multi_box(char *title,PLAT_MULTI p[]);
/* Displays a very simple dialog made up of 'no' fields as defined in pd[].
Returns TRUE if the dialog is accepted, FALSE otherwise.
Note that as the values in the PLAT_DIALOG array are not pointing to
actual client data they need not be preserved on a cancel of the dialog.
*/
int GUI_dialog(char *title, int no, PLAT_DIALOG pd[]);
/* Displays the contents of a file. The form this display takes is not really
of any concern to viDOOM.
Control codes should just be filtered out. Tabs should be converted to
spaces, or honoured.
This interface is used for reading the license from the menu, and for
reading the results from running the node builder.
*/
void GUI_view_file(char *title, char *path);
/* Allows simple text editting. The form this display takes is not really
of any concern to viDOOM (if applicable it would be more than OK to start
an external text editor).
text is a pointer to the original text, which is one long string with line
breaks denoted by the '\n' character. Note that lines should _only_ be
terminated with the \n character (ie. MSDOS stlye \r\n need not be accepted
by this routine).
The return is a newly allocated copy of the edited text is the text is OKed.
The return is NULL if the text is cancelled.
In either case, the original string pointed to by text should be as it was.
*/
char *GUI_text_edit(char *title, char *text);
#endif
/* END OF FILE */
|