25#pragma warning(disable:4251)
27#define OT_JSON_MEMBER_GraphicsItemCfgType "GIType"
39 ItemIsMoveable = 0x0001,
40 ItemIsSelectable = 0x0002,
41 ItemIsConnectable = 0x0004,
43 ItemSnapsToGridTopLeft = 0x0010,
44 ItemSnapsToGridCenter = 0x0020,
48 ItemForwardsTooltip = 0x0100,
52 ItemUserTransformEnabled = 0x0200,
57 ItemIgnoresParentTransform = 0x0400,
63 ItemHandlesState = 0x1000,
67 ItemForwardsState = 0x2000
96 virtual void setFromJsonObject(
const ConstJsonObject& _object)
override;
103 void setName(
const std::string& _name) { m_name = _name; };
106 const std::string&
getName(
void)
const {
return m_name; };
110 void setTitle(
const std::string& _title) { m_title = _title; };
114 const std::string&
getTitle(
void)
const {
return m_title; };
118 void setToolTip(
const std::string& _toolTip) { m_tooltip = _toolTip; };
122 const std::string&
getToolTip(
void)
const {
return m_tooltip; };
188 void setFixedSize(
const Size2DD& _size);
246 void addStringMapEntry(
const std::string& _key,
const std::string& _value) { m_stringMap.insert_or_assign(_key, _value); };
250 void setStringMap(
const std::map<std::string, std::string>& _map) { m_stringMap = _map; };
255 const std::map<std::string, std::string>&
getStringMap(
void)
const {
return m_stringMap; };
260 std::string getStringForKey(
const std::string& _key)
const;
281 std::string m_tooltip;
283 MarginsD m_additionalTriggerDistance;
289 GraphicsItemFlags m_flags;
296 std::map<std::string, std::string> m_stringMap;
#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
The Flags class is a wrapper around a enum that allows bitwise operations (flags)....
Definition Flags.h:214
The GraphicsItemCfg is the base class for all graphics item configurations.
Definition GraphicsItemCfg.h:33
const ot::UID & getUid(void) const
Item UID. The item UID is used to uniquely identify an item in a GraphicsScene. The must never exist ...
Definition GraphicsItemCfg.h:223
void setName(const std::string &_name)
Set item name.
Definition GraphicsItemCfg.h:103
void setMaximumSize(double _width, double _height)
Sets the item maximum size.
Definition GraphicsItemCfg.h:170
virtual std::string getFactoryKey(void) const =0
Returns the unique GraphicsItemCfg type name that is used in the GraphicsItemCfgFactory.
void setAdditionalTriggerDistance(const MarginsD &_d)
Sets the additional trigger distance. The additional trigger distance will expand/shrink the imaginar...
Definition GraphicsItemCfg.h:151
virtual GraphicsItemCfg * createCopy(void) const =0
Creates a copy of this item.
void setStringMap(const std::map< std::string, std::string > &_map)
Sets the string map.
Definition GraphicsItemCfg.h:250
void setUid(const UID &_uid)
Set item UID.
Definition GraphicsItemCfg.h:218
const Point2DD & getPosition(void) const
Item position If the item is the root item, the position is the scene position. If the item is a chil...
Definition GraphicsItemCfg.h:140
SizePolicy getSizePolicy(void) const
Current item size policy. The item size policy is used for nested items.
Definition GraphicsItemCfg.h:232
const std::string & getTitle(void) const
Item title The item title will be displayed to the user when needed.
Definition GraphicsItemCfg.h:114
const Transform & getTransform(void) const
Get the item transform.
Definition GraphicsItemCfg.h:266
void setMargins(double _left, double _top, double _right, double _bottom)
Set item margins.
Definition GraphicsItemCfg.h:195
const Size2DD & getMinimumSize(void) const
Item minimum size. If the graphics item is resized (e.g. via layout) then it may not shrink below the...
Definition GraphicsItemCfg.h:166
void setSizePolicy(SizePolicy _policy)
Set item size policy.
Definition GraphicsItemCfg.h:227
ConnectionDirection getConnectionDirection(void) const
Current item connection direction. This has only an effect if GraphicsItemFlag::ItemIsConnectable is ...
Definition GraphicsItemCfg.h:241
const MarginsD & getMargins(void) const
Item margins.
Definition GraphicsItemCfg.h:202
void setFixedSize(double _width, double _height)
Sets the items minimum and maximum size.
Definition GraphicsItemCfg.h:183
void setTransform(const Transform &_transform)
Set the item transform.
Definition GraphicsItemCfg.h:263
const GraphicsItemFlags & getGraphicsItemFlags(void) const
Definition GraphicsItemCfg.h:206
Alignment getAlignment(void) const
Current item alignment. The alignment only has an effect if the item is nested.
Definition GraphicsItemCfg.h:214
const std::string & getToolTip(void) const
ToolTip that will be displayed to the user when he hovers over the item. If the root item in a graphi...
Definition GraphicsItemCfg.h:122
void setGraphicsItemFlag(GraphicsItemFlag _flag, bool _active=true)
Definition GraphicsItemCfg.h:204
void setAlignment(Alignment _align)
Set the item alignment.
Definition GraphicsItemCfg.h:210
Flags< GraphicsItemFlag > GraphicsItemFlags
Definition GraphicsItemCfg.h:69
void setConnectionDirection(ConnectionDirection _direction)
Set the item connection direction.
Definition GraphicsItemCfg.h:236
const std::string & getName(void) const
Item name.
Definition GraphicsItemCfg.h:106
void setTitle(const std::string &_title)
Set item title The item title will be displayed to the user when needed.
Definition GraphicsItemCfg.h:110
void setPosition(const Point2DD &_pos)
Set item position If the item is the root item, the position is the scene position....
Definition GraphicsItemCfg.h:135
void setMargins(const MarginsD &_margins)
Set item margins.
Definition GraphicsItemCfg.h:199
GraphicsItemFlag
GraphicsItemFlag.
Definition GraphicsItemCfg.h:37
const std::map< std::string, std::string > & getStringMap(void) const
The string map may be used to reference a value via a key in a complex graphics item....
Definition GraphicsItemCfg.h:255
void setAdditionalTriggerDistance(double _d)
Definition GraphicsItemCfg.h:144
void setToolTip(const std::string &_toolTip)
Set ToolTip.
Definition GraphicsItemCfg.h:118
void setGraphicsItemFlags(const GraphicsItemFlags &_flags)
Definition GraphicsItemCfg.h:205
void setMaximumSize(const Size2DD &_size)
Sets the item maximum size.
Definition GraphicsItemCfg.h:174
void setMinimumSize(const Size2DD &_size)
Sets the item minimum size.
Definition GraphicsItemCfg.h:162
const MarginsD & getAdditionalTriggerDistance(void) const
Definition GraphicsItemCfg.h:154
void addStringMapEntry(const std::string &_key, const std::string &_value)
Adds the provided entry to the string map. If an entry for the same key already exists it will be rep...
Definition GraphicsItemCfg.h:246
void setMinimumSize(double _width, double _height)
Sets the item minimum size.
Definition GraphicsItemCfg.h:158
const Size2DD & getMaximumSize(void) const
Item maximum size. If the graphics item is resized (e.g. via layout) then it may not brow above the m...
Definition GraphicsItemCfg.h:178
void setPosition(double _x, double _y)
Set item position If the item is the root item, the position is the scene position....
Definition GraphicsItemCfg.h:129
void setAdditionalTriggerDistance(double _left, double _top, double _right, double _bottom)
Definition GraphicsItemCfg.h:147
2D Point with double values
Definition Point2D.h:144
The Serializable class is the default interface of serializable objects.
Definition Serializable.h:17
2D Size with double values
Definition Size2D.h:115
SizePolicy
Size policy for UI elements.
Definition GuiTypes.h:58
ConnectionDirection
Describes in which direction a connetion from an item is starting.
Definition GuiTypes.h:65
unsigned long UID
Unique identifier (32 bit unsigned integer)
Definition CoreTypes.h:27
Alignment
Alignment.
Definition GuiTypes.h:21
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