Photon microGUI widgets library 0.6.0
ToggleButton.h
1#ifndef PHWIDGETS_TOGGLE_BUTTON_H
2#define PHWIDGETS_TOGGLE_BUTTON_H
3
4#include <photon/PtToggleButton.h>
5
6#include "./Button.h"
7
8
9namespace PhWidgets
10{
12
22 {
24
28 {
29 Radio = Pt_TOGGLE_RADIO,
30 Check = Pt_TOGGLE_CHECK,
31 Outline = Pt_TOGGLE_OUTLINE
32 };
33 };
34
41
46 public Button
47 {
48 public:
49
51 struct ThisArgs
52 {
55 {
57
67 {
68 indicator_type = Pt_ARG_INDICATOR_TYPE
70 };
71 };
72
74 struct ArgColor
75 {
77
87 {
88 indicator_color = Pt_ARG_INDICATOR_COLOR
89 };
90 };
91
92 };
93
96 public ArgumentsEx<Button::ArgUnsignedChar>,
98 {
100 };
101
103 struct ArgColor:
104 public ArgumentsEx<Button::ArgColor>,
105 public ThisArgs::ArgColor
106 {
108 };
109
111 struct Arguments:
112 public ArgColor,
113 public ArgUnsignedChar,
114 public Button::Arguments
115 { };
116
117 protected:
118 typedef ResourceFrom<Button::WidgetResourcesSingleton>::
119 Define::Scalar<ThisArgs::ArgUnsignedChar::eArgUnsignedChar, unsigned char>::
120 Define::Color<ThisArgs::ArgColor::eArgColor>::
121
122 resource_type WidgetResourcesSingleton;
123
124 virtual void check();
125
126 void setChecked(bool val);
127 bool getChecked() const;
128
129 void setIndicatorType(ToggleIndicatorType::eToggleIndicatorType val);
130 ToggleIndicatorType::eToggleIndicatorType getIndicatorType() const;
131
132 public:
134
138 explicit ToggleButton(int abn);
139
141
145 explicit ToggleButton(PtWidget_t *wdg);
146
148
153
155
160
162
166 WidgetResourcesSingleton resource;
167
170
171
173
183 property<bool>::bind<ToggleButton, &ToggleButton::getChecked, &ToggleButton::setChecked> IsChecked;
184
186
210 property<ToggleIndicatorType::eToggleIndicatorType>::
211 bind<ToggleButton, &ToggleButton::getIndicatorType, &ToggleButton::setIndicatorType> IndicatorType;
212
214
238 };
239
240} // namespace PhWidgets
241
242
243#endif // PHWIDGETS_TOGGLE_BUTTON_H
A button for initiating an action.
Definition: Button.h:24
A toggle switch that's either off or on.
Definition: ToggleButton.h:47
property< bool >::bind< ToggleButton, &ToggleButton::getChecked, &ToggleButton::setChecked > IsChecked
Gets or sets whether the ToggleButton is checked.
Definition: ToggleButton.h:183
phproperty< Drawing::Color >::bind< ToggleButton, ThisArgs::ArgColor::eArgColor, Arguments::indicator_color > IndicatorColor
Gets or sets the fill color for the toggle button's indicator.
Definition: ToggleButton.h:236
ToggleButton(const ToggleButton &other)
(copy constructor)
WidgetResourcesSingleton resource
Resources of the ToggleButton.
Definition: ToggleButton.h:166
ToggleButton(PtWidget_t *wdg)
(constructor)
property< ToggleIndicatorType::eToggleIndicatorType >::bind< ToggleButton, &ToggleButton::getIndicatorType, &ToggleButton::setIndicatorType > IndicatorType
Gets or sets the type for the toggle button's indicator.
Definition: ToggleButton.h:211
ToggleButton(int abn)
(constructor)
ToggleButton & operator=(const ToggleButton &other)
Assigns value in ToggleButton.
The main namespace for all widgets.
Definition: Basic.h:11
Contains resource IDs for all Button arguments.
Definition: Button.h:122
Contains resource IDs for arguments of type PgColor_t.
Definition: ToggleButton.h:106
Contains resource IDs for arguments of type unsigned char.
Definition: ToggleButton.h:98
Contains resource IDs for all ToggleButton arguments.
Definition: ToggleButton.h:115
Contains resource IDs for ToggleButton arguments of type PgColor_t.
Definition: ToggleButton.h:75
eArgColor
Resource IDs for ToggleButton arguments of type PgColor_t.
Definition: ToggleButton.h:87
@ indicator_color
The fill color for the toggle button's indicator.
Definition: ToggleButton.h:88
Contains resource IDs for ToggleButton arguments of type unsigned char.
Definition: ToggleButton.h:55
eArgUnsignedChar
Resource IDs for ToggleButton arguments of type unsigned char.
Definition: ToggleButton.h:67
@ indicator_type
Definition: ToggleButton.h:68
Contains resource IDs for ToggleButton arguments.
Definition: ToggleButton.h:52
Specifies how the indicator of ToggleButton is drawn.
Definition: ToggleButton.h:22
eToggleIndicatorType
Toggle indicator types for ToggleButton resource ToggleButton::Arguments::indicator_type.
Definition: ToggleButton.h:28
@ Check
[x]
Definition: ToggleButton.h:30
@ Outline
I>
Definition: ToggleButton.h:31
@ Radio
Definition: ToggleButton.h:29