28 #ifndef _LCDGFX_TEXT_ENTRY_H_ 29 #define _LCDGFX_TEXT_ENTRY_H_ 83 const char *charset =
" ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-_");
143 template <
typename D>
void show(D &d)
147 const lcduint_t fontH = d.getFont().getHeader().height;
148 const lcduint_t fontW = d.getFont().getHeader().width;
151 d.printFixed(baseX, baseY, m_buffer);
154 d.drawHLine(cursorX, cursorY, cursorX + (
lcdint_t)fontW - 2);
165 const lcduint_t fontH = d.getFont().getHeader().height;
166 const lcduint_t fontW = d.getFont().getHeader().width;
182 const char *m_charset;
183 uint8_t m_charsetLen;
185 uint8_t m_cursor = 0;
188 uint8_t indexOfCurrentChar()
const;
void setCursor(uint8_t cursor)
Sets the cursor position.
uint8_t lcduint_t
internal int type, used by the library.
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.
uint8_t getCursor() const
Returns the current cursor position.
void down()
Cycles the character at the cursor backward through the charset.
lcdint_t y
y position in pixels
void left()
Moves the cursor one cell to the left, clamped at 0.
void up()
Cycles the character at the cursor forward through the charset.
uint8_t getMaxLen() const
Returns the maximum number of editable cells.
Single-line text-entry widget.
const NanoRect & getRect() const
Returns the rectangle occupied by the widget.
const char * getText() const
Returns the underlying NUL-terminated text buffer.
LcdGfxTextEntry(char *buffer, uint8_t maxLen, const NanoRect &rect, const char *charset=" ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-_")
Creates a text-entry widget bound to the user's buffer.
Basic structures of nano gfx library.
void updateSize(D &d)
Auto-sizes the widget rectangle from the active font if a zero rect was supplied to the constructor...
void show(D &d)
Renders the widget to the display.
NanoPoint p1
top-left point of the rectangle area
lcdint_t x
x position in pixels
void right()
Moves the cursor one cell to the right, clamped at maxLen - 1.