From 21bb5bd2bd4243dc83a08d6e0329b5de2f96b1fe Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 3 Oct 2015 14:34:20 +0200 Subject: Refactor ComboBox and ListBox(Thin and Basic). --- plugingui/combobox.h | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) (limited to 'plugingui/combobox.h') 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 #include @@ -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 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:: -- cgit v1.2.3