Eliminate nearly all the _connect_macro_ ugliness by using wxw's newish Bind functions.

Unlike Connect, Bind is quite type-safe.
I also seem to have fixed some errors in the input config dialog.
This commit is contained in:
Jordan Woyak
2013-01-13 02:28:12 -06:00
parent 429324a773
commit eca93c4c19
11 changed files with 120 additions and 139 deletions

View File

@ -6,8 +6,6 @@
#include "IniFile.h"
#include <string>
#define _connect_macro_(b, f, c, s) (b)->Connect(wxID_ANY, (c), wxCommandEventHandler( f ), (wxObject*)0, (wxEvtHandler*)s)
UDPConfigDiag::UDPConfigDiag(wxWindow * const parent, UDPWrapper * _wrp) :
wxDialog(parent, -1, _("UDP Wiimote"), wxDefaultPosition, wxDefaultSize),
wrp(_wrp)
@ -31,13 +29,13 @@ UDPConfigDiag::UDPConfigDiag(wxWindow * const parent, UDPWrapper * _wrp) :
port_tbox = new wxTextCtrl(this, wxID_ANY, wxString::FromUTF8(wrp->port.c_str()));
port_sizer->Add(port_tbox, 1, wxLEFT | wxEXPAND, 5);
_connect_macro_(enable, UDPConfigDiag::ChangeState, wxEVT_COMMAND_CHECKBOX_CLICKED, this);
_connect_macro_(butt, UDPConfigDiag::ChangeUpdateFlags, wxEVT_COMMAND_CHECKBOX_CLICKED, this);
_connect_macro_(accel, UDPConfigDiag::ChangeUpdateFlags, wxEVT_COMMAND_CHECKBOX_CLICKED, this);
_connect_macro_(point, UDPConfigDiag::ChangeUpdateFlags, wxEVT_COMMAND_CHECKBOX_CLICKED, this);
_connect_macro_(nun, UDPConfigDiag::ChangeUpdateFlags, wxEVT_COMMAND_CHECKBOX_CLICKED, this);
_connect_macro_(nunaccel, UDPConfigDiag::ChangeUpdateFlags, wxEVT_COMMAND_CHECKBOX_CLICKED, this);
_connect_macro_(port_tbox, UDPConfigDiag::ChangeState, wxEVT_COMMAND_TEXT_UPDATED, this);
enable->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &UDPConfigDiag::ChangeState, this);
butt->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &UDPConfigDiag::ChangeUpdateFlags, this);
accel->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &UDPConfigDiag::ChangeUpdateFlags, this);
point->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &UDPConfigDiag::ChangeUpdateFlags, this);
nun->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &UDPConfigDiag::ChangeUpdateFlags, this);
nunaccel->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &UDPConfigDiag::ChangeUpdateFlags, this);
port_tbox->Bind(wxEVT_COMMAND_TEXT_UPDATED, &UDPConfigDiag::ChangeState, this);
enable->SetValue(wrp->udpEn);
butt->SetValue(wrp->updButt);