CVB++ 15.0
ui.hpp
1#pragma once
2
3#ifdef _MSC_VER
4#pragma warning ( push, 1)
5#pragma warning ( disable : 4127)
6#pragma warning ( disable : 4005) // macro redefinition // TODO
7#endif
8
9#include <QtGlobal>
10#include <QVector2D>
11#include <QString>
12#include <QObject>
13#include <QSizeF>
14#include <QRectF>
15
16#ifdef _MSC_VER
17#pragma warning ( pop)
18#endif
19
20
21#include "_detail/detail_ui.hpp"
22
23
24#include "../global.hpp"
25#include "../string.hpp"
26#include "../image.hpp"
27#include "../rect_lt.hpp"
28
29
30
31namespace Cvb
32{
33
34CVB_BEGIN_INLINE_NS
35
37
49namespace UI
50{
51
52
53
54class ImageView;
55class ImageScene;
56class PropertyGrid;
57
59enum class RefreshMode
60{
79};
80
81
82
83
84
86
89enum class RenderEngine
90{
96 Raster,
102 OpenGL2,
108 OpenGL3
109};
110
111
112
113
114
115
116
119{
123 Unknown,
127 RGB,
131 Mono
132};
133
135
138{
142 int Width = 0;
143
147 int Height = 0;
148
152 int LinePad = 0;
153
158
159
160
162
168 bool operator==(const OpenGLBufferFormat & bufferFormat) const noexcept
169 {
170 return (Width == bufferFormat.Width
171 && Height == bufferFormat.Height
172 && LinePad == bufferFormat.LinePad
173 && TextureFormat == bufferFormat.TextureFormat);
174 }
175
176
178
184 bool operator!=(const OpenGLBufferFormat & bufferFormat) const noexcept
185 {
186 return !(*this == bufferFormat);
187 }
188};
189
190
191
193
196{
205};
206
208
211{
228};
229
230
231
233
238inline Cvb::String QtToCvb(const QString text) noexcept
239{
240#if defined _WIN32 && defined(UNICODE)
241 return text.toStdWString();
242#else
243 return text.toStdString();
244#endif
245}
246
248
253inline QString CvbToQt(const Cvb::String& text) noexcept
254{
255#if defined _WIN32 && defined(UNICODE)
256 return QString::fromStdWString(text);
257#else
258 return QString::fromStdString(text);
259#endif
260}
261
263
268inline QSizeF CvbToQt(Size2D<double> size) noexcept
269{
270 return QSizeF(size.Width(), size.Height());
271}
272
273
275
280inline Size2D<double> QtToCvb(QSizeF size) noexcept
281{
282 return Size2D<double>(size.width(), size.height());
283}
284
286
291inline QRectF CvbToQt(RectLT<double> rect) noexcept
292{
293 return QRectF(rect.Left(), rect.Top(), rect.Width(), rect.Height());
294}
295
297
302inline RectLT<double> QtToCvb(const QRectF & rect) noexcept
303{
304 return RectLT<double>(rect.left(), rect.top(), rect.right(), rect.bottom());
305}
306
307
309
314inline QPointF CvbToQt(Point2D<double> point) noexcept
315{
316 return QPointF(point.X(), point.Y());
317}
318
320
325inline Point2D<double> QtToCvb(const QPointF & point)
326{
327 return Point2D<double>(point.x(), point.y());
328}
329
330
331
332
333
334
335}
336
337
338
339CVB_END_INLINE_NS
340
341
342
343}
344
T Height() const noexcept
Gets the vertical component of the size.
Definition: size_2d.hpp:79
T Width() const noexcept
Gets the horizontal component of the size.
Definition: size_2d.hpp:59
Cvb::String QtToCvb(const QString text) noexcept
Convenience converter for strings.
Definition: ui.hpp:238
RefreshMode
Defines the refresh behavior.
Definition: ui.hpp:60
OpenGLTextureFormat
OpenGL texture format to hold the pixel data.
Definition: ui.hpp:119
RenderEngine
Defines the render engine used for drawing.
Definition: ui.hpp:90
QString CvbToQt(const Cvb::String &text) noexcept
Convenience converter for strings.
Definition: ui.hpp:253
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24
qreal x() const const
qreal y() const const
QString fromStdString(const std::string &str)
QString fromStdWString(const std::wstring &str)
Buffer format description for a texture to hold the pixel data.
Definition: ui.hpp:138
OpenGLTextureFormat TextureFormat
Definition: ui.hpp:157
int LinePad
Definition: ui.hpp:152
bool operator!=(const OpenGLBufferFormat &bufferFormat) const noexcept
Definition: ui.hpp:184
int Height
Definition: ui.hpp:147
int Width
Definition: ui.hpp:142
bool operator==(const OpenGLBufferFormat &bufferFormat) const noexcept
Definition: ui.hpp:168
Set of all coordinates required to render a texture.
Definition: ui.hpp:211
OpenGLCoord BottomRight
Definition: ui.hpp:223
OpenGLCoord TopRight
Definition: ui.hpp:227
OpenGLCoord TopLeft
Definition: ui.hpp:215
OpenGLCoord BottomLeft
Definition: ui.hpp:219
OpenGL coordinate representing a texture corner.
Definition: ui.hpp:196
QVector2D VerPoint
Definition: ui.hpp:200
QVector2D TexPoint
Definition: ui.hpp:204