29 #define POPUP_MAX_CHOICES 3 // max number of buttons allowed on popup
31 #define POPUP_MAX_LINE_CHARS 256 // max chars of msg text allowed per line
32 #define POPUP_MAX_LINES 30 // max lines of text allowed
33 #define POPUP_MAX_CHARS 2048 // total max chars
34 #define POPUP_INPUT_MAX_CHARS 255 // max length of input string
36 #define POPUP_NOCHANGE 100
37 #define POPUP_ABORT 101
61 #define PF_INPUT (1<<0) // contents of the box is an inputbox and a caption
122 static int Popup_is_active=0;
123 static int Popup_should_die=0;
126 static int Popup_flags;
148 {464, 232, 510, 250},
149 {464, 262, 510, 279},
153 {752, 373, 806, 406},
154 {752, 421, 806, 461},
176 {
"Pop2", { 129, 99 } },
177 {
"Pop2", { 129, 99 } },
178 {
"Pop3", { 129, 99 } }
181 {
"2_Pop2", { 206, 158 } },
182 {
"2_Pop2", { 206, 158 } },
183 {
"2_Pop3", { 206, 158 } }
187 #define BUTTON_NEGATIVE 0
188 #define BUTTON_POSITIVE 1
189 #define BUTTON_GENERIC_FIRST 2
190 #define BUTTON_GENERIC_SECOND 3
191 #define BUTTON_GENERIC_THIRD 4
233 for ( i = 0; i < pi->
nchoices; i++ ) {
234 b = &Popup_button_regions[
i];
239 b = &Popup_buttons[
i];
257 for ( i = 0; i < pi->
nchoices; i++ ) {
258 br = &Popup_button_regions[
i];
259 b = &Popup_buttons[
i];
296 for ( i = 0; i < pi->
nchoices; i++ ) {
355 int nlines,
i, body_offset = 0;
367 strncpy(pi->
title, p_str[0], n_chars[0]);
368 pi->
title[n_chars[0]] = 0;
379 pi->
nlines = nlines - body_offset;
381 for ( i = 0; i < pi->
nlines; i++ ) {
383 strncpy(pi->
msg_lines[i], p_str[i+body_offset], n_chars[i+body_offset]);
425 if ( flags & PF_USE_AFFIRMATIVE_ICON && i==1 ) {
486 b = &Popup_buttons[
i];
506 b = &Popup_button_regions[
i];
509 if ( (pi->
nchoices == 1) && (flags&PF_USE_AFFIRMATIVE_ICON) ) {
535 Popup_should_die = 0;
719 for ( i = line_index; i < pi->
nlines; i++, line_count++ ) {
747 for ( i=0; i < pi->
nchoices; i++ ) {
779 int i,mouse_is_highlighting=0;
782 for ( i = 0; i < pi->
nchoices; i++ ) {
783 br = &Popup_button_regions[
i];
784 b = &Popup_buttons[
i];
787 mouse_is_highlighting=1;
793 mouse_is_highlighting=1;
799 if ( (!mouse_is_highlighting) && (pi->
nchoices>1) ) {
800 for ( i = 0; i < pi->
nchoices; i++ ) {
801 b = &Popup_buttons[
i];
814 int screen_id, choice = -1, done = 0;
835 if(Popup_should_die){
864 if(!(flags & PF_RUN_STATE)){
880 gr_set_screen_scale(old_max_w_unscaled, old_max_h_unscaled, old_max_w_unscaled_zoomed, old_max_h_unscaled_zoomed);
888 int screen_id, choice = -1, done = 0;
937 gr_set_screen_scale(old_max_w_unscaled, old_max_h_unscaled, old_max_w_unscaled_zoomed, old_max_h_unscaled_zoomed);
950 int i,j,
len=0,next_char_is_shortcut=0;
962 for (i=0; i<len-1; i++) {
963 if ( str[i] ==
'&' ) {
965 next_char_is_shortcut=1;
967 if ( next_char_is_shortcut ) {
968 next_char_is_shortcut=0;
969 char first_char_string[2];
970 first_char_string[0]=str[
i];
971 first_char_string[1]=0;
972 strlwr(first_char_string);
993 int popup(
int flags,
int nchoices, ... )
999 if ( Popup_is_active ) {
1004 Popup_flags =
flags;
1009 va_start(args, nchoices );
1012 for (i=0; i<nchoices; i++ ) {
1013 s = va_arg( args,
char * );
1019 format = va_arg( args,
char * );
1020 vsnprintf(Popup_info.
raw_text,
sizeof(Popup_info.
raw_text)-1, format, args);
1027 Popup_is_active = 1;
1029 choice =
popup_do( &Popup_info, flags );
1041 return Popup_is_active;
1055 if ( Popup_is_active ) {
1067 s = va_arg( args,
char * );
1072 format = va_arg( args,
char * );
1073 vsnprintf(Popup_info.
raw_text,
sizeof(Popup_info.
raw_text)-1, format, args);
1080 Popup_is_active = 1;
1094 if ( Popup_is_active ) {
1100 Popup_flags =
flags;
1125 Popup_is_active = 1;
1144 if(Popup_is_active){
1145 Popup_should_die = 1;
GLenum GLsizei GLenum format
void set_highlight_action(void(*_user_function)(void))
void game_do_state_common(int, int)
void game_set_frametime(int)
GLfloat GLfloat GLfloat GLfloat h
#define gr_restore_screen
void set_foreground_bmap(char *fname)
int gameseq_get_state(void)
#define GR_NUM_RESOLUTIONS
__inline void gr_string(int x, int y, const char *string, int resize_mode=GR_RESIZE_FULL)
void gr_set_screen_scale(int w, int h, int zoom_w, int zoom_h, int max_w, int max_h, int center_w, int center_h, bool force_stretch)
void gr_set_color_fast(color *dst)
#define UI_INPUTBOX_FLAG_ESC_FOC
int key_to_ascii(int keycode)
popup dialog box appeared
void draw_forced(int frame_num)
int set_bmaps(char *ani_filename, int nframes=3, int start_frame=1)
void create(UI_WINDOW *wnd, int _x, int _y, int _w, int _h, int _numberItems, char *_bitmapSliderControl, void(*_upCallback)(), void(*_downCallback)(), void(*_captureCallback)())
void process_set_of_keys(int key, int count, int *list)
#define UI_INPUTBOX_FLAG_TEXT_CEN
int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str, int max_lines, char ignore_char)
const char * XSTR(const char *str, int index)
user_click (mouse selects a control)
void anim_ignore_next_frametime()
popup dialog box goes away
void set_hotkey(int keycode)
void button_info_do(button_info *bi)
int max_w_unscaled_zoomed
GLboolean GLboolean GLboolean b
void create(UI_WINDOW *wnd, char *_text, int _x, int _y, int _w, int _h, int do_repeat=0, int ignore_focus=0)
void create(int _x, int _y, int _w, int _h, int _flags, int _f_id=-1)
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
void common_play_highlight_sound()
void create(UI_WINDOW *wnd, int _x, int _y, int _w, int _textlen, char *_text, int _flags=0, int pixel_lim=-1, color *clr=NULL)
void gr_reset_screen_scale()
#define UI_INPUTBOX_FLAG_INVIS
void gamesnd_play_iface(int n)
void gr_set_font(int fontnum)
int process(int key_in=-1, int process_mouse=1)
void _cdecl gr_printf_menu(int x, int y, const char *format,...)
#define UI_INPUTBOX_FLAG_KEYTHRU
int max_h_unscaled_zoomed
#define UI_INPUTBOX_FLAG_ESC_CLR
void set_custom_cursor_bmap(int bmap_id)