|
CPGen
C++ project generator
|
A single-line text input component. More...
#include <Input.hpp>


Public Member Functions | |
| Input (std::string label, std::function< void(std::string)> on_change) | |
| Construct an Input with a label and a change callback. | |
| std::string | render () const override |
| Render the input box as a multi-line ANSI string. | |
| bool | handleInput (Defs::Key key) override |
| Handle a key event. | |
Public Member Functions inherited from Component | |
| Component ()=default | |
| virtual | ~Component ()=default |
| Virtual destructor — components are always owned via base-class pointer. | |
| Component (const Component &)=delete | |
| Non-copyable (unique ownership). | |
| Component & | operator= (const Component &)=delete |
| Non-copyable (unique ownership). | |
| Component (Component &&)=delete | |
| Non-movable. | |
| Component & | operator= (Component &&)=delete |
| Non-movable. | |
| virtual void | setFocused (bool focused) |
| Change the focus state of this component. | |
| bool | isFocused () const |
| Return whether this component currently has keyboard focus. | |
Additional Inherited Members | |
Protected Attributes inherited from Component | |
| bool | m_is_focused |
| Current focus state, managed by setFocused. | |
A single-line text input component.
Renders a fixed-width bordered box containing a label on the left and the current value on the right. When focused, the box is highlighted with a distinct colour. The component accepts printable character input, handles Defs::Special::Backspace for deletion, and fires on_change on every modification.
| Input::Input | ( | std::string | label, |
| std::function< void(std::string)> | on_change | ||
| ) |
Construct an Input with a label and a change callback.
| label | Descriptive text shown in the top border of the widget. |
| on_change | Callback invoked with the current full value string after every character is added or removed. |
|
overridevirtual |
Handle a key event.
char → appended to the current value.false).| key | The key to process. |
true if the key was consumed, false otherwise. Implements Component.
|
overridevirtual |
Render the input box as a multi-line ANSI string.
Implements Component.
