uicore::TextBlock Class Referenceabstract

Span layout class. More...

#include <text_block.h>

Classes

struct  HitTestResult
 

Public Member Functions

virtual void add_component (std::shared_ptr< SpanComponent > component, float baseline_offset=0.0f, int id=-1)=0
 Add component object. More...
 
virtual void add_image (const ImagePtr &image, float baseline_offset=0.0f, int id=-1)=0
 Add image object. More...
 
virtual void add_text (const std::string &text, const FontPtr &font, const Colorf &color=Colorf::white, int id=-1)=0
 Add text object. More...
 
virtual void clear ()=0
 Removes all objects. More...
 
virtual std::string combined_text () const =0
 Get all text. More...
 
virtual void draw_layout (const CanvasPtr &canvas)=0
 Draw layout. More...
 
virtual void draw_layout_ellipsis (const CanvasPtr &canvas, const Rectf &content_rect)=0
 Draw layout generating ellipsis for clipped text. More...
 
virtual Sizef find_preferred_size (const CanvasPtr &canvas)=0
 Find the preferred size for the given layout. More...
 
virtual float first_baseline_offset ()=0
 Returns the baseline offset for the first baseline. More...
 
virtual void hide_cursor ()=0
 Hides the cursor caret. More...
 
virtual HitTestResult hit_test (const CanvasPtr &canvas, const Pointf &pos)=0
 Hit test which object is located at the specified position. More...
 
virtual float last_baseline_offset ()=0
 Returns the baseline offset for the last baseline. More...
 
virtual void layout (const CanvasPtr &canvas, float max_width)=0
 Layout objects. More...
 
virtual Rectf rect () const =0
 Returns the geometry of the layout. More...
 
virtual std::vector< Rectfrect_by_id (int id) const =0
 Returns the geometry of the object with the given id. More...
 
virtual void set_align (SpanAlign align)=0
 Sets the text alignment. More...
 
virtual void set_component_geometry ()=0
 Set component geometry. More...
 
virtual void set_cursor_color (const Colorf &color)=0
 Sets the cursor color. More...
 
virtual void set_cursor_overwrite_mode (bool enable)=0
 Toggles whether the cursor caret is shown as a solid box or a line. More...
 
virtual void set_cursor_pos (std::string::size_type pos)=0
 Sets the cursor position. More...
 
virtual void set_position (const Pointf &pos)=0
 Set position of layout. More...
 
virtual void set_selection_colors (const Colorf &foreground, const Colorf &background)=0
 Set selection colors. More...
 
virtual void set_selection_range (std::string::size_type start, std::string::size_type end)=0
 Set selection range. More...
 
virtual void show_cursor ()=0
 Shows the cursor caret. More...
 
virtual Sizef size () const =0
 Returns the size of the layout. More...
 

Static Public Member Functions

static std::shared_ptr< TextBlockcreate ()
 

Detailed Description

Span layout class.

Member Function Documentation

virtual void uicore::TextBlock::add_component ( std::shared_ptr< SpanComponent component,
float  baseline_offset = 0.0f,
int  id = -1 
)
pure virtual

Add component object.

virtual void uicore::TextBlock::add_image ( const ImagePtr image,
float  baseline_offset = 0.0f,
int  id = -1 
)
pure virtual

Add image object.

virtual void uicore::TextBlock::add_text ( const std::string text,
const FontPtr font,
const Colorf color = Colorf::white,
int  id = -1 
)
pure virtual

Add text object.

virtual void uicore::TextBlock::clear ( )
pure virtual

Removes all objects.

virtual std::string uicore::TextBlock::combined_text ( ) const
pure virtual

Get all text.

static std::shared_ptr<TextBlock> uicore::TextBlock::create ( )
static
virtual void uicore::TextBlock::draw_layout ( const CanvasPtr canvas)
pure virtual

Draw layout.

virtual void uicore::TextBlock::draw_layout_ellipsis ( const CanvasPtr canvas,
const Rectf content_rect 
)
pure virtual

Draw layout generating ellipsis for clipped text.

virtual Sizef uicore::TextBlock::find_preferred_size ( const CanvasPtr canvas)
pure virtual

Find the preferred size for the given layout.

virtual float uicore::TextBlock::first_baseline_offset ( )
pure virtual

Returns the baseline offset for the first baseline.

virtual void uicore::TextBlock::hide_cursor ( )
pure virtual

Hides the cursor caret.

virtual HitTestResult uicore::TextBlock::hit_test ( const CanvasPtr canvas,
const Pointf pos 
)
pure virtual

Hit test which object is located at the specified position.

virtual float uicore::TextBlock::last_baseline_offset ( )
pure virtual

Returns the baseline offset for the last baseline.

virtual void uicore::TextBlock::layout ( const CanvasPtr canvas,
float  max_width 
)
pure virtual

Layout objects.

virtual Rectf uicore::TextBlock::rect ( ) const
pure virtual

Returns the geometry of the layout.

virtual std::vector<Rectf> uicore::TextBlock::rect_by_id ( int  id) const
pure virtual

Returns the geometry of the object with the given id.

virtual void uicore::TextBlock::set_align ( SpanAlign  align)
pure virtual

Sets the text alignment.

Alignment is applied when layout() is called

virtual void uicore::TextBlock::set_component_geometry ( )
pure virtual

Set component geometry.

virtual void uicore::TextBlock::set_cursor_color ( const Colorf color)
pure virtual

Sets the cursor color.

Parameters
color= Color of cursor
virtual void uicore::TextBlock::set_cursor_overwrite_mode ( bool  enable)
pure virtual

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
virtual void uicore::TextBlock::set_cursor_pos ( std::string::size_type  pos)
pure virtual

Sets the cursor position.

Parameters
pos= Index of cursor
virtual void uicore::TextBlock::set_position ( const Pointf pos)
pure virtual

Set position of layout.

virtual void uicore::TextBlock::set_selection_colors ( const Colorf foreground,
const Colorf background 
)
pure virtual

Set selection colors.

virtual void uicore::TextBlock::set_selection_range ( std::string::size_type  start,
std::string::size_type  end 
)
pure virtual

Set selection range.

virtual void uicore::TextBlock::show_cursor ( )
pure virtual

Shows the cursor caret.

virtual Sizef uicore::TextBlock::size ( ) const
pure virtual

Returns the size of the layout.


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