00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00036 #ifndef FUI_H
00037 #define FUI_H
00038
00039 #include "../Include/FlyLegacy.h"
00040 #include <list>
00041 #include <vector>
00042 #include <stack>
00043 #include <map>
00044 #include <string>
00045 #include <stdio.h>
00046
00047
00048
00049
00050
00051
00052 enum EFuiWindowIdentifier
00053 {
00054 FUI_WINDOW_FRAME_RATE = 'fpsw',
00055 FUI_WINDOW_SITUATION_LOAD = 'Load',
00056 FUI_WINDOW_SITUATION_SAVE = 'Save',
00057 FUI_WINDOW_SITUATION_SAVE_AS = 'SavA',
00058 FUI_WINDOW_QUIT = 'Quit',
00059 FUI_WINDOW_OPTIONS_SCENERY = 'tree',
00060 FUI_WINDOW_OPTIONS_REALISM = 'real',
00061 FUI_WINDOW_OPTIONS_STARTUP = 'gogo',
00062 FUI_WINDOW_OPTIONS_COCKPIT = 'cock',
00063 FUI_WINDOW_OPTIONS_TEST_CONTROLS = 'test',
00064 FUI_WINDOW_OPTIONS_KEYS_BUTTONS = 'real',
00065 FUI_WINDOW_OPTIONS_DATE_TIME = 'date',
00066 FUI_WINDOW_OPTIONS_SOUND = 'SndO',
00067 FUI_WINDOW_ADVENTURES = 'fnow',
00068 FUI_WINDOW_QUICKFLIGHT = 'gogo',
00069 FUI_WINDOW_TELEPORT = 'goto',
00070 FUI_WINDOW_TELEPORT_DIRECTORY = 'wdir',
00071 FUI_WINDOW_TELEPORT_ALERT = 'alrt',
00072 FUI_WINDOW_AIRCRAFT_OPTIONS = 'aplo',
00073 FUI_WINDOW_AIRCRAFT_CG = 'cgin',
00074 FUI_WINDOW_AIRCRAFT_AUTOTUNE = 'tune',
00075 FUI_WINDOW_AIRCRAFT_FUEL = 'fuel',
00076 FUI_WINDOW_AIRCRAFT_WEIGHT_BALANCE = 'phat',
00077 FUI_WINDOW_AIRCRAFT_DAMAGE = 'ouch',
00078 FUI_WINDOW_AIRCRAFT_SELECT = 'sela',
00079 FUI_WINDOW_WEATHER_METAR = 'meta',
00080 FUI_WINDOW_WEATHER_OTHER = 'env+',
00081 FUI_WINDOW_WEATHER_WINDS = 'wind',
00082 FUI_WINDOW_WEATHER_CLOUDS = 'clds',
00083 FUI_WINDOW_WEATHER_SKY_TWEAKER = 'skyc',
00084 FUI_WINDOW_WEATHER_OVERVIEW = 'envr',
00085 FUI_WINDOW_INSTANT_REPLAY = 'insR',
00086 FUI_WINDOW_AXIS = 'axis',
00087 FUI_WINDOW_MAP = 'smap',
00088 FUI_WINDOW_VECTOR_MAP = 'mapw',
00089 };
00090
00091
00092 enum EFuiComponentTypes
00093 {
00094 COMPONENT_WINDOW = 'wind',
00095 COMPONENT_BUTTON = 'butn',
00096 COMPONENT_DOUBLE_BUTTON = 'dbtn',
00097 COMPONENT_DEFAULT_BUTTON = 'okbn',
00098 COMPONENT_CHECKBOX = 'chkb',
00099 COMPONENT_RADIOBUTTON = 'radb',
00100 COMPONENT_LABEL = 'labl',
00101 COMPONENT_LINE = 'line',
00102 COMPONENT_BOX = 'box_',
00103 COMPONENT_PICTURE = 'pict',
00104 COMPONENT_POPUPMENU = 'popu',
00105 COMPONENT_MENUBAR = 'mbar',
00106 COMPONENT_SCROLLBAR = 'scrl',
00107 COMPONENT_SLIDER = 'slid',
00108 COMPONENT_GROUPBOX = 'grbx',
00109 COMPONENT_GAUGE = 'gage',
00110 COMPONENT_LIST = 'list',
00111 COMPONENT_SCROLLAREA = 'scla',
00112 COMPONENT_TEXTFIELD = 'edit',
00113 COMPONENT_TEXTAREA = 'txta',
00114 COMPONENT_PROGRESS = 'prog',
00115 COMPONENT_MAP = 'map_',
00116 COMPONENT_TABPAGE = 'ntab',
00117 COMPONENT_TABBUTTON = 'tabb',
00118 COMPONENT_TABCONTROL = 'tabs',
00119 COMPONENT_GRAPH = 'grph',
00120
00121
00122 COMPONENT_WINDOW_MENUBAR = 'wmbr',
00123 COMPONENT_MENU = 'mnu2',
00124 COMPONENT_DLLVIEW = 'DLLV',
00125 COMPONENT_DISCLOSURE = 'disc',
00126 COMPONENT_CANVAS = 'canv',
00127 COMPONENT_RUNWAY_CANVAS = 'rcvs',
00128 COMPONENT_MARQUEE = 'mrqe',
00129 COMPONENT_HORIZ_MARQUEE = 'hmrq',
00130 COMPONENT_WINDOW_NORESIZE = 'winn',
00131 COMPONENT_TITLE = 'titl',
00132 COMPONENT_PALETTE_WINDOW = 'pwin',
00133 COMPONENT_PALETTE_WINDOW_TITLE = 'wint',
00134 COMPONENT_CLOSE_BUTTON = 'clos',
00135 COMPONENT_MINIMIZE_BUTTON = 'mini',
00136 COMPONENT_ZOOM_BUTTON = 'zoom'
00137 };
00138
00139 enum EFuiEvents
00140 {
00141 EVENT_IDCHANGED ='dtid',
00142 EVENT_HIDDEN ='hide',
00143 EVENT_SHOWN ='show',
00144 EVENT_ENABLED ='enbl',
00145 EVENT_DISABLED ='!enb',
00146 EVENT_RESIZED ='size',
00147 EVENT_MOVED ='move',
00148 EVENT_RENAMED ='name',
00149 EVENT_COMPONENTDIED = 'dead',
00150 EVENT_CHECKED = 'chek',
00151 EVENT_UNCHECKED = 'uchk',
00152 EVENT_SELECTITEM = 'slct',
00153 EVENT_BUTTONPRESSED = 'actn',
00154 EVENT_TEXTCHANGED = 'delt',
00155 EVENT_TEXTSET = 'tset',
00156 EVENT_VALUECHANGED = 'valu',
00157 EVENT_OPENWINDOW ='open',
00158 EVENT_CLOSEWINDOW ='clos',
00159 EVENT_TITLECHANGED ='titl',
00160 EVENT_FOCUSLOST = '!foc',
00161 EVENT_FOCUSGAINED = 'foci',
00162 EVENT_WIDGETTYPECHANGED = 'widg',
00163 EVENT_DIALOGDISMISSED = 'dlog',
00164 EVENT_DIALOGDISMISSEDOK = 'dlOK',
00165 EVENT_DIALOGDISMISSEDCANCEL = 'dlCn',
00166 EVENT_UPDATE = 'updt',
00167 EVENT_ANYSUBEVENT = 0,
00168 EVENT_NOSUBEVENT = 0
00169 };
00170
00171 enum EFuiBinding {
00172 BIND_H_LEFT = 1<<0,
00173 BIND_H_RIGHT = 1<<1,
00174 BIND_H_CENTER = 1<<2,
00175 BIND_V_TOP = 1<<4,
00176 BIND_V_BOTTOM = 1<<5,
00177 BIND_V_CENTER = 1<<6
00178 };
00179
00180 enum EFuiJustify {
00181 JUSTIFY_H_LEFT = 1<<0,
00182 JUSTIFY_H_RIGHT = 1<<1,
00183 JUSTIFY_H_CENTER = 1<<2,
00184 JUSTIFY_V_TOP = 1<<4,
00185 JUSTIFY_V_BOTTOM = 1<<5,
00186 JUSTIFY_V_CENTER = 1<<6
00187 };
00188
00189 enum EFuiLayer {
00190 LAYER_NORMAL,
00191 LAYER_FLOATING,
00192 LAYER_MODAL,
00193 LAYER_FRONTMOST
00194 };
00195
00196
00197
00198
00199
00200 class CFuiComponent;
00201 class CFuiPicture;
00202 class CFuiButton;
00203 class CFuiCloseButton;
00204 class CFuiMiniButton;
00205 class CFuiZoomButton;
00206 class CFuiWindowTitle;
00207 class CFuiWindow;
00208
00209
00210
00211
00212
00213
00214 typedef void(*FuiEventNoticeCb)(Tag window,
00215 Tag component,
00216 EFuiEvents event,
00217 EFuiEvents subevent);
00218
00219
00220
00221
00222 class CFuiComponent : public CStreamObject
00223 {
00224 public:
00225
00226 CFuiComponent (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00227 virtual ~CFuiComponent (void);
00228
00229
00230 virtual int Read (SStream *stream, Tag tag);
00231 virtual void ReadFinished (void);
00232
00233
00234 inline bool IsType (EFuiComponentTypes type) { return (this->type == type); }
00235 virtual void SetParentWindowId (Tag parentWindowId);
00236 inline Tag GetId (void) { return id; }
00237 inline void Show (void) { show = true; }
00238 inline void Hide (void) { show = false; }
00239 inline void Enable (void) { enable = true; }
00240 inline void Disable (void) { enable = false; }
00241 inline char* GetText (void) { return text; }
00242 virtual void SetText (const char* text);
00243 virtual void SetPosition (int x, int y);
00244 virtual void SetParentPosition (int xParent, int yParent);
00245 virtual void SetSize (int w, int h);
00246 virtual void SetPositionSize (int x, int y, int w, int h);
00247 virtual bool MouseHit (int x, int y);
00248 virtual bool MouseMove (int x, int y);
00249 virtual bool MouseClick (int x, int y, EMouseButton button);
00250 virtual bool MouseStopClick (int x, int y, EMouseButton button);
00251
00252
00253 virtual void Draw (void);
00254
00255 protected:
00256 void MakeSurface (void);
00257
00258 protected:
00259 Tag parentWindowId;
00260
00261 EFuiComponentTypes type;
00262 Tag id;
00263 int bind;
00264 char widgetName[64];
00265 Tag widgetTag;
00266 char text[256];
00267 int xParent, yParent;
00268 int x, y;
00269 int w, h;
00270 int enable;
00271 int show;
00272 Tag fontTag;
00273 SFont *font;
00274
00275 SSurface *surface;
00276 };
00277
00278
00279
00280
00281
00282 class CFuiPicture : public CFuiComponent
00283 {
00284 public:
00285
00286 CFuiPicture (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00287 virtual ~CFuiPicture (void);
00288
00289
00290 virtual int Read (SStream *stream, Tag tag);
00291 virtual void ReadFinished (void);
00292
00293
00294 virtual void Draw (void);
00295
00296
00297 virtual void SetBitmap (SBitmap *bm);
00298 virtual void DrawTiledBitmap (SBitmap *bitmap);
00299 virtual void DrawNoTiling (void);
00300 virtual void SetFrame (int i);
00301
00302 protected:
00303 SBitmap *bm;
00304 bool destroyBitmap;
00305
00306
00307 int lastFrame;
00308 int frame;
00309 };
00310
00311
00312
00313
00314
00315 class CFuiButton : public CFuiComponent
00316 {
00317 public:
00318
00319 CFuiButton (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00320
00321
00322 virtual int Read (SStream *stream, Tag tag);
00323 virtual void ReadFinished (void);
00324
00325
00326 virtual void Draw (void);
00327 virtual void SetParentPosition (int xParent, int yParent);
00328 virtual bool MouseMove (int x, int y);
00329 virtual bool MouseClick (int x, int y, EMouseButton button);
00330 virtual bool MouseStopClick (int x, int y, EMouseButton button);
00331
00332
00333 void Fill (void);
00334
00335 protected:
00336 int ok;
00337 int canc;
00338 int rrpt;
00339 float rate;
00340 char psiz[64];
00341 int xLsiz, yLsiz;
00342 int xBsiz, yBsiz;
00343
00344 SBitmap* bmLeft;
00345 SBitmap* bmBack;
00346 SBitmap* bmRight;
00347 CFuiPicture* left;
00348 CFuiPicture* back;
00349 CFuiPicture* right;
00350 unsigned int colText;
00351
00352 bool state;
00353 };
00354
00355
00356
00357
00358
00359 class CFuiWindowTitle : public CFuiComponent
00360 {
00361 public:
00362
00363 CFuiWindowTitle (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00364
00365
00366
00367
00368 void Draw (void);
00369 void SetParentPosition (int xParent, int yParent);
00370
00371
00372 void Fill (void);
00373
00374 protected:
00375 SBitmap* bmBack;
00376 SBitmap* bmAltBack;
00377 SBitmap* bmLeft;
00378 SBitmap* bmRight;
00379 unsigned int colText;
00380
00381 CFuiPicture *back;
00382 CFuiPicture *left;
00383 CFuiPicture *right;
00384
00385 std::vector<CFuiComponent*> childVector;
00386 };
00387
00388
00389
00390
00391 class CFuiCloseButton : public CFuiComponent
00392 {
00393 public:
00394
00395 CFuiCloseButton (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00396
00397
00398
00399
00400 virtual void Draw (void);
00401 virtual void SetParentPosition (int xParent, int yParent);
00402 virtual bool MouseMove (int x, int y);
00403 virtual bool MouseClick (int x, int y, EMouseButton button);
00404 virtual bool MouseStopClick (int x, int y, EMouseButton button);
00405
00406
00407 void Fill (void);
00408
00409 protected:
00410 SBitmap* bmBack;
00411 CFuiPicture *back;
00412 bool state;
00413 };
00414
00415
00416
00417
00418 class CFuiMinimizeButton : public CFuiComponent
00419 {
00420 public:
00421
00422 CFuiMinimizeButton (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00423
00424
00425
00426
00427 virtual void Draw (void);
00428 virtual void SetParentPosition (int xParent, int yParent);
00429 virtual bool MouseMove (int x, int y);
00430 virtual bool MouseClick (int x, int y, EMouseButton button);
00431 virtual bool MouseStopClick (int x, int y, EMouseButton button);
00432
00433
00434 void Fill (void);
00435
00436 protected:
00437 SBitmap* bmBack;
00438 CFuiPicture *back;
00439 bool state;
00440 };
00441
00442
00443
00444
00445 class CFuiZoomButton : public CFuiComponent
00446 {
00447 public:
00448
00449 CFuiZoomButton (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00450
00451
00452
00453
00454 virtual void Draw (void);
00455 virtual void SetParentPosition (int xParent, int yParent);
00456 virtual bool MouseMove (int x, int y);
00457 virtual bool MouseClick (int x, int y, EMouseButton button);
00458 virtual bool MouseStopClick (int x, int y, EMouseButton button);
00459
00460
00461 void Fill (void);
00462
00463 protected:
00464 SBitmap* bmBack;
00465 CFuiPicture *back;
00466 bool state;
00467 };
00468
00469 typedef enum {
00470 FUI_WINDOW_INIT,
00471 FUI_WINDOW_OPEN,
00472 FUI_WINDOW_CLOSED,
00473 FUI_WINDOW_MOVE
00474 } EFuiWindowState;
00475
00476
00477
00478
00479
00480 class CFuiWindow : public CFuiComponent
00481 {
00482 public:
00483
00484 CFuiWindow (const char* winFilename, Tag tag, FuiEventNoticeCb handler = NULL);
00485 ~CFuiWindow (void);
00486
00487
00488 virtual int Read (SStream *stream, Tag tag);
00489 virtual void ReadFinished (void);
00490
00491
00492 virtual void Draw (void);
00493 virtual void Draw (SSurface *surface);
00494 virtual bool MouseMove (int x, int y);
00495 virtual bool MouseClick (int x, int y, EMouseButton button);
00496 virtual bool MouseStopClick (int x, int y, EMouseButton button);
00497 virtual void SetPosition (int x, int y);
00498
00499
00500 static void ParseThemeElement (const char* s);
00501
00502
00503 EFuiWindowState GetState (void);
00504 void SetTitle (const char* title);
00505 CFuiComponent* GetComponent (Tag component);
00506 void GenerateEventNotice (Tag componentId,
00507 EFuiEvents event,
00508 EFuiEvents subevent);
00509 void Close ();
00510
00511 protected:
00512 EFuiWindowState state;
00513 Tag windowId;
00514
00515 int xWsiz, yWsiz;
00516 int x1, y1, x2, y2;
00517 int title;
00518 int close;
00519 int mini;
00520 int zoom;
00521 int resize;
00522 int border;
00523 int borderSize;
00524 int move;
00525 EFuiLayer layer;
00526 int trns;
00527 int save;
00528
00529 char winFilename[64];
00530 FuiEventNoticeCb handler;
00531
00532 SBitmap *bmBack;
00533 SBitmap *bmTop;
00534 SBitmap *bmBottom;
00535 SBitmap *bmLeft;
00536 SBitmap *bmRight;
00537 SBitmap *bmTopLeft;
00538 SBitmap *bmTopRight;
00539 SBitmap *bmBottomLeft;
00540 SBitmap *bmBottomRight;
00541
00542 std::list<CFuiComponent*> decorationList;
00543 std::list<CFuiComponent*> childList;
00544
00545 CFuiWindowTitle *windowTitle;
00546 CFuiComponent *btnClose;
00547 CFuiComponent *btnMini;
00548 CFuiComponent *btnZoom;
00549
00550 int lastX, lastY;
00551 };
00552
00553
00554
00555
00556 class CFuiPopupMenu : public CFuiButton
00557 {
00558 public:
00559
00560 CFuiPopupMenu (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00561
00562
00563 virtual int Read (SStream *stream, Tag tag);
00564 virtual void ReadFinished (void);
00565
00566
00567 void Draw (void);
00568 void SetParentPosition (int xParent, int yParent);
00569
00570
00571 void ClearItems (void);
00572 void AddItem (Tag item, const char *label);
00573 void AddSeparator (void);
00574 void RemoveItem (Tag item);
00575 void SelectItem (Tag item);
00576 Tag GetItemSelection (char *outText);
00577
00578 protected:
00579 int just1, just2, just3;
00580
00581 SBitmap *bmBack;
00582 SBitmap *bmLeft;
00583 SBitmap *bmRight;
00584
00585 unsigned int colText, colSelection;
00586
00587 std::list<CFuiComponent*> decorationList;
00588 std::map<Tag, std::string> items;
00589 Tag selection;
00590 bool popupActive;
00591 int xText, yText;
00592 };
00593
00594
00595
00596
00597 class CFuiCheckbox : public CFuiComponent
00598 {
00599 public:
00600
00601 CFuiCheckbox (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00602
00603
00604 virtual int Read (SStream *stream, Tag tag);
00605 virtual void ReadFinished (void);
00606
00607
00608 void Draw (void);
00609 bool MouseClick (int x, int y, EMouseButton button);
00610 bool MouseStopClick (int x, int y, EMouseButton button);
00611
00612
00613 int GetState (void);
00614 void SetState (int);
00615
00616 protected:
00617 SBitmap *bmBack;
00618 int state;
00619 bool pressed;
00620 };
00621
00622
00623
00624
00625 class CFuiRadioButton : public CFuiComponent
00626 {
00627 public:
00628
00629 CFuiRadioButton (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00630
00631
00632 virtual int Read (SStream *stream, Tag tag);
00633 virtual void ReadFinished (void);
00634
00635
00636 virtual void Draw (void);
00637 virtual bool MouseClick (int x, int y, EMouseButton button);
00638 virtual bool MouseStopClick (int x, int y, EMouseButton button);
00639
00640
00641 int GetState (void);
00642 void SetState (int);
00643
00644 protected:
00645 SBitmap *bmBack;
00646 int state;
00647 bool pressed;
00648 };
00649
00650
00651
00652
00653 class CFuiLabel : public CFuiComponent
00654 {
00655 public:
00656
00657 CFuiLabel (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00658
00659
00660 virtual int Read (SStream *stream, Tag tag);
00661 virtual void ReadFinished (void);
00662
00663
00664 void Draw (void);
00665
00666
00667 void SetColour (unsigned int colour);
00668
00669 protected:
00670 int just;
00671 int wrap;
00672 unsigned int colText;
00673 unsigned int colShadow;
00674 bool useShadow;
00675 };
00676
00677
00678
00679
00680 #define FUI_LINE_HORIZONTAL 0
00681 #define FUI_LINE_VERTICAL 1
00682
00683 class CFuiLine : public CFuiComponent
00684 {
00685 public:
00686
00687 CFuiLine (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00688
00689
00690 virtual int Read (SStream *stream, Tag tag);
00691 virtual void ReadFinished (void);
00692
00693
00694 void Draw (void);
00695
00696 protected:
00697 int direction;
00698 int thickness;
00699
00700 unsigned int colLine;
00701 };
00702
00703
00704
00705
00706 class CFuiBox : public CFuiComponent
00707 {
00708 public:
00709
00710 CFuiBox (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00711
00712
00713 virtual int Read (SStream *stream, Tag tag);
00714 virtual void ReadFinished (void);
00715
00716
00717 void Draw (void);
00718
00719 protected:
00720 SBitmap *bmBack;
00721 SBitmap *bmTop;
00722 SBitmap *bmBottom;
00723 SBitmap *bmLeft;
00724 SBitmap *bmRight;
00725 SBitmap *bmTopLeft;
00726 SBitmap *bmTopRight;
00727 SBitmap *bmBottomLeft;
00728 SBitmap *bmBottomRight;
00729
00730 int thickness;
00731 unsigned int colLine;
00732 unsigned int colFill;
00733 };
00734
00735
00736 struct SMenuBarItem {
00737 Tag tag;
00738 char text[64];
00739 };
00740
00741
00742
00743
00744 class CFuiMenuBar : public CFuiComponent
00745 {
00746 public:
00747
00748
00749
00750
00751 protected:
00752 Tag menuTag;
00753 char menuString[64];
00754
00756 };
00757
00758
00759
00760
00761 class CFuiScrollBar : public CFuiComponent
00762 {
00763 public:
00764
00765
00766
00767
00768 protected:
00769
00770 };
00771
00772
00773
00774
00775 class CFuiSlider : public CFuiComponent
00776 {
00777 public:
00778
00779 CFuiSlider (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00780
00781
00782 virtual int Read (SStream *stream, Tag tag);
00783 virtual void ReadFinished (void);
00784
00785
00786 void Draw (void);
00787 void SetParentPosition (int xParent, int yParent);
00788
00789
00790 void SetMajorTickSpacing (float spacing);
00791 void SetMinorTickSpacing (float spacing);
00792 void SetSnapToTicks (int snapFlag);
00793 void SetDrawMajorTicks (int drawFlag);
00794 void SetDrawMinorTicks (int drawFlag);
00795 float GetMajorTickSpacing (void);
00796 float GetMinorTickSpacing (void);
00797 int GetSnapToTicks (void);
00798 int GetDrawMajorTicks (void);
00799 int GetDrawMinorTicks (void);
00800
00801 protected:
00802 SBitmap *bmBack;
00803 SBitmap *bmAltBack;
00804 SBitmap *bmHThumb;
00805 SBitmap *bmVThumb;
00806 SBitmap *bmHLTick;
00807 SBitmap *bmHSTick;
00808 SBitmap *bmVLTick;
00809 SBitmap *bmVSTick;
00810
00811 CFuiPicture *back;
00812
00813 float maxv, minv;
00814 float curv;
00815 float majt;
00816 int dmjt;
00817 float mint;
00818 int dmnt;
00819 int snap;
00820 Tag link;
00821
00822 bool vertical;
00823 };
00824
00825
00826
00827
00828 class CFuiGroupBox : public CFuiComponent
00829 {
00830 public:
00831
00832 CFuiGroupBox (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00833
00834
00835 virtual int Read (SStream *stream, Tag tag);
00836 virtual void ReadFinished (void);
00837
00838
00839 virtual bool MouseMove (int x, int y);
00840 virtual bool MouseClick (int x, int y, EMouseButton button);
00841 virtual bool MouseStopClick (int x, int y, EMouseButton button);
00842 void Draw (void);
00843 void SetParentPosition (int xParent, int yParent);
00844
00845 protected:
00846 SBitmap *bmBack;
00847 SBitmap *bmTop;
00848 SBitmap *bmBottom;
00849 SBitmap *bmLeft;
00850 SBitmap *bmRight;
00851 SBitmap *bmTopLeft;
00852 SBitmap *bmTopRight;
00853 SBitmap *bmBottomLeft;
00854 SBitmap *bmBottomRight;
00855
00856 bool transparent;
00857 unsigned int colText;
00858 int xText;
00859 std::list<CFuiComponent *> decorationList;
00860 std::list<CFuiComponent *> childList;
00861 };
00862
00863
00864
00865
00866 class CFuiGauge : public CFuiComponent
00867 {
00868 public:
00869
00870
00871
00872
00873 protected:
00874 };
00875
00876
00877
00878
00879 class CFuiListRow {
00880 public:
00881
00882 CFuiListRow (void);
00883
00884
00885 void SetHeight (unsigned int height);
00886 unsigned int GetHeight (void);
00887 void SetText (const char *text);
00888 const char * GetText (void);
00889
00890 protected:
00891 unsigned int height;
00892 std::string text;
00893 };
00894
00895 class CFuiListColumn {
00896 public:
00897
00898 CFuiListColumn (void);
00899
00900
00901 void SetWidth (unsigned int width);
00902 unsigned int GetWidth (void);
00903 void SetTitle (const char *title);
00904 void AddRow (CFuiListRow row);
00905 void DeleteRow (unsigned int row);
00906 void DeleteAllRows (void);
00907 CFuiListRow& GetRow (unsigned int i);
00908 unsigned int GetRowCount (void);
00909
00910 protected:
00911 unsigned int width;
00912 unsigned int minWidth;
00913 std::string title;
00914 std::vector<CFuiListRow> rows;
00915 };
00916
00917 class CFuiList : public CFuiComponent
00918 {
00919 public:
00920
00921 CFuiList (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
00922
00923
00924 virtual int Read (SStream *stream, Tag tag);
00925 virtual void ReadFinished (void);
00926
00927
00928 void Draw (void);
00929 void SetParentPosition (int xParent, int yParent);
00930
00931
00932 void ScrollToRow (unsigned int row);
00933 void ScrollToColumn (unsigned int column);
00934 unsigned int GetRowCount (void);
00935 unsigned int GetColumnCount (void);
00936 void AddColumn (unsigned int width, char *title);
00937 void DeleteColumn (unsigned int column);
00938 void DeleteAllColumns (void);
00939 void SetColumnWidth (unsigned int column, unsigned int width);
00940 void AddRow (unsigned int height);
00941 void DeleteRow (unsigned int row);
00942 void DeleteAllRows (void);
00943 unsigned int CountSelectedRows (void);
00944 unsigned int GetSelectedRow (unsigned int index);
00945 void SelectRow (unsigned int row);
00946 void ClearSelection (void);
00947 void SetCellText (unsigned int row, unsigned int column, char *text);
00948 void SetCellIcon (unsigned int row, unsigned int column, char *filename);
00949 void ClearCellText (unsigned int row, unsigned int column);
00950 void ClearCellIcon (unsigned int row, unsigned int column);
00951 void GetCellText (unsigned int row, unsigned int column, char *outtext);
00952
00953 protected:
00954 int utit;
00955 int usrr;
00956 int multiselect;
00957 int vscroll;
00958 int hscroll;
00959 int dwidth;
00960 int dheight;
00961 int autowidth;
00962 bool noBackground;
00963
00964 SBitmap *bmBack;
00965 SBitmap *bmTop;
00966 SBitmap *bmBottom;
00967 SBitmap *bmLeft;
00968 SBitmap *bmRight;
00969 SBitmap *bmTopLeft;
00970 SBitmap *bmTopRight;
00971 SBitmap *bmBottomLeft;
00972 SBitmap *bmBottomRight;
00973 SBitmap *bmHighlight;
00974
00975 unsigned int colText;
00976 unsigned int colTextHighlight;
00977 unsigned int colHighlight;
00978
00979 std::list<CFuiComponent *> decorationList;
00980 unsigned int nRows;
00981 std::vector<CFuiListColumn> cols;
00982
00983 unsigned int scrollRow;
00984 unsigned int scrollCol;
00985 };
00986
00987
00988
00989
00990 class CFuiScrollArea : public CFuiComponent
00991 {
00992 public:
00993
00994
00995
00996
00997 protected:
00998
00999 };
01000
01001
01002
01003
01004 class CFuiTextField : public CFuiComponent
01005 {
01006 public:
01007
01008 CFuiTextField (int x = 0, int y = 0, int w = 0, int h = 0, Tag window = 0);
01009 ~CFuiTextField (void);
01010
01011
01012 virtual int Read (SStream *stream, Tag tag);
01013 virtual void ReadFinished (void);
01014
01015
01016 void SetParentPosition (int xParent, int yParent);
01017 void Draw (void);
01018
01019
01020 void SetMaxChars (int maxChars);
01021 int GetMaxChars (void);
01022 void UsePassword (int passwordFlag);
01023 int IsPassword (void);
01024 int GetLength (void);
01025 void SetText (char *text);
01026 char* GetText(void);
01027 void SetSelection(int firstChar, int lastChar);
01028 void GetSelection(int *firstChar, int *lastChar);
01029
01030 protected:
01031 SBitmap *bmBack;
01032 SBitmap *bmTop;
01033 SBitmap *bmBottom;
01034 SBitmap *bmLeft;
01035 SBitmap *bmRight;
01036 SBitmap *bmTopLeft;
01037 SBitmap *bmTopRight;
01038 SBitmap *bmBottomLeft;
01039 SBitmap *bmBottomRight;
01040
01041 unsigned int colText;
01042 unsigned int colHighlight;
01043 unsigned int colTextHighlight;
01044 unsigned int colLine;
01045 unsigned int colFill;
01046 unsigned int colFillDisabled;
01047 unsigned int colCaret;
01048 bool ignore_background;
01049
01050 int pass;
01051 int nChars;
01052 int numb;
01053 char* data;
01054
01055 std::list<CFuiComponent *> decorationList;
01056 };
01057
01058
01059
01060
01061
01062 class CFuiTextArea : public CFuiComponent
01063 {
01064 public:
01065
01066
01067
01068
01069 protected:
01070 };
01071
01072
01073
01074
01075 class CFuiProgress : public CFuiComponent
01076 {
01077 public:
01078
01079
01080
01081
01082 protected:
01083
01084 };
01085
01086
01087
01088
01089 class CFuiMap : public CFuiComponent
01090 {
01091 public:
01092
01093
01094
01095
01096 protected:
01097
01098 };
01099
01100
01101
01102
01103 class CFuiTabPage : public CFuiComponent
01104 {
01105 public:
01106
01107
01108
01109
01110 protected:
01111
01112 };
01113
01114
01115
01116
01117 class CFuiTabButton : public CFuiComponent
01118 {
01119 public:
01120
01121
01122
01123
01124 protected:
01125
01126 };
01127
01128
01129
01130
01131 class CFuiTabControl : public CFuiComponent
01132 {
01133 public:
01134
01135
01136
01137
01138 protected:
01139
01140 };
01141
01142
01143
01144
01145
01146 typedef enum {
01147 FUI_GRAPH_TRACE_POINT = 0,
01148 FUI_GRAPH_TRACE_LINE = 1
01149 };
01150
01151 typedef struct {
01152 float x, y;
01153 } SFuiGraphTracePoint;
01154
01155 class CFuiGraphTrace {
01156 public:
01157
01158 CFuiGraphTrace (Tag id, int type);
01159
01160
01161 void AddPoint (float x, float y);
01162 void ClearPoints (void);
01163 void SetRange (float minX, float minY, float maxX, float maxY);
01164 void SetColour (unsigned int colour);
01165 void Draw (SSurface *surface);
01166
01167 protected:
01168 Tag id;
01169 int type;
01170 unsigned int colour;
01171 float minX, maxX;
01172 float minY, maxY;
01173 std::vector<SFuiGraphTracePoint> points;
01174 };
01175
01176
01177
01178
01179 class CFuiGraph : public CFuiComponent {
01180 public:
01181
01182 CFuiGraph (void);
01183
01184
01185 virtual int Read (SStream *stream, Tag tag);
01186
01187
01188 void Draw (void);
01189
01190
01191 void AddTrace (Tag traceID, int traceType);
01192 void RemoveTrace (Tag traceID);
01193 void RemoveAllTraces (void);
01194 void AddTracePoint (Tag traceID, float x, float y);
01195 void ClearTracePoints (Tag traceID);
01196 void SetTraceRange (Tag traceID, float minX, float minY, float maxX, float maxY);
01197 void SetTraceColour (Tag traceID, unsigned int colour);
01198 void SetUseGrid (int useGrid);
01199 void SetGridRange (float minX, float minY, float maxX, float maxY);
01200 void SetGridSpacing (float stepX, float stepY);
01201 void SetGridColour (unsigned int colour);
01202 void SetGridBackColour (unsigned int colour);
01203 void GetGridRange (float *minX, float *minY, float *maxX, float *maxY);
01204 void GetGridSpacing (float *stepX, float *stepY);
01205
01206 protected:
01207 bool useGrid;
01208 float minX, maxX;
01209 float minY, maxY;
01210 float stepX, stepY;
01211
01212 unsigned long bgColour;
01213 unsigned long gridColour;
01214 std::map<Tag,CFuiGraphTrace*> traces;
01215 };
01216
01217
01218
01219
01220 class CFuiMarquee : public CFuiComponent
01221 {
01222 public:
01223
01224
01225
01226
01227 protected:
01228 int just;
01229 int wrap;
01230 int rateX, rateY;
01231 char file[64];
01232 };
01233
01234
01235
01236
01237 class CFuiHorizontalMarquee : public CFuiComponent
01238 {
01239 public:
01240
01241
01242
01243
01244 protected:
01245 int rateX;
01246 };
01247
01248
01249
01250
01251
01252
01253
01254 class CFuiTextPopup : public CFuiComponent
01255 {
01256 public:
01257
01258
01259
01260 void SetText (const char *text);
01261
01262 protected:
01263 };
01264
01265
01266 enum EFuiThemeColourType {
01267 THEME_COLOUR_TEXT = 0,
01268 THEME_COLOUR_SHADOW = 1,
01269 THEME_COLOUR_SELECTION = 2,
01270 THEME_COLOUR_HILITE = 3,
01271 THEME_COLOUR_TEXTHILITE = 4,
01272 THEME_COLOUR_LINE = 5,
01273 THEME_COLOUR_TEXTGREY = 6,
01274 THEME_COLOUR_FILL = 7,
01275 THEME_COLOUR_FILLDISABLED = 8,
01276 THEME_COLOUR_CARET = 9,
01277 THEME_COLOUR_BORDER = 10,
01278 THEME_COLOUR_BACK = 11,
01279 THEME_COLOUR_TRACE = 12,
01280 THEME_COLOUR_MAX
01281 };
01282
01283 enum EFuiThemeSizeType {
01284 THEME_SIZE_SMALL = 0,
01285 THEME_SIZE_NORMAL = 1,
01286 THEME_SIZE_LARGE = 2,
01287 THEME_SIZE_SMALL_INLINE = 3,
01288 THEME_SIZE_NORMAL_INLINE = 4,
01289 THEME_SIZE_LARGE_INLINE = 5,
01290 THEME_SIZE_MAX
01291 };
01292
01293 enum EFuiThemeFlagType {
01294 THEME_FLAG_DONT_DRAW_BACKGROUND = 0,
01295 THEME_FLAG_IGNORE_BITMAP_BACKGROUND = 1,
01296 THEME_FLAG_USE_SHADOW = 2,
01297 THEME_FLAG_MAX
01298 };
01299
01300
01301
01302
01303
01304
01305
01306 class CFuiThemeWidget
01307 {
01308 public:
01309
01310 CFuiThemeWidget (void);
01311 ~CFuiThemeWidget (void);
01312
01313
01314 void ParseBitmap (char* s);
01315 void ParseColour (char* s);
01316 void ParseSize (char* s);
01317 void ParseFrameRate (char *s);
01318 void ParseThickness (char *s);
01319 void ParseComponentName (char *s, std::string type);
01320 void ParseButtonWidth (char *s);
01321
01322 void SetName (const char* s);
01323 SBitmap *GetBitmap (std::string name);
01324 unsigned int GetColour (std::string name);
01325 void SetFlag (std::string name);
01326 bool GetFlag (std::string name);
01327 const char* GetComponentName (std::string name);
01328
01329 void Print (FILE *f);
01330
01331 protected:
01332 char name[64];
01333 std::map<std::string,SBitmap*> bmMap;
01334 std::map<std::string,unsigned int> colourMap;
01336 std::vector<std::string> flagVector;
01337 std::map<std::string,std::string> componentNameMap;
01338 int framerate;
01339 int thickness;
01340 int buttonWidth;
01341 };
01342
01343
01344
01345
01346
01347
01348
01349 class CFuiTheme
01350 {
01351 public:
01352
01353 CFuiTheme (void);
01354 CFuiTheme (const char* themeFilename);
01355 ~CFuiTheme (void);
01356
01357
01358 CFuiThemeWidget* GetWidget (std::string name);
01359 void Print (FILE *f);
01360
01361 protected:
01362 char name[64];
01363 Tag id;
01364 std::map<std::string,CFuiThemeWidget*> widgetMap;
01365 };
01366
01367
01368
01369
01370
01371 class CFuiManager
01372 {
01373 public:
01374
01375 CFuiManager (void);
01376 ~CFuiManager (void);
01377
01378
01379 void CreateFuiWindow (FuiEventNoticeCb handler,
01380 Tag id, const char* winFilename);
01381 void DestroyFuiWindow (Tag id);
01382 bool IsWindowCreated (Tag id);
01383 void Draw (void);
01384 CFuiTheme* GetTheme (Tag tag);
01385 CFuiThemeWidget* GetThemeWidget (Tag tag, std::string name);
01386 void GainFocus (Tag windowID, Tag componentID);
01387 void LoseFocus (Tag windowID, Tag componentID);
01388 void GenerateEventNotice (Tag windowId,
01389 Tag componentId,
01390 EFuiEvents event,
01391 EFuiEvents subevent);
01392 void DrawNoticeToUser (const char *text, float timeout);
01393
01394
01395 bool MouseMove (int x, int y);
01396 bool MouseClick (int x, int y, EMouseButton button);
01397 bool MouseStopClick (int x, int y, EMouseButton button);
01398
01399
01400 CFuiWindow* GetFuiWindow (Tag window);
01401 static Tag GetComponentType (const char* name);
01402 void Print (FILE *f);
01403
01404 protected:
01405 std::map<Tag,CFuiWindow*> windowMap;
01406 std::map<Tag,CFuiTheme*> themeMap;
01407 CFuiTextPopup *slew;
01408 CFuiTextPopup *pause;
01409
01410 CFuiTextPopup *usermsg;
01411 bool userMsgActive;
01412 float userMsgExpiry;
01413
01414 public:
01415
01416 void SetWindowTitle (Tag window, const char* title);
01417
01418 void SetComponentText (Tag window, Tag component, const char* text);
01419
01420 void SetLabelColour (Tag window, Tag labelID, unsigned int colour);
01421
01422 int GetCheckboxState(Tag windowID, Tag checkID);
01423 void SetCheckboxState(Tag windowID, Tag checkID, int state);
01424
01425 int GetRadioState(Tag windowID, Tag radioID);
01426 void SetRadioState(Tag windowID, Tag radioID, int state);
01427
01428 void SetTextMaxChars(Tag windowID, Tag textID, int maxChars);
01429 int GetTextMaxChars(Tag windowID, Tag textID);
01430 void UseTextPassword(Tag windowID, Tag textID, int passwordFlag);
01431 int IsTextPassword(Tag windowID, Tag textID);
01432 int GetTextLength(Tag windowID, Tag textID);
01433 void SetTextText(Tag windowID, Tag textID, char *text);
01434 char* GetTextText(Tag windowID, Tag textID);
01435 void SetTextSelection(Tag windowID, Tag textID, int firstChar, int lastChar);
01436 void GetTextSelection(Tag windowID, Tag textID, int *firstChar, int *lastChar);
01437
01438 void AddPopupItem (Tag windowID, Tag popupID, Tag itemID, const char *label);
01439 void AddPopupSeperator (Tag windowID, Tag popupID);
01440 void RemovePopupItem (Tag windowID, Tag popupID, Tag itemID);
01441 void ClearPopupItems (Tag windowID, Tag popupID);
01442 void SelectPopupItem (Tag windowID, Tag popupID, Tag itemID);
01443 Tag GetPopupItemSelection (Tag windowID, Tag popupID, char *outText);
01444
01445 void SetGroupBoxLabel (Tag windowID, Tag groupID, char *label);
01446
01447 void SetSliderMajorTickSpacing (Tag windowID, Tag sliderID, float spacing);
01448 void SetSliderMinorTickSpacing (Tag windowID, Tag sliderID, float spacing);
01449 void SetSliderSnapToTicks (Tag windowID, Tag sliderID, int snapFlag);
01450 void SetSliderDrawMajorTicks (Tag windowID, Tag sliderID, int drawFlag);
01451 void SetSliderDrawMinorTicks (Tag windowID, Tag sliderID, int drawFlag);
01452 float GetSliderMajorTickSpacing (Tag windowID, Tag sliderID);
01453 float GetSliderMinorTickSpacing (Tag windowID, Tag sliderID);
01454 int GetSliderSnapToTicks (Tag windowID, Tag sliderID);
01455 int GetSliderDrawMajorTicks (Tag windowID, Tag sliderID);
01456 int GetSliderDrawMinorTicks (Tag windowID, Tag sliderID);
01457 void SetSliderLabel (Tag windowID, Tag sliderID, char *label);
01458
01459 void ScrollListToRow (Tag windowID, Tag listID, int row);
01460 void ScrollListToColumn (Tag windowID, Tag listID, int column);
01461 int GetListRowCount (Tag windowID, Tag listID);
01462 int GetListColumnCount (Tag windowID, Tag listID);
01463 void AddListColumn (Tag windowID, Tag listID, int width, char *title);
01464 void DeleteListColumn (Tag windowID, Tag listID, int column);
01465 void DeleteAllListColumns (Tag windowID, Tag listID);
01466 void SetListColumnWidth (Tag windowID, Tag listID, int column, int width);
01467 void AddListRow (Tag windowID, Tag listID, int height);
01468 void DeleteListRow (Tag windowID, Tag listID, int row);
01469 void DeleteAllListRows (Tag windowID, Tag listID);
01470 int CountListSelectedRows (Tag windowID, Tag listID);
01471 int GetListSelectedRow (Tag windowID, Tag listID, int index);
01472 void SelectListRow (Tag windowID, Tag listID, int row);
01473 void ClearListSelection (Tag windowID, Tag listID);
01474 void SetListCellText (Tag windowID, Tag listID, int row, int column, char *text);
01475 void SetListCellIcon (Tag windowID, Tag listID, int row, int column, char *filename);
01476 void ClearListCellText (Tag windowID, Tag listID, int row, int column);
01477 void ClearListCellIcon (Tag windowID, Tag listID, int row, int column);
01478 void GetListCellText (Tag windowID, Tag listID, int row, int column, char *outtext);
01479
01480 void AddGraphTrace(Tag windowID, Tag graphID, Tag traceID, int traceType);
01481 void RemoveGraphTrace(Tag windowID, Tag graphID, Tag traceID);
01482 void RemoveAllGraphTraces(Tag windowID, Tag graphID);
01483 void AddGraphTracePoint(Tag windowID, Tag graphID, Tag traceID, float x, float y);
01484 void ClearGraphTracePoints(Tag windowID, Tag graphID, Tag traceID);
01485 void SetGraphTraceRange(Tag windowID, Tag graphID, Tag traceID, float minX, float minY, float maxX, float maxY);
01486 void SetGraphTraceColour(Tag windowID, Tag graphID, Tag traceID, unsigned int colour);
01487 void SetGraphUseGrid(Tag windowID, Tag graphID, int useGrid);
01488 void SetGraphGridRange(Tag windowID, Tag graphID, float minX, float minY, float maxX, float maxY);
01489 void SetGraphGridSpacing(Tag windowID, Tag graphID, float xStep, float yStep);
01490 void SetGridColour(Tag windowID, Tag graphID, unsigned int colour);
01491 void SetGridBackColour(Tag windowID, Tag graphID, unsigned int colour);
01492 void GetGraphGridRange(Tag windowID, Tag graphID, float *minX, float *minY, float *maxX, float *maxY);
01493 void GetGraphGridSpacing(Tag windowID, Tag graphID, float *xStep, float *yStep);
01494
01495 protected:
01496 CFuiComponent* FindComponent (Tag windowID, Tag id);
01497 CFuiLabel* FindLabel (Tag windowID, Tag labelID);
01498 CFuiCheckbox* FindCheckbox (Tag windowID, Tag checkboxID);
01499 CFuiList* FindList (Tag windowID, Tag listID);
01500 CFuiSlider* FindSlider (Tag windowID, Tag sliderID);
01501 CFuiGraph* FindGraph (Tag windowID, Tag graphID);
01502 };
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536 void ReplayNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent);
01537 void AxisNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent);
01538 void VectorMapNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent);
01539 void MapNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent);
01540 void FrameRateNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent);
01541
01542 #endif // FUI_H
01543