Foundation classes for a basic GUI implementing simple widgets and events. (Fork for custom changes.)
Fork of SimpleGUI by
Diff: Widgets/SpinnerWidget.h
- Revision:
- 11:b485561aa112
- Child:
- 12:63db16fea709
diff -r e9d13e3a9d4f -r b485561aa112 Widgets/SpinnerWidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Widgets/SpinnerWidget.h Fri Apr 22 16:12:42 2016 +0000 @@ -0,0 +1,42 @@ +#ifndef SIMPLEGUI_SPINNER_WIDGET_H +#define SIMPLEGUI_SPINNER_WIDGET_H + +#include "BitmapWidget.h" +#include "TextWidget.h" +#include "ContainerWidget.h" +#include "GUI.h" + +/** +* A spinner widget shows up and down arrows to set a value +**/ +class SpinnerWidget : public ContainerWidget { + +public: + + SpinnerWidget(GUI* gui); + + void setMin(float min); + void setMax(float max); + void setIncrement(float increment); + void setValue(float value); + void getValue(); + + template<typename T> + void onChange(T* tptr, void (T::*mptr)(void)); + +protected: + +float _min, _max, _value, _increment; + +BitmapWidget _upArrow; +BitmapWidget _downArrow; +TextWidget _text; + +FunctionPointerArg1<void,void> _onChange; + + void _onUpClick(); + void _onDownClick(); + + +}; +#endif \ No newline at end of file