00001
#ifndef GUI_H
00002
#define GUI_H
00003
00004
#include <PropertyLib\IPropertyHost.h>
00005
00006
#include "TextureManager.h"
00007
#include "MaterialManager.h"
00008
#include "FontManager.h"
00009
#include "FrameAnimationManager.h"
00010
#include "InputEngine.h"
00011
#include "EventHandler.h"
00012
00013
00014
#include <GL\gl.h>
00015
#pragma comment (lib, "OpenGL32.lib")
00016
00017
class CGUIElement;
00018
00019
#define GUI_MAX_MESSAGES 64
00020
#define GUI_MAX_BUTTON_STATES 4
00021
#define GUI_MINIMUM_WIDTH 8
00022
#define GUI_MINIMUM_HEIGHT 8
00023
#define DEFAULT_PROGRESSBAR_SPACINGX 3
00024
#define DEFAULT_PROGRESSBAR_SPACINGY 3
00025
#define MENU_MAX_EXPANSIONS 8
00026
//#define GUI_USE_ACTIVE_INACTIVE 1
00028
#define GUI_DEFAULT_TITLEBAR_HEIGHT 10
00029
#define GUI_DEFAULT_STATUSBAR_HEIGHT 8
00031
#define GUI_TITLEBAR_BTN_SPACING 1
00033
enum eGUIFlag
00034
{
00035 GUI_Flag_RestrictMovementX,
00036 GUI_Flag_RestrictMovementY,
00037 GUI_Flag_RestrictSizeX,
00038 GUI_Flag_RestrictSizeY,
00039 GUI_Flag_BorderLock
00040 };
00041
00042
enum eButtonState
00043 {
00044 Button_Default = 0,
00045 Button_MouseOver,
00046 Button_MouseDown,
00047 Button_Disabled
00048 };
00049
00050
enum eWindowState
00051 {
00052 GUI_WindowNormal,
00053 GUI_WindowMinimized,
00054 GUI_WindowMaximized
00055 };
00056
00057
enum eGUIControlType
00058 {
00059 GUI_Element,
00060 GUI_Border,
00061 GUI_Static,
00062 GUI_TextBox,
00063 GUI_Button,
00064 GUI_RadioGroup,
00065 GUI_DropList,
00066 GUI_ListBox,
00067 GUI_HorizontalScrollBar,
00068 GUI_VerticalScrollBar,
00069 GUI_HorizontalProgressBar,
00070 GUI_VerticalProgressBar,
00071 GUI_WindowTitleBar,
00072 GUI_WindowStatusBar,
00073 GUI_Window,
00074 GUI_TabControl,
00075 GUI_TabButton,
00076 GUI_Menu,
00077 GUI_MenuEntry,
00078
00079 GUI_ProgressBar_PositiveElement,
00080 GUI_ProgressBar_NegativeElement,
00081 GUI_ScrollBar_ButtonInc,
00082 GUI_ScrollBar_ButtonDec,
00083 GUI_ScrollBar_ButtonThumb,
00084 GUI_Window_TitleBar,
00085 GUI_Window_StatusBar,
00086 GUI_Window_MinimizeButton,
00087 GUI_Window_MaxRestoreButton,
00088 GUI_Window_CloseButton,
00089 GUI_Caret,
00090 GUI,
00091 };
00092
00093
00094
enum eGUIMessage
00095 {
00096 GUI_Message_Default = 250,
00097 GUI_Message_MouseOver,
00098 GUI_Message_LMouseDown,
00099 GUI_Message_MouseOut,
00100 GUI_Message_MouseMove,
00101 GUI_Message_RMouseDown,
00102 GUI_Message_LMouseUp,
00103 GUI_Message_RMouseUp,
00104 GUI_Message_KeyDown,
00105 GUI_Message_KeyUp,
00106 GUI_Message_KeyPress,
00107 GUI_Message_AquireFocus,
00108 GUI_Message_LostFocus,
00109 GUI_Message_SizeX,
00110 GUI_Message_SizeY,
00111 GUI_Message_SizeXY,
00112 GUI_Message_MoveX,
00113 GUI_Message_MoveY,
00114 GUI_Message_MoveXY,
00115 GUI_Message_Visible,
00116 GUI_Message_Hidden,
00117
00118 GUI_Message_ButtonPressed,
00119 GUI_Message_Scrolled,
00120 GUI_Message_Progressed,
00121 GUI_Message_TextChanged,
00122 };
00123
00125
00129 struct tGUIMessage :
public tMessage
00130 {
00131 CGUIElement *
pSender;
00132 CGUIElement *
pReceiver;
00135
tGUIMessage() : tMessage()
00136 {
00137
pSender =
pReceiver = NULL;
00138 };
00139
00141
virtual ~
tGUIMessage()
00142 {
00143
00144 };
00145 };
00146
00148
00167 struct tButtonState
00168 {
00169 CTextureFrameAnimation **
m_pEventAnimations;
00170 int m_iEventCount;
00172
tButtonState()
00173 {
00174
m_pEventAnimations = NULL;
00175
m_iEventCount = 0;
00176 };
00177
00178
virtual ~
tButtonState()
00179 { SAFEDEL_ARRAY(m_pEventAnimations) };
00180 };
00181
00182
00184
00189 class CGUIEventHandler :
public CEventHandler
00190 {
00191 CREATOR(
CGUI);
00193
protected:
00194
00196
CGUIEventHandler(UINT MaxMessages = GUI_MAX_MESSAGES);
00198
virtual ~
CGUIEventHandler();
00199
00205
tGUIMessage*
GetMessage(UINT uiMessageIndex);
00206
00217
virtual int PostMessage(
CGUIElement *pSender,
CGUIElement *pReceiver, eGUIMessage eMessage, DWORD lParam = 0, DWORD wParam = 0, UINT uiTimeoutMs = 0);
00222
virtual void Dispatch(
bool bOnce =
true);
00223
00228
void Flush();
00229
00230 };
00231
00233
00238 class CGUIElement :
public CXMLResource,
public CDoubleList<CGUIElement *>,
public IPropertyHost
00239 {
00240 CREATOR(
CGUI);
00241 CREATOR(
CGUIBorder);
00243
public:
00245
CGUIElement();
00247
virtual ~
CGUIElement();
00248
00253
virtual void Initialize();
00254
00264
virtual int Create(
CGUIElement *pParent, tRect WidgetRect,
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false);
00265
00266
public:
00272
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
00277
virtual void GetProperties(EPropList& PropList);
00278
00284
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
00290
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
00291
00296
virtual void Draw();
00301
virtual void Destroy();
00302
00303
public:
00308
virtual void ProcessMessages();
00313
virtual void ProcessMessage(
tGUIMessage& Message);
00314
00315
00321
virtual int Resize(tRect& NewRect);
00322
00328
virtual int OnKeyDown(UINT uiKeyCode);
00334
virtual int OnKeyUp(UINT uiKeyCode);
00341
virtual int OnMove(UINT x, UINT y);
00348
virtual int OnMouseMove(UINT x, UINT y);
00355
virtual int OnLMouseDown(UINT x, UINT y);
00362
virtual int OnLMouseUp(UINT x, UINT y);
00363
00370
virtual int OnRMouseDown(UINT x, UINT y);
00377
virtual int OnRMouseUp(UINT x, UINT y);
00378
00383 UINT
GetWidth();
00388
void SetWidth(UINT uiWidth);
00389
00394 UINT
GetHeight();
00399
void SetHeight(UINT uiHeight);
00405
CGUIElement *
GetChild(UINT uiIndex);
00411
CGUIElement *
GetChild(eGUIControlType eWidgetType);
00417
CGUIElement *
GetChild(
TiXmlElement *pXMLElement);
00418
00423 UINT
GetChildCount();
00428
void RemoveChild(
CGUIElement *pChild);
00429
00434
void HideSiblings(
int iDeep = -1);
00439
void ShowSiblings(
int iDeep = -1);
00440
00445
void SetZOrder(UINT uiZOrder);
00450 UINT
GetZOrder();
00451
00456
bool Visible();
00457
00462
void Hide();
00467
void Show();
00468
00473
CGUIElement *
GetParent();
00478
void SetParent(
CGUIElement *pParent);
00483
void SetTexture(
CTexture *pTexture);
00488
CTexture *
GetTexture();
00493
void SetMaterial(
CMaterial *pMaterial);
00498
CMaterial *
GetMaterial();
00504
void SetTexCoord(UINT uiIndex,
float U,
float V);
00509
tVERTEX2f&
GetTexCoord(UINT index);
00514
CGUI *
GetGUI();
00515
00521
void SetRect(tRect& NewRect);
00526 tRect&
GetRect();
00527
00532
void SetGUI(
CGUI *pGUI);
00533
00538 eGUIControlType&
GetType();
00543
void SetType(eGUIControlType eWidgetType);
00544
00550
void SetFlag(eGUIFlag eFlag,
bool bSet);
00555
bool IsFlagSet(eGUIFlag eFlag);
00556
00561
bool IsChild(
CGUIElement *pElement);
00566
virtual bool IsOfType(eEntityType eType);
00567
00568
#ifdef GUI_USE_ACTIVE_INACTIVE
00569
bool IsActive() {
return m_bActive; };
00570
void Activate() {
m_bActive =
true; };
00571
void Deactivate() {
m_bActive =
false; };
00572
#endif
00573
00578
bool IsAutoCalc();
00583
void SetAutoCalc(
bool bAutoCalc);
00584
bool m_bUpdateRequired;
00585
00586
protected:
00588 bool m_bAutoCalc;
00589
00590 CString
m_strElementType;
00591 UINT
m_iChildren;
00593 CString
m_strRectangle;
00595 bool m_bAllowMoveX;
00596 bool m_bAllowMoveY;
00597 bool m_bAllowSizeX;
00598 bool m_bAllowSizeY;
00600
#ifndef GUI_USE_ACTIVE_INACTIVE
00601 CString
m_strMaterialName;
00602 int m_iMaterialIndex;
00604 COLORREF
m_MaterialAmbient;
00605 COLORREF
m_MaterialDiffuse;
00606 COLORREF
m_MaterialSpecular;
00607 COLORREF
m_MaterialEmissive;
00608 int m_iMaterialShininess;
00609
#elif
00610 COLORREF
m_ActiveColor;
00611 COLORREF
m_InactiveColor;
00612 bool m_bActive;
00613
#endif
00614
00615 CString
m_strTextureName;
00616 CString
m_strTextureFilename;
00617 int m_iTextureIndex;
00619
00620
00621 eGUIControlType
m_eControlType;
00623 CGUIElement *
m_pParent;
00624 CGUI *
m_pGUI;
00625 tRect
m_Rect;
00626 DWORD
m_dwFlags;
00627 CMaterial *
m_pMaterial;
00628 CTexture *
m_pTexture;
00629 tVERTEX2f m_TexCoord[4];
00630 bool m_bVisible;
00631 };
00632
00634
00638 class CGUI :
public CGUIElement
00639 {
00640
public:
00641
00643
CGUI();
00645
virtual ~
CGUI();
00650
virtual void Initialize();
00651
00657
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
00662
virtual void GetProperties( EPropList& PropList );
00663
00668
void SelectInvisible(
bool bShow);
00673
bool IsInvisibleSelectable();
00674
00681
virtual int OnLMouseDown(UINT x, UINT y);
00688
virtual int OnLMouseUp(UINT x, UINT y);
00689
00694
virtual int Create();
00695
public:
00696
00701
virtual void Update();
00702
00707
virtual void Draw();
00708
00713
void SetActiveElement(
CGUIElement *pElement);
00718
CGUIElement *
GetActiveElement();
00719
00725
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
00731
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
00732
00743
virtual int PostMessage(
CGUIElement *pSender,
CGUIElement *pReceiver, eGUIMessage eMessage, DWORD lParam = 0, DWORD wParam = 0, UINT uiTimeoutMs = 0);
00748
virtual void ProcessMessages();
00753
virtual void ProcessMessage(
tGUIMessage& Message);
00754
00760
tGUIMessage *
GetMessage(UINT uiMessageIndex);
00765 UINT
GetMessageCount();
00766
00771 bool IsLocked() {
return m_bMouseLock; };
00776 void Lock() {
m_bMouseLock =
true; };
00781 void Unlock() {
m_bMouseLock =
false; };
00782
00787
virtual void Destroy();
00792
virtual bool IsOfType(eEntityType eType);
00793
00794
protected:
00795
00796 CGUIEventHandler m_EventHandler;
00797 CGUIElement *
m_pActiveElement;
00798 bool m_bMouseLock;
00799 bool m_bSelectInvisible;
00800 };
00801
00803
00809 class CGUIBorder :
public CGUIElement
00810 {
00811
public:
00812
CGUIBorder();
00813
virtual ~
CGUIBorder();
00818
virtual void Initialize();
00824
virtual int Create(
CGUIElement *pParent);
00825
00826
public:
00832
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
00837
virtual void GetProperties(EPropList& PropList);
00838
00843
virtual void Draw();
00849
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
00855
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
00861
virtual int Resize(tRect& NewRect);
00862
00869
virtual int OnLMouseDown(UINT x, UINT y);
00876
virtual int OnLMouseUp(UINT x, UINT y);
00883
virtual int OnMouseMove(UINT x, UINT y);
00884
00889
void SetBorderWidth(UINT uiWidth);
00894 UINT
GetBorderWidth();
00895
00900
void SetBorderSpacing(UINT uiSpacing);
00905 UINT
GetBorderSpacing();
00906
00911
virtual void ProcessMessage(
tGUIMessage& Message);
00916
virtual bool IsOfType(eEntityType eType);
00917
00918
private:
00919
int m_iBorderWidth,
00920 m_iBorderSpacing;
00921 UINT m_uiDragElement;
00922 };
00923
00925
00930 class CGUIStatic :
public CGUIElement
00931 {
00932
public:
00933
00934
CGUIStatic();
00935
virtual ~
CGUIStatic();
00940
virtual void Initialize();
00951
virtual int Create(
CGUIElement *pParent, tRect WidgetRect,
CCustomFont *pFont = NULL,
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false);
00952
00953
public:
00959
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
00964
virtual void GetProperties(EPropList& PropList);
00965
00970
virtual void Draw();
00976
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
00982
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
00988
virtual int Resize(tRect& NewRect);
00993
virtual void Destroy();
00994
00999
void DrawText();
01000
01005
const CCustomFont *
GetFont();
01010
void SetFont(
CBitmapFont *pBitmapFont);
01011
01016 CString&
GetText();
01021
void SetText(CString& strText);
01022
01027
void SetTextAlign(DWORD dwTextAlignFlags);
01032 DWORD
GetTextAlign();
01037 UINT
GetTextLength();
01042 UINT
GetLineCount();
01047 UINT
GetLineLength(UINT uiLine);
01052
void ShowText();
01057
void HideText();
01062
virtual bool IsOfType(eEntityType eType);
01063
01064
protected:
01065
01066
01067 int m_iHorizontalAlign;
01068 int m_iVerticalAlign;
01070 CString
m_strFontName;
01071 CString
m_strFontFilename;
01072 int m_iFontIndex;
01080 CString
GetLine(UINT uiLine, UINT uiCharacterCount = 0);
01081
01082 tVERTEX2d m_TextPos;
01083 CString
m_strText;
01084 CCustomFont *
m_pFont;
01085 bool m_bTextVisible;
01086 };
01087
01089
01093 class CGUITextBox :
public CGUIStatic
01094 {
01095
01096
public:
01097
CGUITextBox();
01098
virtual ~
CGUITextBox();
01103
virtual void Initialize();
01114
virtual int Create(
CGUIElement *pParent, tRect WidgetRect,
CCustomFont *pFont = NULL,
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false);
01115
01116
public:
01121
virtual void Draw();
01127
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
01133
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
01139
virtual int Resize(tRect& NewRect);
01144
virtual void Destroy();
01149
virtual bool IsOfType(eEntityType eType);
01150
01151
protected:
01152
tVERTEX2d m_CaretPos;
01153
tVERTEX2d m_CaretPosAbs;
01154
tVERTEX2d m_CaretCharPos;
01155 UINT m_uiLenCharPos;
01156 UINT m_uiSelStart, m_uiSelEnd;
01157 };
01158
01160
01165 class CGUIButton :
public CGUIStatic
01166 {
01167
01168
public:
01169
CGUIButton();
01170
virtual ~
CGUIButton();
01175
virtual void Initialize();
01186
virtual int Create(
CGUIElement *pParent, tRect WidgetRect,
CCustomFont *pFont = NULL,
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false);
01187
01188
public:
01194
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
01199
virtual void GetProperties(EPropList& PropList);
01200
01205
virtual void Draw();
01211
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
01217
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
01222
virtual void Destroy();
01229
virtual int OnLMouseUp(UINT x, UINT y);
01235 UINT
GetState();
01237
void SetState(
bool bLoopAnimation, UINT uiState);
01242
virtual bool IsOfType(eEntityType eType);
01243
01244
protected:
01250
CTextureFrameAnimation *
GetEventAnimation(UINT uiEventIndex);
01255
CTextureFrameAnimation *
GetCurrentAnimation();
01261
bool LoadButtonStates(
TiXmlNode *pButtonXMLNode);
01267
bool LoadStateEvents(
tButtonState *uiState,
TiXmlNode *pStateXMLNode);
01273
int SaveButtonStates(
TiXmlNode *pDataNode);
01279
int SaveStateEvents(
TiXmlNode *pDataNode,
tButtonState *pState);
01280
01281
private:
01282
tButtonState *m_pButtonStates;
01283 UINT m_iuStateCount;
01284
int m_iCurrentState;
01287
int m_iDisabledStateIndex;
01288
int m_iNormalStateIndex;
01289
int m_iMouseOverStateIndex;
01290
int m_iMouseDownStateIndex;
01292
bool m_bLoopState;
01293 };
01294
01296
01300 class CGUIScrollBar :
public CGUIStatic
01301 {
01302
01303
public:
01304
CGUIScrollBar();
01305
virtual ~
CGUIScrollBar();
01310
virtual void Initialize();
01325
virtual int Create(
CGUIElement *pParent, tRect WidgetRect, eGUIControlType ScrollBarType,
01326
CGUIButton *pIncButton = NULL,
01327
CGUIButton *pDecButton = NULL,
01328
CGUIButton *pThumbButton = NULL,
01329
CCustomFont *pFont = NULL,
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false);
01330
01331
public:
01337
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
01342
virtual void GetProperties(EPropList& PropList);
01347
virtual void Draw();
01353
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
01359
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
01365
virtual int Resize(tRect& NewRect);
01372
virtual int OnLMouseUp(UINT x, UINT y);
01373
01374
public:
01380
void SetRange(UINT uiMin, UINT uiMax);
01385
tVERTEX2d&
GetRange();
01386
01391 UINT
GetCurPos();
01396
virtual void SetCurPos(
float fPos);
01401
virtual bool IsOfType(eEntityType eType);
01402
01403
protected:
01404
01409
virtual void ProcessMessage(
tGUIMessage& Message);
01410
01411
protected:
01412 int m_iCurPos,
01413
m_iMinPos,
01414
m_iMaxPos,
01415
m_iBtnInc,
01416
m_iScrlInc;
01418 int m_iPrevPos;
01420 double m_fCurPos,
01421
m_fPixelPerValue;
01422 };
01423
01425
01429 class CGUIProgressBar :
public CGUIStatic
01430 {
01431
01432
public:
01433
CGUIProgressBar();
01434
virtual ~
CGUIProgressBar();
01439
virtual void Initialize();
01453
virtual int Create(
CGUIElement *pParent, tRect WidgetRect, eGUIControlType ProgressBarType,
01454
CGUIElement *pPosElement = NULL,
01455
CGUIElement *pNegElement = NULL,
01456
CCustomFont *pFont = NULL,
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false);
01457
01458
public:
01464
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
01469
virtual void GetProperties(EPropList& PropList);
01474
virtual void Draw();
01480
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
01486
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
01492
virtual int Resize(tRect& NewRect);
01493
01494
public:
01501
void SetRange(UINT uiMin, UINT uiMax,
bool bMinToMax =
true);
01506
tVERTEX2d&
GetRange();
01507
01512 UINT
GetCurPos();
01517
virtual void SetCurPos(
float fPos);
01522
virtual bool IsOfType(eEntityType eType);
01523
01524
protected:
01525
01530
virtual void ProcessMessage(
tGUIMessage& Message);
01531
01532
protected:
01533 bool m_bMinToMax;
01534 bool m_bAutoCoordCalc;
01536 int m_iCurPos,
01537
m_iMinPos,
01538
m_iMaxPos;
01539 double m_fCurPos,
01540
m_fPixelPerValue;
01541 };
01542
01544
01548 class CGUIDropList :
public CGUIButton
01549 {
01550
01551
public:
01552
CGUIDropList();
01553
virtual ~
CGUIDropList();
01558
virtual void Initialize();
01570
virtual int Create(
CGUIElement *pParent, tRect WidgetRect,
CCustomFont *pFont = NULL,
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false,
CGUIButton *pDefaultEntryBtn = NULL);
01571
01572
public:
01578
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
01583
virtual void GetProperties(EPropList& PropList);
01588
virtual void Draw();
01594
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
01600
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
01606
virtual int Resize(tRect& NewRect);
01611
virtual void ProcessMessage(
tGUIMessage& Message);
01612
01617
virtual void Expand();
01622
virtual void Collapse();
01623
01624
01625
public:
01630
virtual void SetCurSel(
int iSelection);
01635
int GetCurSel();
01636
01642
virtual CGUIElement*
InsertItem(CString& strItemText, UINT uiInsertAfter = 0);
01647
virtual bool IsOfType(eEntityType eType);
01648
01649
protected:
01650 int m_iSpacing,
01651
m_iListType;
01655 bool m_bExpanded,
01656
m_bIdentSize;
01657 int m_iCurSel;
01659 };
01660
01662
01666 class CGUIListBox :
public CGUIElement
01667 {
01668
01669
public:
01670
CGUIListBox();
01671
virtual ~
CGUIListBox();
01676
virtual void Initialize();
01688
virtual int Create(
CGUIElement *pParent, tRect WidgetRect,
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false,
CGUIButton *pDefaultEntryBtn = NULL);
01689
01690
public:
01696
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
01701
virtual void GetProperties(EPropList& PropList);
01706
virtual void Draw();
01712
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
01718
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
01724
virtual int Resize(tRect& NewRect);
01729
virtual void ProcessMessage(
tGUIMessage& Message);
01734
virtual void SetCurSel(
int iSelection);
01739
int GetCurSel();
01745
virtual CGUIElement*
InsertItem(CString& strItemText, UINT uiInsertAfter = 0);
01750
virtual bool IsOfType(eEntityType eType);
01751
01752
private:
01753
bool m_bIdentSize;
01754
int m_iSpacing;
01755
int m_iListType;
01759
int m_iCurSel;
01761 };
01762
01763
01765
01769 class CGUIMenuEntry :
public CGUIButton
01770 {
01771
01772
public:
01773
CGUIMenuEntry();
01774
virtual ~
CGUIMenuEntry();
01779
virtual void Initialize();
01791
virtual int Create(
CGUIElement *pParent, tRect WidgetRect,
CCustomFont *pFont = NULL,
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false);
01792
01798
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
01803
virtual void GetProperties(EPropList& PropList);
01809
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
01815
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
01816
01821
int HExpand();
01826
int VExpand();
01827
01833
void SetExpand(
int iHorizontal,
int iVertical);
01838
virtual void Expand();
01843
virtual void Collapse();
01848
bool PointInChildRects();
01854
virtual CGUIElement*
InsertItem(CString& strItemText, UINT uiInsertAfter = 0);
01859
void HideSiblingsText(
int iDeep = -1);
01864
void ShowSiblingsText(
int iDeep = -1);
01870
virtual int Resize(tRect& NewRect);
01875
virtual void ProcessMessage(
tGUIMessage& Message);
01880
virtual void Destroy();
01885
virtual void Draw();
01890
const CGUIMenuEntry *
GetExpanded();
01895
virtual bool IsOfType(eEntityType eType);
01896
01897
protected:
01898 int m_iHExpand,
01899
m_iVExpand;
01900 int m_iCurSel;
01901 CGUIMenuEntry *
m_pExpandedChild;
01902 };
01903
01905
01910 class CGUIMenu :
public CGUIMenuEntry
01911 {
01912
public:
01913
CGUIMenu();
01914
virtual ~
CGUIMenu();
01919
virtual void Initialize();
01931
virtual int Create(
CGUIElement *pParent, tRect WidgetRect,
CCustomFont *pFont = NULL,
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false);
01932
01938
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
01943
virtual void GetProperties(EPropList& PropList);
01949
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
01955
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
01960
virtual void ProcessMessage(
tGUIMessage& Message);
01965
virtual void Draw();
01970
virtual bool IsOfType(eEntityType eType);
01971 };
01972
01974
01978 class CGUIRadioGroup :
public CGUIStatic
01979 {
01980
01981
public:
01982
CGUIRadioGroup();
01983
virtual ~
CGUIRadioGroup();
01988
virtual void Initialize();
01999
virtual int Create(
CGUIElement *pParent, tRect WidgetRect,
CCustomFont *pFont = NULL,
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false);
02000
02001
public:
02006
virtual void Draw();
02012
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
02018
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
02019
02024
virtual void SetCurSel(
int iSelection);
02029
int GetCurSel();
02035
virtual CGUIElement*
InsertItem(CString& strItemText, UINT uiInsertAfter = 0);
02036
02042
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
02047
virtual void GetProperties(EPropList& PropList);
02052
virtual void ProcessMessage(
tGUIMessage& Message);
02057
virtual bool IsOfType(eEntityType eType);
02058
02059
protected:
02060 int m_iCurBtnSel;
02061 };
02062
02064
02070 class CGUITabControl :
public CGUIRadioGroup
02071 {
02072
02073
public:
02074
CGUITabControl();
02075
virtual ~
CGUITabControl();
02080
virtual void Initialize();
02092
virtual int Create(
CGUIElement *pParent, tRect WidgetRect, UINT uiNumTabs = 0,
CGUIButton *pTabButton = NULL,
CCustomFont *pFont = NULL,
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false);
02093
02098
virtual void ProcessMessage(
tGUIMessage& Message);
02103
virtual void Draw();
02104
02110
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
02116
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
02117
02123
virtual bool PropertyChanging(
const void* pvProperty ,
void* pvNewValue);
02128
virtual void GetProperties(EPropList& PropList);
02133
virtual void SetCurSel(
int iSelection);
02138
virtual bool IsOfType(eEntityType eType);
02139 };
02140
02141
02143
02147 class CGUIWindow :
public CGUIElement
02148 {
02149
02150
public:
02151
CGUIWindow();
02152
virtual ~
CGUIWindow();
02157
virtual void Initialize();
02158
02173
virtual int Create(
CGUIElement *pParent, tRect WidgetRect,
02174
CGUIStatic *pStatusBar = NULL,
02175
CGUIStatic *pTitleBar = NULL,
02176
CGUIButton *pCloseButton = NULL,
02177
CGUIButton *pMinButton = NULL,
02178
CGUIButton *pMaxRestoreButton = NULL,
02179
CTexture *pTexture = NULL,
CMaterial *pMaterial = NULL,
bool bBorder =
false);
02184
virtual void ProcessMessage(
tGUIMessage& Message);
02189
virtual void Draw();
02190
02196
virtual int LoadXML(
TiXmlNode *pDataNode, CString strFilename);
02202
virtual int SaveXML(
TiXmlNode *pDataNode, CString strFilename);
02208
virtual int Resize(tRect& NewRect);
02209
public:
02214
void Minimize();
02219
void Restore();
02224
void Maximize();
02229
void Close();
02234
virtual bool IsOfType(eEntityType eType);
02235
02236 int m_iWindowState;
02237
private:
02238 tRect m_BackupRect;
02240 };
02241
02248
bool PointInRect(tRect& Rect,
int X,
int Y);
02249
02250
#endif