From b8ac54052c8752fd858259bf73c8c169425ac1f6 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Sat, 18 Jun 2016 17:03:13 +0100 Subject: [PATCH] gui: Use Bind instead of Connect for everything else --- pcsx2/gui/AppInit.cpp | 9 +++------ pcsx2/gui/MainFrame.cpp | 8 ++++---- pcsx2/gui/RecentIsoList.cpp | 4 ++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/pcsx2/gui/AppInit.cpp b/pcsx2/gui/AppInit.cpp index 1d2903e0b9..99eec6ce5d 100644 --- a/pcsx2/gui/AppInit.cpp +++ b/pcsx2/gui/AppInit.cpp @@ -440,11 +440,8 @@ bool Pcsx2App::OnInit() i18n_SetLanguagePath(); -#define pxAppMethodEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(pxInvokeAppMethodEventFunction, &func ) - - Connect( pxID_PadHandler_Keydown, wxEVT_KEY_DOWN, wxKeyEventHandler (Pcsx2App::OnEmuKeyDown) ); - Connect( wxEVT_DESTROY, wxWindowDestroyEventHandler (Pcsx2App::OnDestroyWindow) ); + Bind(wxEVT_KEY_DOWN, &Pcsx2App::OnEmuKeyDown, this, pxID_PadHandler_Keydown); + Bind(wxEVT_DESTROY, &Pcsx2App::OnDestroyWindow, this); // User/Admin Mode Dual Setup: // PCSX2 now supports two fundamental modes of operation. The default is Classic mode, @@ -474,7 +471,7 @@ bool Pcsx2App::OnInit() // loop termination code. We have a much safer system in place that continues to process messages // until all "important" threads are closed out -- not just until the main frame is closed(-ish). m_timer_Termination = std::unique_ptr(new wxTimer( this, wxID_ANY )); - Connect( m_timer_Termination->GetId(), wxEVT_TIMER, wxTimerEventHandler(Pcsx2App::OnScheduledTermination) ); + Bind(wxEVT_TIMER, &Pcsx2App::OnScheduledTermination, this, m_timer_Termination->GetId()); SetExitOnFrameDelete( false ); diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 528b895658..c142df859b 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -528,10 +528,10 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title) m_MenuItem_Console.Check( g_Conf->ProgLogBox.Visible ); ConnectMenus(); - Connect( wxEVT_MOVE, wxMoveEventHandler (MainEmuFrame::OnMoveAround) ); - Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler (MainEmuFrame::OnCloseWindow) ); - Connect( wxEVT_SET_FOCUS, wxFocusEventHandler (MainEmuFrame::OnFocus) ); - Connect( wxEVT_ACTIVATE, wxActivateEventHandler (MainEmuFrame::OnActivate) ); + Bind(wxEVT_MOVE, &MainEmuFrame::OnMoveAround, this); + Bind(wxEVT_CLOSE_WINDOW, &MainEmuFrame::OnCloseWindow, this); + Bind(wxEVT_SET_FOCUS, &MainEmuFrame::OnFocus, this); + Bind(wxEVT_ACTIVATE, &MainEmuFrame::OnActivate, this); PushEventHandler( &wxGetApp().GetRecentIsoManager() ); SetDropTarget( new IsoDropTarget( this ) ); diff --git a/pcsx2/gui/RecentIsoList.cpp b/pcsx2/gui/RecentIsoList.cpp index c22fe353e4..f3e70947e8 100644 --- a/pcsx2/gui/RecentIsoList.cpp +++ b/pcsx2/gui/RecentIsoList.cpp @@ -39,12 +39,12 @@ RecentIsoManager::RecentIsoManager( wxMenu* menu, int firstIdForMenuItems_or_wxI IniLoader loader; LoadListFrom(loader); - Connect( wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(RecentIsoManager::OnChangedSelection) ); + Bind(wxEVT_MENU, &RecentIsoManager::OnChangedSelection, this); } RecentIsoManager::~RecentIsoManager() throw() { - Disconnect( wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(RecentIsoManager::OnChangedSelection) ); + Unbind(wxEVT_MENU, &RecentIsoManager::OnChangedSelection, this); } void RecentIsoManager::OnChangedSelection( wxCommandEvent& evt )