[saco] Implement CDXUTDialog constructor

This commit is contained in:
RD42 2024-05-16 22:41:42 +08:00
parent f833cc2302
commit 81c340ad4f
2 changed files with 117 additions and 1 deletions

View File

@ -10,6 +10,46 @@
#undef min // use __min instead
#undef max // use __max instead
//--------------------------------------------------------------------------------------
// CDXUTDialog class
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
CDXUTDialog::CDXUTDialog()
{
m_x = 0;
m_y = 0;
m_width = 0;
m_height = 0;
m_pManager = NULL;
m_bVisible = true;
m_bCaption = false;
m_bMinimized = false;
m_wszCaption[0] = L'\0';
m_nCaptionHeight = 18;
m_colorTopLeft = 0;
m_colorTopRight = 0;
m_colorBottomLeft = 0;
m_colorBottomRight = 0;
m_pCallbackEvent = NULL;
m_pCallbackEventUserContext = NULL;
m_fTimeLastRefresh = 0;
m_pControlMouseOver = NULL;
m_pNextDialog = this;
m_pPrevDialog = this;
m_nDefaultControlID = 0xffff;
m_bNonUserEvents = false;
m_bKeyboardInput = false;
m_bMouseInput = true;
}
//--------------------------------------------------------------------------------------
CDXUTDialogResourceManager::CDXUTDialogResourceManager()
{
@ -92,7 +132,6 @@ void CDXUTDialogResourceManager::OnDestroyDevice()
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
// MATCH
CDXUTControl::CDXUTControl( CDXUTDialog *pDialog )
{
m_Type = DXUT_CONTROL_BUTTON;

View File

@ -9,6 +9,16 @@
#ifndef DXUT_GUI_H
#define DXUT_GUI_H
//--------------------------------------------------------------------------------------
// Forward declarations
//--------------------------------------------------------------------------------------
class CDXUTDialogResourceManager;
class CDXUTControl;
class CDXUTStatic;
class CDXUTElement;
struct DXUTElementHolder;
typedef VOID (CALLBACK *PCALLBACKDXUTGUIEVENT) ( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext );
//--------------------------------------------------------------------------------------
// Enums for pre-defined control types
@ -66,6 +76,61 @@ public:
};
//-----------------------------------------------------------------------------
// All controls must be assigned to a dialog, which handles
// input and rendering for the controls.
//-----------------------------------------------------------------------------
class CDXUTDialog
{
public:
CDXUTDialog();
bool m_bNonUserEvents;
bool m_bKeyboardInput;
bool m_bMouseInput;
private:
int m_nDefaultControlID;
static double s_fTimeRefresh;
double m_fTimeLastRefresh;
CDXUTControl* m_pControlMouseOver; // The control which is hovered over
bool m_bVisible;
bool m_bCaption;
bool m_bMinimized;
TCHAR m_wszCaption[256];
int m_x;
int m_y;
int m_width;
int m_height;
int m_nCaptionHeight;
D3DCOLOR m_colorTopLeft;
D3DCOLOR m_colorTopRight;
D3DCOLOR m_colorBottomLeft;
D3DCOLOR m_colorBottomRight;
CDXUTDialogResourceManager* m_pManager;
PCALLBACKDXUTGUIEVENT m_pCallbackEvent;
void* m_pCallbackEventUserContext;
CGrowableArray< int > m_Textures; // Index into m_TextureCache;
CGrowableArray< int > m_Fonts; // Index into m_FontCache;
CGrowableArray< CDXUTControl* > m_Controls;
CGrowableArray< DXUTElementHolder* > m_DefaultElements;
CDXUTElement m_CapElement; // Element for the caption
CDXUTDialog* m_pNextDialog;
CDXUTDialog* m_pPrevDialog;
};
//--------------------------------------------------------------------------------------
// Structs for shared resources
//--------------------------------------------------------------------------------------
@ -181,6 +246,18 @@ protected:
};
//-----------------------------------------------------------------------------
// Contains all the display information for a given control type
//-----------------------------------------------------------------------------
struct DXUTElementHolder
{
UINT nControlType;
UINT iElement;
CDXUTElement Element;
};
//-----------------------------------------------------------------------------
// Static control
//-----------------------------------------------------------------------------