From fd4965bf98bc6d03dde6d8edf82a308ae0d1f15d Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Fri, 24 May 2024 22:50:43 +0800 Subject: [PATCH] [saco] Implement `CDXUTDialog::SendEvent(...)` --- saco/d3d9/common/DXUTgui.cpp | 16 ++++++++++++++++ saco/d3d9/common/DXUTgui.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/saco/d3d9/common/DXUTgui.cpp b/saco/d3d9/common/DXUTgui.cpp index 9b892fa..77fb1c4 100644 --- a/saco/d3d9/common/DXUTgui.cpp +++ b/saco/d3d9/common/DXUTgui.cpp @@ -203,6 +203,22 @@ void CDXUTDialog::Refresh() } +//-------------------------------------------------------------------------------------- +VOID CDXUTDialog::SendEvent( UINT nEvent, bool bTriggeredByUser, CDXUTControl* pControl ) +{ + // If no callback has been registered there's nowhere to send the event to + if( m_pCallbackEvent == NULL ) + return; + + // Discard events triggered programatically if these types of events haven't been + // enabled + if( !bTriggeredByUser && !m_bNonUserEvents ) + return; + + m_pCallbackEvent( nEvent, pControl->GetID(), pControl, m_pCallbackEventUserContext ); +} + + //-------------------------------------------------------------------------------------- // CDXUTControl class //-------------------------------------------------------------------------------------- diff --git a/saco/d3d9/common/DXUTgui.h b/saco/d3d9/common/DXUTgui.h index f19e879..f399adb 100644 --- a/saco/d3d9/common/DXUTgui.h +++ b/saco/d3d9/common/DXUTgui.h @@ -91,6 +91,10 @@ public: CDXUTDialog(); ~CDXUTDialog(); + + // Methods called by controls + void SendEvent( UINT nEvent, bool bTriggeredByUser, CDXUTControl* pControl ); + void RemoveAllControls(); // Sets the callback used to notify the app of control events