summaryrefslogtreecommitdiff
path: root/platgui.h
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2011-06-09 13:57:32 +0000
committerIan C <ianc@noddybox.co.uk>2011-06-09 13:57:32 +0000
commitec32cf41f916fc34c03d2844684631bee39005ad (patch)
tree0ecd4b3a8602ba76df3b9395eb6c71c350d510df /platgui.h
Added copies of old numbered releases.0.02
Diffstat (limited to 'platgui.h')
-rw-r--r--platgui.h199
1 files changed, 199 insertions, 0 deletions
diff --git a/platgui.h b/platgui.h
new file mode 100644
index 0000000..0719ef0
--- /dev/null
+++ b/platgui.h
@@ -0,0 +1,199 @@
+/*
+
+ 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 _PLATGUI_H
+#define _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
+ {
+ char *text; /* Text to display */
+ int client_index; /* Value returned by GUI_menu() */
+ } 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 simple dialog
+*/
+#define PLAT_DIAL_MAXSTRLEN 128
+
+#define PLAT_DIAL_STRING 0
+#define PLAT_DIAL_INTEGER 1
+#define PLAT_DIAL_DOUBLE 2
+
+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;
+ } 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.
+*/
+int GUI_yesno(char *question);
+
+
+/* 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 char pointers passed in, which terminates with a NULL pointer.
+
+ The passed in integer pointer points to a value which is used to enable/
+ disable the options dependent on the integers bit setting. The integer
+ pointed to is updated on exit of the multi-selection box is not cancelled.
+
+ Note that the bit patterns are matched bit number to opt index. ie.
+ val & 0x0001 corresponds to opts[0]
+ val & 0x0002 corresponds to opts[1]
+ ....
+ val & 0x0010 corresponds to opts[4]
+ ....
+ val & 0x0100 corresponds to opts[8]
+ ....
+ val & 0x8000 corresponds to opts[15]
+
+ A maximum of 16 bits should be all that needs supporting currently.
+
+ Returns TRUE if dialog accepted, otherwise FALSE.
+*/
+int GUI_multi_box(char *title,char *opts[],int *val);
+
+
+/* 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[]);
+
+
+#endif
+
+
+/* END OF FILE */