OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
GraphicsFlowItemBuilder.h
Go to the documentation of this file.
1
5// ###########################################################################################################################################################################################################################################################################################################################
6
7#pragma once
8
9// OpenTwin header
14#include "OTGui/Margins.h"
15
16namespace ot {
17
18 class GraphicsGridLayoutItemCfg;
19
20 class Painter2D;
21
23 public:
40
44 GraphicsFlowItemConnector& operator = (const GraphicsFlowItemConnector& _other);
45
46 void setName(const std::string& _name) { m_name = _name; };
47 const std::string& name(void) const { return m_name; };
48
49 void setText(const std::string& _text) { m_text = _text; };
50 const std::string& text(void) const { return m_text; };
51
52 void setToolTip(const std::string& _toolTip) { m_toolTip = _toolTip; };
53 const std::string& toolTip(void) const { return m_toolTip; };
54
55 void setFont(const ot::Font& _font) { m_font = _font; };
56 const ot::Font& font(void) const { return m_font; };
57
58 void setTextColor(const ot::Color& _color) { m_textColor = _color; };
59 const ot::Color& textColor(void) const { return m_textColor; };
60
64 void setCustomPrimaryPainter(ot::Painter2D* _painter);
65 const ot::Painter2D* getCustomPrimaryPainter(void) const { return m_customPrimaryPainter; };
66
70 void setCustomSecondaryPainter(ot::Painter2D* _painter);
71 const ot::Painter2D* getCustomSecondaryPainter(void) const { return m_customSecondaryPainter; };
72
73 void setFigure(GraphicsFlowItemConnector::ConnectorFigure _figure) { m_figure = _figure; };
74 GraphicsFlowItemConnector::ConnectorFigure figure(void) const { return m_figure; };
75
76 void addToGrid(int _row, GraphicsGridLayoutItemCfg* _gridLayout, bool _isLeft);
77
78 private:
79 Painter2D* createPrimaryPainter(void) const;
80 Painter2D* createSecondaryPainter(void) const;
81
82 ot::GraphicsItemCfg* createConnectorItem(void);
83 ot::GraphicsItemCfg* createSquareItem(void);
84 ot::GraphicsItemCfg* createCircleItem(void);
86
87 std::string m_name;
88 std::string m_text;
89 std::string m_toolTip;
90 ConnectorFigure m_figure;
91 ot::Color m_textColor;
92 ot::Font m_font;
93 ot::Painter2D* m_customPrimaryPainter;
94 ot::Painter2D* m_customSecondaryPainter;
95 };
96
97 // ###########################################################################################################################################################################################################################################################################################################################
98
99 // ###########################################################################################################################################################################################################################################################################################################################
100
101 // ###########################################################################################################################################################################################################################################################################################################################
102
105 public:
110
113 ot::GraphicsItemCfg* createGraphicsItem(void) const;
114
116 virtual ~GraphicsFlowItemBuilder();
117
120 void setName(const std::string& _name) { m_name = _name; };
121
123 const std::string& name(void) const { return m_name; };
124
126 void setTitle(const std::string& _title) { m_title = _title; };
127
129 const std::string& title(void) const { return m_title; };
130
132 void setToolTip(const std::string& _toolTip) { m_toolTip = _toolTip; };
133
135 const std::string& toolTip(void) const { return m_toolTip; };
136
142 void addLeft(const std::string& _name, const std::string& _title, GraphicsFlowItemConnector::ConnectorFigure _figure);
143
149 void addLeft(const std::string& _name, const std::string& _title, GraphicsFlowItemConnector::ConnectorFigure _figure, ot::DefaultColor _color);
150
156 void addLeft(const std::string& _name, const std::string& _title, GraphicsFlowItemConnector::ConnectorFigure _figure, const ot::Color& _color);
157
160 void addLeft(const GraphicsFlowItemConnector& _left);
161
167 void addRight(const std::string& _name, const std::string& _title, GraphicsFlowItemConnector::ConnectorFigure _figure);
168
174 void addRight(const std::string& _name, const std::string& _title, GraphicsFlowItemConnector::ConnectorFigure _figure, ot::DefaultColor _color);
175
181 void addRight(const std::string& _name, const std::string& _title, GraphicsFlowItemConnector::ConnectorFigure _figure, const ot::Color& _color);
182
185 void addRight(const GraphicsFlowItemConnector& _right);
186
189 void setTitleBackgroundPainter(ot::Painter2D* _painter);
190
193 void setTitleBackgroundColor(const ot::Color& _color);
194
197 void setTitleBackgroundGradientColor(const ot::Color& _color);
198
201 inline void setTitleBackgroundColor(int _r, int _g, int _b, int _a = 255) { this->setTitleBackgroundColor(ot::Color(_r, _g, _b, _a)); };
202
205 void setTitleForegroundPainter(ot::Painter2D* _painter);
206
209 void setTitleForegroundColor(const ot::Color& _color);
210
214 void setDefaultTitleForegroundGradient(void);
215
219 void setDefaultConnectorStyle(const GraphicsFlowItemConnector& _config) { m_defaultConnectorStyle = _config; };
220 const GraphicsFlowItemConnector& defaultConnectorStyle(void) const { return m_defaultConnectorStyle; };
221
222 void setBackgroundImagePath(const std::string& _path) { m_backgroundImagePath = _path; };
223 void setBackgroundImageAlignment(ot::Alignment _align) { m_backgroundImageAlignment = _align; };
224 void setBackgroundImageMargins(const ot::MarginsD& _margins) { m_backgroundImageMargins = _margins; };
225 void setBackgroundImageInsertMode(BackgroundImageInsertMode _mode) { m_backgroundImageInsertMode = _mode; };
226 void setBackgroundImageMaintainAspectRatio(bool _active) { m_backgroundImageMaintainAspectRatio = _active; };
227
228 void setLeftTitleCornerImagePath(const std::string& _path) { m_leftTitleImagePath = _path; };
229
230 void setRightTitleCornerImagePath(const std::string& _path) { m_rightTitleImagePath = _path; };
231
232 private:
233 std::string m_name;
234 std::string m_title;
235 std::string m_toolTip;
236
237 ot::Painter2D* m_titleBackgroundPainter;
238 ot::Painter2D* m_titleForegroundPainter;
239
240 std::string m_leftTitleImagePath;
241 std::string m_rightTitleImagePath;
242
243 std::string m_backgroundImagePath;
244 ot::Alignment m_backgroundImageAlignment;
245 ot::MarginsD m_backgroundImageMargins;
246 BackgroundImageInsertMode m_backgroundImageInsertMode;
247 bool m_backgroundImageMaintainAspectRatio;
248
249 GraphicsFlowItemConnector m_defaultConnectorStyle;
250
251 std::list<GraphicsFlowItemConnector> m_left;
252 std::list<GraphicsFlowItemConnector> m_right;
253 };
254
255}
This file contains defines that may be used simplyfy class creation.
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
#define OT_GUI_API_EXPORTONLY
Definition OTGuiAPIExport.h:12
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
The Color class is used to represent RGBA colors with integer values.
Definition Color.h:72
Definition Font.h:20
Definition GraphicsFlowItemBuilder.h:103
void setName(const std::string &_name)
Sets the name for the root item The item name will be used as a prefix for the created child items (l...
Definition GraphicsFlowItemBuilder.h:120
const GraphicsFlowItemConnector & defaultConnectorStyle(void) const
Definition GraphicsFlowItemBuilder.h:220
BackgroundImageInsertMode
Definition GraphicsFlowItemBuilder.h:106
@ OnLayout
Definition GraphicsFlowItemBuilder.h:107
const std::string & title(void) const
Item title.
Definition GraphicsFlowItemBuilder.h:129
void setDefaultConnectorStyle(const GraphicsFlowItemConnector &_config)
Sets the default connector style The new default style will only affect items added after settings th...
Definition GraphicsFlowItemBuilder.h:219
void setTitleBackgroundColor(int _r, int _g, int _b, int _a=255)
Sets the title background color Will create a FillPainter2D and replace the current title background ...
Definition GraphicsFlowItemBuilder.h:201
const std::string & name(void) const
Item name.
Definition GraphicsFlowItemBuilder.h:123
void setBackgroundImageMaintainAspectRatio(bool _active)
Definition GraphicsFlowItemBuilder.h:226
void setBackgroundImageAlignment(ot::Alignment _align)
Definition GraphicsFlowItemBuilder.h:223
void setBackgroundImageMargins(const ot::MarginsD &_margins)
Definition GraphicsFlowItemBuilder.h:224
void setBackgroundImageInsertMode(BackgroundImageInsertMode _mode)
Definition GraphicsFlowItemBuilder.h:225
void setLeftTitleCornerImagePath(const std::string &_path)
Definition GraphicsFlowItemBuilder.h:228
const std::string & toolTip(void) const
Set the item tool tip.
Definition GraphicsFlowItemBuilder.h:135
void setRightTitleCornerImagePath(const std::string &_path)
Definition GraphicsFlowItemBuilder.h:230
void setBackgroundImagePath(const std::string &_path)
Definition GraphicsFlowItemBuilder.h:222
void setToolTip(const std::string &_toolTip)
Set the item tool tip.
Definition GraphicsFlowItemBuilder.h:132
void setTitle(const std::string &_title)
Sets the title that will be displayed to the user.
Definition GraphicsFlowItemBuilder.h:126
Definition GraphicsFlowItemBuilder.h:22
void setTextColor(const ot::Color &_color)
Definition GraphicsFlowItemBuilder.h:58
ConnectorFigure
Definition GraphicsFlowItemBuilder.h:24
@ TriangleDown
Definition GraphicsFlowItemBuilder.h:29
@ IceConeUp
Definition GraphicsFlowItemBuilder.h:36
@ IceConeRight
Definition GraphicsFlowItemBuilder.h:34
@ TriangleRight
Definition GraphicsFlowItemBuilder.h:26
@ IceConeLeft
Definition GraphicsFlowItemBuilder.h:35
@ KiteUp
Definition GraphicsFlowItemBuilder.h:32
@ TriangleLeft
Definition GraphicsFlowItemBuilder.h:27
@ KiteLeft
Definition GraphicsFlowItemBuilder.h:31
@ Square
Definition GraphicsFlowItemBuilder.h:25
@ TriangleUp
Definition GraphicsFlowItemBuilder.h:28
@ IceConeDown
Definition GraphicsFlowItemBuilder.h:37
@ KiteDown
Definition GraphicsFlowItemBuilder.h:33
@ KiteRight
Definition GraphicsFlowItemBuilder.h:30
const std::string & text(void) const
Definition GraphicsFlowItemBuilder.h:50
const std::string & name(void) const
Definition GraphicsFlowItemBuilder.h:47
const std::string & toolTip(void) const
Definition GraphicsFlowItemBuilder.h:53
const ot::Painter2D * getCustomPrimaryPainter(void) const
Definition GraphicsFlowItemBuilder.h:65
const ot::Font & font(void) const
Definition GraphicsFlowItemBuilder.h:56
void setText(const std::string &_text)
Definition GraphicsFlowItemBuilder.h:49
void setFigure(GraphicsFlowItemConnector::ConnectorFigure _figure)
Definition GraphicsFlowItemBuilder.h:73
GraphicsFlowItemConnector::ConnectorFigure figure(void) const
Definition GraphicsFlowItemBuilder.h:74
const ot::Painter2D * getCustomSecondaryPainter(void) const
Definition GraphicsFlowItemBuilder.h:71
void setToolTip(const std::string &_toolTip)
Definition GraphicsFlowItemBuilder.h:52
const ot::Color & textColor(void) const
Definition GraphicsFlowItemBuilder.h:59
void setFont(const ot::Font &_font)
Definition GraphicsFlowItemBuilder.h:55
void setName(const std::string &_name)
Definition GraphicsFlowItemBuilder.h:46
Definition GraphicsGridLayoutItemCfg.h:16
The GraphicsItemCfg is the base class for all graphics item configurations.
Definition GraphicsItemCfg.h:33
TriangleShape
Definition GraphicsTriangleItemCfg.h:30
TriangleDirection
Definition GraphicsTriangleItemCfg.h:23
Definition Margins.h:98
Definition Painter2D.h:17
Definition Connector.h:8
DefaultColor
Default colors.
Definition Color.h:18
Alignment
Alignment.
Definition GuiTypes.h:21