Merge pull request #4589 from ligfx/cleaninputconfigdiag

InputConfigDiag: move function bodies out of header
This commit is contained in:
Mat M 2017-01-05 14:29:35 -05:00 committed by GitHub
commit 6fe621f203
2 changed files with 48 additions and 21 deletions

View File

@ -104,6 +104,11 @@ void InputConfigDialog::ConfigExtension(wxCommandEvent& event)
}
}
PadSetting::PadSetting(wxControl* const _control) : wxcontrol(_control)
{
wxcontrol->SetClientData(this);
}
PadSettingExtension::PadSettingExtension(wxWindow* const parent,
ControllerEmu::Extension* const ext)
: PadSetting(new wxChoice(parent, wxID_ANY)), extension(ext)
@ -210,6 +215,11 @@ ControlDialog::ControlDialog(InputConfigDialog* const parent, InputConfig& confi
SetFocus();
}
ExtensionButton::ExtensionButton(wxWindow* const parent, ControllerEmu::Extension* const ext)
: wxButton(parent, wxID_ANY, _("Configure"), wxDefaultPosition), extension(ext)
{
}
ControlButton::ControlButton(wxWindow* const parent,
ControllerInterface::ControlReference* const _ref,
const std::string& name, const unsigned int width,
@ -918,6 +928,12 @@ ControlGroupBox::~ControlGroupBox()
delete padSetting;
}
bool ControlGroupBox::HasBitmapHeading() const
{
return control_group->type == GROUP_TYPE_STICK || control_group->type == GROUP_TYPE_TILT ||
control_group->type == GROUP_TYPE_CURSOR || control_group->type == GROUP_TYPE_FORCE;
}
ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWindow* const parent,
InputConfigDialog* eventsink)
: wxStaticBoxSizer(wxVERTICAL, parent, wxGetTranslation(StrToWxStr(group->ui_name))),
@ -1238,6 +1254,16 @@ InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputConfig& config
m_update_timer.Start(PREVIEW_UPDATE_TIME, wxTIMER_CONTINUOUS);
}
InputEventFilter::InputEventFilter()
{
wxEvtHandler::AddFilter(this);
}
InputEventFilter::~InputEventFilter()
{
wxEvtHandler::RemoveFilter(this);
}
int InputEventFilter::FilterEvent(wxEvent& event)
{
if (m_block && ShouldCatchEventType(event.GetEventType()))
@ -1248,3 +1274,16 @@ int InputEventFilter::FilterEvent(wxEvent& event)
return Event_Skip;
}
void InputEventFilter::BlockEvents(bool block)
{
m_block = block;
}
bool InputEventFilter::ShouldCatchEventType(wxEventType type)
{
return type == wxEVT_KEY_DOWN || type == wxEVT_KEY_UP || type == wxEVT_CHAR ||
type == wxEVT_CHAR_HOOK || type == wxEVT_LEFT_DOWN || type == wxEVT_LEFT_UP ||
type == wxEVT_MIDDLE_DOWN || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_DOWN ||
type == wxEVT_RIGHT_UP;
}

View File

@ -38,7 +38,8 @@ class wxTextCtrl;
class PadSetting
{
protected:
PadSetting(wxControl* const _control) : wxcontrol(_control) { wxcontrol->SetClientData(this); }
PadSetting(wxControl* const _control);
public:
virtual void UpdateGUI() = 0;
virtual void UpdateValue() = 0;
@ -82,19 +83,14 @@ public:
class InputEventFilter : public wxEventFilter
{
public:
InputEventFilter() { wxEvtHandler::AddFilter(this); }
~InputEventFilter() { wxEvtHandler::RemoveFilter(this); }
InputEventFilter();
~InputEventFilter();
int FilterEvent(wxEvent& event) override;
void BlockEvents(bool block) { m_block = block; }
void BlockEvents(bool block);
private:
static bool ShouldCatchEventType(wxEventType type)
{
return type == wxEVT_KEY_DOWN || type == wxEVT_KEY_UP || type == wxEVT_CHAR ||
type == wxEVT_CHAR_HOOK || type == wxEVT_LEFT_DOWN || type == wxEVT_LEFT_UP ||
type == wxEVT_MIDDLE_DOWN || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_DOWN ||
type == wxEVT_RIGHT_UP;
}
static bool ShouldCatchEventType(wxEventType type);
bool m_block = false;
};
@ -148,11 +144,7 @@ private:
class ExtensionButton : public wxButton
{
public:
ExtensionButton(wxWindow* const parent, ControllerEmu::Extension* const ext)
: wxButton(parent, wxID_ANY, _("Configure"), wxDefaultPosition), extension(ext)
{
}
ExtensionButton(wxWindow* const parent, ControllerEmu::Extension* const ext);
ControllerEmu::Extension* const extension;
};
@ -178,11 +170,7 @@ public:
InputConfigDialog* eventsink);
~ControlGroupBox();
bool HasBitmapHeading() const
{
return control_group->type == GROUP_TYPE_STICK || control_group->type == GROUP_TYPE_TILT ||
control_group->type == GROUP_TYPE_CURSOR || control_group->type == GROUP_TYPE_FORCE;
}
bool HasBitmapHeading() const;
std::vector<PadSetting*> options;