2010-11-14 13:30:57 +00:00
|
|
|
#include <string>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/checkbox.h>
|
|
|
|
#include <wx/defs.h>
|
|
|
|
#include <wx/dialog.h>
|
|
|
|
#include <wx/event.h>
|
|
|
|
#include <wx/gdicmn.h>
|
|
|
|
#include <wx/sizer.h>
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
#include <wx/translation.h>
|
2010-11-14 13:30:57 +00:00
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/UDPConfigDiag.h"
|
|
|
|
#include "DolphinWX/WxUtils.h"
|
|
|
|
#include "InputCommon/UDPWrapper.h"
|
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
class wxWindow;
|
|
|
|
|
2010-11-14 13:30:57 +00:00
|
|
|
UDPConfigDiag::UDPConfigDiag(wxWindow * const parent, UDPWrapper * _wrp) :
|
2011-01-05 04:35:46 +00:00
|
|
|
wxDialog(parent, -1, _("UDP Wiimote"), wxDefaultPosition, wxDefaultSize),
|
2010-11-14 13:30:57 +00:00
|
|
|
wrp(_wrp)
|
|
|
|
{
|
|
|
|
wxBoxSizer *const outer_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
wxBoxSizer *const sizer1 = new wxBoxSizer(wxVERTICAL);
|
2011-01-05 04:35:46 +00:00
|
|
|
wxStaticBoxSizer *const sizer2 = new wxStaticBoxSizer(wxVERTICAL, this, _("Update"));
|
2010-11-14 13:30:57 +00:00
|
|
|
|
|
|
|
outer_sizer->Add(sizer1, 0, wxTOP | wxLEFT | wxRIGHT | wxEXPAND, 5);
|
|
|
|
outer_sizer->Add(sizer2, 1, wxLEFT | wxRIGHT | wxEXPAND, 10);
|
|
|
|
|
2011-03-16 12:59:05 +00:00
|
|
|
enable = new wxCheckBox(this, wxID_ANY, _("Enable"));
|
|
|
|
butt = new wxCheckBox(this, wxID_ANY, _("Buttons"));
|
|
|
|
accel = new wxCheckBox(this, wxID_ANY, _("Acceleration"));
|
|
|
|
point = new wxCheckBox(this, wxID_ANY, _("IR Pointer"));
|
|
|
|
nun = new wxCheckBox(this, wxID_ANY, _("Nunchuk"));
|
|
|
|
nunaccel = new wxCheckBox(this, wxID_ANY, _("Nunchuk Acceleration"));
|
2010-11-14 13:30:57 +00:00
|
|
|
|
|
|
|
wxBoxSizer *const port_sizer = new wxBoxSizer(wxHORIZONTAL);
|
2011-01-05 04:35:46 +00:00
|
|
|
port_sizer->Add(new wxStaticText(this, wxID_ANY, _("UDP Port:")), 0, wxALIGN_CENTER);
|
2013-02-28 04:37:38 +00:00
|
|
|
port_tbox = new wxTextCtrl(this, wxID_ANY, StrToWxStr(wrp->port));
|
2011-03-16 12:59:05 +00:00
|
|
|
port_sizer->Add(port_tbox, 1, wxLEFT | wxEXPAND, 5);
|
2010-11-14 13:30:57 +00:00
|
|
|
|
2013-01-13 08:28:12 +00:00
|
|
|
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);
|
2010-11-14 13:30:57 +00:00
|
|
|
|
|
|
|
enable->SetValue(wrp->udpEn);
|
|
|
|
butt->SetValue(wrp->updButt);
|
|
|
|
accel->SetValue(wrp->updAccel);
|
|
|
|
point->SetValue(wrp->updIR);
|
|
|
|
nun->SetValue(wrp->updNun);
|
|
|
|
nunaccel->SetValue(wrp->updNunAccel);
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2010-11-14 13:30:57 +00:00
|
|
|
sizer1->Add(enable, 1, wxALL | wxEXPAND, 5);
|
|
|
|
sizer1->Add(port_sizer, 1, wxBOTTOM | wxLEFT| wxRIGHT | wxEXPAND, 5);
|
|
|
|
|
|
|
|
sizer2->Add(butt, 1, wxALL | wxEXPAND, 5);
|
|
|
|
sizer2->Add(accel, 1, wxALL | wxEXPAND, 5);
|
|
|
|
sizer2->Add(point, 1, wxALL | wxEXPAND, 5);
|
|
|
|
sizer2->Add(nun, 1, wxALL | wxEXPAND, 5);
|
|
|
|
sizer2->Add(nunaccel, 1, wxALL | wxEXPAND, 5);
|
|
|
|
|
2011-06-03 12:26:32 +00:00
|
|
|
outer_sizer->Add(CreateButtonSizer(wxOK), 0, wxALL | wxALIGN_RIGHT, 5);
|
2010-11-14 13:30:57 +00:00
|
|
|
|
|
|
|
SetSizerAndFit(outer_sizer);
|
2011-03-16 12:59:05 +00:00
|
|
|
Center();
|
|
|
|
SetFocus();
|
2010-11-14 13:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void UDPConfigDiag::ChangeUpdateFlags(wxCommandEvent & WXUNUSED(event))
|
|
|
|
{
|
|
|
|
wrp->updAccel=accel->GetValue();
|
|
|
|
wrp->updButt=butt->GetValue();
|
|
|
|
wrp->updIR=point->GetValue();
|
|
|
|
wrp->updNun=nun->GetValue();
|
|
|
|
wrp->updNunAccel=nunaccel->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPConfigDiag::ChangeState(wxCommandEvent & WXUNUSED(event))
|
|
|
|
{
|
2013-02-28 04:37:38 +00:00
|
|
|
wrp->udpEn = enable->GetValue();
|
|
|
|
wrp->port = WxStrToStr(port_tbox->GetValue());
|
2010-11-14 13:30:57 +00:00
|
|
|
wrp->Refresh();
|
|
|
|
}
|