diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-13 19:00:22 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-13 19:00:22 (GMT) |
| commit | 7758fe52cb9ef78b562bc2587b17b6344d8829fe (patch) | |
| tree | 92f45320d240148f6e518ed07aec480e329d4a25 /src/interface/DropDown.h | |
| parent | 4032a0469b1f40f7197468f34986e365bd6e7314 (diff) | |
| download | powder-7758fe52cb9ef78b562bc2587b17b6344d8829fe.zip powder-7758fe52cb9ef78b562bc2587b17b6344d8829fe.tar.gz | |
DropDown UI component
Diffstat (limited to 'src/interface/DropDown.h')
| -rw-r--r-- | src/interface/DropDown.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/interface/DropDown.h b/src/interface/DropDown.h index 619ec5a..34310df 100644 --- a/src/interface/DropDown.h +++ b/src/interface/DropDown.h @@ -8,18 +8,37 @@ #ifndef DROPDOWN_H_ #define DROPDOWN_H_ +#include <utility> #include "Component.h" #include "Colour.h" namespace ui { +class DropDown; +class DropDownWindow; +class DropDownAction +{ +public: + virtual void OptionChanged(DropDown * sender, std::pair<std::string, int> newOption) {} + virtual ~DropDownAction() {} +}; class DropDown: public ui::Component { + friend class DropDownWindow; Colour background, activeBackground; Colour border, activeBorder; Colour text, activeText; bool isMouseInside; + int optionIndex; + DropDownAction * callback; + std::vector<std::pair<std::string, int> > options; public: DropDown(Point position, Point size); + void SetOption(int option); + void SetOption(std::string option); + void AddOption(std::pair<std::string, int> option); + void RemoveOption(std::string option); + void SetOptions(std::vector<std::pair<std::string, int> > options); + void SetActionCallback(DropDownAction * action) { callback = action;} virtual void Draw(const Point& screenPos); virtual void OnMouseClick(int x, int y, unsigned int button); virtual ~DropDown(); |
