OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
WidgetViewBase.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTCore/Flags.h"
13
14// std header
15#include <list>
16#include <string>
17
18#pragma warning(disable:4251)
19
20namespace ot {
21
27 public:
29 enum ViewFlag {
30 NoViewFlags = 0x00,
31 ViewIsCloseable = 0x01,
32 ViewDefaultCloseHandling = 0x02,
33 ViewIsPinnable = 0x04,
34 ViewIsCentral = 0x10,
35 ViewIsSide = 0x20,
36 ViewIsTool = 0x40
37 };
39
48
61
64 static std::string toString(ViewFlag _flag);
65
68 static ViewFlag stringToViewFlag(const std::string& _flag);
69
72 static std::list<std::string> toStringList(ViewFlags _flags);
73
76 static ViewFlags stringListToViewFlags(const std::list<std::string>& _flags);
77
80 static std::string toString(ViewDockLocation _dockLocation);
81
84 static ViewDockLocation stringToDockLocation(const std::string& _dockLocation);
85
87 static std::string toString(ViewType _type);
88
90 static ViewType stringToViewType(const std::string& _type);
91
92 // ###########################################################################################################################################################################################################################################################################################################################
93
94 WidgetViewBase(ViewType _type, ViewFlags _flags = ViewFlags());
95 WidgetViewBase(const std::string& _entityName, const std::string& _title, ViewType _type, ViewFlags _flags = ViewFlags());
96 WidgetViewBase(const std::string& _entityName, const std::string& _title, ViewDockLocation _dockLocation, ViewType _type, ViewFlags _flags = ViewFlags());
97 WidgetViewBase(const WidgetViewBase& _other);
98 virtual ~WidgetViewBase();
99
100 WidgetViewBase& operator = (const WidgetViewBase& _other);
101
102 // ###########################################################################################################################################################################################################################################################################################################################
103
104 // Base class functions
105
109 virtual void addToJsonObject(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
110
114 virtual void setFromJsonObject(const ot::ConstJsonObject& _object) override;
115
116 // ###########################################################################################################################################################################################################################################################################################################################
117
118 // Setter/Getter
119
120 void setTitle(const std::string& _title) { m_title = _title; };
121 const std::string& getTitle(void) const { return m_title; };
122
126 void setViewFlag(ViewFlag _flag, bool _active = true) { m_flags.setFlag(_flag, _active); };
127
129 void setViewFlags(ViewFlags _flags) { m_flags = _flags; };
130
132 ViewFlags getViewFlags(void) const { return m_flags; };
133
134 void setViewType(ViewType _type) { m_type = _type; };
135 ViewType getViewType(void) const { return m_type; };
136
139 void setDockLocation(ViewDockLocation _dockLocation) { m_dockLocation = _dockLocation; };
140
142 ViewDockLocation getDockLocation(void) const { return m_dockLocation; };
143
144 void setEntityInformation(const BasicEntityInformation& _info);
145
146 private:
147 std::string m_title;
148
149 ViewFlags m_flags;
150 ViewType m_type;
151 ViewDockLocation m_dockLocation;
152 };
153
154}
155
#define OT_ADD_FLAG_FUNCTIONS(___enumName)
Will add the default bitwise operations for the provided private 32/64 bit bitfield....
Definition Flags.h:129
This file contains defines that may be used simplyfy class creation.
#define OT_DECL_NODEFAULT(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:22
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
Definition BasicEntityInformation.h:19
The Flags class is a wrapper around a enum that allows bitwise operations (flags)....
Definition Flags.h:214
General widget view information class. The WidgetViewBase holds the general information of a WidgetVi...
Definition WidgetViewBase.h:25
void setViewFlags(ViewFlags _flags)
Replace the current flags with the flags provided.
Definition WidgetViewBase.h:129
ViewType
Definition WidgetViewBase.h:49
@ ViewGraphics
Version graph view.
Definition WidgetViewBase.h:55
@ ViewTable
Text editor view.
Definition WidgetViewBase.h:53
@ ViewVersion
Table view.
Definition WidgetViewBase.h:54
@ ViewText
1D plot view.
Definition WidgetViewBase.h:52
@ View3D
Definition WidgetViewBase.h:50
@ ViewProperties
Graphics picker view.
Definition WidgetViewBase.h:57
@ ViewGraphicsPicker
Graphics view.
Definition WidgetViewBase.h:56
@ View1D
3D view.
Definition WidgetViewBase.h:51
@ ViewNavigation
Properties view.
Definition WidgetViewBase.h:58
ViewFlags getViewFlags(void) const
Returns the current flags.
Definition WidgetViewBase.h:132
ViewFlag
ViewFlags are used to describe the view behaviour in the frontend.
Definition WidgetViewBase.h:29
const std::string & getTitle(void) const
Definition WidgetViewBase.h:121
ViewDockLocation getDockLocation(void) const
Returns the dock location.
Definition WidgetViewBase.h:142
ViewDockLocation
/ref ViewFlag "ViewFlag"
Definition WidgetViewBase.h:41
@ Left
Default (Central) dock location.
Definition WidgetViewBase.h:43
@ Right
Top dock location.
Definition WidgetViewBase.h:45
@ Top
Left dock location.
Definition WidgetViewBase.h:44
@ Default
Definition WidgetViewBase.h:42
Flags< ViewFlag > ViewFlags
Definition WidgetViewBase.h:38
void setTitle(const std::string &_title)
Definition WidgetViewBase.h:120
ViewType getViewType(void) const
Definition WidgetViewBase.h:135
void setDockLocation(ViewDockLocation _dockLocation)
Set the dock location.
Definition WidgetViewBase.h:139
void setViewFlag(ViewFlag _flag, bool _active=true)
Set the widget view flag.
Definition WidgetViewBase.h:126
void setViewType(ViewType _type)
Definition WidgetViewBase.h:134
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