utilities: Use Bind compatible event declarations/definitions

This commit is contained in:
Jonathan Li 2016-06-14 23:17:37 +01:00
parent 7ac47676e2
commit c10728319b
7 changed files with 22 additions and 29 deletions

View File

@ -18,9 +18,7 @@
#include "Threading.h"
#include "wxAppWithHelpers.h"
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE(pxEvt_ThreadedTaskComplete, -1)
END_DECLARE_EVENT_TYPES()
wxDECLARE_EVENT(pxEvt_ThreadedTaskComplete, wxCommandEvent);
namespace Threading
{

View File

@ -15,13 +15,9 @@
#pragma once
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE( pxEvt_StartIdleEventTimer, -1 )
DECLARE_EVENT_TYPE( pxEvt_DeleteObject, -1 )
DECLARE_EVENT_TYPE( pxEvt_DeleteThread, -1 )
DECLARE_EVENT_TYPE( pxEvt_InvokeAction, -1 )
DECLARE_EVENT_TYPE( pxEvt_SynchronousCommand, -1 )
END_DECLARE_EVENT_TYPES()
wxDECLARE_EVENT(pxEvt_StartIdleEventTimer, wxCommandEvent);
wxDECLARE_EVENT(pxEvt_DeleteObject, wxCommandEvent);
wxDECLARE_EVENT(pxEvt_DeleteThread, wxCommandEvent);
typedef void FnType_Void();
@ -89,6 +85,10 @@ public:
// --------------------------------------------------------------------------------------
// pxActionEvent
// --------------------------------------------------------------------------------------
class pxActionEvent;
wxDECLARE_EVENT(pxEvt_InvokeAction, pxActionEvent);
class pxActionEvent : public wxEvent
{
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxActionEvent)
@ -188,6 +188,8 @@ public:
void SetException( const BaseException& ex );
};
wxDECLARE_EVENT(pxEvt_SynchronousCommand, pxSynchronousCommandEvent);
// --------------------------------------------------------------------------------------
// BaseMessageBoxEvent
// --------------------------------------------------------------------------------------

View File

@ -128,7 +128,7 @@ protected:
void IdleEventDispatcher( const wxChar* action=wxEmptyString );
void OnIdleEvent( wxIdleEvent& evt );
void OnStartIdleEventTimer( wxEvent& evt );
void OnStartIdleEventTimer( wxCommandEvent& evt );
void OnIdleEventTimeout( wxTimerEvent& evt );
void OnDeleteObject( wxCommandEvent& evt );
void OnDeleteThread( wxCommandEvent& evt );

View File

@ -270,13 +270,7 @@ void operator+=( wxSizer& target, const pxWindowAndFlags<WinType>& src )
target.Add( src.window, src.flags );
}
BEGIN_DECLARE_EVENT_TYPES()
// Added to the event queue by pxDialogWithHelpers
DECLARE_EVENT_TYPE( pxEvt_OnDialogCreated, -1 )
END_DECLARE_EVENT_TYPES()
wxDECLARE_EVENT(pxEvt_OnDialogCreated, wxCommandEvent);
// --------------------------------------------------------------------------------------
// pxDialogCreationFlags

View File

@ -19,7 +19,7 @@
using namespace pxSizerFlags;
DEFINE_EVENT_TYPE(pxEvt_ThreadedTaskComplete);
wxDEFINE_EVENT(pxEvt_ThreadedTaskComplete, wxCommandEvent);
// --------------------------------------------------------------------------------------
// WaitForTaskDialog Implementations

View File

@ -19,12 +19,11 @@
#include "ThreadingInternal.h"
#include "PersistentThread.h"
DEFINE_EVENT_TYPE( pxEvt_DeleteObject );
DEFINE_EVENT_TYPE( pxEvt_DeleteThread );
DEFINE_EVENT_TYPE( pxEvt_StartIdleEventTimer );
DEFINE_EVENT_TYPE( pxEvt_InvokeAction );
DEFINE_EVENT_TYPE( pxEvt_SynchronousCommand );
wxDEFINE_EVENT(pxEvt_StartIdleEventTimer, wxCommandEvent);
wxDEFINE_EVENT(pxEvt_DeleteObject, wxCommandEvent);
wxDEFINE_EVENT(pxEvt_DeleteThread, wxCommandEvent);
wxDEFINE_EVENT(pxEvt_InvokeAction, pxActionEvent);
wxDEFINE_EVENT(pxEvt_SynchronousCommand, pxSynchronousCommandEvent);
IMPLEMENT_DYNAMIC_CLASS( pxSimpleEvent, wxEvent )
@ -484,12 +483,12 @@ void wxAppWithHelpers::AddIdleEvent( const wxEvent& evt )
{
ScopedLock lock( m_IdleEventMutex );
if( m_IdleEventQueue.size() == 0 )
PostEvent( pxSimpleEvent( pxEvt_StartIdleEventTimer ) );
PostEvent(wxCommandEvent(pxEvt_StartIdleEventTimer));
m_IdleEventQueue.push_back( evt.Clone() );
}
void wxAppWithHelpers::OnStartIdleEventTimer( wxEvent& evt )
void wxAppWithHelpers::OnStartIdleEventTimer( wxCommandEvent& evt )
{
ScopedLock lock( m_IdleEventMutex );
if( m_IdleEventQueue.size() != 0 )
@ -641,7 +640,7 @@ bool wxAppWithHelpers::OnInit()
Connect( pxEvt_SynchronousCommand, pxSynchronousEventHandler (wxAppWithHelpers::OnSynchronousCommand) );
Connect( pxEvt_InvokeAction, pxActionEventHandler (wxAppWithHelpers::OnInvokeAction) );
Connect( pxEvt_StartIdleEventTimer, wxEventHandler (wxAppWithHelpers::OnStartIdleEventTimer) );
Connect( pxEvt_StartIdleEventTimer, wxCommandEventHandler (wxAppWithHelpers::OnStartIdleEventTimer) );
Connect( pxEvt_DeleteObject, wxCommandEventHandler (wxAppWithHelpers::OnDeleteObject) );
Connect( pxEvt_DeleteThread, wxCommandEventHandler (wxAppWithHelpers::OnDeleteThread) );

View File

@ -117,7 +117,7 @@ bool pxDialogExists( const wxString& name )
// wxDialogWithHelpers Class Implementations
// =====================================================================================================
DEFINE_EVENT_TYPE( pxEvt_OnDialogCreated )
wxDEFINE_EVENT(pxEvt_OnDialogCreated, wxCommandEvent);
IMPLEMENT_DYNAMIC_CLASS(wxDialogWithHelpers, wxDialog)