Photon microGUI widgets library 0.6.0
Gauge.h
1#ifndef PHWIDGETS_GAUGE_H
2#define PHWIDGETS_GAUGE_H
3
4#include <photon/PtGauge.h>
5
6#include "./Basic.h"
7#include "./Drawing/Font.h"
8
9
10namespace PhWidgets
11{
18
22 class Gauge:
23 public Basic
24 {
25 public:
26
28 struct ThisArgs
29 {
31 struct ArgLong
32 {
34
44 {
45 gauge_value = Pt_ARG_GAUGE_VALUE,
46 maximum = Pt_ARG_MAXIMUM,
47 minimum = Pt_ARG_MINIMUM
48 };
49 };
50
52 struct ArgShort
53 {
55
65 {
66 gauge_flags = Pt_ARG_GAUGE_FLAGS
67 };
68 };
69
71 struct ArgChar
72 {
74
84 {
85 gauge_orientation = Pt_ARG_GAUGE_ORIENTATION
86 };
87 };
88
91 {
93
103 {
104 gauge_horizontal_align = Pt_ARG_GAUGE_H_ALIGN,
105 gauge_vertical_align = Pt_ARG_GAUGE_V_ALIGN
106 };
107 };
108
110 struct ArgPChar
111 {
113
123 {
124 value_prefix = Pt_ARG_GAUGE_VALUE_PREFIX,
125 value_suffix = Pt_ARG_GAUGE_VALUE_SUFFIX,
126 gauge_font = Pt_ARG_GAUGE_FONT
127 };
128 };
129
130 };
131
134 {
136 struct Gauge
137 {
139
147 {
148
149#ifndef Pt_SHOW_VALUE
150 #define Pt_SHOW_VALUE_IMPL Pt_GAUGE_SHOW_VALUE
151#else
152 #define Pt_SHOW_VALUE_IMPL Pt_SHOW_VALUE
153#endif
154
155#ifndef Pt_VALUE_XOR
156 #define Pt_VALUE_XOR_IMPL Pt_GAUGE_VALUE_XOR
157#else
158 #define Pt_VALUE_XOR_IMPL Pt_VALUE_XOR
159#endif
160
161#ifndef Pt_GAUGE_MAX_ON_RIGHT
162 #define Pt_GAUGE_MAX_ON_RIGHT_IMPL 0
163#else
164 #define Pt_GAUGE_MAX_ON_RIGHT_IMPL Pt_GAUGE_MAX_ON_RIGHT
165#endif
166
167#ifndef Pt_GAUGE_MAX_ON_BOTTOM
168 #define Pt_GAUGE_MAX_ON_BOTTOM_IMPL 0
169#else
170 #define Pt_GAUGE_MAX_ON_BOTTOM_IMPL Pt_GAUGE_MAX_ON_BOTTOM
171#endif
172
173#ifndef Pt_GAUGE_INDETERMINATE
174 #define Pt_GAUGE_INDETERMINATE_IMPL 0
175#else
176 #define Pt_GAUGE_INDETERMINATE_IMPL Pt_GAUGE_INDETERMINATE
177#endif
178
179#ifndef Pt_GAUGE_INTERACTIVE
180 #define Pt_GAUGE_INTERACTIVE_IMPL 0
181#else
182 #define Pt_GAUGE_INTERACTIVE_IMPL Pt_GAUGE_INTERACTIVE
183#endif
184
185 ShowValue = Pt_SHOW_VALUE_IMPL,
186 ValueXOR = Pt_VALUE_XOR_IMPL,
187 MaximumOnTop = Pt_GAUGE_MAX_ON_TOP,
188 MaximumOnRight = Pt_GAUGE_MAX_ON_RIGHT_IMPL,
189 MaximumOnLeft = Pt_GAUGE_MAX_ON_LEFT,
190 MaximumOnBottom = Pt_GAUGE_MAX_ON_BOTTOM_IMPL,
191 Indeterminate = Pt_GAUGE_INDETERMINATE_IMPL,
192 Interactive = Pt_GAUGE_INTERACTIVE_IMPL
193
194#undef Pt_SHOW_VALUE_IMPL
195#undef Pt_VALUE_XOR_IMPL
196#undef Pt_GAUGE_MAX_ON_RIGHT_IMPL
197#undef Pt_GAUGE_MAX_ON_BOTTOM_IMPL
198#undef Pt_GAUGE_INDETERMINATE_IMPL
199#undef Pt_GAUGE_INTERACTIVE_IMPL
200 };
201 };
202
205 {
207
215 {
216 Horizontal = Pt_HORIZONTAL,
217 Vertical = Pt_VERTICAL
218 };
219 };
220
223 {
226 {
228
236 {
237 Left = Pt_LEFT,
238 Right = Pt_RIGHT,
239 Center = Pt_CENTER
240 };
241 };
242
244 struct Vertical
245 {
247
255 {
256 Top = Pt_TOP,
257 Bottom = Pt_BOTTOM,
258 Center = Pt_CENTER
259 };
260 };
261 };
262 };
263
265 struct ArgLong:
266 public ArgumentsEx<Basic::ArgLong>,
267 public ThisArgs::ArgLong
268 {
270 };
271
273 struct ArgShort:
274 public ThisArgs::ArgShort
275 { };
276
278 struct ArgChar:
279 public ArgumentsEx<Basic::ArgChar>,
280 public ThisArgs::ArgChar
281 {
283 };
284
287 public ArgumentsEx<Basic::ArgUnsignedChar>,
289 {
291 };
292
294 struct ArgPChar:
295 public ArgumentsEx<Basic::ArgPChar>,
296 public ThisArgs::ArgPChar
297 {
299 };
300
302 struct Arguments:
303 public ArgLong,
304 public ArgShort,
305 public ArgChar,
306 public ArgUnsignedChar,
307 public ArgPChar,
308 public Basic::Arguments
309 { };
310
312 struct Flags:
313 public ThisFlags,
314 public Basic::Flags
315 { };
316
317 protected:
318 typedef ResourceFrom<Basic::WidgetResourcesSingleton>::
319 Define::String<ThisArgs::ArgPChar::eArgPChar>::
320 Define::Scalar<ThisArgs::ArgLong::eArgLong, long>::
321 Define::Flag<ThisArgs::ArgShort::eArgShort, short int>::
322 Define::Scalar<ThisArgs::ArgChar::eArgChar, char>::
323 Define::Scalar<ThisArgs::ArgUnsignedChar::eArgUnsignedChar, unsigned char>::
324
325 resource_type WidgetResourcesSingleton;
326
327 Drawing::Font getFont() const;
328 void setFont(Drawing::Font);
329
330 std::string getPrefix() const;
331 void setPrefix(std::string text);
332
333 std::string getSuffix() const;
334 void setSuffix(std::string text);
335
336 virtual void check();
337
338
339 public:
341
345 WidgetResourcesSingleton resource;
346
348
352 explicit Gauge(int abn);
353
355
359 explicit Gauge(PtWidget_t *wdg);
360
362
366 Gauge(const Gauge &other);
367
369
373 Gauge &operator=(const Gauge &other);
374
377
378
380
399 property<Drawing::Font>::bind<Gauge, &Gauge::getFont, &Gauge::setFont> Font;
400
402
409 property<std::string>::bind<Gauge, &Gauge::getPrefix, &Gauge::setPrefix> Prefix;
410
412
419 property<std::string>::bind<Gauge, &Gauge::getSuffix, &Gauge::setSuffix> Suffix;
420
422
430
432
440
442
450
451
453 phbitmask<short int, Flags::Gauge::eGaugeFlags>::bind<Gauge, ArgShort::eArgShort, ArgShort::gauge_flags> GaugeFlags;
454
455
457 };
458} // namespace PhWidgets
459
460
461#endif // PHWIDGETS_GAUGE_H
A superclass of basic resources for most widgets.
Definition: Basic.h:41
Defines a particular format for text, including font face, size, and style attributes....
Definition: Font.h:232
Common class for gauge-type widgets.
Definition: Gauge.h:24
phproperty< long >::bind< Gauge, ArgLong::eArgLong, Arguments::minimum > Minimum
Gets or sets the minimum value of the range of the gauge.
Definition: Gauge.h:449
phbitmask< short int, Flags::Gauge::eGaugeFlags >::bind< Gauge, ArgShort::eArgShort, ArgShort::gauge_flags > GaugeFlags
Gets or sets gauge flags inherited by all gauge-like widgets. See Flags::Gauge::eGaugeFlags.
Definition: Gauge.h:453
property< Drawing::Font >::bind< Gauge, &Gauge::getFont, &Gauge::setFont > Font
Gets or sets the font of the value, title, and any other text in the Gauge.
Definition: Gauge.h:399
Gauge(int abn)
(constructor)
WidgetResourcesSingleton resource
Resources of the Gauge.
Definition: Gauge.h:345
phproperty< long >::bind< Gauge, ArgLong::eArgLong, Arguments::gauge_value > Value
Gets or sets the the gauge's current value.
Definition: Gauge.h:429
Gauge(PtWidget_t *wdg)
(constructor)
phproperty< long >::bind< Gauge, ArgLong::eArgLong, Arguments::maximum > Maximum
Gets or sets the maximum value of the range of the gauge.
Definition: Gauge.h:439
property< std::string >::bind< Gauge, &Gauge::getPrefix, &Gauge::setPrefix > Prefix
Gets or sets the text prefixed to the value displayed in the Gauge.
Definition: Gauge.h:409
Gauge(const Gauge &other)
(copy constructor)
property< std::string >::bind< Gauge, &Gauge::getSuffix, &Gauge::setSuffix > Suffix
Gets or sets the text appended to the value displayed in the Gauge.
Definition: Gauge.h:419
Gauge & operator=(const Gauge &other)
Assigns value in Gauge widget.
The main namespace for all widgets.
Definition: Basic.h:11
Contains resource IDs for Basic arguments.
Definition: Basic.h:47
Contains flags for all Basic resources.
Definition: Basic.h:269
Contains resource IDs for arguments of type char.
Definition: Gauge.h:281
Contains resource IDs for arguments of type long.
Definition: Gauge.h:268
Contains resource IDs for arguments of type char*.
Definition: Gauge.h:297
Contains resource IDs for arguments of type short.
Definition: Gauge.h:275
Contains resource IDs for arguments of type unsigned char.
Definition: Gauge.h:289
Contains resource IDs for all Gauge arguments.
Definition: Gauge.h:309
Contains flags for all Gauge resources.
Definition: Gauge.h:315
Contains resource IDs for Gauge arguments of type char.
Definition: Gauge.h:72
eArgChar
Resource IDs for Gauge arguments of type char.
Definition: Gauge.h:84
@ gauge_orientation
Indicates whether the gauge will be drawn vertically or horizontally.
Definition: Gauge.h:85
Contains resource IDs for Gauge arguments of type long.
Definition: Gauge.h:32
eArgLong
Resource IDs for Gauge arguments of type long.
Definition: Gauge.h:44
@ gauge_value
The gauge's current value.
Definition: Gauge.h:45
@ minimum
The minimum value of the gauge.
Definition: Gauge.h:47
@ maximum
The maximum value of the gauge.
Definition: Gauge.h:46
Contains resource IDs for Gauge arguments of type char*.
Definition: Gauge.h:111
eArgPChar
Resource IDs for Gauge arguments of type char*.
Definition: Gauge.h:123
@ value_suffix
Text appended to the value displayed. For example, % would result in 35%. @default NULL
Definition: Gauge.h:125
@ value_prefix
Text prefixed to the value displayed. For example, Red: would result in Red:35. @default NULL
Definition: Gauge.h:124
@ gauge_font
The font used for displaying the value, title, and any other text. @default "helv12".
Definition: Gauge.h:126
Contains resource IDs for Gauge arguments of type short.
Definition: Gauge.h:53
eArgShort
Resource IDs for Gauge arguments of type short.
Definition: Gauge.h:65
@ gauge_flags
Gauge flags.
Definition: Gauge.h:66
Contains resource IDs for Gauge arguments of type unsigned char.
Definition: Gauge.h:91
eArgUnsignedChar
Resource IDs for Gauge arguments of type unsigned char.
Definition: Gauge.h:103
@ gauge_horizontal_align
Controls horizontal alignment.
Definition: Gauge.h:104
@ gauge_vertical_align
Controls vertical alignment.
Definition: Gauge.h:105
Contains resource IDs for Gauge arguments.
Definition: Gauge.h:29
Contains flags for Gauge resource Gauge::Arguments::gauge_horizontal_align.
Definition: Gauge.h:226
eHorizontal
Horizontal alignment flags for Gauge resource Gauge::Arguments::gauge_horizontal_align.
Definition: Gauge.h:236
@ Left
Draw the value aligned to the left edge.
Definition: Gauge.h:237
@ Center
Draw the value centered.
Definition: Gauge.h:239
@ Right
Draw the value aligned to the right edge.
Definition: Gauge.h:238
Contains flags for Gauge resource Gauge::Arguments::gauge_vertical_align.
Definition: Gauge.h:245
eVertical
Vertical alignment flags for Gauge resource Gauge::Arguments::gauge_vertical_align.
Definition: Gauge.h:255
@ Bottom
Draw the value aligned with the bottom edge.
Definition: Gauge.h:257
@ Center
Draw the value centered.
Definition: Gauge.h:258
@ Top
Draw the value aligned with the top edge.
Definition: Gauge.h:256
Contains flags for Gauge resource Gauge::Arguments::gauge_horizontal_align and Gauge::Arguments::gaug...
Definition: Gauge.h:223
Contains flags for Gauge resource Gauge::Arguments::gauge_flags.
Definition: Gauge.h:137
eGaugeFlags
Common flags for Gauge resource Gauge::Arguments::gauge_flags.
Definition: Gauge.h:147
@ ShowValue
Indicates whether or not the value of the gauge will be displayed.
Definition: Gauge.h:185
@ MaximumOnTop
Place position of the maximum value to top.
Definition: Gauge.h:187
@ MaximumOnBottom
Place position of the maximum value to bottom.
Definition: Gauge.h:190
@ MaximumOnLeft
Place position of the maximum value to left.
Definition: Gauge.h:189
@ MaximumOnRight
Place position of the maximum value to right.
Definition: Gauge.h:188
@ ValueXOR
XOR the value display with the background (i.e. invert the fill of the type face).
Definition: Gauge.h:186
Contains flags for Gauge resource Gauge::Arguments::gauge_orientation.
Definition: Gauge.h:205
eOrientation
Orientation flags for Gauge resource Gauge::Arguments::gauge_orientation.
Definition: Gauge.h:215
@ Vertical
The gauge will be drawn vertically.
Definition: Gauge.h:217
@ Horizontal
The gauge will be drawn horizontally.
Definition: Gauge.h:216
Contains flags for Gauge resources.
Definition: Gauge.h:134