diff --git a/saco/d3d9/common/DXUTgui.cpp b/saco/d3d9/common/DXUTgui.cpp index c991430..b9a56fc 100644 --- a/saco/d3d9/common/DXUTgui.cpp +++ b/saco/d3d9/common/DXUTgui.cpp @@ -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 //-------------------------------------------------------------------------------------- diff --git a/saco/d3d9/common/DXUTgui.h b/saco/d3d9/common/DXUTgui.h index 0d83784..ca2c829 100644 --- a/saco/d3d9/common/DXUTgui.h +++ b/saco/d3d9/common/DXUTgui.h @@ -94,6 +94,9 @@ public: HRESULT AddControl( CDXUTControl* pControl ); HRESULT InitControl( CDXUTControl* pControl ); + CDXUTControl* GetControl( int ID ); + CDXUTControl* GetControl( int ID, UINT nControlType ); + // Methods called by controls void SendEvent( UINT nEvent, bool bTriggeredByUser, CDXUTControl* pControl );