101#ifndef _TOUCH_TEXT_ENTRY_H_
102#define _TOUCH_TEXT_ENTRY_H_
130#define ENTRY_ALPHA (ENTRY_UPPERCASE | ENTRY_LOWERCASE)
132#define ENTRY_ALPHANUM (ENTRY_ALPHA | ENTRY_NUMBERS)
134#define ENTRY_WORD (ENTRY_UPPERCASE | ENTRY_LOWERCASE | ENTRY_NUMBERS | ENTRY_SYMBOLS)
136#define ENTRY_ALL (ENTRY_UPPERCASE | ENTRY_LOWERCASE | ENTRY_NUMBERS | ENTRY_SYMBOLS | ENTRY_WHITESPACE)
A font is a collection of font_ch_t for all ASCII characters. Each character has the same height and ...
Definition font.h:66
buttonBit_t
Bitmask values for all the different buttons.
Definition hdw-btn.h:101
paletteColor_t
All 216 possible colors, named like cRGB.
Definition palette.h:23
bool blinkState
Boolean value to keep track of whether the blinking cursor is shown.
Definition touchTextEntry.h:173
bool overtype
Whether the cursor will operate in overtype mode instead of insert mode.
Definition touchTextEntry.h:164
uint16_t maxLength
The maximum length of text allowed, or 0 for no limit.
Definition touchTextEntry.h:182
textEntryCharMask_t mask
The mask of character types that are allowed.
Definition touchTextEntry.h:185
textEntryCb cbFn
The function to call when the text entry is completed.
Definition touchTextEntry.h:218
const font_t * font
The font to use for text entry.
Definition touchTextEntry.h:212
bool pendingChar
Whether a to-be-entered character should be shown.
Definition touchTextEntry.h:167
uint16_t minLength
The minimum length of text that will be accepted.
Definition touchTextEntry.h:179
uint16_t x
The X position of the text entry box.
Definition touchTextEntry.h:203
char * value
The buffer holding the actual entered text value. Can be accessed as a string.
Definition touchTextEntry.h:155
touchSpinState_t spinState
Struct to track the state of the touchpad for spins.
Definition touchTextEntry.h:188
uint16_t cursor
The position of the cursor.
Definition touchTextEntry.h:161
char cur
The current character pending addition at the cursor, when pendingChar is true.
Definition touchTextEntry.h:170
uint16_t w
The width of the text entry box.
Definition touchTextEntry.h:209
void * data
A pointer to be passed back into the callback.
Definition touchTextEntry.h:215
void textEntrySetText(textEntry_t *textEntry, const char *text)
Copy the given text into the text entry, replacing any text that was there and moving the cursor to t...
Definition touchTextEntry.c:380
void textEntryMainLoop(textEntry_t *textEntry, int64_t elapsedUs)
Update timer logic and handle touchpad for a text entry.
Definition touchTextEntry.c:413
textEntryCharMask_t
Bitmask enum for specifying which classes of characters may be entered.
Definition touchTextEntry.h:116
@ ENTRY_LOWERCASE
Mask for allowing lowercase alphabet characters.
Definition touchTextEntry.h:120
@ ENTRY_WHITESPACE
Mask for allowing whitespace characters (space)
Definition touchTextEntry.h:126
@ ENTRY_NUMBERS
Mask for allowing numeric characters.
Definition touchTextEntry.h:122
@ ENTRY_UPPERCASE
Mask for allowing uppercase alphabet characters.
Definition touchTextEntry.h:118
@ ENTRY_SYMBOLS
Mask for allowing symbol characters (printable, non-alphanumeric, and non-whitespace)
Definition touchTextEntry.h:124
void textEntryButton(textEntry_t *textEntry, const buttonEvt_t *evt)
Handle a button event for a text entry to modify the text or confirm entry.
Definition touchTextEntry.c:501
uint16_t size
The total size of the dynamic text buffer.
Definition touchTextEntry.h:158
char spinCharStart
The selected character at the start of the touchpad spin.
Definition touchTextEntry.h:191
buttonBit_t heldButton
The button that is currently being held, or 0 if none.
Definition touchTextEntry.h:194
uint16_t y
The Y position of the text entry box.
Definition touchTextEntry.h:206
textEntry_t * initTextEntry(uint16_t x, uint16_t y, uint16_t w, uint16_t length, const font_t *font, textEntryCharMask_t mask, textEntryCb cbFn)
Allocate and return a new text entry. The text entry must be freed with freeTextEntry()
Definition touchTextEntry.c:322
void(* textEntryCb)(const char *text, void *data)
A callback which is called once text entry is complete.
Definition touchTextEntry.h:144
uint16_t offset
The first character to be drawn on-screen, if the whole value doesn't fit.
Definition touchTextEntry.h:200
void drawTextEntry(textEntry_t *textEntry, paletteColor_t fg, paletteColor_t bg, bool drawBox)
Draw a text entry box.
Definition touchTextEntry.c:656
int64_t blinkTimer
The number of nanoseconds remaining before the blink state changes.
Definition touchTextEntry.h:176
int64_t repeatTimer
The number of nanoseconds remaining before the held button repeats.
Definition touchTextEntry.h:197
void freeTextEntry(textEntry_t *textEntry)
Frees any memory associated with a text entry.
Definition touchTextEntry.c:356
void textEntrySetData(textEntry_t *textEntry, void *data)
Sets the data pointer to be passed along to the callback function.
Definition touchTextEntry.c:368
Struct to store all state for a text entry.
Definition touchTextEntry.h:151
Definition touchUtils.h:24