1 #ifndef TERMOX_WIDGET_WIDGETS_DETAIL_TEXTLINE_BASE_HPP
2 #define TERMOX_WIDGET_WIDGETS_DETAIL_TEXTLINE_BASE_HPP
3 #include <termox/system/key.hpp>
4 #include <termox/system/mouse.hpp>
5 #include <termox/widget/align.hpp>
6 #include <termox/widget/area.hpp>
7 #include <termox/widget/widget.hpp>
8 #include <termox/widget/widgets/detail/textline_core.hpp>
10 namespace ox::detail {
16 enum class Action { None, Clear };
20 ox::Align align = ox::Align::Left;
21 Action focus_in_action = Action::None;
26 ox::Align align = ox::Align::Left,
42 [[nodiscard]] auto
alignment() const noexcept -> ox::Align;
69 auto
resize_event(ox::Area new_size, ox::Area old_size) ->
bool override;
76 Action focus_in_action_;
Holds a collection of Glyphs with a similar interface to std::string.
Definition: glyph_string.hpp:19
Contains functions to paint Glyphs to a Widget's screen area.
Definition: painter.hpp:21
Implements single line text Cursor navigation and deletion, no text input.
Definition: textline_base.hpp:14
auto text() const noexcept -> ox::Glyph_string const &
Return the full text contents.
Definition: textline_base.cpp:35
auto resize_event(ox::Area new_size, ox::Area old_size) -> bool override
Handles Resize_event objects.
Definition: textline_base.cpp:110
auto focus_out_event() -> bool override
Handles Focus_out_event objects.
Definition: textline_base.cpp:127
void set_text(ox::Glyph_string x)
Clear and reset the text being displayed.
Definition: textline_base.cpp:29
auto paint_event(ox::Painter &p) -> bool override
Handles Paint_event objects.
Definition: textline_base.cpp:68
void nothing_on_focus()
Does nothing on focus in event.
Definition: textline_base.cpp:55
auto key_press_event(ox::Key k) -> bool override
Handles Key_press_event objects.
Definition: textline_base.cpp:87
void set_cursor_to_index(int i)
Set the Cursor to the Glyph in text at index .
Definition: textline_base.cpp:62
auto alignment() const noexcept -> ox::Align
Return the current alignment.
Definition: textline_base.cpp:46
auto mouse_press_event(ox::Mouse const &m) -> bool override
Handles Mouse_press_event objects.
Definition: textline_base.cpp:103
void set_focus_in_action(Action x)
Set the Action that occurs on focus in events.
Definition: textline_base.cpp:51
auto focus_in_action() const noexcept -> Action
Return the currently used focus in event Action.
Definition: textline_base.cpp:57
auto focus_in_event() -> bool override
Handles Focus_in_event objects.
Definition: textline_base.cpp:117
void clear_on_focus()
Clear the text on focus in event, restoring if nothing edited.
Definition: textline_base.cpp:53
void set_alignment(ox::Align x)
Set either Left or Right Alignment, asserts with other alignments.
Definition: textline_base.cpp:40
Provides a view of a Glyph_string and cursor position over a fixed length.
Definition: textline_core.hpp:10
Definition: textline_base.hpp:18