From b3ff5fd8aaeff60b7349b122648ab64ad0a81c6e Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Fri, 24 May 2024 22:45:01 +0800 Subject: [PATCH] [saco] Implement `CDXUTDialog::RemoveAllControls()` --- saco/d3d9/common/DXUTgui.cpp | 20 ++++++++++++++++++++ saco/d3d9/common/DXUTgui.h | 1 + 2 files changed, 21 insertions(+) diff --git a/saco/d3d9/common/DXUTgui.cpp b/saco/d3d9/common/DXUTgui.cpp index aa121ba..a910d0b 100644 --- a/saco/d3d9/common/DXUTgui.cpp +++ b/saco/d3d9/common/DXUTgui.cpp @@ -86,6 +86,26 @@ void CDXUTDialog::SetCallback( PCALLBACKDXUTGUIEVENT pCallback, void* pUserConte } +//-------------------------------------------------------------------------------------- +void CDXUTDialog::RemoveAllControls() +{ + if( s_pControlFocus && s_pControlFocus->m_pDialog == this ) + s_pControlFocus = NULL; + if( s_pControlPressed && s_pControlPressed->m_pDialog == this ) + s_pControlPressed = NULL; + m_pControlMouseOver = NULL; + + for( int i=0; i < m_Controls.GetSize(); i++ ) + { + CDXUTControl* pControl = m_Controls.GetAt( i ); + SAFE_DELETE( pControl ); + } + + m_Controls.RemoveAll(); +} + + +//-------------------------------------------------------------------------------------- CDXUTDialogResourceManager::CDXUTDialogResourceManager() { m_pd3dDevice = NULL; diff --git a/saco/d3d9/common/DXUTgui.h b/saco/d3d9/common/DXUTgui.h index 6062405..71659cd 100644 --- a/saco/d3d9/common/DXUTgui.h +++ b/saco/d3d9/common/DXUTgui.h @@ -91,6 +91,7 @@ public: CDXUTDialog(); ~CDXUTDialog(); + void RemoveAllControls(); // Sets the callback used to notify the app of control events void SetCallback( PCALLBACKDXUTGUIEVENT pCallback, void* pUserContext = NULL );