FS2_Open
Open source remastering of the Freespace 2 engine
window.cpp
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 #include "bmpman/bmpman.h"
13 #include "cmdline/cmdline.h"
14 #include "globalincs/alphacolors.h"
15 #include "io/timer.h"
16 #include "localization/localize.h"
17 #include "osapi/osapi.h"
18 #include "palman/palman.h"
19 #include "parse/parselo.h"
20 #include "ui/ui.h"
21 #include "ui/uidefs.h"
22 
23 
24 
25 // global xstr colors
27  { // UI_XSTR_COLOR_GREEN
28  &Color_normal,
31  },
32  { // UI_XSTR_COLOR_PINK
33  &Color_normal,
36  },
37 };
38 
39 // --------------------------------------------------------------------
40 // UI_WINDOW constructor
41 //
42 //
44 {
45  int idx;
46 
47  mask_bmap_id = -1; // bitmap id of the mask bitmap to define hotspots
48  foreground_bmap_id = -1; // bitmap id of the foreground bitmap to display
49  mask_bmap_ptr = NULL; // pointer to bitmap of the mask
50  mask_data = NULL; // points to raw mask bitmap data
51  mask_w = -1; // bitmap width
52  mask_h = -1; // bitmap height
53  tooltip_handler = NULL; // pointer to function to handle custom tooltips
54 
55  // NULL all the xstring structs
56  for(idx=0; idx<MAX_UI_XSTRS; idx++){
57  xstrs[idx] = NULL;
58  }
59 }
60 
61 // --------------------------------------------------------------------
62 // UI_WINDOW destructor
63 //
64 //
66 {
67 }
68 
69 // --------------------------------------------------------------------
70 // UI_WINDOW::set_mask_bmap()
71 //
72 // Specify the filename for the mask bitmap to use. This has the hotspots
73 // for all the different controls.
74 //
75 void UI_WINDOW::set_mask_bmap(char *fname)
76 {
77  int bmap;
78 
79  bmap = bm_load(fname);
80 
81  if (bmap < 0) {
82  Error(LOCATION, "Could not load in %s!", fname);
83 
84  } else {
85  set_mask_bmap(bmap, fname);
86  }
87 }
88 
89 void UI_WINDOW::set_mask_bmap(int bmap, char *name)
90 {
91  // int i;
92 
93  // init_tooltips();
94  Assert(bmap >= 0);
95 
96  if (bmap != mask_bmap_id) {
97  if (mask_bmap_id >= 0){
99  }
100 
101  mask_w = -1;
102  mask_h = -1;
103 
104  mask_bmap_id = bmap;
107  bm_get_info( bmap, &mask_w, &mask_h );
108  tt_group = -1;
109  /*
110  for (i=0; i<Num_tooltip_groups; i++){
111  if (!stricmp(Tooltip_groups[i].mask, name)){
112  tt_group = i;
113  }
114  }
115  */
116  } else {
117  nprintf(("UI", "Warning: tried to switch bitmap mask to the same bitmap\n"));
118  }
119 }
120 
121 // --------------------------------------------------------------------
122 // UI_WINDOW::set_foreground_bmap()
123 //
124 // Specify the filename for the mask bitmap to display on the ui window as
125 // a background.
126 //
128 {
129  // load in the background bitmap
130  foreground_bmap_id = bm_load(fname);
131  if (foreground_bmap_id < 0) {
132  Error(LOCATION,"Could not load in %s!",fname);
133  }
134 #ifndef HARDWARE_ONLY
136 #endif
137 }
138 
139 
140 void UI_WINDOW::create( int _x, int _y, int _w, int _h, int _flags, int _f_id )
141 {
142  x = _x;
143  y = _y;
144  w = _w;
145  h = _h;
146  flags = _flags;
147  f_id = (_f_id >= 0 && _f_id < Num_fonts) ? _f_id : FONT1;
148 
149  first_gadget = NULL;
150  selected_gadget = NULL;
151  tooltip_handler = NULL; // pointer to function to handle custom tooltips
152  ignore_gadgets = 0;
154 
155  if (_x < 0)
156  _x = 0;
157  if (_x + _w - 1 >= gr_screen.max_w_unscaled)
158  _x = gr_screen.max_w_unscaled - _w;
159  if (_y < 0)
160  _y = 0;
161  if (_y + _h - 1 >= gr_screen.max_h_unscaled)
162  _y = gr_screen.max_h_unscaled - _h;
163 
164  game_flush();
165 }
166 
168 {
169  if (mask_bmap_ptr) {
170  // done with the mask bitmap, so unlock it
172 
173  // unload the bitmaps
174  if (mask_bmap_id >= 0) {
176  mask_bmap_id = -1;
177  }
178 
179  mask_data = NULL;
180  mask_bmap_ptr = NULL;
181  }
182 
183  if (foreground_bmap_id >= 0) {
185  foreground_bmap_id = -1;
186  }
187 }
188 
190 {
191  UI_GADGET *cur;
192  int idx;
193 
194  // free up any bitmaps
195  release_bitmaps();
196 
197  // destroy all gadgets
198  if (first_gadget) {
199  cur = first_gadget;
200  do {
201  cur->destroy();
202  cur = cur->next;
203 
204  } while (cur != first_gadget);
205  }
206 
207  // free up all xstrs
208  for(idx=0; idx<MAX_UI_XSTRS; idx++){
209  // free up this struct
210  if(xstrs[idx] != NULL){
211  if(xstrs[idx]->xstr != NULL){
212  vm_free(xstrs[idx]->xstr);
213  }
214  vm_free(xstrs[idx]);
215  xstrs[idx] = NULL;
216  }
217  }
218 }
219 
221 {
222  UI_GADGET *tmp;
223 
224  gr_reset_clip();
225  gr_set_font(f_id);
226 
227  if (foreground_bmap_id >= 0) {
230  }
231 
232  if (flags & WIN_FILLED) {
233  ui_draw_box_out(x, y, x+w-1, y+h-1);
234  }
235 
236  if (flags & WIN_BORDER) {
238  }
239 
240  if (first_gadget) {
241  tmp = first_gadget;
242  do {
243  if (!tmp->hidden)
244  tmp->draw();
245 
246  tmp = tmp->next;
247 
248  } while (tmp != first_gadget);
249  }
250 
251  if (first_gadget) {
252  tmp = first_gadget;
253  do {
254  if (!tmp->hidden && (tmp->kind == UI_KIND_BUTTON) && ((UI_BUTTON *) tmp)->button_down()){
255  tmp->draw();
256  }
257 
258  tmp = tmp->next;
259  } while (tmp != first_gadget);
260  }
261 
262  // draw all xstrs
263  draw_xstrs();
264 
265  // draw tooltips
266  draw_tooltip();
267 
268  // convenient debug code for showing mouse coords
270  int mx, my;
271  mouse_get_pos(&mx, &my);
272  // mprintf(("MOUSE (%d, %d)\n", mx, my));
274  gr_printf_no_resize(mx, my - 12, "%d %d", mx, my);
275  }
276 }
277 
278 void UI_WINDOW::draw_XSTR_forced(UI_GADGET *owner, int frame)
279 {
280  int idx;
281 
282  // lookup the xstr and draw it if necessary
283  for(idx=0; idx<MAX_UI_XSTRS; idx++){
284  if((xstrs[idx] != NULL) && (xstrs[idx]->assoc == owner)){
285  draw_one_xstr(xstrs[idx], frame);
286  }
287  }
288 }
289 
291 {
292  int offset, pixel_val;
293 
294  if (!mask_data){
295  return -1;
296  }
297 
298  // check the pixel value under the mouse
300  pixel_val = *(mask_data + offset);
301  return pixel_val;
302 }
303 
305 {
306  // int i;
307  // tooltip_group *ptr;
308  int hotspot;
309  UI_GADGET *gadget;
310 
311  if (tt_group < 0)
312  return;
313 
314  // ptr = &Tooltip_groups[tt_group];
315  hotspot = get_current_hotspot();
316 
317 // mprintf(("HOTSPOT: %d [%d]\n",hotspot, Framecount));
318 
319  /*
320  if (hotspot != last_tooltip_hotspot) {
321  last_tooltip_hotspot = hotspot;
322  last_tooltip_time = timer_get_milliseconds();
323  ttx = tty = -1;
324  return;
325 
326  } else if (timer_get_milliseconds() - last_tooltip_time < TOOLTIP_DELAY)
327  return;
328  */
329 
330  if (first_gadget) {
331  gadget = first_gadget;
332  do {
333  if (gadget->get_hotspot() == hotspot) {
334  if (gadget->hidden) // if control is hidden, don't draw tooltip for it.
335  return;
336  else
337  break;
338  }
339 
340  gadget = gadget->next;
341 
342  } while (gadget != first_gadget);
343  }
344 
345  /*
346  for (i=ptr->start; i<ptr->end; i++) {
347  if (Tooltips[i].hotspot == hotspot) {
348  char *str;
349  int w, h;
350 
351  str = Tooltips[i].text;
352  if (str[0] == '@') {
353  if (!tooltip_handler)
354  Error(LOCATION, "No tooltip handler for screen with mask \"%s\"", ptr->mask);
355 
356  str = (*tooltip_handler)(str); // Let the screen handle the custom tooltips
357  if (!str)
358  return;
359  }
360 
361  if (ttx < 0 || tty < 0) {
362  gr_get_string_size(&w, &h, str);
363  Assert(w < 320 && h < 100);
364  ttx = ui_mouse.x - w / 2;
365  tty = ui_mouse.y - h;
366  }
367 
368  render_tooltip(str);
369  }
370  }
371  */
372 }
373 
375 {
376  int str_w, str_h;
377 
378  gr_get_string_size(&str_w, &str_h, str);
379  Assert(str_w < gr_screen.max_w_unscaled - 4 && str_h < gr_screen.max_h_unscaled - 4);
380 
381  if (ttx < 2)
382  ttx = 2;
383 
384  if (tty < 2)
385  tty = 2;
386 
387  if (ttx + str_w + 2 > gr_screen.max_w_unscaled)
388  ttx = gr_screen.max_w_unscaled - str_w;
389 
390  if (tty + str_h + 2 > gr_screen.max_h_unscaled)
391  tty = gr_screen.max_h_unscaled - str_h;
392 
394  gr_rect(ttx - 1, tty - 1, str_w + 2, str_h + 1, GR_RESIZE_MENU);
395 
398 }
399 
400 // key_in: If not -1, this means to use this key as input, and not call game_poll()
401 int UI_WINDOW::process(int key_in,int process_mouse)
402 {
403  UI_GADGET *tmp;
404 
405  // only does stuff in non THREADED mode
406  os_poll();
407 
408  if (process_mouse){
410  }
411 
412  if (key_in == -1){
414  } else {
415  keypress = key_in;
416  }
417 
419  do_dump_check();
421  mouse_captured_gadget = NULL;
422  }
423 
424  // The following code was commented out by NeilK on 4/15/99 to fix a problem we were having with
425  // the UI_SLIDER2 class not receiving the process event when the mouse was dragging the scroller
426  // but outside the mask region. I checked a handful of other screens and so no adverse affects
427  // of this change at the time.
428 
429 /*
430  if (mouse_captured_gadget) {
431  mouse_captured_gadget->process(); // if a control has captured the mouse, only it gets processed
432  use_hack_to_get_around_stupid_problem_flag = 0;
433  return last_keypress;
434  }
435 */
436  if (!first_gadget) {
438  return last_keypress;
439  }
440 
442 
443  // run through all top level gadgets and process them (they are responsible for processing
444  // their children, which UI_GADGET will handle if you don't override process() or if you
445  // do, you call UI_GADGET::process()).
446  if ( !ignore_gadgets ) {
447  tmp = first_gadget;
448  do {
449  if ( !tmp->check_move() )
450  tmp->process();
451 
452  tmp = tmp->next;
453 
454  } while (tmp != first_gadget);
455  }
456 
458  return last_keypress;
459 }
460 
462 {
463  return;
464 }
465 
467 {
468  mouse_captured_gadget = gadget;
469 }
470 
472 {
473  ignore_gadgets = state;
474 }
475 
476 void UI_WINDOW::add_XSTR(char *string, int _xstr_id, int _x, int _y, UI_GADGET *_assoc, int _color_type, int _font_id)
477 {
478  int idx;
479  int found = -1;
480  UI_XSTR *ui_x;
481 
482  // try and find a free xstr
483  for(idx=0; idx<MAX_UI_XSTRS; idx++){
484  if(xstrs[idx] == NULL){
485  found = idx;
486  break;
487  }
488  }
489 
490  // if we don't have a free spot
491  if(found < 0){
492  Int3(); // aieee! we need to up the max # of xstrs allowed in a window.
493  return;
494  }
495 
496  // allocate a new struct
497  xstrs[idx] = (UI_XSTR*)vm_malloc(sizeof(UI_XSTR));
498  if(xstrs[idx] == NULL){
499  return;
500  }
501  ui_x = xstrs[idx];
502 
503  // fill in the data
504  ui_x->xstr = vm_strdup(string);
505  if(ui_x->xstr == NULL){
506  vm_free(ui_x);
507  xstrs[idx] = NULL;
508  return;
509  }
510  ui_x->xstr_id = _xstr_id;
511  ui_x->x = _x;
512  ui_x->y = _y;
513  ui_x->assoc = _assoc;
514  ui_x->font_id = _font_id;
515  ui_x->clr = _color_type;
516  Assert((ui_x->clr >= 0) && (ui_x->clr < UI_NUM_XSTR_COLORS));
517  if((ui_x->clr < 0) || (ui_x->clr >= UI_NUM_XSTR_COLORS)){
518  ui_x->clr = 0;
519  }
520 }
521 
523 {
524  int idx;
525  int found = -1;
526  UI_XSTR *ui_x;
527 
528  // try and find a free xstr
529  for(idx=0; idx<MAX_UI_XSTRS; idx++){
530  if(xstrs[idx] == NULL){
531  found = idx;
532  break;
533  }
534  }
535 
536  // if we don't have a free spot
537  if(found < 0){
538  Int3(); // aieee! we need to up the max # of xstrs allowed in a window.
539  return;
540  }
541 
542  // allocate a new struct
543  xstrs[idx] = (UI_XSTR*)vm_malloc(sizeof(UI_XSTR));
544  if(xstrs[idx] == NULL){
545  return;
546  }
547  ui_x = xstrs[idx];
548 
549  // fill in the data
550  ui_x->xstr = vm_strdup(xstr->xstr);
551  if(ui_x->xstr == NULL){
552  vm_free(ui_x);
553  xstrs[idx] = NULL;
554  return;
555  }
556  ui_x->xstr_id = xstr->xstr_id;
557  ui_x->x = xstr->x;
558  ui_x->y = xstr->y;
559  ui_x->assoc = xstr->assoc;
560  ui_x->font_id = xstr->font_id;
561  ui_x->clr = xstr->clr;
562  Assert((ui_x->clr >= 0) && (ui_x->clr < UI_NUM_XSTR_COLORS));
563  if((ui_x->clr < 0) || (ui_x->clr >= UI_NUM_XSTR_COLORS)){
564  ui_x->clr = 0;
565  }
566 }
567 
568 void UI_WINDOW::draw_one_xstr(UI_XSTR *xs, int frame)
569 {
570  font *f_backup = NULL;
571  char str[255] = "";
572 
573  // sanity
574  if((xs == NULL) || (xs->xstr == NULL)){
575  return;
576  }
577 
578  // if it has an associated gadet that is hidden, do nothing
579  if((xs->assoc != NULL) && (xs->assoc->hidden)){
580  return;
581  }
582 
583  // maybe set the font
584  if(xs->font_id >= 0){
585  // backup the current font
586  Assert(Current_font != NULL);
587  f_backup = Current_font;
588 
589  // set the new font
590  gr_set_font(xs->font_id);
591  }
592 
593  // set the color
594  if(xs->assoc == NULL){
596  } else {
597  // just buttons for now
598  switch(xs->assoc->kind){
599  case UI_KIND_BUTTON:
600  // override case
601  if((frame != -1) && (frame < 3)){
602  gr_set_color_fast(Xstr_colors[xs->clr][frame]);
603  }
604  // normal checking
605  else {
606  // if the button is pressed
607  if(((UI_BUTTON*)xs->assoc)->button_down()){
608  gr_set_color_fast(Xstr_colors[xs->clr][2]);
609  }
610  // if the mouse is just over it
611  else if(xs->assoc->is_mouse_on()){
612  gr_set_color_fast(Xstr_colors[xs->clr][1]);
613  } else {
614  gr_set_color_fast(Xstr_colors[xs->clr][0]);
615  }
616  break;
617  }
618  break;
619 
620  // all other controls just draw the normal frame
621  default :
622  if((frame != -1) && (frame < 3)){
623  gr_set_color_fast(Xstr_colors[xs->clr][frame]);
624  } else {
625  gr_set_color_fast(Xstr_colors[xs->clr][0]);
626  }
627  break;
628  }
629 
630  // if the gadget disabled, just draw the normal nonhighlighted frame
631  if(xs->assoc->disabled()){
632  gr_set_color_fast(Xstr_colors[xs->clr][0]);
633  }
634  }
635 
636  // print this puppy out
638  strncpy(str, XSTR(xs->xstr, xs->xstr_id), 254);
639  if(str[0] == '&'){
640  if(strlen(str) > 1){
641  gr_string((xs->x) + xoffset, xs->y, str + 1, GR_RESIZE_MENU);
642  }
643  } else {
644  gr_string((xs->x) + xoffset, xs->y, str, GR_RESIZE_MENU);
645  }
646 
647  // maybe restore the old font
648  if(f_backup != NULL){
649  Current_font = f_backup;
650  }
651 }
652 
654 {
655  int idx = 0;
656 
657  // draw the xstrs
658  do {
659  draw_one_xstr(xstrs[idx], -1);
660 
661  // next xstr
662  idx++;
663  } while(idx < MAX_UI_XSTRS);
664 }
665 
666 // TEST CODE
667 
669 {
670 #if 0
672  FILE *fp;
673 
674  last_keypress = keypress = 0;
675 
676  mprintf(( "\n========== WINDOW GADGETS =========\n" ));
677  mprintf(( "(Also dumped to ui.out)\n" ));
678 
679  fp = fopen( "ui.out", "wt" );
680  tmp = first_gadget;
681  do {
682  if ( tmp->parent == NULL ) {
683  switch ( tmp->kind ) {
684  case UI_KIND_BUTTON:
685  mprintf(( "UI: Button at %d,%d\n", tmp->x, tmp->y ));
686  fprintf( fp, "UI: Button at %d,%d\n", tmp->x, tmp->y );
687  break;
688  case UI_KIND_KEYTRAP:
689  mprintf(( "UI: Keytrap at %d,%d\n", tmp->x, tmp->y ));
690  fprintf( fp, "UI: Keytrap at %d,%d\n", tmp->x, tmp->y );
691  break;
692  case UI_KIND_CHECKBOX:
693  mprintf(( "UI: Checkbox at %d,%d\n", tmp->x, tmp->y ));
694  fprintf( fp, "UI: Checkbox at %d,%d\n", tmp->x, tmp->y );
695  break;
696  case UI_KIND_RADIO:
697  mprintf(( "UI: Radiobutton at %d,%d\n", tmp->x, tmp->y ));
698  fprintf( fp, "UI: Radiobutton at %d,%d\n", tmp->x, tmp->y );
699  break;
700  case UI_KIND_SCROLLBAR:
701  mprintf(( "UI: Scrollbar at %d,%d\n", tmp->x, tmp->y ));
702  fprintf( fp, "UI: Scrollbar at %d,%d\n", tmp->x, tmp->y );
703  break;
704  case UI_KIND_LISTBOX:
705  mprintf(( "UI: Listbox at %d,%d\n", tmp->x, tmp->y ));
706  fprintf( fp, "UI: Listbox at %d,%d\n", tmp->x, tmp->y );
707  break;
708  case UI_KIND_INPUTBOX:
709  mprintf(( "UI: Inputbox at %d,%d\n", tmp->x, tmp->y ));
710  fprintf( fp, "UI: Inputbox at %d,%d\n", tmp->x, tmp->y );
711  break;
712  default:
713  mprintf(( "UI: Unknown type %d at %d,%d\n", tmp->kind, tmp->x, tmp->y ));
714  fprintf( fp, "UI: Unknown type %d at %d,%d\n", tmp->kind, tmp->x, tmp->y );
715  }
716  }
717  tmp = tmp->next;
718  } while( tmp != first_gadget );
719  fclose(fp);
720  mprintf(( "===================================\n" ));
721  }
722 #endif
723 }
724 
725 /*
726 void parse_tooltip(int n)
727 {
728  char buf[MESSAGE_LENGTH];
729 
730  stuff_int(&Tooltips[n].hotspot);
731  stuff_string(buf, F_MESSAGE, NULL);
732  Tooltips[n].text = vm_strdup(buf);
733 }
734 
735 int parse_tooltips_group(int group, int n)
736 {
737  char buf[NAME_LENGTH];
738 
739  Assert(group < MAX_TOOLTIP_GROUPS);
740  required_string("$Mask Filename:");
741  stuff_string(buf, F_NAME, NULL);
742  Tooltip_groups[group].mask = vm_strdup(buf);
743  Tooltip_groups[group].start = n;
744 
745  while (1) {
746  if (check_for_string("#") || check_for_string("$")) {
747  Tooltip_groups[group].end = n;
748  return n;
749  }
750 
751  Assert(n < MAX_TOOLTIPS);
752  parse_tooltip(n++);
753  }
754 }
755 
756 void parse_ship_tooltip(int n)
757 {
758 }
759 
760 void parse_weapon_tooltip(int n)
761 {
762 }
763 
764 void parse_tooltips()
765 {
766  int n, rval;
767 
768  // open localization
769  lcl_ext_open();
770 
771  if ((rval = setjmp(parse_abort)) != 0) {
772  mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "tooltips.tbl", rval));
773  lcl_ext_close();
774  return;
775  }
776 
777  read_file_text("tooltips.tbl");
778 
779  n = Num_tooltip_groups = 0;
780  reset_parse();
781 
782  if (optional_string("#UI"))
783  while (required_string_either("#", "$")) {
784  n = parse_tooltips_group(Num_tooltip_groups, n);
785  Num_tooltip_groups++;
786  }
787 
788  if (optional_string("#Ships"))
789  while (required_string_either("#", "$")) {
790  parse_ship_tooltip(Num_ship_tooltips);
791  Num_ship_tooltips++;
792  }
793 
794  if (optional_string("#Weapons"))
795  while (required_string_either("#", "$")) {
796  parse_ship_tooltip(Num_weapon_tooltips);
797  Num_weapon_tooltips++;
798  }
799 
800  required_string("#End");
801 
802  // close localization
803  lcl_ext_close();
804 }
805 
806 void init_tooltips()
807 {
808  static int inited = 0;
809 
810  if (!inited) {
811  parse_tooltips();
812  inited = 1;
813  }
814 }
815 */
816 
818 {
819  mprintf(( "OK Clicked!\n" ));
820 }
821 
822 void do_help()
823 {
824  mprintf(( "Help!\n" ));
825 }
826 
void gr_rect(int x, int y, int w, int h, int resize_mode)
Definition: 2d.cpp:2068
void game_flush()
Definition: fredstubs.cpp:83
void bm_unlock(int handle)
Unlocks a bitmap.
Definition: bmpman.cpp:3005
int y
Definition: ui.h:165
#define vm_free(ptr)
Definition: pstypes.h:548
void add_XSTR(char *string, int _xstr_id, int _x, int _y, UI_GADGET *_assoc, int _color_type, int _font_id=-1)
Definition: window.cpp:476
int tt_group
Definition: ui.h:606
GLfloat GLfloat GLfloat GLfloat h
Definition: Glext.h:7280
int get_current_hotspot()
Definition: window.cpp:290
#define KEY_F12
Definition: key.h:154
virtual void process(int focus=0)
Definition: gadget.cpp:352
color * Xstr_colors[UI_NUM_XSTR_COLORS][3]
Definition: window.cpp:26
int is_mouse_on()
Definition: gadget.cpp:371
void release_bitmaps()
Definition: window.cpp:167
#define GR_RESIZE_MENU
Definition: 2d.h:684
int ignore_gadgets
Definition: ui.h:607
int foreground_bmap_id
Definition: ui.h:614
int check_move()
Definition: gadget.cpp:510
#define UI_KIND_KEYTRAP
Definition: ui.h:19
void check_focus_switch_keys()
Definition: window.cpp:461
void set_foreground_bmap(char *fname)
Definition: window.cpp:127
Assert(pm!=NULL)
#define mprintf(args)
Definition: pstypes.h:238
__inline void gr_string(int x, int y, const char *string, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:769
Definition: ui.h:61
Definition: 2d.h:95
int lcl_get_xstr_offset(int index, int res)
Definition: localize.cpp:872
int res
Definition: 2d.h:370
#define UI_KIND_RADIO
Definition: ui.h:21
int max_h_unscaled
Definition: 2d.h:361
int bm_get_info(int handle, int *w, int *h, ubyte *flags, int *nframes, int *fps)
Gets info on the bitmap indexed by handle.
Definition: bmpman.cpp:769
GLint GLint xoffset
Definition: Glext.h:5181
UI_GADGET * assoc
Definition: ui.h:168
int mouse_get_pos(int *xpos, int *ypos)
Definition: mouse.cpp:512
void set_ignore_gadgets(int state)
Definition: window.cpp:471
void gr_set_color_fast(color *dst)
Definition: 2d.cpp:1197
UI_WINDOW()
Definition: window.cpp:43
Definition: ui.h:195
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
Definition: 2d.cpp:2105
int max_w_unscaled
Definition: 2d.h:361
#define Int3()
Definition: pstypes.h:292
int font_id
Definition: ui.h:167
color Color_ui_green
Definition: alphacolors.cpp:35
void ui_draw_box_out(int x1, int y1, int x2, int y2)
Definition: uidraw.cpp:69
#define BORDER_WIDTH
Definition: uidefs.h:28
color Color_ui_pink
Definition: alphacolors.cpp:36
const char *(* tooltip_handler)(const char *text)
Definition: ui.h:649
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
Definition: bmpman.cpp:2603
void do_dump_check()
Definition: window.cpp:668
char * xstr
Definition: ui.h:163
#define UI_KIND_BUTTON
Definition: ui.h:18
#define BMP_AABITMAP
antialiased bitmap
Definition: bmpman.h:52
color Color_ui_light_green
Definition: alphacolors.cpp:35
UI_MOUSE ui_mouse
Definition: uimouse.cpp:17
void destroy()
Definition: window.cpp:189
UI_GADGET * first_gadget
Definition: ui.h:609
int y
Definition: uidefs.h:59
#define gr_reset_clip
Definition: 2d.h:745
void set_mask_bmap(char *fname)
Definition: window.cpp:75
virtual void destroy()
Definition: gadget.cpp:160
Definition: font.h:36
GLintptr offset
Definition: Glext.h:5497
int mask_w
Definition: ui.h:617
ubyte * mask_data
Definition: ui.h:616
UI_GADGET * mouse_captured_gadget
Definition: ui.h:611
#define nprintf(args)
Definition: pstypes.h:239
int mask_h
Definition: ui.h:617
int disabled()
Definition: gadget.cpp:447
font * Current_font
Definition: font.cpp:36
#define MAX_UI_XSTRS
Definition: ui.h:171
#define KEY_SHIFTED
Definition: key.h:62
UI_GADGET * next
Definition: ui.h:103
int Cmdline_mouse_coords
Definition: cmdline.cpp:274
#define vm_strdup(ptr)
Definition: pstypes.h:549
void do_help()
Definition: window.cpp:822
bitmap * bm_lock(int handle, ubyte bpp, ubyte flags, bool nodebug)
Locks down the bitmap indexed by bitmapnum.
Definition: bmpman.cpp:1754
~UI_WINDOW()
Definition: window.cpp:65
#define UI_KIND_INPUTBOX
Definition: ui.h:24
int use_hack_to_get_around_stupid_problem_flag
Definition: ui.h:652
#define B1_RELEASED
Definition: uidefs.h:48
int idx
Definition: multiui.cpp:761
#define UI_KIND_SCROLLBAR
Definition: ui.h:22
cfbp fp
Definition: cfile.cpp:1065
void render_tooltip(char *str)
Definition: window.cpp:374
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
void ui_mouse_process()
Definition: uimouse.cpp:21
unsigned char ubyte
Definition: pstypes.h:62
void os_poll()
Definition: osapi.cpp:748
int mask_bmap_id
Definition: ui.h:613
const char * XSTR(const char *str, int index)
Definition: localize.cpp:851
int x
Definition: uidefs.h:59
void ok_clicked()
Definition: window.cpp:817
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
GLbitfield flags
Definition: Glext.h:6722
#define vm_malloc(size)
Definition: pstypes.h:547
int get_hotspot()
Definition: gadget.cpp:29
GLuint const GLchar * name
Definition: Glext.h:5608
int hidden
Definition: ui.h:86
color Color_black
Definition: alphacolors.cpp:32
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
Definition: bmpman.cpp:1119
color Color_bright_white
Definition: alphacolors.cpp:32
#define FONT1
Definition: font.h:65
GLubyte GLubyte GLubyte GLubyte w
Definition: Glext.h:5679
int last_keypress
Definition: ui.h:650
void draw_one_xstr(UI_XSTR *xstr, int frame)
Definition: window.cpp:568
#define KEY_ALTED
Definition: key.h:63
#define UI_KIND_LISTBOX
Definition: ui.h:23
void palette_use_bm_palette(int n)
Definition: palman.cpp:578
#define WIN_FILLED
Definition: ui.h:580
void create(int _x, int _y, int _w, int _h, int _flags, int _f_id=-1)
Definition: window.cpp:140
int Num_fonts
Definition: font.cpp:34
int kind
Definition: ui.h:77
int game_check_key()
Definition: fredstubs.cpp:65
int clr
Definition: ui.h:166
screen gr_screen
Definition: 2d.cpp:46
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
Definition: font.cpp:196
Definition: ui.h:162
void capture_mouse(UI_GADGET *gadget=NULL)
Definition: window.cpp:466
#define UI_KIND_CHECKBOX
Definition: ui.h:20
#define LOCATION
Definition: pstypes.h:245
ptr_u data
Pointer to data, or maybe offset into VRAM.
Definition: bmpman.h:109
void draw_tooltip()
Definition: window.cpp:304
void ui_draw_frame(int x1, int y1, int x2, int y2)
Definition: uidraw.cpp:50
void draw_XSTR_forced(UI_GADGET *owner, int frame)
Definition: window.cpp:278
#define KEY_CTRLED
Definition: key.h:64
color Color_normal
Definition: alphacolors.cpp:28
int x
Definition: ui.h:165
void gr_bitmap(int _x, int _y, int resize_mode)
Definition: 2d.cpp:1303
bitmap * mask_bmap_ptr
Definition: ui.h:615
#define WIN_BORDER
Definition: ui.h:579
UI_XSTR * xstrs[MAX_UI_XSTRS]
Definition: ui.h:619
int ttx
Definition: ui.h:651
color Color_ui_light_pink
Definition: alphacolors.cpp:36
void _cdecl gr_printf_no_resize(int x, int y, const char *format,...)
Definition: font.cpp:342
void draw()
Definition: window.cpp:220
void gr_set_font(int fontnum)
Definition: font.cpp:566
int keypress
Definition: ui.h:622
int process(int key_in=-1, int process_mouse=1)
Definition: window.cpp:401
int f_id
Definition: ui.h:603
virtual void draw()
Definition: gadget.cpp:139
#define UI_NUM_XSTR_COLORS
Definition: ui.h:159
int tty
Definition: ui.h:651
GLint y
Definition: Gl.h:1505
void draw_xstrs()
Definition: window.cpp:653
int xstr_id
Definition: ui.h:164
UI_GADGET * selected_gadget
Definition: ui.h:610