51 void SetOnTextChanged(std::function<
void(
const std::string &)> callback)
override;
57 void GetPosition(
float &x,
float &y)
const override;
60 void SetSize(
float width,
float height)
override;
63 void GetSize(
float &width,
float &height)
const override;
93 [[nodiscard]]
const std::string &
GetText()
const override;
96 void SetText(
const std::string &text)
override;
99 void Clear()
override;
102 [[nodiscard]]
bool IsFocused()
const override;
108 void SetFont(
int fontHandle)
override;
123 [[nodiscard]]
bool IsEnabled()
const override;
Abstract interface for graphics rendering operations.
Abstract interface for UI text input fields.
Raylib implementation of the ITextInput interface.
void GetSize(float &width, float &height) const override
Get the current size of the text input.
const std::string & GetText() const override
Get the current text content.
static constexpr float BORDER_THICKNESS
std::string _regexPattern
void GetPosition(float &x, float &y) const override
Get the current top-left position of the text input.
bool IsPasswordMode() const override
Check if password mode is enabled.
void SetTextSize(int size) override
Set the text size in pixels.
void SetFocused(bool focused) override
Set focus state programmatically.
static constexpr float BACKSPACE_REPEAT_DELAY
static constexpr float CURSOR_BLINK_RATE
void HandleBackspace()
Handle backspace key with repeat support.
void ResetCursor()
Show cursor and reset blink timer.
bool TryAddCharacter(char c)
Add a character to the text if valid.
void SetOnTextChanged(std::function< void(const std::string &)> callback) override
Set callback invoked when text changes.
bool IsEnabled() const override
Check if the text input is enabled.
unsigned int _activeBorderColor
void SetValidationRegex(const std::string ®exPattern) override
Set a regex pattern to restrict allowed characters.
bool IsMouseOver() const
Check whether the mouse cursor is currently over the input rectangle.
unsigned int _backgroundColor
void SetActiveBorderColor(unsigned int color) override
Set the border color when the input is focused/active.
void SetAlign(Align align) override
Set alignment mode relative to the window.
bool IsFocused() const override
Check if the text input is currently focused/active.
void SetBorderColor(unsigned int color) override
Set the border color when the input is not focused.
void SetText(const std::string &text) override
Set the text content programmatically.
void HandleFocusClick()
Handle mouse click to set focus state.
void SetTextColor(unsigned int color) override
Set the text color.
void ApplyAlignment() override
Apply the current alignment mode to the position.
void SetPasswordMode(bool passwordMode) override
Enable or disable password mode (masks characters with asterisks).
void Clear() override
Clear the text content.
void SetFont(int fontHandle) override
Set the font handle for rendering text.
Graphics::IGraphics & _graphics
void SetPlaceholderColor(unsigned int color) override
Set the placeholder text color (when input is empty).
void SetPosition(float x, float y) override
Set the top-left position of the text input.
std::function< void(const std::string &)> _onTextChanged
void Render() override
Render the text input box.
void SetSize(float width, float height) override
Set the text input size.
void SetBackgroundColor(unsigned int color) override
Set the background color of the text input box.
void SetEnabled(bool enabled) override
Enable or disable the text input.
void HandlePaste()
Handle paste operation (Ctrl+V or Cmd+V).
Align GetAlign() const override
Get the current alignment mode.
void UpdateCursorBlink()
Update cursor blink animation.
void HandleCharacterInput()
Handle regular character input.
void SetMaxLength(size_t maxLength) override
Set the maximum number of characters allowed.
void Update() override
Update the text input internal state (focus, cursor, input).
bool IsCharValid(char c) const
Validate a character against the current regex pattern.
static constexpr float BACKSPACE_REPEAT_RATE
void SetPlaceholder(const std::string &placeholder) override
Set the placeholder text displayed when the input is empty.
static constexpr float TEXT_PADDING
std::unique_ptr< std::regex > _validationRegex
unsigned int _placeholderColor
~RaylibTextInput() override=default
Destroy the RaylibTextInput.
unsigned int _borderColor
Align
Alignment modes relative to the current window.