summaryrefslogtreecommitdiff
path: root/plugingui/checkbox.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-09-03 18:20:34 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2015-09-03 18:20:34 +0200
commit3ec43973d1e269c5e6124e02276107c2c3020180 (patch)
treede1bae3885ca8bd56ea6aa953d8df55179717138 /plugingui/checkbox.h
parent2295655ffec08ba2f99973ef7a8464fe726ae899 (diff)
Use Notifier in CheckBox class.
Diffstat (limited to 'plugingui/checkbox.h')
-rw-r--r--plugingui/checkbox.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/plugingui/checkbox.h b/plugingui/checkbox.h
index 1d6f9d6..8dd3821 100644
--- a/plugingui/checkbox.h
+++ b/plugingui/checkbox.h
@@ -24,11 +24,11 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_CHECKBOX_H__
-#define __DRUMGIZMO_CHECKBOX_H__
+#pragma once
#include "widget.h"
#include "image.h"
+#include "notifier.h"
namespace GUI {
@@ -38,21 +38,24 @@ public:
void setText(std::string text);
- bool isFocusable() { return true; }
+ bool isFocusable() override { return true; }
bool checked();
void setChecked(bool checked);
- void registerClickHandler(void (*handler)(void *), void *ptr);
+ Notifier<bool> stateChangedNotifier;
- //protected:
+protected:
virtual void clicked() {}
- virtual void repaintEvent(RepaintEvent *e);
- virtual void buttonEvent(ButtonEvent *e);
- virtual void keyEvent(KeyEvent *e);
+ // From Widget:
+ virtual void repaintEvent(RepaintEvent *e) override;
+ virtual void buttonEvent(ButtonEvent *e) override;
+ virtual void keyEvent(KeyEvent *e) override;
private:
+ void internalSetChecked(bool checked);
+
Image bg_on;
Image bg_off;
Image knob;
@@ -60,12 +63,7 @@ private:
bool state;
bool middle;
- void (*handler)(void *);
- void *ptr;
-
std::string _text;
};
-};
-
-#endif/*__DRUMGIZMO_CHECKBOX_H__*/
+} // GUI::