HikoGUI
Select Version: ⚠️ This documents the main development branch of HikoGUI. It might differ from release versions.
A low latency retained GUI
|
#include <hikogui/text/text_cursor.hpp>
Public Member Functions | |
constexpr | text_cursor (text_cursor const &) noexcept=default |
constexpr | text_cursor (text_cursor &&) noexcept=default |
constexpr text_cursor & | operator= (text_cursor const &) noexcept=default |
constexpr text_cursor & | operator= (text_cursor &&) noexcept=default |
constexpr text_cursor & | resize (size_t size) &noexcept |
Set the text size. | |
constexpr text_cursor | resize (size_t size) &&noexcept |
constexpr | text_cursor (size_t index, bool after) noexcept |
Create a new text cursor. | |
constexpr text_cursor | neighbor (size_t size) const noexcept |
Return the neighbor cursor. | |
constexpr text_cursor | after_neighbor (size_t size) const noexcept |
constexpr text_cursor | before_neighbor (size_t size) const noexcept |
constexpr bool | start_of_text () const noexcept |
constexpr bool | end_of_text (size_t size) const noexcept |
constexpr size_t | index () const noexcept |
constexpr bool | after () const noexcept |
constexpr bool | before () const noexcept |
Friends | |
constexpr friend bool | operator== (text_cursor const &, text_cursor const &)=default |
constexpr friend auto | operator<=> (text_cursor const &, text_cursor const &)=default |
A cursor-position in text.
The cursor position takes into account the index of the character and if it is in front or behind this character. This allows for more detailed positioning inside bidirectional text.
|
inlineconstexprnoexcept |
Create a new text cursor.
index | The character where the cursor is. |
after | True if the cursor is after the character, false if the cursor is before the character |
|
inlineconstexprnoexcept |
Return the neighbor cursor.
size | The text size. |
|
inlineconstexprnoexcept |
Set the text size.
This function will clamp the cursor position inside the actual text. It should be called before the cursor position is used to select characters in a text.
The cursor position after this function will be:
size | The size of the text string that this cursor points into. |