ControllerEmu/BooleanSetting: Add exclusive flag

This commit is contained in:
spycrab 2018-07-02 15:15:23 +02:00
parent 9cfcbfacbe
commit c7c93a8e80
2 changed files with 20 additions and 6 deletions

View File

@ -7,15 +7,16 @@
namespace ControllerEmu
{
BooleanSetting::BooleanSetting(const std::string& setting_name, const std::string& ui_name,
const bool default_value, const SettingType setting_type)
const bool default_value, const SettingType setting_type,
const bool exclusive)
: m_type(setting_type), m_name(setting_name), m_ui_name(ui_name),
m_default_value(default_value), m_value(default_value)
m_default_value(default_value), m_value(default_value), m_exclusive(exclusive)
{
}
BooleanSetting::BooleanSetting(const std::string& setting_name, const bool default_value,
const SettingType setting_type)
: BooleanSetting(setting_name, setting_name, default_value, setting_type)
const SettingType setting_type, const bool exclusive)
: BooleanSetting(setting_name, setting_name, default_value, setting_type, exclusive)
{
}
@ -23,6 +24,12 @@ bool BooleanSetting::GetValue() const
{
return m_value;
}
bool BooleanSetting::IsExclusive() const
{
return m_exclusive;
}
void BooleanSetting::SetValue(bool value)
{
m_value = value;

View File

@ -15,17 +15,24 @@ class BooleanSetting
{
public:
BooleanSetting(const std::string& setting_name, const std::string& ui_name,
const bool default_value, const SettingType setting_type = SettingType::NORMAL);
const bool default_value, const SettingType setting_type = SettingType::NORMAL,
const bool exclusive = false);
BooleanSetting(const std::string& setting_name, const bool default_value,
const SettingType setting_type = SettingType::NORMAL);
const SettingType setting_type = SettingType::NORMAL,
const bool exclusive = false);
bool GetValue() const;
void SetValue(bool value);
bool IsExclusive() const;
const SettingType m_type;
const std::string m_name;
const std::string m_ui_name;
const bool m_default_value;
bool m_value;
private:
const bool m_exclusive;
};
} // namespace ControllerEmu