Foundation classes for a basic GUI implementing simple widgets and events. (Fork for custom changes.)
Fork of SimpleGUI by
Widgets/SpinnerWidget.h
- Committer:
- duncanFrance
- Date:
- 2016-05-21
- Revision:
- 13:6714534e7974
- Parent:
- 12:63db16fea709
- Child:
- 17:5184762fda6c
File content as of revision 13:6714534e7974:
#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 * It automatically sizes itself to fit the screen dimensions when created **/ class SpinnerWidget : public ContainerWidget { public: SpinnerWidget(GraphicsContext *context); void setMin(float min); void setMax(float max); void setIncrement(float increment); void setValue(float value); 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)(Event e)); // Overrides virtual void setSize(int width, int height); protected: BitmapWidget _upArrow; TextWidget _text; BitmapWidget _downArrow; float _min, _max, _increment, _value; const char* _format; char _buf[64]; FunctionPointerArg1<void,Event> _onChange; virtual void _onUpClick(Event e); virtual void _onDownClick(Event e); /** * Overrides **/ virtual void _dirty(); }; #endif