1 #ifndef TERMOX_WIDGET_WIDGETS_LINE_EDIT_HPP
2 #define TERMOX_WIDGET_WIDGETS_LINE_EDIT_HPP
8 #include <signals_light/signal.hpp>
10 #include <termox/painter/glyph_string.hpp>
11 #include <termox/system/key.hpp>
12 #include <termox/widget/widgets/detail/textline_base.hpp>
18 using Validator_t = std::function<bool(char32_t)>;
22 Align alignment = Align::Left;
23 Action focus_in_action = Action::None;
24 std::optional<Validator_t> validator = std::nullopt;
38 std::optional<Validator_t>
validator = std::nullopt);
51 [[nodiscard]]
auto validator() const noexcept
52 -> std::optional<Validator_t> const&;
60 std::optional<Validator_t> validator_;
64 [[nodiscard]] auto line_edit(
Holds a collection of Glyphs with a similar interface to std::string.
Definition: glyph_string.hpp:19
Definition: line_edit.hpp:16
auto focus_out_event() -> bool override
Handles Focus_out_event objects.
Definition: line_edit.cpp:56
auto validator() const noexcept -> std::optional< Validator_t > const &
Return the current validator function object, or nullopt if not set.
Definition: line_edit.cpp:37
void disable_validator()
Turn off the validator so all text input is valid.
Definition: line_edit.cpp:34
auto key_press_event(ox::Key k) -> bool override
Handles Key_press_event objects.
Definition: line_edit.cpp:42
void set_validator(std::optional< Validator_t > x)
Set the input validator, allowing or disallowing specific char values.
Definition: line_edit.cpp:28
sl::Signal< void(std::string const &)> submitted
Emitted on Enter key press, sends along the current contents.
Definition: line_edit.hpp:29
sl::Signal< void(std::string const &)> text_modified
Emitted on every printable key press, sends along the current contents.
Definition: line_edit.hpp:32
Implements single line text Cursor navigation and deletion, no text input.
Definition: textline_base.hpp:14
auto alignment() const noexcept -> ox::Align
Return the current alignment.
Definition: textline_base.cpp:46
auto focus_in_action() const noexcept -> Action
Return the currently used focus in event Action.
Definition: textline_base.cpp:57
Definition: line_edit.hpp:20