FS2_Open
Open source remastering of the Freespace 2 engine
popup.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
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 the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef __POPUP_H__
13 #define __POPUP_H__
14 
15 // standardized text used for common buttons
16 // Special note (JH): The leading '&' is expected for these 4 defines in the code
17 #define POPUP_OK XSTR("&Ok", 503)
18 #define POPUP_CANCEL XSTR("&Cancel", 504)
19 #define POPUP_YES XSTR("&Yes", 505)
20 #define POPUP_NO XSTR("&No", 506)
21 
23 // flags
25 
26 // NEVER ADD FLAGS LESS THAN 10 here. there are some internal flags which use those
27 
28 // font size
29 #define PF_TITLE (1<<10) // Draw title centered in regular font (title is first line)
30 #define PF_TITLE_BIG (1<<11) // Draw title centered in large font (title is first line)
31 #define PF_BODY_BIG (1<<12) // Draw message body in large font
32 
33 // color
34 #define PF_TITLE_RED (1<<13) // Color to draw title, if different from default
35 #define PF_TITLE_GREEN (1<<14)
36 #define PF_TITLE_BLUE (1<<15)
37 #define PF_TITLE_WHITE (1<<16)
38 #define PF_BODY_RED (1<<17) // Color to draw body, if different from title
39 #define PF_BODY_GREEN (1<<18)
40 #define PF_BODY_BLUE (1<<19)
41 
42 // icon choices
43 #define PF_USE_NEGATIVE_ICON (1<<20) // Always drawn as first icon if set
44 #define PF_USE_AFFIRMATIVE_ICON (1<<21) // Always drawn as second icon if two choices (if 1 choice, it is the only icon)
45 
46 // misc
47 #define PF_RUN_STATE (1<<22) // call the do frame of the current state underneath the popup
48 #define PF_IGNORE_ESC (1<<23) // ignore the escape character
49 #define PF_ALLOW_DEAD_KEYS (1<<24) // Allow player to use keyset that exists when player dies
50 #define PF_NO_NETWORKING (1<<25) // don't do any networking
51 
52 // no special buttons
53 #define PF_NO_SPECIAL_BUTTONS (1<<26)
54 
55 // special web mouseover cursor flags
56 #define PF_WEB_CURSOR_1 (1<<27) // button 1 will get web cursor
57 #define PF_WEB_CURSOR_2 (1<<28) // button 2 will get web cursor
58 
59 // input: flags => formatting specificatons (PF_... shown above)
60 // nchoices => number of choices popup has
61 // text_1 => text for first button
62 // ... =>
63 // text_n => text for last button
64 // msg text => text msg for popup (can be of form "%s",pl->text)
65 //
66 // exit: choice selected (0..nchoices-1)
67 // will return -1 if there was an error or popup was aborted
68 //
69 // typical usage:
70 //
71 // rval = popup(0, 2, POPUP_YES, POPUP_NO, "Hey %s, do you want to quit", pl->callsign);
72 int popup(int flags, int nchoices, ... );
73 
74 // popup with cancel button and conditional funcrion.
75 // input: condition => function to call every frame, if condition() returns FALSE, the popup
76 // continues waiting. If condition() returns anything else, the popup will
77 // return that value.
78 // text_1 => text for cancel button
79 // msg text => text msg for popup (can be of form "%s",pl->text)
80 //
81 // exit: condition occured (return value of condition)
82 // will return 0 if cancel was pressed or popup was aborted
83 // will return -1 if there was an error
84 //
85 // typical usage:
86 //
87 // int condition_function() {
88 // if (blah) return 1;
89 // return 0;
90 // }
91 // .
92 // .
93 // .
94 // rval = popup_till_condition( condition_function, "Cancel", "Checking to see if %s is an idiot.", pl->callsign);
95 int popup_till_condition( int(*condition)() , ...);
96 
97 // popup to return the value from an input box
98 char *popup_input(int flags, const char *caption, int max_output_len = -1);
99 
100 int popup_active();
101 
102 int popup_running_state();
103 
104 // kill any active popup, forcing it to return -1 (similar to ESC)
105 void popup_kill_any_active();
106 
107 // change the text inside of the popup
108 void popup_change_text(const char *new_text);
109 
110 #endif
GLenum condition
Definition: Glext.h:8726
GLbitfield flags
Definition: Glext.h:6722