Foundation classes for a basic GUI implementing simple widgets and events. (Fork for custom changes.)
Fork of SimpleGUI by
Diff: Widgets/SpinnerWidget.h
- Revision:
- 12:63db16fea709
- Parent:
- 11:b485561aa112
- Child:
- 13:6714534e7974
diff -r b485561aa112 -r 63db16fea709 Widgets/SpinnerWidget.h --- a/Widgets/SpinnerWidget.h Fri Apr 22 16:12:42 2016 +0000 +++ b/Widgets/SpinnerWidget.h Sun May 08 14:42:08 2016 +0000 @@ -9,34 +9,50 @@ /** * A spinner widget shows up and down arrows to set a value **/ -class SpinnerWidget : public ContainerWidget { - +class SpinnerWidget : public ContainerWidget +{ + public: - SpinnerWidget(GUI* gui); + SpinnerWidget(GraphicsContext *context); void setMin(float min); void setMax(float max); void setIncrement(float increment); void setValue(float value); - void getValue(); - + void setFormat(const char* format); + + float getMin(); + float getMax(); + float getIncrement(); + float getValue(); + const char* getFormat(); + template<typename T> - void onChange(T* tptr, void (T::*mptr)(void)); + void onChange(T* tptr, void (T::*mptr)(Event e)); + + // Overrides + virtual void setSize(int width, int height); protected: -float _min, _max, _value, _increment; + BitmapWidget _upArrow; + TextWidget _text; + BitmapWidget _downArrow; -BitmapWidget _upArrow; -BitmapWidget _downArrow; -TextWidget _text; + float _min, _max, _increment, _value; + + const char* _format; + char _buf[64]; -FunctionPointerArg1<void,void> _onChange; - - void _onUpClick(); - void _onDownClick(); - - + FunctionPointerArg1<void,Event> _onChange; + + virtual void _onUpClick(Event e); + virtual void _onDownClick(Event e); + + /** + * Overrides + **/ + virtual void _dirty(); }; #endif \ No newline at end of file