1 #ifndef TERMOX_WIDGET_WIDGETS_DETAIL_TEXTLINE_CORE_HPP
2 #define TERMOX_WIDGET_WIDGETS_DETAIL_TEXTLINE_CORE_HPP
3 #include <termox/painter/glyph.hpp>
4 #include <termox/painter/glyph_string.hpp>
5 #include <termox/widget/align.hpp>
15 int cursor_index = 0);
37 [[nodiscard]]
auto alignment()
const noexcept -> ox::Align;
78 int anchor_index_ = 0;
Holds a collection of Glyphs with a similar interface to std::string.
Definition: glyph_string.hpp:19
Provides a view of a Glyph_string and cursor position over a fixed length.
Definition: textline_core.hpp:10
auto display_length() const noexcept -> int
Return the current display_length.
Definition: textline_core.cpp:59
void set_cursor_to_index(int i)
Move the cursor to the Glyph at index i into the text, scrolls.
Definition: textline_core.cpp:102
void increment_cursor()
Move the cursor one position to the right, scrolling the text if needed.
Definition: textline_core.cpp:76
void cursor_home()
Move the Cursor to the first index and scroll.
Definition: textline_core.cpp:113
auto display_substr() const -> ox::Glyph_string
Return a substring that fits within width, accounting for cursor scroll.
Definition: textline_core.cpp:161
void decrement_cursor()
Move the cursor one position to the left, scrolling the text if needed.
Definition: textline_core.cpp:85
void set_alignment(ox::Align x)
Set either Left or Right Alignment, display_length interacts with this.
Definition: textline_core.cpp:64
auto cursor_position() const noexcept -> int
Return the position along the display length that the cursor is at.
Definition: textline_core.cpp:156
void set_text(ox::Glyph_string x)
Clear and reset the text.
Definition: textline_core.cpp:24
void erase_at_cursor()
Remove the Glyph at the cursor index.
Definition: textline_core.cpp:133
void clear()
Erase all text and reset anchor and cursor indices.
Definition: textline_core.cpp:38
void cursor_end()
Move the Cursor to the last index and scroll.
Definition: textline_core.cpp:119
void move_cursor_to_display(int x)
Move the cursor to the closest index to display position x.
Definition: textline_core.cpp:93
void set_display_length(int x)
Set the number of cells that the text will be displayed in.
Definition: textline_core.cpp:45
void insert_at_cursor(ox::Glyph x)
Inserts x at the current cursor index.
Definition: textline_core.cpp:126
auto text() const noexcept -> ox::Glyph_string const &
Return the full text contents.
Definition: textline_core.cpp:33
auto alignment() const noexcept -> ox::Align
Return the current alignment.
Definition: textline_core.cpp:71
void erase_before_cursor()
Remove the Glyph at one less the cursor index, if valid.
Definition: textline_core.cpp:145
Holds a description of a paintable tile on the screen.
Definition: glyph.hpp:11