1 /*
2     GUILIB:  An example GUI framework library for use with SDL
3 */
4 
5 /* This is a set of C functions wrapping C++ classes for popup text output */
6 
7 #ifndef _GUI_output_h
8 #define _GUI_output_h
9 
10 #include "SDL.h"
11 #include "begin_code.h"
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /************************************************************************/
17 /* C functions for GUI output window support                            */
18 /*                                                                      */
19 /************************************************************************/
20 
21 /* The (really C++) structure holding information for popup text output */
22 struct GUI_Output;
23 typedef struct GUI_Output GUI_Output;
24 
25 /* Function to create a hidden output window 'width' by 'height' characters.
26    The 'font' argument should either be a pointer to a 16x16 character font
27    image (with an extra pixel row under each row of characters), or NULL to
28    use a default internal 8x8-pixel font.
29    When shown, the output window will display to the 'screen' surface.
30  */
31 extern GUI_Output *GUI_CreateOutput(SDL_Surface *screen,
32 				int width, int height, SDL_Surface *font);
33 
34 /* Add output to an output window.  If the window is visible, the output
35    will appear immediately.  Note that the output windows are not overlays,
36    and any normal SDL drawing will overwrite the output window display.
37    If output causes the window to scroll, previous text will be lost.
38 */
39 extern void GUI_AddOutput(GUI_Output *output, const char *fmt, ...);
40 
41 /* Clear the contents of an output window */
42 extern void GUI_ClearOutput(GUI_Output *output);
43 
44 /* Show an output window, saving the area behind the window, and wait for
45    keyboard or mouse press input if 'wait' is non-zero.
46  */
47 extern void GUI_ShowOutput(GUI_Output *output, int wait);
48 
49 /* Hide an output window, restoring the previous contents of the display */
50 extern void GUI_HideOutput(GUI_Output *output);
51 
52 /* Delete an output window */
53 extern void GUI_DeleteOutput(GUI_Output *output);
54 
55 
56 /************************************************************************/
57 /* Simple C message-box functions for quick popup output                */
58 /*                                                                      */
59 /************************************************************************/
60 
61 /* Create a popup message box of the given style, and wait for user input.
62    If 'title' is NULL, then no title-text will be used.
63 
64    Returns the index of the button pressed, which is style dependent:
65 */
66 #define GUI_MBNONE	0x0000	/* No buttons, any input causes -1 return */
67 #define GUI_MBOK	0x0001	/* A single "OK" button - causes 1 return */
68 #define GUI_MBOKCANCEL	0x0002	/* A "Cancel" button on the left - return 0
69 				   An "OK" button on the right - return 1 */
70 /* */
71 extern int GUI_MessageBox(SDL_Surface *screen,
72 			const char *title, const char *text, Uint32 style);
73 
74 #ifdef __cplusplus
75 };
76 #endif
77 #include "close_code.h"
78 
79 #endif /* _GUI_output_h */
80