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

clan::SpanLayout::SpanLayout ( )
clan::SpanLayout::~SpanLayout ( )

Member Function Documentation

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
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
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
void clan::SpanLayout::clear ( )

Clear.

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

Draw layout.

Parameters
canvas= Canvas
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
Size clan::SpanLayout::find_preferred_size ( Canvas canvas)

Find preferred size.

Parameters
canvas= Canvas
Returns
Size
std::string clan::SpanLayout::get_combined_text ( ) const

Get Combined text.

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

Rect clan::SpanLayout::get_rect ( ) const

Get Rect.

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

Get Rect By Id.

Returns
rect
Size clan::SpanLayout::get_size ( ) const

Get Size.

Returns
size
void clan::SpanLayout::hide_cursor ( )

Hides the cursor caret.

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

Hit test.

Parameters
canvas= Canvas
pos= Point
Returns
Hit Test Result
void clan::SpanLayout::layout ( Canvas canvas,
int  max_width 
)

Layout.

Parameters
canvas= Canvas
max_width= value
void clan::SpanLayout::set_align ( SpanAlign  align)

Sets the text alignment.

Alignment is applied when layout() is called

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

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

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

Parameters
pos= Index of cursor
void clan::SpanLayout::set_position ( const Point pos)

Set position.

Parameters
pos= Point
void clan::SpanLayout::set_selection_colors ( const Colorf foreground,
const Colorf background 
)

Set selection colors.

Parameters
foreground= Colorf
background= Colorf
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
void clan::SpanLayout::show_cursor ( )

Shows the cursor caret.


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