[saco] Implement CDXUTDialog::GetControl(...)

This commit is contained in:
RD42 2024-05-24 23:07:39 +08:00
parent 66cb7f0290
commit 937495a9b8
2 changed files with 43 additions and 0 deletions

View File

@ -332,6 +332,46 @@ HRESULT CDXUTDialog::AddControl( CDXUTControl* pControl )
} }
//--------------------------------------------------------------------------------------
CDXUTControl* CDXUTDialog::GetControl( int ID )
{
// Try to find the control with the given ID
for( int i=0; i < m_Controls.GetSize(); i++ )
{
CDXUTControl* pControl = m_Controls.GetAt( i );
if( pControl->GetID() == ID )
{
return pControl;
}
}
// Not found
return NULL;
}
//--------------------------------------------------------------------------------------
CDXUTControl* CDXUTDialog::GetControl( int ID, UINT nControlType )
{
// Try to find the control with the given ID
for( int i=0; i < m_Controls.GetSize(); i++ )
{
CDXUTControl* pControl = m_Controls.GetAt( i );
if( pControl->GetID() == ID && pControl->GetType() == nControlType )
{
return pControl;
}
}
// Not found
return NULL;
}
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// CDXUTControl class // CDXUTControl class
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@ -94,6 +94,9 @@ public:
HRESULT AddControl( CDXUTControl* pControl ); HRESULT AddControl( CDXUTControl* pControl );
HRESULT InitControl( CDXUTControl* pControl ); HRESULT InitControl( CDXUTControl* pControl );
CDXUTControl* GetControl( int ID );
CDXUTControl* GetControl( int ID, UINT nControlType );
// Methods called by controls // Methods called by controls
void SendEvent( UINT nEvent, bool bTriggeredByUser, CDXUTControl* pControl ); void SendEvent( UINT nEvent, bool bTriggeredByUser, CDXUTControl* pControl );