summaryrefslogtreecommitdiff
path: root/plugingui/slider.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-11-18 21:00:48 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2015-11-18 21:00:48 +0100
commitc1973bc4d4ec9d8d18a690359a2d649905e35264 (patch)
tree045c4d5afc28422319c4e20322fbafe97fefd280 /plugingui/slider.h
parentf11a61a36fa5e21b0c6c2362af2952a3f87408a0 (diff)
Refactored Slider. Expanded all event variable names (all was 'e' before). Changed all uievent enums to enum classes.
Diffstat (limited to 'plugingui/slider.h')
-rw-r--r--plugingui/slider.h47
1 files changed, 20 insertions, 27 deletions
diff --git a/plugingui/slider.h b/plugingui/slider.h
index f07ccff..01cbd54 100644
--- a/plugingui/slider.h
+++ b/plugingui/slider.h
@@ -24,8 +24,7 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_SLIDER_H__
-#define __DRUMGIZMO_SLIDER_H__
+#pragma once
#include "widget.h"
@@ -33,38 +32,32 @@ namespace GUI {
class Slider : public Widget {
public:
- Slider(Widget *parent);
+ Slider(Widget* parent);
- bool catchMouse() { return true; }
+ // From Widget:
+ bool catchMouse() override { return true; }
- void setValue(float value);
- float value();
+ void setValue(float value);
+ float value();
- void registerClickHandler(void (*handler)(void *), void *ptr);
+ Notifier<> clickNotifier;
- //protected:
- virtual void clicked() {}
-
- virtual void repaintEvent(RepaintEvent *e);
- virtual void buttonEvent(ButtonEvent *e);
- virtual void mouseMoveEvent(MouseMoveEvent *e);
+protected:
+ virtual void repaintEvent(RepaintEvent* repaintEvent) override;
+ virtual void buttonEvent(ButtonEvent* buttonEvent) override;
+ virtual void mouseMoveEvent(MouseMoveEvent* mouseMoveEvent) override;
private:
- typedef enum {
- up,
- down
- } state_t;
-
- float val;
- float maximum;
- float minimum;
+ enum class State {
+ up,
+ down
+ };
- state_t state;
-
- void (*handler)(void *);
- void *ptr;
-};
+ float currentValue;
+ float maximum;
+ float minimum;
+ State state;
};
-#endif/*__DRUMGIZMO_SLIDER_H__*/
+} // GUI::