summaryrefslogtreecommitdiff
path: root/plugingui/scrollbar.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/scrollbar.h')
-rw-r--r--plugingui/scrollbar.h59
1 files changed, 29 insertions, 30 deletions
diff --git a/plugingui/scrollbar.h b/plugingui/scrollbar.h
index 52acf9d..99f8377 100644
--- a/plugingui/scrollbar.h
+++ b/plugingui/scrollbar.h
@@ -24,52 +24,51 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_SCROLLBAR_H__
-#define __DRUMGIZMO_SCROLLBAR_H__
+#pragma once
+
+#include <limits>
#include "widget.h"
#include "image.h"
+#include "notifier.h"
namespace GUI {
class ScrollBar : public Widget {
+ friend class ListBoxBasic;
public:
- ScrollBar(Widget *parent);
-
- bool catchMouse() { return true; }
+ ScrollBar(Widget *parent);
- void setRange(int range);
- int range();
+ void setRange(int range);
+ int range();
- void setMaximum(int max);
- int maximum();
+ void setMaximum(int max);
+ int maximum();
- void setValue(int value);
- int value();
+ void addValue(int delta);
+ void setValue(int value);
+ int value();
- void registerValueChangeHandler(void (*handler)(void *), void *ptr);
+ Notifier<int> valueChangeNotifier; // (int value)
- void repaintEvent(RepaintEvent *e);
- void scrollEvent(ScrollEvent *e);
- void buttonEvent(ButtonEvent *e);
- void mouseMoveEvent(MouseMoveEvent *e);
+protected:
+ // From Widget:
+ bool catchMouse() override { return true; }
+ void scrollEvent(ScrollEvent* scrollEvent) override;
+ void repaintEvent(RepaintEvent* repaintEvent) override;
+ void buttonEvent(ButtonEvent* buttonEvent) override;
+ void mouseMoveEvent(MouseMoveEvent* mouseMoveEvent) override;
private:
- int max;
- int val;
- int ran;
-
- int yoffset;
- int value_offset;
- bool dragging;
+ int maxValue{100};
+ int currentValue{0};
+ int rangeValue{10};
- Image bg_img;
+ int yOffset{0};
+ int valueOffset{0};
+ bool dragging{false};
- void (*handler)(void *);
- void *ptr;
+ Image bg_img;
};
-};
-
-
-#endif/*__DRUMGIZMO_SCROLLBAR_H__*/
+} // GUI::