diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-14 18:36:55 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-14 18:36:55 +0100 |
commit | f11a61a36fa5e21b0c6c2362af2952a3f87408a0 (patch) | |
tree | 2c1570a2ce1ca0a2e674383134cbd091ae8217d7 /plugingui/scrollbar.h | |
parent | bfdb184d349d2b8ecf4ea993793182cb32098e12 (diff) |
Refactor ScrollBar, and fix keyboard navigation in listbox.
Diffstat (limited to 'plugingui/scrollbar.h')
-rw-r--r-- | plugingui/scrollbar.h | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/plugingui/scrollbar.h b/plugingui/scrollbar.h index 52acf9d..42e504e 100644 --- a/plugingui/scrollbar.h +++ b/plugingui/scrollbar.h @@ -24,52 +24,49 @@ * 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 "widget.h" #include "image.h" +#include "notifier.h" namespace GUI { class ScrollBar : public Widget { + friend class ListBoxBasic; public: - ScrollBar(Widget *parent); + ScrollBar(Widget *parent); - bool catchMouse() { return true; } + 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 addValue(int delta); + void setValue(int value); + int value(); - void setValue(int value); - int value(); + Notifier<int> valueChangeNotifier; // (int value) - void registerValueChangeHandler(void (*handler)(void *), void *ptr); - - 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; + int currentValue; + int rangeValue; - Image bg_img; + int yOffset; + int valueOffset; + bool dragging; - void (*handler)(void *); - void *ptr; + Image bg_img; }; -}; - - -#endif/*__DRUMGIZMO_SCROLLBAR_H__*/ +} // GUI:: |