OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ToolButtonCfg.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTGui/MenuCfg.h"
10#include "OTGui/WidgetBaseCfg.h"
11
12namespace ot {
13
15 public:
17 ToolButtonCfg(const std::string& _name, const std::string& _text, const std::string& _relativeIconPath = std::string(), const MenuCfg& _menu = MenuCfg());
18 ToolButtonCfg(const ToolButtonCfg&) = default;
20 virtual ~ToolButtonCfg();
21
22 ToolButtonCfg& operator = (const ToolButtonCfg&) = default;
23 ToolButtonCfg& operator = (ToolButtonCfg&&) = default;
24
25 static std::string getToolButtonCfgTypeString(void) { return "ToolButtonCfg"; };
26 virtual std::string getWidgetBaseTypeString(void) const override { return ToolButtonCfg::getToolButtonCfgTypeString(); };
27
28 virtual void addToJsonObject(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
29 virtual void setFromJsonObject(const ot::ConstJsonObject& _object) override;
30
31 void setText(const std::string& _text) { m_text = _text; };
32 const std::string& getText(void) const { return m_text; };
33
34 void setIconPath(const std::string& _relativeIconPath) { m_iconPath = _relativeIconPath; };
35 const std::string& getIconPath(void) const { return m_iconPath; };
36
37 private:
38 std::string m_text;
39 std::string m_iconPath;
40 MenuCfg m_menu;
41 };
42
43}
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
Definition MenuCfg.h:17
Definition ToolButtonCfg.h:14
static std::string getToolButtonCfgTypeString(void)
Definition ToolButtonCfg.h:25
ToolButtonCfg(ToolButtonCfg &&)=default
ToolButtonCfg(const ToolButtonCfg &)=default
const std::string & getIconPath(void) const
Definition ToolButtonCfg.h:35
virtual std::string getWidgetBaseTypeString(void) const override
Definition ToolButtonCfg.h:26
void setIconPath(const std::string &_relativeIconPath)
Definition ToolButtonCfg.h:34
const std::string & getText(void) const
Definition ToolButtonCfg.h:32
void setText(const std::string &_text)
Definition ToolButtonCfg.h:31
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
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30