OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
CheckBoxCfg.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
10
11namespace ot {
12
14 public:
20 static std::string toString(CheckBoxState _state);
21 static CheckBoxState stringToCheckBoxState(const std::string& _state);
22
24 CheckBoxCfg(const std::string& _name, const std::string& _text, CheckBoxState _checkedState = CheckBoxState::Checked);
25 CheckBoxCfg(const CheckBoxCfg&) = default;
27 virtual ~CheckBoxCfg();
28
29 CheckBoxCfg& operator = (const CheckBoxCfg&) = default;
30 CheckBoxCfg& operator = (CheckBoxCfg&&) = default;
31
32 static std::string getCheckBoxCfgTypeString(void) { return "CheckBoxCfg"; };
33 virtual std::string getWidgetBaseTypeString(void) const override { return CheckBoxCfg::getCheckBoxCfgTypeString(); };
34
35 virtual void addToJsonObject(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
36 virtual void setFromJsonObject(const ot::ConstJsonObject& _object) override;
37
38 void setText(const std::string& _text) { m_text = _text; };
39 const std::string& getText(void) const { return m_text; };
40
41 void setChecked(bool _checked) { m_state = (_checked ? CheckBoxState::Checked : CheckBoxState::Unchecked); };
42 void setCheckedState(CheckBoxState _state) { m_state = _state; };
43 bool getChecked(void) const { return m_state == CheckBoxState::Checked; };
44 CheckBoxState getCheckedState(void) const { return m_state; };
45
46 private:
47 std::string m_text;
48 CheckBoxState m_state;
49 };
50
51}
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
Definition CheckBoxCfg.h:13
const std::string & getText(void) const
Definition CheckBoxCfg.h:39
void setChecked(bool _checked)
Definition CheckBoxCfg.h:41
virtual std::string getWidgetBaseTypeString(void) const override
Definition CheckBoxCfg.h:33
static std::string getCheckBoxCfgTypeString(void)
Definition CheckBoxCfg.h:32
CheckBoxCfg(CheckBoxCfg &&)=default
CheckBoxState
Definition CheckBoxCfg.h:15
@ Unchecked
Definition CheckBoxCfg.h:16
@ PartiallyChecked
Definition CheckBoxCfg.h:17
bool getChecked(void) const
Definition CheckBoxCfg.h:43
void setText(const std::string &_text)
Definition CheckBoxCfg.h:38
void setCheckedState(CheckBoxState _state)
Definition CheckBoxCfg.h:42
CheckBoxCfg(const CheckBoxCfg &)=default
CheckBoxState getCheckedState(void) const
Definition CheckBoxCfg.h:44
Definition WidgetBaseCfg.h:19
Definition Connector.h:8
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35
OT_GUI_API_EXPORT std::string toString(ColorStyleName _colorStyleName)
Definition ColorStyleTypes.cpp:10
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30