1 #ifndef TERMOX_WIDGET_WIDGETS_DETAIL_TEXTBOX_BASE_HPP
2 #define TERMOX_WIDGET_WIDGETS_DETAIL_TEXTBOX_BASE_HPP
5 #include <signals_light/signal.hpp>
7 #include <termox/painter/glyph_string.hpp>
8 #include <termox/widget/point.hpp>
9 #include <termox/widget/widgets/text_view.hpp>
11 namespace ox::detail {
22 Wrap
wrap = Wrap::Word,
76 auto
resize_event(Area new_size, Area old_size) ->
bool override;
80 void increment_cursor_right();
83 void increment_cursor_left();
Holds the look of any paintable object with Traits and Colors.
Definition: brush.hpp:13
Holds a collection of Glyphs with a similar interface to std::string.
Definition: glyph_string.hpp:19
Non-interactive box to display a given Glyph_string.
Definition: text_view.hpp:21
auto alignment() const -> Align
Return the currently used Alignment.
Definition: text_view.cpp:53
Brush insert_brush
Brush to be applied to all new incoming Glyphs, but not existing Glyphs.
Definition: text_view.hpp:33
auto wrap() const -> Wrap
Return the currently set text Wrap type.
Definition: text_view.cpp:61
auto text() -> Glyph_string &
Return the entire contents of the Text_view.
Definition: text_view.cpp:43
Implements cursor movement on top of a Text_view, for use by Textbox.
Definition: textbox_base.hpp:14
sl::Signal< void(std::size_t n)> cursor_moved_left
Emitted when the cursor moves left, passes along positions moved.
Definition: textbox_base.hpp:29
void cursor_right(int n=1)
Move the cursor n indices towards the end of contents.
Definition: textbox_base.cpp:80
Textbox_base(Glyph_string text=U"", Align alignment=Align::Left, Wrap wrap=Wrap::Word, Brush insert_brush=Brush{})
Construct with initial text, enable cursor.
Definition: textbox_base.cpp:9
void scroll_up(int n=1) override
Add cursor movement to Text_view::scroll_up.
Definition: textbox_base.cpp:31
void cursor_down(int n=1)
Move the cursor down n lines, scroll if at the bottom line.
Definition: textbox_base.cpp:59
void scroll_down(int n=1) override
Add cursor movement to Text_view::scroll_down.
Definition: textbox_base.cpp:41
sl::Signal< void(std::size_t n)> cursor_moved_up
Emitted when the cursor moves up, passes along positions moved.
Definition: textbox_base.hpp:35
sl::Signal< void(std::size_t n)> cursor_moved_down
Emitted when the cursor moves down, passes along positions moved.
Definition: textbox_base.hpp:38
void cursor_left(int n=1)
Move the cursor n indices towards the beginning of contents.
Definition: textbox_base.cpp:73
auto resize_event(Area new_size, Area old_size) -> bool override
Scroll to make the cursor visible if no longer on screen after resize.
Definition: textbox_base.cpp:92
void cursor_up(int n=1)
Move the cursor up n lines, scroll if at the top line.
Definition: textbox_base.cpp:48
auto cursor_index() const -> int
Return the index into contents that the cursor is located at.
Definition: textbox_base.cpp:87
void set_cursor(Point position)
Set the cursor to position, or the nearest Glyph if no glyph there.
Definition: textbox_base.cpp:20
sl::Signal< void(std::size_t n)> cursor_moved_right
Emitted when the cursor moves right, passes along positions moved.
Definition: textbox_base.hpp:32
Definition: text_view.hpp:23