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-08
- Revision:
- 12:63db16fea709
- Parent:
- 11:b485561aa112
- Child:
- 13:6714534e7974
File content as of revision 12:63db16fea709:
#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(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