Photon microGUI widgets library 0.6.0
OnOffButton.h
1#ifndef PHWIDGETS_ONOFF_BUTTON_H
2#define PHWIDGETS_ONOFF_BUTTON_H
3
4#include <photon/PtOnOffButton.h>
5
6#include "./Button.h"
7
8
9namespace PhWidgets
10{
17
22 public Button
23 {
24 public:
25
27 struct ThisArgs
28 {
30 struct ArgBool
31 {
33
43 {
44 onoff_state = Pt_ARG_ONOFF_STATE
45 };
46 };
47 };
48
51 {
53 struct Callback
54 {
56
65 {
66 new_value = Pt_CB_ONOFF_NEW_VALUE
67 };
68 };
69 };
70
72 struct ArgBool:
74 { };
75
77 struct Callback:
78 public ArgumentsEx<ThisCallbacks::Callback>,
79 public Button::Callback
80 {
82 };
83
85 struct Arguments:
86 public Button::Arguments,
87 public ArgBool
88 { };
89
91 struct Callbacks:
92 public Callback,
94 { };
95
96 protected:
97 typedef ResourceFrom<Button::WidgetResourcesSingleton>::
98 Define::Scalar<ThisArgs::ArgBool::eArgBool, bool>::
99
100 Define::Link<ThisCallbacks::Callback::eCallback, PtCallback_t*>::
101
102 resource_type WidgetResourcesSingleton;
103
104 virtual void check();
105
106 public:
108
112 WidgetResourcesSingleton resource;
113
115
119 explicit OnOffButton(int abn);
120
122
126 explicit OnOffButton(PtWidget_t* wdg);
127
129
134
136
141
142 void Check(bool val = true);
143 void Uncheck(bool val = true);
144
147
148
150
160 phproperty<bool>::bind<OnOffButton, ArgBool::eArgBool, Arguments::onoff_state> IsChecked;
161
163
165 };
166
167} // namespace PhWidgets
168
169
170#endif // PHWIDGETS_ONOFF_BUTTON_H
A button for initiating an action.
Definition: Button.h:24
An on/off button that can be set or unset.
Definition: OnOffButton.h:23
OnOffButton(PtWidget_t *wdg)
(constructor)
OnOffButton & operator=(const OnOffButton &other)
Assigns value in OnOffButton widget.
phproperty< bool >::bind< OnOffButton, ArgBool::eArgBool, Arguments::onoff_state > IsChecked
Gets or set a value indicating whether the OnOffButton is in the checked state.
Definition: OnOffButton.h:160
OnOffButton(const OnOffButton &other)
(copy constructor)
WidgetResourcesSingleton resource
Resources of the OnOffButton.
Definition: OnOffButton.h:112
OnOffButton(int abn)
(constructor)
An event, which raise a notification to registered subscribers (event handlers) that something of int...
Definition: Widget.h:132
The main namespace for all widgets.
Definition: Basic.h:11
Contains resource IDs for Basic callbacks.
Definition: Basic.h:217
Contains resource IDs for all Button arguments.
Definition: Button.h:122
Contains resource IDs for arguments of type bool.
Definition: OnOffButton.h:74
Contains resource IDs for all OnOffButton arguments.
Definition: OnOffButton.h:88
Contains resource IDs for callbacks of type PtCallback_t.
Definition: OnOffButton.h:80
Contains resource IDs for all OnOffButton callbacks.
Definition: OnOffButton.h:94
Contains resource IDs for OnOffButton arguments of type bool.
Definition: OnOffButton.h:31
eArgBool
Resource IDs for OnOffButton arguments of type bool.
Definition: OnOffButton.h:43
Contains resource IDs for OnOffButton arguments.
Definition: OnOffButton.h:28
Contains resource IDs for OnOffButton callbacks of type PtCallback_t.
Definition: OnOffButton.h:54
eCallback
Resource IDs for OnOffButton arguments of type PtCallback_t.
Definition: OnOffButton.h:65
Contains resource IDs for OnOffButton callbacks.
Definition: OnOffButton.h:51