1#ifndef __BINDTEXTINPUT_H
2#define __BINDTEXTINPUT_H
5#include "BindUtils.hpp"
56 changeCallback = callback;
59 void invokeCallback(
const char *val, uint8_t length)
62 if (changeCallback !=
nullptr)
64 changeCallback(val, length);
80 void setText(
const char *cstr,
int length)
82 if (cstr ==
text || length < 0) {
87 if (
text !=
nullptr) {
90 text =
new char[length + 1];
91 strncpy(
text, cstr, length);
108 const char* getText()
const
121 uint16_t
getBytes(uint8_t *out)
override;
130 bool numberOnly =
false;
135 uint8_t objID = BIND_ID_TEXTINPUT;
139 static int16_t tagIndex;
140 void (*changeCallback)(
const char *, uint8_t) =
nullptr;
The BindTextInput class represents a text input UI element for use with BindCanvas.
Definition BindTextInput.hpp:16
int32_t textColor
Text color for the text input.
Definition BindTextInput.hpp:127
int16_t y
Y-coordinate position of the text input.
Definition BindTextInput.hpp:124
int16_t fontSize
Font size for the text input.
Definition BindTextInput.hpp:126
uint8_t widthChars
Width of the text input in characters.
Definition BindTextInput.hpp:129
int32_t backColor
Background color for the text input.
Definition BindTextInput.hpp:128
void setCallback(void(*callback)(const char *, uint8_t))
Set the Callback function for the text input.
Definition BindTextInput.hpp:54
BindTextInput()
Constructs a BindTextInput with default properties.
Definition BindTextInput.cpp:11
void setHint(const char *cstr)
Sets the hint text for the text input.
Definition BindTextInput.hpp:103
uint8_t cmdId
Command ID for the text input.
Definition BindTextInput.hpp:125
uint16_t getBytes(uint8_t *out) override
Retrieves the bytes representing the text input for synchronization.
Definition BindTextInput.cpp:18
void setText(const char *cstr)
Sets the text content for the text input.
Definition BindTextInput.hpp:75
int16_t x
X-coordinate position of the text input.
Definition BindTextInput.hpp:123
char * text
Text content of the text input.
Definition BindTextInput.hpp:131
Definition BindView.hpp:26