15#include "string_base.h"
50 void Assign(
const std::string_view text);
56 bool InsertString(
const char *str,
bool marked,
const char *
caret =
nullptr,
const char *insert_location =
nullptr,
const char *replacement_end =
nullptr);
71 std::unique_ptr<StringIterator> char_iter;
78 void DeleteText(uint16_t from, uint16_t to,
bool update);
IterType
Type of the iterator.
CharSetFilter
Valid filter types for IsValidChar.
Types related to strings.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Helper/buffer for input fields.
uint16_t pixels
the current size of the string in pixels
uint16_t caretpos
the current position of the caret in the buffer, in bytes
void UpdateSize()
Update Textbuf type with its actual physical character and screenlength Get the count of characters i...
bool MovePos(uint16_t keycode)
Handle text navigation with arrow keys left/right.
uint16_t markxoffs
the start position of the marked area in pixels
void UpdateMarkedText()
Update pixel positions of the marked text area.
void UpdateWidth()
Update pixel width of the text.
bool DeleteChar(uint16_t keycode)
Delete a character from a textbuffer, either with 'Delete' or 'Backspace' The character is delete fro...
void DeleteAll()
Delete every character in the textbuffer.
uint16_t max_bytes
the maximum size of the buffer in bytes (including terminating '\0')
uint16_t chars
the current size of the string in characters (including terminating '\0')
bool InsertString(const char *str, bool marked, const char *caret=nullptr, const char *insert_location=nullptr, const char *replacement_end=nullptr)
Insert a string into the text buffer.
bool MovePrev(StringIterator::IterType what)
Move to previous character position.
uint16_t max_chars
the maximum size of the buffer in characters (including terminating '\0')
void Assign(StringID string)
Render a string into the textbuffer.
uint16_t markend
the end position of the marked area in the buffer, in bytes
void DeleteText(uint16_t from, uint16_t to, bool update)
Delete a part of the text.
bool MoveNext(StringIterator::IterType what)
Move to next character position.
bool InsertClipboard()
Insert a chunk of text from the clipboard onto the textbuffer.
uint16_t bytes
the current size of the string in bytes (including terminating '\0')
const char * GetText() const
Get the current text.
uint16_t caretxoffs
the current position of the caret in pixels
uint16_t marklength
the length of the marked area in pixels
uint16_t markpos
the start position of the marked area in the buffer, in bytes
bool CanDelChar(bool backspace)
Checks if it is possible to delete a character.
void DiscardMarkedText(bool update=true)
Discard any marked text.
bool caret
is the caret ("_") visible or not
CharSetFilter afilter
Allowed characters.
bool InsertChar(char32_t key)
Insert a character to a textbuffer.
void UpdateStringIter()
Update the character iter after the text has changed.
char *const buf
buffer in which text is saved
bool HandleCaret()
Handle the flashing of the caret.
void UpdateCaretPosition()
Update pixel position of the caret.
HandleKeyPressResult
Return values for Textbuf::HandleKeypress.
@ HKPR_NOT_HANDLED
Key does not affect editboxes.
@ HKPR_CANCEL
Escape key pressed.
@ HKPR_EDITING
Textbuf content changed.
@ HKPR_CONFIRM
Return or enter key pressed.
@ HKPR_CURSOR
Non-text change, e.g. cursor position.