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