Foundation classes for a basic GUI implementing simple widgets and events. (Fork for custom changes.)
Fork of SimpleGUI by
Widgets/SpinnerWidget.cpp@11:b485561aa112, 2016-04-22 (annotated)
- Committer:
- duncanFrance
- Date:
- Fri Apr 22 16:12:42 2016 +0000
- Revision:
- 11:b485561aa112
- Child:
- 12:63db16fea709
TextWidget now uses string; Start of SpinnerWidget
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
duncanFrance | 11:b485561aa112 | 1 | #include "SpinnerWidget.h" |
duncanFrance | 11:b485561aa112 | 2 | |
duncanFrance | 11:b485561aa112 | 3 | #include"resources/spinner-upArrow.bmp" |
duncanFrance | 11:b485561aa112 | 4 | #include"resources/spinner-downArrow.bmp" |
duncanFrance | 11:b485561aa112 | 5 | |
duncanFrance | 11:b485561aa112 | 6 | SpinnerWidget::SpinnerWidget(GUI* gui) : ContainerWidget(gui), |
duncanFrance | 11:b485561aa112 | 7 | _upArrow(gui), _downArrow(gui), _text(gui), _min(0), _max(0), _increment(1), _value(0) |
duncanFrance | 11:b485561aa112 | 8 | { |
duncanFrance | 11:b485561aa112 | 9 | _upArrow.setBitmap(spinner_upArrow_bmp); |
duncanFrance | 11:b485561aa112 | 10 | _upArrow.setSize(10,10); |
duncanFrance | 11:b485561aa112 | 11 | |
duncanFrance | 11:b485561aa112 | 12 | _downArrow.setBitmap(spinner_downArrow_bmp); |
duncanFrance | 11:b485561aa112 | 13 | _downArrow.setSize(10,10); |
duncanFrance | 11:b485561aa112 | 14 | |
duncanFrance | 11:b485561aa112 | 15 | _text.setSize(gui->defaultFont()->width() * 4, gui->defaultFont()->height()); |
duncanFrance | 11:b485561aa112 | 16 | |
duncanFrance | 11:b485561aa112 | 17 | append(_upArrow); |
duncanFrance | 11:b485561aa112 | 18 | append(_downArrow); |
duncanFrance | 11:b485561aa112 | 19 | append(_text); |
duncanFrance | 11:b485561aa112 | 20 | |
duncanFrance | 11:b485561aa112 | 21 | } |
duncanFrance | 11:b485561aa112 | 22 | |
duncanFrance | 11:b485561aa112 | 23 | void SpinnerWidget::setMin(float min) |
duncanFrance | 11:b485561aa112 | 24 | { |
duncanFrance | 11:b485561aa112 | 25 | } |
duncanFrance | 11:b485561aa112 | 26 | |
duncanFrance | 11:b485561aa112 | 27 | void SpinnerWidget::setMax(float max) |
duncanFrance | 11:b485561aa112 | 28 | { |
duncanFrance | 11:b485561aa112 | 29 | } |
duncanFrance | 11:b485561aa112 | 30 | |
duncanFrance | 11:b485561aa112 | 31 | void SpinnerWidget::setIncrement(float increment) |
duncanFrance | 11:b485561aa112 | 32 | { |
duncanFrance | 11:b485561aa112 | 33 | } |
duncanFrance | 11:b485561aa112 | 34 | |
duncanFrance | 11:b485561aa112 | 35 | void SpinnerWidget::setValue(float value) |
duncanFrance | 11:b485561aa112 | 36 | { |
duncanFrance | 11:b485561aa112 | 37 | } |
duncanFrance | 11:b485561aa112 | 38 | |
duncanFrance | 11:b485561aa112 | 39 | void SpinnerWidget::getValue() |
duncanFrance | 11:b485561aa112 | 40 | { |
duncanFrance | 11:b485561aa112 | 41 | } |
duncanFrance | 11:b485561aa112 | 42 | |
duncanFrance | 11:b485561aa112 | 43 | template<typename T> |
duncanFrance | 11:b485561aa112 | 44 | void SpinnerWidget::onChange(T* tptr, void (T::*mptr)(SpinnerWidget*)) |
duncanFrance | 11:b485561aa112 | 45 | { |
duncanFrance | 11:b485561aa112 | 46 | _onChange.attach(tptr, mptr); |
duncanFrance | 11:b485561aa112 | 47 | } |
duncanFrance | 11:b485561aa112 | 48 | |
duncanFrance | 11:b485561aa112 | 49 | |
duncanFrance | 11:b485561aa112 | 50 | void SpinnerWidget::_onUpClick() { |
duncanFrance | 11:b485561aa112 | 51 | } |
duncanFrance | 11:b485561aa112 | 52 | |
duncanFrance | 11:b485561aa112 | 53 | void SpinnerWidget::_onDownClick() { |
duncanFrance | 11:b485561aa112 | 54 | } |