Span layout class. More...
#include <span_layout.h>
Classes | |
| struct | HitTestResult |
Public Member Functions | |
| SpanLayout () | |
| ~SpanLayout () | |
| template<typename T > | |
| void | add_component (T *component, int baseline_offset=0, int id=-1) |
| Add component. More... | |
| void | add_image (const Image &image, int baseline_offset=0, int id=-1) |
| Add image. More... | |
| void | add_text (const std::string &text, const Font &font, const Colorf &color=StandardColorf::white(), int id=-1) |
| Add text. More... | |
| void | clear () |
| Clear. More... | |
| void | draw_layout (Canvas &canvas) |
| Draw layout. More... | |
| void | draw_layout_ellipsis (Canvas &canvas, const Rect &content_rect) |
| Draw layout generating ellipsis for clipped text. More... | |
| Size | find_preferred_size (Canvas &canvas) |
| Find preferred size. More... | |
| std::string | get_combined_text () const |
| Get Combined text. More... | |
| int | get_first_baseline_offset () |
| Returns the baseline offset for the first baseline. More... | |
| int | get_last_baseline_offset () |
| Returns the baseline offset for the last baseline. More... | |
| Rect | get_rect () const |
| Get Rect. More... | |
| std::vector< Rect > | get_rect_by_id (int id) const |
| Get Rect By Id. More... | |
| Size | get_size () const |
| Get Size. More... | |
| void | hide_cursor () |
| Hides the cursor caret. More... | |
| HitTestResult | hit_test (Canvas &canvas, const Point &pos) |
| Hit test. More... | |
| void | layout (Canvas &canvas, int max_width) |
| Layout. More... | |
| void | set_align (SpanAlign align) |
| Sets the text alignment. More... | |
| void | set_component_geometry () |
| Set component geometry. More... | |
| void | set_cursor_color (const Colorf &color) |
| Sets the cursor color. More... | |
| void | set_cursor_overwrite_mode (bool enable) |
| Toggles whether the cursor caret is shown as a solid box or a line. More... | |
| void | set_cursor_pos (std::string::size_type pos) |
| Sets the cursor position. More... | |
| void | set_position (const Point &pos) |
| Set position. More... | |
| void | set_selection_colors (const Colorf &foreground, const Colorf &background) |
| Set selection colors. More... | |
| void | set_selection_range (std::string::size_type start, std::string::size_type end) |
| Set selection range. More... | |
| void | show_cursor () |
| Shows the cursor caret. More... | |
Span layout class.
| clan::SpanLayout::SpanLayout | ( | ) |
| clan::SpanLayout::~SpanLayout | ( | ) |
| void clan::SpanLayout::add_component | ( | T * | component, |
| int | baseline_offset = 0, |
||
| int | id = -1 |
||
| ) |
Add component.
| component | = T |
| baseline_offset | = value |
| id | = value |
| void clan::SpanLayout::add_image | ( | const Image & | image, |
| int | baseline_offset = 0, |
||
| int | id = -1 |
||
| ) |
Add image.
| image | = Image |
| baseline_offset | = value |
| id | = value |
| void clan::SpanLayout::add_text | ( | const std::string & | text, |
| const Font & | font, | ||
| const Colorf & | color = StandardColorf::white(), |
||
| int | id = -1 |
||
| ) |
| void clan::SpanLayout::clear | ( | ) |
Clear.
Draw layout generating ellipsis for clipped text.
| canvas | = Canvas |
| content_rect | = Clipping rectangle |
| std::string clan::SpanLayout::get_combined_text | ( | ) | const |
Get Combined text.
| int clan::SpanLayout::get_first_baseline_offset | ( | ) |
Returns the baseline offset for the first baseline.
| int clan::SpanLayout::get_last_baseline_offset | ( | ) |
Returns the baseline offset for the last baseline.
| void clan::SpanLayout::hide_cursor | ( | ) |
Hides the cursor caret.
| HitTestResult clan::SpanLayout::hit_test | ( | Canvas & | canvas, |
| const Point & | pos | ||
| ) |
| void clan::SpanLayout::layout | ( | Canvas & | canvas, |
| int | max_width | ||
| ) |
Layout.
| canvas | = Canvas |
| max_width | = value |
| void clan::SpanLayout::set_align | ( | SpanAlign | align | ) |
Sets the text alignment.
Alignment is applied when layout() is called
| align | = The alignment |
| void clan::SpanLayout::set_component_geometry | ( | ) |
Set component geometry.
| void clan::SpanLayout::set_cursor_color | ( | const Colorf & | color | ) |
Sets the cursor color.
| color | = Color of cursor |
| void clan::SpanLayout::set_cursor_overwrite_mode | ( | bool | enable | ) |
Toggles whether the cursor caret is shown as a solid box or a line.
| enable | = Shows the cursor as a solid box if set to true |
| void clan::SpanLayout::set_cursor_pos | ( | std::string::size_type | pos | ) |
Sets the cursor position.
| pos | = Index of cursor |
| void clan::SpanLayout::set_selection_range | ( | std::string::size_type | start, |
| std::string::size_type | end | ||
| ) |
Set selection range.
| size_type | = String |
| size_type | = String |
| void clan::SpanLayout::show_cursor | ( | ) |
Shows the cursor caret.