28 #ifndef _LCDGFX_SPINBOX_H_ 29 #define _LCDGFX_SPINBOX_H_ 69 template <
typename D>
void show(D &d)
72 snprintf(buf,
sizeof(buf),
"%d", (
int)m_value);
73 lcduint_t fontH = d.getFont().getHeader().height;
74 lcduint_t arrowW = d.getFont().getTextSize(
"<");
75 lcduint_t textW = d.getFont().getTextSize(buf);
83 uint16_t color = d.getColor();
85 d.fillRect(innerLeft, m_rect.
p1.
y + 1, innerRight, m_rect.
p2.
y - 1);
88 d.printFixed(m_rect.
p1.
x + 2, cy,
"<");
89 d.printFixed(m_rect.
p2.
x - 2 - (
lcdint_t)d.getFont().getTextSize(
">"), cy,
">");
90 d.printFixed(cx, cy, buf);
116 int16_t minValue()
const 121 int16_t maxValue()
const uint8_t lcduint_t
internal int type, used by the library.
LcdGfxSpinbox(const NanoRect &rect, int16_t minValue, int16_t maxValue, int16_t value, int16_t step=1, bool wrap=false)
Creates a spinbox widget.
NanoRect structure describes rectangle area.
lcdint_t height() const
returns height of NanoRect
NanoPoint p2
right-bottom point of the rectangle area
int8_t lcdint_t
internal int type, used by the library.
lcdint_t y
y position in pixels
Basic structures of nano gfx library.
int16_t value() const
Returns the current value.
Class implements an integer spinbox widget for lcdgfx library.
NanoPoint p1
top-left point of the rectangle area
lcdint_t x
x position in pixels
void down()
Decrements the value (wraps or clamps depending on configuration).
void setValue(int16_t value)
Sets the current value, clamped into [min, max].
void show(D &d)
Renders the spinbox on the display: a border with a centered numeric value and "<" ">" arrows on the ...
void up()
Increments the value (wraps or clamps depending on configuration).