utilities: Use Bind instead of Connect

This commit is contained in:
Jonathan Li 2016-06-16 20:37:31 +01:00
parent c10728319b
commit 3904c67e6e
7 changed files with 15 additions and 26 deletions

View File

@ -362,9 +362,3 @@ public:
protected:
int _DoDialog() const;
};
typedef void (wxEvtHandler::*pxSyncronousEventFunction)(pxSynchronousCommandEvent&);
#define pxSynchronousEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(pxSyncronousEventFunction, &func )

View File

@ -27,7 +27,7 @@ CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxS
// Ensure that the right-side of the static group box isn't too cozy:
SetMinWidth( ThisToggle.GetSize().GetWidth() + 32 );
Connect( ThisToggle.GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CheckedStaticBox::MainToggle_Click ) );
Bind(wxEVT_CHECKBOX, &CheckedStaticBox::MainToggle_Click, this, ThisToggle.GetId());
}
// Event handler for click events for the main checkbox (default behavior: enables/disables all child controls)

View File

@ -41,7 +41,7 @@ Threading::WaitForTaskDialog::WaitForTaskDialog( const wxString& title, const wx
if( m_title.IsEmpty() ) m_title = _("Waiting for task...");
if( m_heading.IsEmpty() ) m_heading = m_title;
Connect( pxEvt_ThreadedTaskComplete, wxCommandEventHandler(WaitForTaskDialog::OnTaskComplete) );
Bind(pxEvt_ThreadedTaskComplete, &WaitForTaskDialog::OnTaskComplete, this);
*this += 12;
*this += Heading(m_heading).Unwrapped() | StdExpand();
@ -53,7 +53,7 @@ Threading::WaitForTaskDialog::WaitForTaskDialog( const wxString& title, const wx
//applyDlg += new wxButton( &applyDlg, wxID_CANCEL ) | pxCenter;
//applyDlg += 6;
//Connect( m_Timer.GetId(), wxEVT_TIMER, wxTimerEventHandler(WaitForTaskDialog::OnTimer) );
//Bind(wxEVT_TIMER, &WaitForTaskDialog::OnTimer, this, m_Timer.GetId());
//m_Timer.Start( 200 );
//GetSysExecutorThread().PostEvent( new SysExecEvent_ApplyPlugins( this, m_sync ) );
}

View File

@ -57,7 +57,7 @@ void pxCheckBox::Init(const wxString& label, const wxString& subtext, int flags)
*this += &spaced | pxExpand;
}
Connect( m_checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(pxCheckBox::OnCheckpartCommand) );
Bind(wxEVT_CHECKBOX, &pxCheckBox::OnCheckpartCommand, this, m_checkbox->GetId());
}
pxCheckBox& pxCheckBox::SetSubPadding( int pad )

View File

@ -46,7 +46,7 @@ void pxStaticText::Init( const wxString& label )
m_autowrap = true;
m_wrappedWidth = -1;
m_label = label;
Connect( wxEVT_PAINT, wxPaintEventHandler(pxStaticText::paintEvent) );
Bind(wxEVT_PAINT, &pxStaticText::paintEvent, this);
}
// we need to refresh the window after changing its size as the standard

View File

@ -630,24 +630,19 @@ void wxAppWithHelpers::DeleteThread( pxThread& obj )
AddIdleEvent( evt );
}
typedef void (wxEvtHandler::*pxInvokeActionEventFunction)(pxActionEvent&);
bool wxAppWithHelpers::OnInit()
{
#define pxActionEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(pxInvokeActionEventFunction, &func )
Bind(pxEvt_SynchronousCommand, &wxAppWithHelpers::OnSynchronousCommand, this);
Bind(pxEvt_InvokeAction, &wxAppWithHelpers::OnInvokeAction, this);
Connect( pxEvt_SynchronousCommand, pxSynchronousEventHandler (wxAppWithHelpers::OnSynchronousCommand) );
Connect( pxEvt_InvokeAction, pxActionEventHandler (wxAppWithHelpers::OnInvokeAction) );
Bind(pxEvt_StartIdleEventTimer, &wxAppWithHelpers::OnStartIdleEventTimer, this);
Connect( pxEvt_StartIdleEventTimer, wxCommandEventHandler (wxAppWithHelpers::OnStartIdleEventTimer) );
Bind(pxEvt_DeleteObject, &wxAppWithHelpers::OnDeleteObject, this);
Bind(pxEvt_DeleteThread, &wxAppWithHelpers::OnDeleteThread, this);
Connect( pxEvt_DeleteObject, wxCommandEventHandler (wxAppWithHelpers::OnDeleteObject) );
Connect( pxEvt_DeleteThread, wxCommandEventHandler (wxAppWithHelpers::OnDeleteThread) );
Bind(wxEVT_IDLE, &wxAppWithHelpers::OnIdleEvent, this);
Connect( wxEVT_IDLE, wxIdleEventHandler (wxAppWithHelpers::OnIdleEvent) );
Connect( m_IdleEventTimer.GetId(), wxEVT_TIMER, wxTimerEventHandler(wxAppWithHelpers::OnIdleEventTimeout) );
Bind(wxEVT_TIMER, &wxAppWithHelpers::OnIdleEventTimeout, this, m_IdleEventTimer.GetId());
return _parent::OnInit();
}

View File

@ -167,10 +167,10 @@ void wxDialogWithHelpers::Init( const pxDialogCreationFlags& cflags )
delete wxHelpProvider::Set( new wxSimpleHelpProvider() );
#endif
Connect( pxEvt_OnDialogCreated, wxCommandEventHandler (wxDialogWithHelpers::OnDialogCreated) );
Bind(pxEvt_OnDialogCreated, &wxDialogWithHelpers::OnDialogCreated, this);
Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (wxDialogWithHelpers::OnOkCancel) );
Connect( wxID_CANCEL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (wxDialogWithHelpers::OnOkCancel) );
Bind(wxEVT_BUTTON, &wxDialogWithHelpers::OnOkCancel, this, wxID_OK);
Bind(wxEVT_BUTTON, &wxDialogWithHelpers::OnOkCancel, this, wxID_CANCEL);
wxCommandEvent createEvent( pxEvt_OnDialogCreated );
createEvent.SetId( GetId() );