FS2_Open
Open source remastering of the Freespace 2 engine
wmcgui.h
Go to the documentation of this file.
1 /*
2  * wmcgui.h
3  * created by WMCoolmon
4  *
5  * You may not sell or otherwise commercially exploit the source or things you
6  * create based on the source.
7  *
8  */
9 
10 
11 
12 #include "globalincs/alphacolors.h"
13 #include "globalincs/linklist.h"
14 #include "globalincs/pstypes.h"
15 #include "io/mouse.h"
16 
17 #include <string>
18 #include <limits.h>
19 
20 //*****************************Low-level abstraction*******************************
21 //Lame attempt to keep things from being exceedingly difficult when switching to ferrium
22 #ifndef FERRIUM
23 #define IMG_HANDLE int
24 #define IMG_HANDLE_SET_INVALID(h) h = -1
25 #define IMG_HANDLE_IS_INVALID(h) (h==-1)
26 #define IMG_HANDLE_IS_VALID(h) (h!=-1)
27 #define IMG_HANDLE_SET_FRAME(dh,h,f)(dh = h + f)
28 #define IMG_LOAD(f) bm_load(f)
29 #define IMG_LOAD_ANIM(f,n,fps) bm_load_animation(f,n,fps)
30 #define IMG_UNLOAD(a) bm_unload(a)
31 #define IMG_SET(h) gr_set_bitmap(h)
32 #define IMG_SET_FRAME(h, f) gr_set_bitmap(h + f)
33 #define IMG_DRAW(x,y) gr_bitmap(x,y,GR_RESIZE_NONE)
34 #define IMG_INFO(ha,w,h) bm_get_info(ha,w,h)
35 #endif
36 
37 //*****************************LinkedList*******************************
38 struct LinkedList
39 {
40  friend class GUISystem;
41  friend class GUIObject;
42  friend class Tree;
43  friend struct TreeItem;
44  friend class Window;
45 public:
46  struct LinkedList *next, *prev;
47 
48  LinkedList(){ next = this; prev = this; }
49  virtual ~LinkedList(){ prev->next = next; next->prev = prev; }
50 };
51 
52 //*****************************ClassInfoEntry*******************************
53 //This is chiefly used in conjunction with GUISystem to store information
54 //about classes
55 
56 //T - Top
57 //L - Left
58 //R - Right
59 //B - Bottom
60 
61 //N - Normal
62 //M - Mouseovered
63 //C - Clicked
64 //S - Selected/Active (for windows)
65 //D - Disabled
66 
67 //A - Active
68 //I - Inactive
69 
70 //Types of CIEs
71 #define CIE_NONE -1
72 #define CIE_IMAGE 0
73 #define CIE_IMAGE_NMCSD 1
74 #define CIE_IMAGE_BORDER 2
75 #define CIE_COORDS 3
76 #define CIE_TEXT 4
77 
78 //NMCSD Handles
79 #define CIE_HANDLE_N 0
80 #define CIE_HANDLE_M 1
81 #define CIE_HANDLE_C 3
82 #define CIE_HANDLE_S 3
83 #define CIE_HANDLE_D 4
84 
85 //Border handles
86 #define CIE_HANDLE_TL 0
87 #define CIE_HANDLE_TM 1
88 #define CIE_HANDLE_TR 2
89 #define CIE_HANDLE_ML 3
90 #define CIE_HANDLE_MR 4
91 #define CIE_HANDLE_BL 5
92 #define CIE_HANDLE_BM 6
93 #define CIE_HANDLE_BR 7
94 
95 //Text
96 #define CIE_COLOR_R 0
97 #define CIE_COLOR_G 1
98 #define CIE_COLOR_B 2
99 #define CIE_COLOR_A 3
100 
101 //Return vals
102 #define CIE_GC_NONE_SET 0
103 #define CIE_GC_X_SET (1<<0)
104 #define CIE_GC_Y_SET (1<<1)
105 #define CIE_GC_W_SET (1<<2)
106 #define CIE_GC_H_SET (1<<3)
107 
108 //Global stuff
109 #define CIE_NUM_HANDLES 8 //We need 8 for border
110 union Handle
111 {
114 };
115 
116 //Individual info
118 {
119  int CIEType;
120  Handle Handles[CIE_NUM_HANDLES];
121  int Coords[2];
122 
123 public:
124  //--CONSTRUCTORS
125  ClassInfoEntry();
126  ~ClassInfoEntry();
127 
128  //--SET FUNCTIONS
129  void Parse(char* tag, int in_type);
130 
131  //--GET FUNCTIONS
132  int GetImageHandle(int ID=CIE_HANDLE_N){return Handles[ID].Image;}
133  ubyte GetColorHandle(int ColorID, int ID=CIE_HANDLE_N){return Handles[ID].Colors[ColorID];}
134  //Copies the coordinates to the given location if coordinates are set.
135  int GetCoords(int *x, int *y);
136 };
137 
138 //Entries for an object, ie a window or button
140 {
141  friend class GUIScreen;
142 private:
143  int Object;
144  SCP_string Name; //Do we want this to only apply to a specific object?
145  //If so, set name
146  int Coords[4];
147 
150 public:
151  ObjectClassInfoEntry(){Object=-1;Coords[0]=Coords[1]=Coords[2]=Coords[3]=INT_MAX;}
152  bool Parse();
153  int GetImageHandle(int id, int handle_num);
154  int GetCoords(int id, int *x, int *y);
155 
156  int GetObjectCoords(int *x, int *y, int *w, int *h);
157 };
158 
159 //Entries for a screen.
161 {
162  friend class GUIScreen;
163 private:
164  SCP_string Name;
166 public:
167  bool Parse();
168 
169  SCP_string GetName(){return Name;}
170 };
171 
172 //*****************************GUIObject*******************************
173 //What type a GUIObject is, mostly for debugging
174 #define GT_NONE 0
175 #define GT_WINDOW 1
176 #define GT_BUTTON 2
177 #define GT_MENU 3
178 #define GT_TEXT 4
179 #define GT_CHECKBOX 5
180 #define GT_IMAGEANIM 6
181 #define GT_HUDGAUGE 7
182 #define GT_NUM_TYPES 8 //Total number of types
183 
184 //States of being for GUIObjects
185 #define GST_NORMAL 0
186 #define GST_MOUSE_LEFT_BUTTON (1<<0)
187 #define GST_MOUSE_RIGHT_BUTTON (1<<1)
188 #define GST_MOUSE_MIDDLE_BUTTON (1<<2)
189 #define GST_MOUSE_OVER (1<<3)
190 #define GST_KEYBOARD_CTRL (1<<4)
191 #define GST_KEYBOARD_ALT (1<<5)
192 #define GST_KEYBOARD_SHIFT (1<<6)
193 #define GST_KEYBOARD_KEYPRESS (1<<7)
194 
195 #define GST_MOUSE_PRESS (GST_MOUSE_LEFT_BUTTON | GST_MOUSE_RIGHT_BUTTON | GST_MOUSE_MIDDLE_BUTTON)
196 #define GST_MOUSE_STATUS (GST_MOUSE_LEFT_BUTTON | GST_MOUSE_RIGHT_BUTTON | GST_MOUSE_MIDDLE_BUTTON | GST_MOUSE_OVER)
197 #define GST_KEYBOARD_STATUS (GST_KEYBOARD_CTRL | GST_KEYBOARD_ALT | GST_KEYBOARD_SHIFT | GST_KEYBOARD_KEYPRESS)
198 
199 //GUIObject styles
200 #define GS_NOAUTORESIZEX (1<<0)
201 #define GS_NOAUTORESIZEY (1<<1)
202 #define GS_HIDDEN (1<<2)
203 #define GS_INTERNALCHILD (1<<3)
204 
205 //DoFrame return values
206 #define OF_TRUE -1
207 #define OF_FALSE -2
208 //#define OF_DESTROYED -3 //If a call to DoFrame results in the object destroying itself
209  //(ie the close button was pressed)
210 
211 class GUIObject : public LinkedList
212 {
213  friend class Window; //Hack, because I can't figure out how to let it access protected
214  friend class Menu; //This too
215  friend class Text; //And this
216  friend class Tree; //By, the way...THIS
217  friend class Checkbox;
218  friend class Button;
219  friend class ImageAnim;
220  friend class HUDGauge;
221  friend class GUIScreen;
222  friend class GUISystem;
223 private:
224  class GUISystem *OwnerSystem; //What system this object is associated with
225  class GUIScreen *OwnerScreen;
226 
227  int Coords[4]; //Upper left corner (x, y) and lower right corner (x, y)
228  int ChildCoords[4]; //Coordinates where children may frolick
229 
230  int Type;
231  SCP_string Name;
232 
233  int LastStatus;
234  int Status;
235  int Style;
236 
237  class ObjectClassInfoEntry* InfoEntry;
238 
239  void (*CloseFunction)(GUIObject *caller);
240 
241  class GUIObject* Parent;
242  LinkedList Children;
243 
244  int GetOIECoords(int *x1, int *y1, int *x2, int *y2);
245  GUIObject *AddChildInternal(GUIObject* cgp);
246 protected:
247  //ON FUNCTIONS
248  //These handle the calling of do functions, mostly.
249  void OnDraw(float frametime);
250  int OnFrame(float frametime, int *unused_queue);
251  void OnMove(int dx, int dy);
252  void OnRefreshSize(){if(DoRefreshSize() != OF_FALSE && Parent!=NULL)Parent->OnRefreshSize();}
254 
255  //DO FUNCTIONS
256  //Used by individual objects to define actions when that event happens
257  virtual void DoDraw(float frametime){}
258  virtual int DoFrame(float frametime){return OF_FALSE;}
259  virtual int DoRefreshSize(){return OF_FALSE;}
260  virtual void DoRefreshSkin(){}
261  virtual void DoMove(int dx, int dy){}
262  virtual int DoMouseOver(float frametime){return OF_FALSE;}
263  virtual int DoMouseDown(float frametime){return OF_FALSE;}
264  virtual int DoMouseUp(float frametime){return OF_FALSE;} //In other words, a click
265  virtual int DoMouseOut(float frametime){return OF_FALSE;}
266  virtual int DoKeyState(float frametime){return OF_FALSE;}
267  virtual int DoKeyPress(float frametime){return OF_FALSE;}
268 
269  //CALCULATESIZE
270  //Sort of an on and do function; if you define your own, the following MUST be included at the end:
271  //"if(Parent!=NULL)Parent->OnRefreshSize();"
272 
273  //PRIVATE ClassInfo FUNCTIONS
274  void SetCIPointer();
275  int GetCIEImageHandle(int id, int handleid=0){if(InfoEntry!=NULL){return InfoEntry->GetImageHandle(id, handleid);}else{return -1;}}
276  int GetCIECoords(int id, int *x, int *y);
277 public:
278  //CONSTRUCTION/DESTRUCTION
279  //Derive your class's constructer from the GUIObject one
280  GUIObject(const SCP_string &in_Name="", int x_coord = 0, int y_coord = 0, int x_width = -1, int y_height = -1, int in_style = 0);
281  ~GUIObject();
282  void Delete();
283 
284  //CHILD FUNCTIONS
285  //Used for managing children. :)
287  void DeleteChildren(GUIObject* exception = NULL);
288 
289  //SET FUNCTIONS
290  void SetPosition(int x, int y);
291  void SetCloseFunction(void (*in_closefunc)(GUIObject* caller)){CloseFunction = in_closefunc;}
292 
293  //GET FUNCTIONS
294  int GetWidth(){return Coords[2]-Coords[0];}
295  int GetHeight(){return Coords[3]-Coords[1];}
296 };
297 
298 //*****************************GUIScreen*******************************
299 #define GSOF_NOTHINGPRESSED -1
300 #define GSOF_SOMETHINGPRESSED -2
301 class GUIScreen : public LinkedList
302 {
303  friend class GUISystem;
304 private:
305  SCP_string Name;
306 
307  GUISystem* OwnerSystem;
308 
309  ScreenClassInfoEntry* ScreenClassInfo;
310  GUIObject Guiobjects;
311  SCP_vector<GUIObject*> DeletionCache;
312 public:
313  GUIScreen(const SCP_string &in_Name="");
314  ~GUIScreen();
315 
317 
318  //Set funcs
319  GUIObject *Add(GUIObject* new_gauge);
320  void DeleteObject(GUIObject* dgp);
321 
322  //On funcs
323  int OnFrame(float frametime, bool doevents);
324 };
325 
326 //*****************************GUISystem*******************************
328 {
329  friend class GUIScreen; //I didn't want to do this, but it's the easiest way
330  //to keep it from being confusing about how to remove GUIScreens
331 private:
332  GUIScreen Screens;
333  GUIObject* ActiveObject;
334 
335  //Moving stuff
336  GUIObject* GraspedGuiobject;
337  int GraspingButton; //Button flag for button used to grasp the object
338  int GraspedDiff[2]; //Diff between initial mouse position and object corner
339 
340  //Linked list of screen class info
341  bool ClassInfoParsed;
342  ScreenClassInfoEntry ScreenClassInfo;
343 
344  //Mouse/status
345  int MouseX;
346  int MouseY;
347  int KeyPressed;
348  int Status, LastStatus;
349 
350  void DestroyClassInfo();
351 public:
352  GUISystem();
353  ~GUISystem();
354 
355  //-----
357  void PullScreen(GUIScreen *in_screen);
358  ScreenClassInfoEntry *GetClassInfo(){return &ScreenClassInfo;}
359  ScreenClassInfoEntry *GetScreenClassInfo(const SCP_string & screen_name);
360  //-----
361 
362  //Set stuff
363  void ParseClassInfo(char* section);
364  void SetActiveObject(GUIObject *cgp);
365  void SetGraspedObject(GUIObject *cgp, int button);
366 
367  //Get stuff
368  int GetMouseX(){return MouseX;}
369  int GetMouseY(){return MouseY;}
370  int GetStatus(){return Status;}
371  //int *GetLimits(){return Guiobjects.ChildCoords;}
372  GUIObject* GetActiveObject(){return ActiveObject;}
373  GUIObject* GetGraspedObject(){return GraspedGuiobject;}
374  int GetKeyPressed(){return KeyPressed;}
375 
376  int OnFrame(float frametime, bool doevents, bool clearandflip);
377 };
378 
379 //*****************************Window*******************************
380 #define W_BORDERWIDTH 1
381 #define W_BORDERHEIGHT 1
382 
383 #define WS_NOTITLEBAR (1<<31) // doesn't have a title bar (ie, no title or min/close buttons)
384 #define WS_NONMOVEABLE (1<<30) // can't be moved around
385 
386 #define WCI_CAPTION 0
387 #define WCI_CAPTION_TEXT 1
388 #define WCI_BORDER 2
389 #define WCI_BODY 3
390 #define WCI_HIDE 4
391 #define WCI_CLOSE 5
392 #define WCI_COORDS 6
393 #define WCI_NUM_ENTRIES 7
394 
395 class Window : public GUIObject
396 {
397  SCP_string Caption;
398 
399  //Close
400  bool CloseHighlight;
401  int CloseCoords[4];
402 
403  //Hide
404  bool HideHighlight;
405  int HideCoords[4];
406 
407  //Caption text
408  int CaptionCoords[4];
409 
410  //Old height
411  int UnhiddenHeight;
412 
413  //Skinning stuff
414  //Left width, top height, right width, bottom height
415  int BorderSizes[4];
416  bitmap_rect_list BorderRectLists[8];
417  bitmap_rect_list CaptionRectList;
418 
419  shader WindowShade;
420 
421 protected:
422  void DoDraw(float frametime);
423  void DoMove(int dx, int dy);
424  int DoRefreshSize();
425  int DoMouseOver(float frametime);
426  int DoMouseDown(float frametime);
427  int DoMouseUp(float frametime);
428  int DoMouseOut(float frametime);
429  bool HasChildren(){return NOT_EMPTY(&Children);}
430 
431 public:
432  Window(const SCP_string &in_caption, int x_coord, int y_coord, int x_width = -1, int y_height = -1, int in_style = 0);
433  void SetCaption(const SCP_string &in_caption){Caption = in_caption;}
434  void ClearContent();
435 };
436 
437 //*****************************Button*******************************
438 //#define DEFAULT_BUTTON_WIDTH 50
439 #define B_BORDERWIDTH 1
440 #define B_BORDERHEIGHT 1
441 #define DEFAULT_BUTTON_HEIGHT 15
442 
443 #define BS_STICKY (1<<31) //Button stays pressed
444 
445 #define BCI_COORDS 0
446 #define BCI_BUTTON 1
447 #define BCI_NUM_ENTRIES 2
448 
449 class Button : public GUIObject
450 {
451  SCP_string Caption;
452  void (*function)(Button *caller);
453 
454  bool IsDown; //Does it look pressed?
455 
456 protected:
457  void DoDraw(float frametime);
458  int DoRefreshSize();
459  int DoMouseDown(float frametime);
460  int DoMouseUp(float frametime);
461  int DoMouseOut(float frametime);
462 public:
463  Button(const SCP_string &in_caption, int x_coord, int y_coord, void (*in_function)(Button *caller) = NULL, int x_width = -1, int y_height = -1, int in_style = 0);
464 
465  void SetPressed(bool in_isdown){IsDown = in_isdown;}
466 };
467 
468 //*****************************Tree*******************************
469 
470 //In pixels
471 #define TI_BORDER_WIDTH 1
472 #define TI_BORDER_HEIGHT 1
473 #define TI_INITIAL_INDENT 2
474 #define TI_INITIAL_INDENT_VERTICAL 2
475 #define TI_INDENT_PER_LEVEL 10
476 #define TI_SPACE_BETWEEN_VERTICAL 2
477 
478 // forward declaration
479 class Tree;
480 
481 struct TreeItem : public LinkedList
482 {
483  friend class Tree;
484 private:
485  SCP_string Name;
486  void (*Function)(Tree *caller);
487  int Data;
488 
489  bool DeleteData; //Do we delete data for the user?
490  bool ShowThis;
491  bool ShowChildren;
492 
493  int Coords[4]; //For hit testing
494 
495  TreeItem *Parent;
496  LinkedList Children;
497 public:
498  //Get
499  TreeItem * GetParentItem(){return Parent;}
500  int GetData(){return Data;}
501  bool HasChildren(){return NOT_EMPTY(&Children);}
502 
503  void ClearAllItems();
504 
505  TreeItem();
506  ~TreeItem();
507 };
508 
509 class Tree : public GUIObject
510 {
511  TreeItem Items;
512  void *AssociatedItem;
513 
514  TreeItem *SelectedItem;
515  TreeItem *HighlightedItem;
516 
517  TreeItem* HitTest(TreeItem *items);
518 
519  void MoveTreeItems(int dx, int dy, TreeItem *items);
520  void CalcItemsSize(TreeItem *items, int *DrawData);
521  void DrawItems(TreeItem *items);
522 protected:
523  void DoDraw(float frametime);
524  void DoMove(int dx, int dy);
525  int DoRefreshSize();
526  int DoMouseOver(float frametime);
527  int DoMouseDown(float frametime);
528  int DoMouseUp(float frametime);
529 public:
530  Tree(const SCP_string &in_name, int x_coord, int y_coord, void* in_associateditem = NULL, int x_width = -1, int y_width = -1, int in_style = 0);
531 
532  //void LoadItemList(TreeItem *in_list, unsigned int count);
533  TreeItem* AddItem(TreeItem *parent, const SCP_string &in_name, int in_data = 0, bool in_delete_data = true, void (*in_function)(Tree *caller) = NULL);
534  void ClearItems();
535 
536  TreeItem* GetSelectedItem(){return SelectedItem;}
537 };
538 
539 //*****************************Text*******************************
540 #define MAX_TEXT_LINES 100
541 #define T_EDITTABLE (1<<31)
542 
543 //What type?
544 #define T_ST_NONE 0 //No saving
545 #define T_ST_INT (1<<0)
546 #define T_ST_SINT (1<<1)
547 #define T_ST_CHAR (1<<2)
548 #define T_ST_FLOAT (1<<3)
549 #define T_ST_UBYTE (1<<4)
550 
551 //When do we save changes?
552 #define T_ST_ONENTER (1<<21)
553 #define T_ST_CLOSE (1<<22)
554 #define T_ST_REALTIME (1<<23)
555 
556 //If dynamically allocated, then how?
557 #define T_ST_NEW (1<<30) //Allocated using new
558 #define T_ST_MALLOC (1<<31) //Allocated using malloc
559 
560 class Text : public GUIObject
561 {
562  SCP_string Content;
563 
564  //Used to display stuff; change only from calculate func
565  int NumLines;
566  int LineLengths[MAX_TEXT_LINES];
567  const char *LineStartPoints[MAX_TEXT_LINES];
568 
569  //Used for editing
570  int CursorPos; //Line #, then position in line
571  int SaveType;
572  union
573  {
580  };
581  union{int SaveMax;float flSaveMax;uint uSaveMax;};
582  union{int SaveMin;float flSaveMin;uint uSaveMin;};
583 
584 protected:
585  void DoDraw(float frametime);
586  int DoRefreshSize();
587  int DoMouseDown(float frametime);
588  int DoKeyPress(float frametime);
589 public:
590  Text(const SCP_string &in_name, const SCP_string &in_content, int x_coord, int y_coord, int x_width = -1, int y_width = -1, int in_style = 0);
591 
592  //Set
593  void SetText(const SCP_string &in_content);
594  void SetText(int the_int);
595  void SetText(float the_float);
596  void SetSaveLoc(int *ptr, int save_method, int max_value=INT_MAX, int min_value=INT_MIN);
597  void SetSaveLoc(short int *sint_ptr, int save_method, short int max_value=SHRT_MAX, short int min_value=SHRT_MIN);
598  void SetSaveLoc(float *ptr, int save_method, float max_value=INT_MAX, float min_value=INT_MIN);
599  void SetSaveLoc(char *ptr, int save_method, uint max_len=UINT_MAX, uint min_len = 0);
600  void SetSaveLoc(ubyte *ptr, int save_method, int max_value=UCHAR_MAX, int min_value=0);
601  void SetSaveStringAlloc(char **ptr, int save_method, int mem_flags, uint max_len=UINT_MAX, uint min_len = 0);
602  void AddLine(const SCP_string &in_line);
603 
604  //Get?
605  bool Save();
606  void Load();
607 };
608 
609 //*****************************Checkbox*******************************
610 #define CB_TEXTCHECKDIST 2
611 
612 class Checkbox : public GUIObject
613 {
614  SCP_string Label;
615  void (*function)(Checkbox *caller);
616 
617  //For toggling flags with this thing
618  int* FlagPtr;
619  int Flag;
620 
621  bool *BoolFlagPtr;
622 
623  int CheckCoords[4];
624  bool IsChecked; //Is it checked?
625  int HighlightStatus;
626 
627 protected:
628  void DoDraw(float frametime);
629  void DoMove(int dx, int dy);
630  int DoRefreshSize();
631  int DoMouseOver(float frametime);
632  int DoMouseDown(float frametime);
633  int DoMouseUp(float frametime);
634  int DoMouseOut(float frametime);
635 
636 public:
637  Checkbox(const SCP_string &in_label, int x_coord, int y_coord, void (*in_function)(Checkbox *caller) = NULL, int x_width = -1, int y_height = DEFAULT_BUTTON_HEIGHT, int in_style = 0);
638 
639  bool GetChecked() {
640  return IsChecked;
641  }
642 
643  void SetLabel(const SCP_string &in_label) {
644  Label = in_label;
645  }
646 
647  void SetChecked(bool in_ischecked) {
648  IsChecked = in_ischecked;
649  }
650 
651  void SetFlag(int* in_flag_ptr, int in_flag) {
652  FlagPtr = in_flag_ptr;
653  Flag = in_flag;
654 
655  if ( (FlagPtr != NULL) && (*FlagPtr & Flag) ) {
656  IsChecked = true;
657  }
658  }
659 
660  void SetFlag(uint* in_flag_ptr, int in_flag) {
661  SetFlag((int*)in_flag_ptr, in_flag);
662  }
663 
664  void SetBool(bool *in_bool_ptr) {
665  BoolFlagPtr = in_bool_ptr;
666  }
667 };
668 
669 //*****************************ImageAnim*******************************
670 #define PT_STOPPED 0
671 #define PT_PLAYING 1
672 #define PT_PLAYING_REVERSE 2
673 #define PT_STOPPED_REVERSE 3
674 
675 #define IF_NONE 0
676 #define IF_BOUNCE 1
677 #define IF_REPEAT 2
678 #define IF_REVERSED 3
679 
680 class ImageAnim : public GUIObject
681 {
682  SCP_string ImageAnimName;
683 
684  IMG_HANDLE ImageHandle;
685  int TotalFrames;
686  int FPS;
687  bool IsSet; //Something of a hack, this is called so that
688  //SetImage overrides skin image
689 
690  float Progress;
691  float ElapsedTime;
692  float TotalTime;
693 
694  int PlayType;
695  int ImageFlags;
696 protected:
697  void DoDraw(float frametime);
698  int DoRefreshSize();
699 public:
700  ImageAnim(const SCP_string &in_name, const SCP_string &in_imagename, int x_coord, int y_coord, int x_width = -1, int y_width = -1, int in_style = 0);
701 
702  void SetImage(const SCP_string &in_imagename);
703  void Play(bool in_isreversed);
704  void Pause();
705  void Stop();
706 };
707 
708 //*****************************GLOBALS*******************************
709 extern GUISystem GUI_system;
Definition: wmcgui.h:560
int OnFrame(float frametime, int *unused_queue)
Definition: wmcgui.cpp:874
int DoRefreshSize()
Definition: wmcgui.cpp:1936
void SetSaveLoc(int *ptr, int save_method, int max_value=INT_MAX, int min_value=INT_MIN)
Definition: wmcgui.cpp:2138
Definition: wmcgui.h:139
int GetMouseY()
Definition: wmcgui.h:369
void DeleteChildren(GUIObject *exception=NULL)
Definition: wmcgui.cpp:770
int DoMouseDown(float frametime)
Definition: wmcgui.cpp:1311
GUIScreen * PushScreen(GUIScreen *csp)
Definition: wmcgui.cpp:562
struct LinkedList * prev
Definition: wmcgui.h:46
int GetImageHandle(int ID=CIE_HANDLE_N)
Definition: wmcgui.h:132
~GUIScreen()
Definition: wmcgui.cpp:352
int DoKeyPress(float frametime)
Definition: wmcgui.cpp:2038
int DoMouseDown(float frametime)
Definition: wmcgui.cpp:1636
virtual int DoKeyPress(float frametime)
Definition: wmcgui.h:267
GLfloat GLfloat GLfloat GLfloat h
Definition: Glext.h:7280
void AddLine(const SCP_string &in_line)
Definition: wmcgui.cpp:2132
void OnRefreshSize()
Definition: wmcgui.h:252
int GetStatus()
Definition: wmcgui.h:370
Definition: wmcgui.h:395
int GetCIECoords(int id, int *x, int *y)
Definition: wmcgui.cpp:972
int DoMouseDown(float frametime)
Definition: wmcgui.cpp:2424
Checkbox(const SCP_string &in_label, int x_coord, int y_coord, void(*in_function)(Checkbox *caller)=NULL, int x_width=-1, int y_height=DEFAULT_BUTTON_HEIGHT, int in_style=0)
Definition: wmcgui.cpp:2339
ubyte GetColorHandle(int ColorID, int ID=CIE_HANDLE_N)
Definition: wmcgui.h:133
int SaveMin
Definition: wmcgui.h:582
Tree(const SCP_string &in_name, int x_coord, int y_coord, void *in_associateditem=NULL, int x_width=-1, int y_width=-1, int in_style=0)
Definition: wmcgui.cpp:1779
int SaveMax
Definition: wmcgui.h:581
uint uSaveMax
Definition: wmcgui.h:581
void SetFlag(int *in_flag_ptr, int in_flag)
Definition: wmcgui.h:651
void Parse(char *tag, int in_type)
Definition: wmcgui.cpp:175
int OnFrame(float frametime, bool doevents, bool clearandflip)
Definition: wmcgui.cpp:601
LinkedList()
Definition: wmcgui.h:48
GUIObject * Add(GUIObject *new_gauge)
Definition: wmcgui.cpp:424
~TreeItem()
Definition: wmcgui.cpp:1693
Definition: 2d.h:82
TreeItem()
Definition: wmcgui.cpp:1671
virtual void DoRefreshSkin()
Definition: wmcgui.h:260
int DoMouseUp(float frametime)
Definition: wmcgui.cpp:1646
virtual int DoMouseOver(float frametime)
Definition: wmcgui.h:262
Definition: wmcgui.h:117
ubyte Colors[4]
Definition: wmcgui.h:112
GUIObject * GetGraspedObject()
Definition: wmcgui.h:373
virtual int DoRefreshSize()
Definition: wmcgui.h:259
bool Parse()
Definition: wmcgui.cpp:119
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
#define CIE_NUM_HANDLES
Definition: wmcgui.h:109
virtual void DoMove(int dx, int dy)
Definition: wmcgui.h:261
void SetGraspedObject(GUIObject *cgp, int button)
Definition: wmcgui.cpp:691
int GetMouseX()
Definition: wmcgui.h:368
ObjectClassInfoEntry()
Definition: wmcgui.h:151
void SetCIPointer()
Definition: wmcgui.cpp:1048
char * chSavePointer
Definition: wmcgui.h:578
int DoMouseOver(float frametime)
Definition: wmcgui.cpp:1851
bool HasChildren()
Definition: wmcgui.h:501
int DoMouseUp(float frametime)
Definition: wmcgui.cpp:2438
void ClearAllItems()
Definition: wmcgui.cpp:1683
void SetActiveObject(GUIObject *cgp)
Definition: wmcgui.cpp:675
void DoDraw(float frametime)
Definition: wmcgui.cpp:2390
int DoMouseDown(float frametime)
Definition: wmcgui.cpp:1999
int DoRefreshSize()
Definition: wmcgui.cpp:2546
char ** chpSavePointer
Definition: wmcgui.h:579
int GetWidth()
Definition: wmcgui.h:294
int GetKeyPressed()
Definition: wmcgui.h:374
virtual int DoMouseUp(float frametime)
Definition: wmcgui.h:264
GUIScreen(const SCP_string &in_Name="")
Definition: wmcgui.cpp:332
unsigned int uint
Definition: pstypes.h:64
Window(const SCP_string &in_caption, int x_coord, int y_coord, int x_width=-1, int y_height=-1, int in_style=0)
Definition: wmcgui.cpp:1551
GUIObject(const SCP_string &in_Name="", int x_coord=0, int y_coord=0, int x_width=-1, int y_height=-1, int in_style=0)
Definition: wmcgui.cpp:715
int GetHeight()
Definition: wmcgui.h:295
void Play(bool in_isreversed)
Definition: wmcgui.cpp:2576
#define DEFAULT_BUTTON_HEIGHT
Definition: wmcgui.h:441
int DoMouseOver(float frametime)
Definition: wmcgui.cpp:2412
void Stop()
Definition: wmcgui.cpp:2592
bool Parse()
Definition: wmcgui.cpp:48
#define OF_FALSE
Definition: wmcgui.h:207
void SetChecked(bool in_ischecked)
Definition: wmcgui.h:647
Definition: wmcgui.h:509
void OnMove(int dx, int dy)
Definition: wmcgui.cpp:954
int GetObjectCoords(int *x, int *y, int *w, int *h)
Definition: wmcgui.cpp:309
void ClearItems()
Definition: wmcgui.cpp:1923
void OnRefreshSkin()
Definition: wmcgui.h:253
Definition: wmcgui.h:110
int DoMouseOver(float frametime)
Definition: wmcgui.cpp:1288
uint uSaveMin
Definition: wmcgui.h:582
int DoRefreshSize()
Definition: wmcgui.cpp:1754
friend class Menu
Definition: wmcgui.h:214
void DoDraw(float frametime)
Definition: wmcgui.cpp:2491
void SetText(const SCP_string &in_content)
Definition: wmcgui.cpp:2110
void SetCloseFunction(void(*in_closefunc)(GUIObject *caller))
Definition: wmcgui.h:291
SCP_string GetName()
Definition: wmcgui.h:169
int OnFrame(float frametime, bool doevents)
Definition: wmcgui.cpp:473
void SetPressed(bool in_isdown)
Definition: wmcgui.h:465
void DoMove(int dx, int dy)
Definition: wmcgui.cpp:1371
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
#define CIE_HANDLE_N
Definition: wmcgui.h:79
unsigned char ubyte
Definition: pstypes.h:62
TreeItem * AddItem(TreeItem *parent, const SCP_string &in_name, int in_data=0, bool in_delete_data=true, void(*in_function)(Tree *caller)=NULL)
Definition: wmcgui.cpp:1902
void SetSaveStringAlloc(char **ptr, int save_method, int mem_flags, uint max_len=UINT_MAX, uint min_len=0)
Definition: wmcgui.cpp:2213
bool HasChildren()
Definition: wmcgui.h:429
GUIObject * AddChild(GUIObject *cgp)
Definition: wmcgui.cpp:819
Button(const SCP_string &in_caption, int x_coord, int y_coord, void(*in_function)(Button *caller)=NULL, int x_width=-1, int y_height=-1, int in_style=0)
Definition: wmcgui.cpp:1568
int * iSavePointer
Definition: wmcgui.h:575
void OnDraw(float frametime)
Definition: wmcgui.cpp:862
#define IMG_HANDLE
Definition: wmcgui.h:23
ImageAnim(const SCP_string &in_name, const SCP_string &in_imagename, int x_coord, int y_coord, int x_width=-1, int y_width=-1, int in_style=0)
Definition: wmcgui.cpp:2477
void SetBool(bool *in_bool_ptr)
Definition: wmcgui.h:664
float * flSavePointer
Definition: wmcgui.h:577
int GetCoords(int *x, int *y)
Definition: wmcgui.cpp:284
typedef void(APIENTRY *PFNGLARRAYELEMENTEXTPROC)(GLint i)
int GetData()
Definition: wmcgui.h:500
int DoMouseOut(float frametime)
Definition: wmcgui.cpp:2469
int GetCoords(int id, int *x, int *y)
Definition: wmcgui.cpp:304
int DoMouseOut(float frametime)
Definition: wmcgui.cpp:1364
ScreenClassInfoEntry * GetClassInfo()
Definition: wmcgui.h:358
void Pause()
Definition: wmcgui.cpp:2583
float flSaveMin
Definition: wmcgui.h:582
Definition: wmcgui.h:160
virtual int DoMouseDown(float frametime)
Definition: wmcgui.h:263
GUISystem()
Definition: wmcgui.cpp:543
virtual void DoDraw(float frametime)
Definition: wmcgui.h:257
GLubyte GLubyte GLubyte GLubyte w
Definition: Glext.h:5679
void SetLabel(const SCP_string &in_label)
Definition: wmcgui.h:643
GUIObject * GetActiveObject()
Definition: wmcgui.h:372
bool GetChecked()
Definition: wmcgui.h:639
bool Save()
Definition: wmcgui.cpp:2258
short * siSavePointer
Definition: wmcgui.h:574
virtual ~LinkedList()
Definition: wmcgui.h:49
void DoDraw(float frametime)
Definition: wmcgui.cpp:2012
int DoMouseDown(float frametime)
Definition: wmcgui.cpp:1857
void Load()
Definition: wmcgui.cpp:2316
int DoMouseOut(float frametime)
Definition: wmcgui.cpp:1661
void DoDraw(float frametime)
Definition: wmcgui.cpp:1605
void DoMove(int dx, int dy)
Definition: wmcgui.cpp:1897
int DoMouseUp(float frametime)
Definition: wmcgui.cpp:1863
ubyte * ubSavePointer
Definition: wmcgui.h:576
void ClearContent()
Definition: wmcgui.cpp:1535
int DoMouseUp(float frametime)
Definition: wmcgui.cpp:1334
int DoRefreshSize()
Definition: wmcgui.cpp:1087
friend class HUDGauge
Definition: wmcgui.h:220
ScreenClassInfoEntry * GetScreenClassInfo(const SCP_string &screen_name)
Definition: wmcgui.cpp:589
int DoRefreshSize()
Definition: wmcgui.cpp:1581
void DoDraw(float frametime)
Definition: wmcgui.cpp:1812
~GUIObject()
Definition: wmcgui.cpp:757
void SetFlag(uint *in_flag_ptr, int in_flag)
Definition: wmcgui.h:660
virtual int DoMouseOut(float frametime)
Definition: wmcgui.h:265
void SetCaption(const SCP_string &in_caption)
Definition: wmcgui.h:433
TreeItem * GetSelectedItem()
Definition: wmcgui.h:536
void PullScreen(GUIScreen *in_screen)
Definition: wmcgui.cpp:574
~GUISystem()
Definition: wmcgui.cpp:551
virtual int DoKeyState(float frametime)
Definition: wmcgui.h:266
void DeleteObject(GUIObject *dgp)
Definition: wmcgui.cpp:468
IMG_HANDLE Image
Definition: wmcgui.h:113
Definition: wmcgui.h:449
#define MAX_TEXT_LINES
Definition: wmcgui.h:540
void ParseClassInfo(char *section)
Definition: wmcgui.cpp:142
struct LinkedList * next
Definition: wmcgui.h:46
void DoDraw(float frametime)
Definition: wmcgui.cpp:1415
void SetPosition(int x, int y)
Definition: wmcgui.cpp:1055
ClassInfoEntry()
Definition: wmcgui.cpp:24
ObjectClassInfoEntry * GetObjectClassInfo(GUIObject *cgp)
Definition: wmcgui.cpp:362
int GetCIEImageHandle(int id, int handleid=0)
Definition: wmcgui.h:275
~ClassInfoEntry()
Definition: wmcgui.cpp:34
int DoRefreshSize()
Definition: wmcgui.cpp:2355
void SetImage(const SCP_string &in_imagename)
Definition: wmcgui.cpp:2552
virtual int DoFrame(float frametime)
Definition: wmcgui.h:258
float flSaveMax
Definition: wmcgui.h:581
Text(const SCP_string &in_name, const SCP_string &in_content, int x_coord, int y_coord, int x_width=-1, int y_width=-1, int in_style=0)
Definition: wmcgui.cpp:2100
GLint y
Definition: Gl.h:1505
TreeItem * GetParentItem()
Definition: wmcgui.h:499
void DoMove(int dx, int dy)
Definition: wmcgui.cpp:2382
GUISystem GUI_system
Definition: wmcgui.cpp:21
void Delete()
Definition: wmcgui.cpp:853
int GetImageHandle(int id, int handle_num)
Definition: wmcgui.cpp:299