OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
MessageDialogCfg.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTCore/Flags.h"
10#include "OTGui/DialogCfg.h"
11
12// std header
13#include <string>
14
15namespace ot {
16
18 public:
20 NoButtons = 0 << 0,
21 Ok = 1 << 0,
22 Save = 1 << 1,
23 SaveAll = 1 << 2,
24 Open = 1 << 3,
25 Yes = 1 << 4,
26 YesToAll = 1 << 5,
27 No = 1 << 6,
28 NoToAll = 1 << 7,
29 Abort = 1 << 8,
30 Retry = 1 << 9,
31 Ignore = 1 << 10,
32 Close = 1 << 11,
33 Cancel = 1 << 12,
34 Discard = 1 << 13,
35 Help = 1 << 14,
36 Apply = 1 << 15,
37 Reset = 1 << 16,
38 RestoreDefaults = 1 << 17
39 };
41
49
50 static std::string toString(BasicButton _button);
51 static BasicButton stringToButton(const std::string& _button);
52 static std::list<std::string> toStringList(const BasicButtons& _buttons);
53 static BasicButtons stringListToButtons(const std::list<std::string>& _buttons);
54
55 static std::string iconToString(BasicIcon _icon);
56 static BasicIcon stringToIcon(const std::string& _icon);
57
59 virtual ~MessageDialogCfg();
60
64 virtual void addToJsonObject(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
65
69 virtual void setFromJsonObject(const ot::ConstJsonObject& _object) override;
70
71 void setText(const std::string& _text) { m_text = _text; };
72 const std::string& getText(void) const { return m_text; };
73
74 void setButton(BasicButton _button, bool _active = true) { m_buttons.setFlag(_button, _active); };
75 void setButtons(BasicButtons _buttons) { m_buttons = _buttons; };
76 const BasicButtons& getButtons(void) const { return m_buttons; };
77
78 void setIcon(BasicIcon _icon) { m_icon = _icon; };
79 BasicIcon getIcon(void) const { return m_icon; };
80
81 private:
82 std::string m_text;
83 BasicButtons m_buttons;
84 BasicIcon m_icon;
85 };
86
87}
88
#define OT_ADD_FLAG_FUNCTIONS(___enumName)
Will add the default bitwise operations for the provided private 32/64 bit bitfield....
Definition Flags.h:129
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
Definition DialogCfg.h:22
The Flags class is a wrapper around a enum that allows bitwise operations (flags)....
Definition Flags.h:214
Definition MessageDialogCfg.h:17
void setText(const std::string &_text)
Definition MessageDialogCfg.h:71
void setIcon(BasicIcon _icon)
Definition MessageDialogCfg.h:78
Flags< BasicButton > BasicButtons
Definition MessageDialogCfg.h:40
BasicIcon getIcon(void) const
Definition MessageDialogCfg.h:79
void setButton(BasicButton _button, bool _active=true)
Definition MessageDialogCfg.h:74
const BasicButtons & getButtons(void) const
Definition MessageDialogCfg.h:76
BasicButton
Definition MessageDialogCfg.h:19
const std::string & getText(void) const
Definition MessageDialogCfg.h:72
void setButtons(BasicButtons _buttons)
Definition MessageDialogCfg.h:75
BasicIcon
Definition MessageDialogCfg.h:42
@ Warning
Definition MessageDialogCfg.h:46
@ NoIcon
Definition MessageDialogCfg.h:43
@ Question
Definition MessageDialogCfg.h:45
@ Information
Definition MessageDialogCfg.h:44
Definition Connector.h:8
OT_GUI_API_EXPORT std::list< std::string > toStringList(const LockTypeFlags &_flags)
Definition GuiTypes.cpp:426
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