summaryrefslogtreecommitdiff
path: root/plugingui/knob.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/knob.h')
-rw-r--r--plugingui/knob.h64
1 files changed, 32 insertions, 32 deletions
diff --git a/plugingui/knob.h b/plugingui/knob.h
index a6af499..4a71b2e 100644
--- a/plugingui/knob.h
+++ b/plugingui/knob.h
@@ -24,57 +24,57 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_KNOB_H__
-#define __DRUMGIZMO_KNOB_H__
+#pragma once
#include "widget.h"
-
#include "image.h"
+#include "font.h"
+#include "notifier.h"
namespace GUI {
class Knob : public Widget {
public:
- Knob(Widget *parent);
+ Knob(Widget *parent);
- bool catchMouse() { return true; }
- bool isFocusable() { return true; }
+ // From Widget:
+ bool catchMouse() override { return true; }
+ bool isFocusable() override { return true; }
- void setValue(float value);
- float value();
+ void setValue(float value);
+ float value();
- void registerClickHandler(void (*handler)(void *), void *ptr);
+ Notifier<float> valueChangedNotifier; // (float newValue)
- //protected:
- virtual void clicked() {}
+protected:
+ virtual void clicked() {}
- virtual void repaintEvent(RepaintEvent *e);
- virtual void buttonEvent(ButtonEvent *e);
- virtual void mouseMoveEvent(MouseMoveEvent *e);
- virtual void scrollEvent(ScrollEvent *e);
- virtual void keyEvent(KeyEvent *e);
+ // From Widget:
+ virtual void repaintEvent(RepaintEvent* repaintEvent) override;
+ virtual void buttonEvent(ButtonEvent* buttonEvent) override;
+ virtual void mouseMoveEvent(MouseMoveEvent* mouseMoveEvent) override;
+ virtual void scrollEvent(ScrollEvent* scrollEvent) override;
+ virtual void keyEvent(KeyEvent* keyEvent) override;
private:
- typedef enum {
- up,
- down
- } state_t;
-
- float val;
- float maximum;
- float minimum;
+ //! Sets the internal value and sends out the changed notification.
+ void internalSetValue(float value);
- state_t state;
+ typedef enum {
+ up,
+ down
+ } state_t;
- GUI::Image img_knob;
+ state_t state;
- void (*handler)(void *);
- void *ptr;
+ float currentValue;
+ float maximum;
+ float minimum;
- int mouse_offset_x;
-
-};
+ Image img_knob;
+ int mouse_offset_x;
+ Font font;
};
-#endif/*__DRUMGIZMO_KNOB_H__*/
+} // GUI::