2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/Popup/Popup.h $
15 * Code for displaying pop-up dialog boxes
18 * Revision 1.2 2002/06/09 04:41:14 relnev
19 * added copyright header
21 * Revision 1.1.1.1 2002/05/03 03:28:12 root
25 * 7 8/16/99 9:50a Jefff
26 * added mouseover webcursor options to user-defined popup buttons.
28 * 6 8/04/99 10:53a Dave
29 * Added title to the user tips popup.
31 * 5 8/02/99 9:13p Dave
34 * 4 6/01/99 4:03p Dave
35 * Changed some popup flag #defines. Upped string count to 1336
37 * 3 2/11/99 3:08p Dave
38 * PXO refresh button. Very preliminary squad war support.
40 * 2 10/07/98 10:53a Dave
43 * 1 10/07/98 10:51a Dave
45 * 17 6/12/98 4:48p Hoffoss
46 * Externalized default popup choices.
48 * 16 2/05/98 11:09a Dave
49 * Fixed an ingame join bug. Fixed a read-only file problem with
50 * multiplauer file xfer.
52 * 15 2/03/98 8:18p Dave
53 * More MT stats transfer stuff
55 * 14 1/28/98 6:24p Dave
56 * Made standalone use ~8 megs less memory. Fixed multiplayer submenu
59 * 13 1/27/98 5:52p Lawrance
60 * support new "tiny" popups
62 * 12 1/27/98 3:25p Hoffoss
63 * Made popups use the correct button icons for default positive and
66 * 11 1/26/98 6:28p Lawrance
67 * Use '&' meta char for underlining, change how keyboard usage works so
68 * fits better with mouse usage.
70 * 10 1/17/98 10:04p Lawrance
71 * fix errors in popup comments
73 * 9 1/14/98 6:55p Dave
74 * Fixed a slew of multiplayer bugs. Made certain important popups ignore
75 * the escape character.
77 * 8 1/13/98 5:37p Dave
78 * Reworked a lot of standalone interface code. Put in single and
79 * multiplayer popups for death sequence. Solidified multiplayer kick
82 * 7 1/13/98 4:06p Lawrance
83 * Add underline char for shortcuts.
85 * 6 1/02/98 9:08p Lawrance
86 * Integrated art for popups, expanded options.
88 * 5 12/30/97 4:30p Sandeep
89 * Added conditional popups
91 * 4 12/26/97 10:01p Lawrance
92 * Allow keyboard shortcuts for popup buttons
94 * 3 12/24/97 9:49p Lawrance
95 * ensure mouse gets drawn when popup menu is up
97 * 2 12/24/97 8:54p Lawrance
98 * Integrating new popup code
106 // standardized text used for common buttons
107 // Special note (JH): The leading '&' is expected for these 4 defines in the code
108 #define POPUP_OK XSTR("&Ok", 503)
109 #define POPUP_CANCEL XSTR("&Cancel", 504)
110 #define POPUP_YES XSTR("&Yes", 505)
111 #define POPUP_NO XSTR("&No", 506)
113 ///////////////////////////////////////////////////
115 ///////////////////////////////////////////////////
117 // NEVER ADD FLAGS LESS THAN 10 here. there are some internal flags which use those
120 #define PF_TITLE (1<<10) // Draw title centered in regular font (title is first line)
121 #define PF_TITLE_BIG (1<<11) // Draw title centered in large font (title is first line)
122 #define PF_BODY_BIG (1<<12) // Draw message body in large font
125 #define PF_TITLE_RED (1<<13) // Color to draw title, if different from default
126 #define PF_TITLE_GREEN (1<<14)
127 #define PF_TITLE_BLUE (1<<15)
128 #define PF_TITLE_WHITE (1<<16)
129 #define PF_BODY_RED (1<<17) // Color to draw body, if different from title
130 #define PF_BODY_GREEN (1<<18)
131 #define PF_BODY_BLUE (1<<19)
134 #define PF_USE_NEGATIVE_ICON (1<<20) // Always drawn as first icon if set
135 #define PF_USE_AFFIRMATIVE_ICON (1<<21) // Always drawn as second icon if two choices (if 1 choice, it is the only icon)
138 #define PF_RUN_STATE (1<<22) // call the do frame of the current state underneath the popup
139 #define PF_IGNORE_ESC (1<<23) // ignore the escape character
140 #define PF_ALLOW_DEAD_KEYS (1<<24) // Allow player to use keyset that exists when player dies
141 #define PF_NO_NETWORKING (1<<25) // don't do any networking
143 // no special buttons
144 #define PF_NO_SPECIAL_BUTTONS (1<<26)
146 // special web mouseover cursor flags
147 #define PF_WEB_CURSOR_1 (1<<27) // button 1 will get web cursor
148 #define PF_WEB_CURSOR_2 (1<<28) // button 2 will get web cursor
150 // input: flags => formatting specificatons (PF_... shown above)
151 // nchoices => number of choices popup has
152 // text_1 => text for first button
154 // text_n => text for last button
155 // msg text => text msg for popup (can be of form "%s",pl->text)
157 // exit: choice selected (0..nchoices-1)
158 // will return -1 if there was an error or popup was aborted
162 // rval = popup(0, 2, POPUP_YES, POPUP_NO, "Hey %s, do you want to quit", pl->callsign);
163 int popup(int flags, int nchoices, ... );
165 // popup with cancel button and conditional funcrion.
166 // input: condition => function to call every frame, if condition() returns FALSE, the popup
167 // continues waiting. If condition() returns anything else, the popup will
168 // return that value.
169 // text_1 => text for cancel button
170 // msg text => text msg for popup (can be of form "%s",pl->text)
172 // exit: condition occured (return value of condition)
173 // will return 0 if cancel was pressed or popup was aborted
174 // will return -1 if there was an error
178 // int condition_function() {
179 // if (blah) return 1;
185 // rval = popup_till_condition( condition_function, "Cancel", "Checking to see if %s is an idiot.", pl->callsign);
186 int popup_till_condition( int(*condition)() , ...);
188 // popup to return the value from an input box
189 char *popup_input(int flags, const char *caption, int max_output_len = -1);
193 int popup_running_state();
195 // kill any active popup, forcing it to return -1 (similar to ESC)
196 void popup_kill_any_active();
198 // change the text inside of the popup
199 void popup_change_text(const char *new_text);