ControlGroup: Convert group type enum into an enum class

Gets some constants out of the ControllerEmu namespace, and modifies
ControlGroup so that it uses the enum type itself to represent the
underlying type, rather than a u32 value.
This commit is contained in:
Lioncash
2017-02-25 00:35:02 -05:00
parent 51136681df
commit 26f17a1723
14 changed files with 61 additions and 59 deletions

View File

@ -942,10 +942,10 @@ ControlGroupBox::~ControlGroupBox()
bool ControlGroupBox::HasBitmapHeading() const
{
return control_group->type == ControllerEmu::GROUP_TYPE_STICK ||
control_group->type == ControllerEmu::GROUP_TYPE_TILT ||
control_group->type == ControllerEmu::GROUP_TYPE_CURSOR ||
control_group->type == ControllerEmu::GROUP_TYPE_FORCE;
return control_group->type == ControllerEmu::GroupType::Stick ||
control_group->type == ControllerEmu::GroupType::Tilt ||
control_group->type == ControllerEmu::GroupType::Cursor ||
control_group->type == ControllerEmu::GroupType::Force;
}
ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWindow* const parent,
@ -1000,10 +1000,10 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
switch (group->type)
{
case ControllerEmu::GROUP_TYPE_STICK:
case ControllerEmu::GROUP_TYPE_TILT:
case ControllerEmu::GROUP_TYPE_CURSOR:
case ControllerEmu::GROUP_TYPE_FORCE:
case ControllerEmu::GroupType::Stick:
case ControllerEmu::GroupType::Tilt:
case ControllerEmu::GroupType::Cursor:
case ControllerEmu::GroupType::Force:
{
wxSize bitmap_size = parent->FromDIP(wxSize(64, 64));
m_scale = bitmap_size.GetWidth() / 64.0;
@ -1045,7 +1045,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
Add(h_szr, 0, wxEXPAND | wxLEFT | wxRIGHT, space3);
}
break;
case ControllerEmu::GROUP_TYPE_BUTTONS:
case ControllerEmu::GroupType::Buttons:
{
// Draw buttons in rows of 8
unsigned int button_cols = group->controls.size() > 8 ? 8 : group->controls.size();
@ -1083,17 +1083,17 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
Add(static_bitmap, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, space3);
}
break;
case ControllerEmu::GROUP_TYPE_MIXED_TRIGGERS:
case ControllerEmu::GROUP_TYPE_TRIGGERS:
case ControllerEmu::GROUP_TYPE_SLIDER:
case ControllerEmu::GroupType::MixedTriggers:
case ControllerEmu::GroupType::Triggers:
case ControllerEmu::GroupType::Slider:
{
int height = (int)(12 * group->controls.size());
int width = 64;
if (ControllerEmu::GROUP_TYPE_MIXED_TRIGGERS == group->type)
if (group->type == ControllerEmu::GroupType::MixedTriggers)
width = 64 + 12 + 1;
if (ControllerEmu::GROUP_TYPE_TRIGGERS != group->type)
if (group->type != ControllerEmu::GroupType::Triggers)
height /= 2;
height += 1;
@ -1127,7 +1127,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
Add(static_bitmap, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, space3);
}
break;
case ControllerEmu::GROUP_TYPE_EXTENSION:
case ControllerEmu::GroupType::Extension:
{
PadSettingExtension* const attachments =
new PadSettingExtension(parent, (ControllerEmu::Extension*)group);