Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cXDesktopMgr.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cXDesktopMgr_H
7 #define _INC_cXDesktopMgr_H
8 #pragma once
9 #include "cXDTBase.h"
10 #include "../Style/cXStyleSheet.h"
13 
14 namespace GrayGUI
15 {
16  class cXDialog;
18  class cXComboBox;
20  class cXMenu;
22 
23  class cXDlgMessageBox;
25  class cXDlgChatWindow;
27  class cXDlgObjectProps;
29  class cXDlgDialogProps;
31 
32  enum OBJPROPS_ACTION_TYPE;
33 
35  {
38  DLG_STYLE_INVALID = -1, // not loaded yet.
40  // dynamic to g_SceneMgr_Desktop.m_iXStyleQty
41  };
42 
44  : public cScriptableObj
45  , public cDXRenderBatch
46  , public cSingletonStatic<cXDesktopMgr>
47  {
49  public:
50  cXDesktopMgr(void);
51  ~cXDesktopMgr();
52 
53  virtual const char* get_NameCPtr() const
54  {
55  return "Desktop";
56  }
57  STDMETHOD_(cString, get_Name)() const
58  {
59  return("DesktopManager");
60  }
61 
62  virtual HRESULT OneTimeSceneInit();
63  void PartialCleanup();
64  virtual void FinalCleanup();
65  virtual HRESULT InitDeviceObjects(IDirect3DDevice9* pDev);
66  virtual HRESULT DeleteDeviceObjects();
67  virtual HRESULT OnResetDeviceX();
68  virtual HRESULT OnLostDeviceX();
69 
70  virtual void FrameMoveAll(TIMESECF_t fElapsedTime);
71  virtual HRESULT RenderAll(CCamera* pCamera);
72 
73  void OnSize(UINT uType, int cx, int cy);
74  bool OnMouseWheel(MBUTTON_TYPE uButton, int x, int y, short nWheelChange);
75  bool OnMouse_GUI(WINMSG_t msg, int x, int y);
76  bool OnMouse_Arrow(WINMSG_t msg, int x, int y);
77  void OnCancelMode();
78  bool OnKeyboardEvent(WINMSG_t msg, VK_TYPE vKey);
79 
80  // Script support
81  STDMETHOD(s_PropGet)(const cScriptableProp* pProp, OUT cVariant& vValRet) override;
82  STDMETHOD(s_PropPut)(const cScriptableProp* pProp, const cVariant& vVal) override;
83  STDMETHOD(s_Invoke)(const cScriptableMethod* pMethod, const cVariant& vArgs, OUT cVariant& vValRet) override;
84  STDMETHOD(SetObjStateLoaded)() override; // extra cleanup at the end of the load.
85 
86  void ButtonDrag_OnMouse(cXWindow* pDrag, cXWindow* pDragDummy, int x, int y, bool bTest);
87 
88  void SetMouseCapture(cXWindow* pWindow, MOUSEMODE_TYPE mode);
89  cXWindowPtr GetConsumingControl(int x, int y, cXWindow* pIgnore) const;
90 
91  cXDTBasePtr get_DesktopActive(void) const noexcept
92  {
93  return m_pDTActive;
94  }
95  void put_DesktopActiveX(X_WNDCLASS_TYPE eXWClass);
96 
97  void SetScissorDesktop();
99 
101  {
102  return m_pKeyFocus;
103  }
104  bool put_KeyFocus(cXWindow* pControl);
105 
107  {
108  return m_pDialogActive;
109  }
110  void put_DialogActive(cXDialog* pDialog);
111 
112  void put_DropListRoot(cXComboBox* pDropList);
113 
115  {
116  return(m_pDialogModal);
117  }
119 
123  void DialogPlacementExit();
124 
125  bool Menu_Close();
126  cXMenuPtr Menu_Open(cXWindow* pParent, bool bContext = false);
127  bool IsChildTypeOpen(X_WNDCLASS_TYPE xClassType, DLGID_t id = k_DLGID_ANY) const;
128 
129  public:
131  enum P_TYPE_
132  {
133 #define cXDesktopMgrProp(a,b,c,d,e) P_##a,
134 #include "cXDesktopMgrProps.tbl"
135 #undef cXDesktopMgrProp
137  };
138  void s_Update(P_TYPE_ iProp);
140  enum M_TYPE_
141  {
142 #define cXDesktopMgrMethod(a,b,c) M_##a,
143 #include "cXDesktopMgrMethods.tbl"
144 #undef cXDesktopMgrMethod
146  };
148  public:
149  // App modal stuff.
150  cXDTBasePtr m_pDTActive; // only one active desktop, X_DT_Loading, etc
151  cXDTBasePtr m_pDTPrev; // active desktop before m_pDTActive, X_DT_Loading, etc
152  cXDTBasePtr m_pDTDefault; // Preserve the main/default desktop.
153 
154  cXDialogPtr m_pDialogActive; // what dialog has a title active.
155  cXDialogPtr m_pDialogModal; // m_pDialogActive is modal
156  cXWindowPtr m_pKeyFocus; // who gets keystrokes first
157  cPoint2i m_pntDlgSpawnLocation; // The point of the most recently clicked dialog to spawn based on
158 
159  cArrayRef<cXDlgChatWindow> m_aDlgChats; // All the possible open cXDlgChatWindow cXDialog
160 
161  // Track single instances of windows.
162 
163  // only one menu/DropList active at any one time!
164  cXMenuPtr m_pMenuRoot; // only one active menu root per GUI. (tho it may have child menus)
165  cPoint2i m_MenuPoint; // base point for the menu.
166  cXObjectPtr m_pContextMenuObject; // if menu is context menu for an XObject.
167  cXObjectPtr m_pContextMenuObject2; // commands may apply to the objects parent as well. (template,region,multi)
168  cXComboBoxPtr m_pDropListRoot; // only one active drop list root per GUI.
169 
170  // Current mouse tracking/capture.
171  cXWindowPtr m_pMouseCapture; // window that has captured the mouse input.
172  cXDialogPtr m_pButtonDragOver; // window under dragged button. Used for window exit signals.
173 
174  // Common stuff.
175 
176  bool m_bGameRunning; // We are fully open, not in the process of closing or opening.
177  cArraySortHash<cXDialogPlacementObj> m_aPlacement; // Hold placement information of windows closed during runtime
178 
179  private:
180  cStringF m_sRegistryKey; // Save my state here. based on my user name.
181  };
182 
184 };
185 #endif // _INC_cXDesktopMgr_H
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
UINT WINMSG_t
Supplement _WIN32 "windows.h".
Definition: WinTypes.h:111
int VK_TYPE
a type of physical key in _WIN32. "#define VK_UP" etc. NOT the same as a scan code.
Definition: cInputBase.h:27
Definition: cDXRenderBatch.h:20
Definition: cXComboBox.h:19
Definition: cXDesktopMgr.h:47
void DialogPlacementExit()
Definition: cXDesktopMgr.cpp:184
cXDialogPlacementPtr DialogPlacementAlloc(X_WNDCLASS_TYPE eXWClass)
Definition: cXDesktopMgr.cpp:119
void s_Update(P_TYPE_ iProp)
Definition: cXDesktopMgr.cpp:1011
cXDTBasePtr m_pDTDefault
Definition: cXDesktopMgr.h:152
CSCRIPT_CLASS_DEF1(XDesktopMgr, cXObject)
virtual void FrameMoveAll(TIMESECF_t fElapsedTime)
Definition: cXDesktopMgr.cpp:832
void SetMouseCapture(cXWindow *pWindow, MOUSEMODE_TYPE mode)
Definition: cXDesktopMgr.cpp:620
bool OnMouse_GUI(WINMSG_t msg, int x, int y)
Definition: cXDesktopMgr.cpp:741
cXDTBasePtr m_pDTPrev
Definition: cXDesktopMgr.h:151
cXWindowPtr get_KeyFocus(void) const
Definition: cXDesktopMgr.h:100
void DialogPlacementRelease(cXDialogPlacementObj *pDP)
Definition: cXDesktopMgr.cpp:169
cXDialogPtr m_pDialogActive
Definition: cXDesktopMgr.h:154
cXDialogPtr m_pDialogModal
Definition: cXDesktopMgr.h:155
void ButtonDrag_OnMouse(cXWindow *pDrag, cXWindow *pDragDummy, int x, int y, bool bTest)
Definition: cXDesktopMgr.cpp:251
bool OnMouseWheel(MBUTTON_TYPE uButton, int x, int y, short nWheelChange)
Definition: cXDesktopMgr.cpp:723
cXDTBasePtr m_pDTActive
Definition: cXDesktopMgr.h:150
cXMenuPtr m_pMenuRoot
Definition: cXDesktopMgr.h:164
void put_DesktopActiveX(X_WNDCLASS_TYPE eXWClass)
Definition: cXDesktopMgr.cpp:465
cXDTBasePtr get_DesktopActive(void) const noexcept
Definition: cXDesktopMgr.h:91
virtual HRESULT OnLostDeviceX()
Definition: cXDesktopMgr.cpp:970
virtual HRESULT InitDeviceObjects(IDirect3DDevice9 *pDev)
Definition: cXDesktopMgr.cpp:900
bool IsChildTypeOpen(X_WNDCLASS_TYPE xClassType, DLGID_t id=k_DLGID_ANY) const
Definition: cXDesktopMgr.cpp:242
void OnCancelMode()
Definition: cXDesktopMgr.cpp:652
cXDialogPtr get_DialogModal(void) const
Definition: cXDesktopMgr.h:114
bool Menu_Close()
Definition: cXDesktopMgr.cpp:560
cXMenuPtr Menu_Open(cXWindow *pParent, bool bContext=false)
Definition: cXDesktopMgr.cpp:579
cXWindowPtr GetConsumingControl(int x, int y, cXWindow *pIgnore) const
Definition: cXDesktopMgr.cpp:632
void put_DialogActive(cXDialog *pDialog)
Definition: cXDesktopMgr.cpp:413
~cXDesktopMgr()
Definition: cXDesktopMgr.cpp:53
bool OnKeyboardEvent(WINMSG_t msg, VK_TYPE vKey)
Definition: cXDesktopMgr.cpp:663
virtual void FinalCleanup()
Definition: cXDesktopMgr.cpp:893
void OnSize(UINT uType, int cx, int cy)
Definition: cXDesktopMgr.cpp:712
cPoint2i m_MenuPoint
Definition: cXDesktopMgr.h:165
cXObjectPtr m_pContextMenuObject
Definition: cXDesktopMgr.h:166
bool OnMouse_Arrow(WINMSG_t msg, int x, int y)
Definition: cXDesktopMgr.cpp:763
static cScriptableProp sm_Props[P_QTY+1]
Definition: cXDesktopMgr.h:139
M_TYPE_
Definition: cXDesktopMgr.h:141
@ M_QTY
Definition: cXDesktopMgr.h:145
virtual HRESULT OneTimeSceneInit()
Definition: cXDesktopMgr.cpp:848
virtual const char * get_NameCPtr() const
Render type must have a name.
Definition: cXDesktopMgr.h:53
virtual HRESULT OnResetDeviceX()
Definition: cXDesktopMgr.cpp:950
void put_DropListRoot(cXComboBox *pDropList)
Definition: cXDesktopMgr.cpp:317
virtual HRESULT RenderAll(CCamera *pCamera)
Definition: cXDesktopMgr.cpp:990
STDMETHOD() SetObjStateLoaded() override
Definition: cXDesktopMgr.cpp:1023
P_TYPE_
Definition: cXDesktopMgr.h:132
@ P_QTY
Definition: cXDesktopMgr.h:136
cXDialogPtr put_DialogModal(cXDialog *pDialog)
Definition: cXDesktopMgr.cpp:438
bool put_KeyFocus(cXWindow *pControl)
Definition: cXDesktopMgr.cpp:325
void PartialCleanup()
Definition: cXDesktopMgr.cpp:853
STDMETHOD_(cString, get_Name)() const
Definition: cXDesktopMgr.h:57
STDMETHOD() s_Invoke(const cScriptableMethod *pMethod, const cVariant &vArgs, OUT cVariant &vValRet) override
Definition: cXDesktopMgr.cpp:1053
HRESULT DialogPlacementInit()
Definition: cXDesktopMgr.cpp:60
HRESULT SetViewportDesktop()
Definition: cXDesktopMgr.cpp:455
cXWindowPtr m_pMouseCapture
Definition: cXDesktopMgr.h:171
cArrayRef< cXDlgChatWindow > m_aDlgChats
Definition: cXDesktopMgr.h:159
STDMETHOD() s_PropPut(const cScriptableProp *pProp, const cVariant &vVal) override
Definition: cXDesktopMgr.cpp:1040
cXComboBoxPtr m_pDropListRoot
Definition: cXDesktopMgr.h:168
STDMETHOD() s_PropGet(const cScriptableProp *pProp, OUT cVariant &vValRet) override
Definition: cXDesktopMgr.cpp:1028
static cScriptableMethod sm_Methods[M_QTY+1]
Definition: cXDesktopMgr.h:147
cXDesktopMgr(void)
Definition: cXDesktopMgr.cpp:40
void SetScissorDesktop()
Definition: cXDesktopMgr.cpp:445
cPoint2i m_pntDlgSpawnLocation
Definition: cXDesktopMgr.h:157
cXDialogPtr get_DialogActive(void) const
Definition: cXDesktopMgr.h:106
cXDialogPtr m_pButtonDragOver
Definition: cXDesktopMgr.h:172
cArraySortHash< cXDialogPlacementObj > m_aPlacement
Definition: cXDesktopMgr.h:177
cXObjectPtr m_pContextMenuObject2
Definition: cXDesktopMgr.h:167
cXWindowPtr m_pKeyFocus
Definition: cXDesktopMgr.h:156
virtual HRESULT DeleteDeviceObjects()
Definition: cXDesktopMgr.cpp:925
bool m_bGameRunning
Definition: cXDesktopMgr.h:176
Definition: cXDialog.h:73
Definition: cXDialog.h:96
Definition: cXMenu.h:17
Definition: cXWindow.h:94
Definition: cPoint2.h:20
Definition: cScriptableObj.h:26
const cVariant & vArgs
Definition: cScriptableObj.h:61
Definition: cScriptableInterface.h:97
Definition: cVariant.h:26
Definition: cXObject.h:78
Definition: cArraySortRef.h:60
Definition: cSingleton.h:30
Definition: GrayGUI.cpp:11
cRefPtr< cXComboBox > cXComboBoxPtr
Definition: cXComboBox.h:122
const DLGID_t k_DLGID_ANY
Definition: cXWindow.h:29
cRefPtr< cXDlgChatWindow > cXDlgChatWindowPtr
Definition: cXDesktopMgr.h:25
cRefPtr< cXMenu > cXMenuPtr
Definition: cXDesktopMgr.h:20
cXDesktopMgr g_SceneMgr_Desktop
Definition: cXDesktopMgr.cpp:17
X_WNDCLASS_TYPE
Definition: cXWindow.h:34
cRefPtr< cXDlgMessageBox > cXDlgMessageBoxPtr
Definition: cXDesktopMgr.h:23
cRefPtr< cXDlgObjectProps > cXDlgObjectPropsPtr
Definition: cXDesktopMgr.h:27
SPRITEMAP_t
Definition: cXDesktopMgr.h:35
@ DLG_STYLE_DEFAULT
Definition: cXDesktopMgr.h:39
@ DLG_STYLE_INVALID
Definition: cXDesktopMgr.h:38
cRefPtr< cXDialog > cXDialogPtr
Definition: cXDesktopMgr.h:16
cRefPtr< cXDlgDialogProps > cXDlgDialogPropsPtr
Definition: cXDesktopMgr.h:29
MOUSEMODE_TYPE
Definition: cMouseMgr.h:19
UINT DLGID_t
old window format this was a WORD, EX format this is UINT32.
Definition: cResDialog.h:68
MBUTTON_TYPE
Definition: cInputBase.h:40
float TIMESECF_t
delta float seconds.
Definition: cTimeSys.h:20