1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-16 07:10:08 +00:00
OpenMW/apps/opencs/model/prefs/enumsetting.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
1.5 KiB
C++
Raw Normal View History

2015-12-10 16:33:14 +00:00
#ifndef CSM_PREFS_ENUMSETTING_H
#define CSM_PREFS_ENUMSETTING_H
2022-10-19 17:02:00 +00:00
#include <string>
#include <utility>
2015-12-10 16:33:14 +00:00
#include <vector>
#include "setting.hpp"
class QComboBox;
2015-12-10 16:33:14 +00:00
namespace CSMPrefs
{
2022-10-19 17:02:00 +00:00
class Category;
2015-12-10 16:33:14 +00:00
struct EnumValue
{
std::string mValue;
std::string mTooltip;
EnumValue(const std::string& value, const std::string& tooltip = "");
EnumValue(const char* value);
};
struct EnumValues
{
std::vector<EnumValue> mValues;
EnumValues& add(const EnumValues& values);
EnumValues& add(const EnumValue& value);
EnumValues& add(const std::string& value, const std::string& tooltip);
};
class EnumSetting : public Setting
{
Q_OBJECT
std::string mTooltip;
EnumValue mDefault;
EnumValues mValues;
QComboBox* mWidget;
2015-12-10 16:33:14 +00:00
2022-09-22 18:26:05 +00:00
public:
2015-12-15 11:19:48 +00:00
EnumSetting(Category* parent, QMutex* mutex, const std::string& key, const std::string& label,
const EnumValue& default_);
2015-12-10 16:33:14 +00:00
EnumSetting& setTooltip(const std::string& tooltip);
EnumSetting& addValues(const EnumValues& values);
EnumSetting& addValue(const EnumValue& value);
EnumSetting& addValue(const std::string& value, const std::string& tooltip);
/// Return label, input widget.
std::pair<QWidget*, QWidget*> makeWidgets(QWidget* parent) override;
2015-12-10 16:33:14 +00:00
void updateWidget() override;
2015-12-10 16:33:14 +00:00
private slots:
void valueChanged(int value);
};
}
#endif