From 0de8f4a3a6f19b6718b515d1f1d9c7c5e7248a0b Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Wed, 27 Apr 2016 08:47:03 +0100 Subject: [PATCH] onepad: Use Bind instead of Connect It's the recommended dynamic event binding method since wx2.9. --- plugins/onepad/Linux/GamepadConfiguration.cpp | 21 ++++--------------- .../onepad/Linux/JoystickConfiguration.cpp | 13 ++---------- plugins/onepad/Linux/dialog.cpp | 13 +++--------- plugins/onepad/Linux/dialog.h | 2 +- 4 files changed, 10 insertions(+), 39 deletions(-) diff --git a/plugins/onepad/Linux/GamepadConfiguration.cpp b/plugins/onepad/Linux/GamepadConfiguration.cpp index 6cadcbee9f..6c7de1a6e9 100644 --- a/plugins/onepad/Linux/GamepadConfiguration.cpp +++ b/plugins/onepad/Linux/GamepadConfiguration.cpp @@ -116,24 +116,11 @@ GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent) : wxFrame( wxSize(60,25) // Size ); - // Connect the buttons to the OnButtonClicked Event - Connect( - wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler(GamepadConfiguration::OnButtonClicked) - ); - // Connect the sliders to the OnSliderReleased Event - Connect( - wxEVT_SCROLL_THUMBRELEASE, - wxCommandEventHandler(GamepadConfiguration::OnSliderReleased) - ); + Bind(wxEVT_BUTTON, &GamepadConfiguration::OnButtonClicked, this); + Bind(wxEVT_SCROLL_THUMBRELEASE, &GamepadConfiguration::OnSliderReleased, this); + Bind(wxEVT_CHECKBOX, &GamepadConfiguration::OnCheckboxChange, this); - // Connect the checkboxes to the OnCheckboxClicked Event - Connect( - wxEVT_CHECKBOX, - wxCommandEventHandler(GamepadConfiguration::OnCheckboxChange) - ); - - repopulate(); + repopulate(); } /** diff --git a/plugins/onepad/Linux/JoystickConfiguration.cpp b/plugins/onepad/Linux/JoystickConfiguration.cpp index ab81d3ab20..104c33c7d8 100644 --- a/plugins/onepad/Linux/JoystickConfiguration.cpp +++ b/plugins/onepad/Linux/JoystickConfiguration.cpp @@ -106,17 +106,8 @@ JoystickConfiguration::JoystickConfiguration(int pad, bool left, wxWindow *paren wxSize(60,25) // Size ); - // Connect the buttons to the OnButtonClicked Event - Connect( - wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler(JoystickConfiguration::OnButtonClicked) - ); - - // Connect the checkboxes to the OnCheckboxClicked Event - Connect( - wxEVT_CHECKBOX, - wxCommandEventHandler(JoystickConfiguration::OnCheckboxChange) - ); + Bind(wxEVT_BUTTON, &JoystickConfiguration::OnButtonClicked, this); + Bind(wxEVT_CHECKBOX, &JoystickConfiguration::OnCheckboxChange, this); } /** diff --git a/plugins/onepad/Linux/dialog.cpp b/plugins/onepad/Linux/dialog.cpp index e1e92212b1..9e0aa9a4eb 100644 --- a/plugins/onepad/Linux/dialog.cpp +++ b/plugins/onepad/Linux/dialog.cpp @@ -280,17 +280,10 @@ Dialog::Dialog() : wxFrame( NULL, // Parent m_bt_gamepad[i][Analog]->Disable(); } - // Connect the buttons to the OnButtonClicked Event - Connect( - wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler(Dialog::OnButtonClicked) - ); + Bind(wxEVT_BUTTON, &Dialog::OnButtonClicked, this); m_time_update_gui.SetOwner(this); - Connect( - wxEVT_TIMER, - wxCommandEventHandler(Dialog::JoystickEvent) - ); + Bind(wxEVT_TIMER, &Dialog::JoystickEvent, this); m_time_update_gui.Start(UPDATE_TIME, wxTIMER_CONTINUOUS); for(int i=0; i