summaryrefslogtreecommitdiff
path: root/plugingui/combobox.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-10-03 14:34:20 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2015-10-03 14:34:20 +0200
commit21bb5bd2bd4243dc83a08d6e0329b5de2f96b1fe (patch)
treebeef1c65f08a9677611b20fbb86deff5f1820bd9 /plugingui/combobox.h
parent3be8598f672eb5b8e48373ed4ee59feff543ada2 (diff)
Refactor ComboBox and ListBox(Thin and Basic).
Diffstat (limited to 'plugingui/combobox.h')
-rw-r--r--plugingui/combobox.h44
1 files changed, 20 insertions, 24 deletions
diff --git a/plugingui/combobox.h b/plugingui/combobox.h
index bc4ae38..da157ef 100644
--- a/plugingui/combobox.h
+++ b/plugingui/combobox.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_COMBOBOX_H__
-#define __DRUMGIZMO_COMBOBOX_H__
+#pragma once
#include <string.h>
#include <vector>
@@ -39,35 +38,32 @@ namespace GUI {
class ComboBox : public Widget {
public:
- ComboBox(Widget *parent);
- ~ComboBox();
+ ComboBox(Widget *parent);
+ ~ComboBox();
- bool isFocusable() { return true; }
+ void addItem(std::string name, std::string value);
- void addItem(std::string name, std::string value);
+ void clear();
+ bool selectItem(int index);
+ std::string selectedName();
+ std::string selectedValue();
- void clear();
- bool selectItem(int index);
- std::string selectedName();
- std::string selectedValue();
+ // From Widget:
+ bool isFocusable() override { return true; }
+ virtual void repaintEvent(RepaintEvent *e) override;
+ virtual void buttonEvent(ButtonEvent *e) override;
+ virtual void scrollEvent(ScrollEvent *e) override;
+ virtual void keyEvent(KeyEvent *e) override;
- void registerValueChangedHandler(void (*handler)(void *), void *ptr);
-
- virtual void repaintEvent(RepaintEvent *e);
- virtual void buttonEvent(ButtonEvent *e);
- virtual void scrollEvent(ScrollEvent *e);
- virtual void keyEvent(KeyEvent *e);
+ Notifier<std::string, std::string> valueChangedNotifier;
private:
- Painter::Box box;
-
- GUI::Font font;
- GUI::ListBoxThin *listbox;
+ Painter::Box box;
- void (*handler)(void *);
- void *ptr;
-};
+ void listboxSelectHandler();
+ Font font;
+ ListBoxThin listbox;
};
-#endif/*__DRUMGIZMO_COMBOBOX_H__*/
+} // GUI::