CPGen
C++ project generator
Loading...
Searching...
No Matches
Input.hpp
Go to the documentation of this file.
1#pragma once
2
10#include <functional>
11#include <string>
12
30class Input : public Component {
31public:
38 Input(std::string label, std::function<void(std::string)> on_change);
39
44 [[nodiscard]] std::string render() const override;
45
56 bool handleInput(Defs::Key key) override;
57
58private:
59 std::string m_label;
60 std::string m_value;
61 std::function<void(std::string)>
62 m_on_change;
63};
Abstract base class for all TUI components.
Abstract base for all TUI widgets.
Definition Component.hpp:38
A single-line text input component.
Definition Input.hpp:30
bool handleInput(Defs::Key key) override
Handle a key event.
Definition Input.cpp:74
std::string render() const override
Render the input box as a multi-line ANSI string.
Definition Input.cpp:14
std::variant< char, Special > Key
A single keypress from stdin, represented as either a printable character or a Special control key.
Definition Defs.hpp:45