summaryrefslogtreecommitdiff
path: root/src/interface/DropDown.h
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-11-17 19:44:09 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-11-17 19:44:09 (GMT)
commit058a2edd75debbd0297f92572316daa704bd379f (patch)
treead303f091f9a08b209b91eb34a9fcad996a3de69 /src/interface/DropDown.h
parente3594aba9e05c6865d396418c028049cda92c2f3 (diff)
parent7a21ae192fe19868539956f3fe28e62b2c7c4429 (diff)
downloadpowder-058a2edd75debbd0297f92572316daa704bd379f.zip
powder-058a2edd75debbd0297f92572316daa704bd379f.tar.gz
Merge branch 'master' of github.com:FacialTurd/PowderToypp
Diffstat (limited to 'src/interface/DropDown.h')
-rw-r--r--src/interface/DropDown.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/interface/DropDown.h b/src/interface/DropDown.h
new file mode 100644
index 0000000..3aba971
--- /dev/null
+++ b/src/interface/DropDown.h
@@ -0,0 +1,48 @@
+/*
+ * DropDown.h
+ *
+ * Created on: Apr 16, 2012
+ * Author: Simon
+ */
+
+#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;
+ bool isMouseInside;
+ int optionIndex;
+ DropDownAction * callback;
+ std::vector<std::pair<std::string, int> > options;
+public:
+ DropDown(Point position, Point size);
+ std::pair<std::string, int> GetOption();
+ 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 void OnMouseEnter(int x, int y);
+ virtual void OnMouseLeave(int x, int y);
+ virtual ~DropDown();
+};
+
+} /* namespace ui */
+#endif /* DROPDOWN_H_ */