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< Rectget_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...
 

Detailed Description

Span layout class.

Constructor & Destructor Documentation

◆ SpanLayout()

clan::SpanLayout::SpanLayout ( )

◆ ~SpanLayout()

clan::SpanLayout::~SpanLayout ( )

Member Function Documentation

◆ add_component()

template<typename T >
void clan::SpanLayout::add_component ( T *  component,
int  baseline_offset = 0,
int  id = -1 
)

Add component.

Parameters
component= T
baseline_offset= value
id= value

◆ add_image()

void clan::SpanLayout::add_image ( const Image image,
int  baseline_offset = 0,
int  id = -1 
)

Add image.

Parameters
image= Image
baseline_offset= value
id= value

◆ add_text()

void clan::SpanLayout::add_text ( const std::string text,
const Font font,
const Colorf color = StandardColorf::white(),
int  id = -1 
)

Add text.

Parameters
text= String
font= Font
color= Colorf
id= value

◆ clear()

void clan::SpanLayout::clear ( )

Clear.

◆ draw_layout()

void clan::SpanLayout::draw_layout ( Canvas canvas)

Draw layout.

Parameters
canvas= Canvas

◆ draw_layout_ellipsis()

void clan::SpanLayout::draw_layout_ellipsis ( Canvas canvas,
const Rect content_rect 
)

Draw layout generating ellipsis for clipped text.

Parameters
canvas= Canvas
content_rect= Clipping rectangle

◆ find_preferred_size()

Size clan::SpanLayout::find_preferred_size ( Canvas canvas)

Find preferred size.

Parameters
canvas= Canvas
Returns
Size

◆ get_combined_text()

std::string clan::SpanLayout::get_combined_text ( ) const

Get Combined text.

Returns
combined_text

◆ get_first_baseline_offset()

int clan::SpanLayout::get_first_baseline_offset ( )

Returns the baseline offset for the first baseline.

◆ get_last_baseline_offset()

int clan::SpanLayout::get_last_baseline_offset ( )

Returns the baseline offset for the last baseline.

◆ get_rect()

Rect clan::SpanLayout::get_rect ( ) const

Get Rect.

Returns
rect

◆ get_rect_by_id()

std::vector<Rect> clan::SpanLayout::get_rect_by_id ( int  id) const

Get Rect By Id.

Returns
rect

◆ get_size()

Size clan::SpanLayout::get_size ( ) const

Get Size.

Returns
size

◆ hide_cursor()

void clan::SpanLayout::hide_cursor ( )

Hides the cursor caret.

◆ hit_test()

HitTestResult clan::SpanLayout::hit_test ( Canvas canvas,
const Point pos 
)

Hit test.

Parameters
canvas= Canvas
pos= Point
Returns
Hit Test Result

◆ layout()

void clan::SpanLayout::layout ( Canvas canvas,
int  max_width 
)

Layout.

Parameters
canvas= Canvas
max_width= value

◆ set_align()

void clan::SpanLayout::set_align ( SpanAlign  align)

Sets the text alignment.

Alignment is applied when layout() is called

Parameters
align= The alignment

◆ set_component_geometry()

void clan::SpanLayout::set_component_geometry ( )

Set component geometry.

◆ set_cursor_color()

void clan::SpanLayout::set_cursor_color ( const Colorf color)

Sets the cursor color.

Parameters
color= Color of cursor

◆ set_cursor_overwrite_mode()

void clan::SpanLayout::set_cursor_overwrite_mode ( bool  enable)

Toggles whether the cursor caret is shown as a solid box or a line.

Parameters
enable= Shows the cursor as a solid box if set to true

◆ set_cursor_pos()

void clan::SpanLayout::set_cursor_pos ( std::string::size_type  pos)

Sets the cursor position.

Parameters
pos= Index of cursor

◆ set_position()

void clan::SpanLayout::set_position ( const Point pos)

Set position.

Parameters
pos= Point

◆ set_selection_colors()

void clan::SpanLayout::set_selection_colors ( const Colorf foreground,
const Colorf background 
)

Set selection colors.

Parameters
foreground= Colorf
background= Colorf

◆ set_selection_range()

void clan::SpanLayout::set_selection_range ( std::string::size_type  start,
std::string::size_type  end 
)

Set selection range.

Parameters
size_type= String
size_type= String

◆ show_cursor()

void clan::SpanLayout::show_cursor ( )

Shows the cursor caret.


The documentation for this class was generated from the following file: