32 #include "../../Core/Math/rect.h"
33 #include "../../Core/Math/size.h"
34 #include "../../Core/Math/color.h"
39 typedef std::shared_ptr<Font>
FontPtr;
44 typedef std::shared_ptr<Image>
ImagePtr;
46 typedef std::shared_ptr<Canvas>
CanvasPtr;
72 static std::shared_ptr<TextBlock>
create();
92 virtual void clear() = 0;
98 virtual void add_image(
const ImagePtr &
image,
float baseline_offset = 0.0
f,
int id = -1) = 0;
101 virtual void add_component(std::shared_ptr<SpanComponent> component,
float baseline_offset = 0.0
f,
int id = -1) = 0;
104 virtual void layout(
const CanvasPtr &canvas,
float max_width) = 0;
116 virtual std::vector<Rectf>
rect_by_id(
int id)
const = 0;
122 virtual void draw_layout(
const CanvasPtr &canvas) = 0;
virtual Sizef find_preferred_size(const CanvasPtr &canvas)=0
Find the preferred size for the given layout.
virtual Sizef size() const =0
Returns the size of the layout.
virtual void set_selection_range(std::string::size_type start, std::string::size_type end)=0
Set selection range.
virtual void set_align(SpanAlign align)=0
Sets the text alignment.
virtual void add_image(const ImagePtr &image, float baseline_offset=0.0f, int id=-1)=0
Add image object.
static Colorf white
Definition: color.h:1207
Definition: text_block.h:80
std::shared_ptr< TextBlock > TextBlockPtr
Definition: text_block.h:175
2D (x,y) point structure - Float
Definition: point.h:68
Definition: text_block.h:81
virtual void set_component_geometry()=0
Set component geometry.
virtual void set_cursor_color(const Colorf &color)=0
Sets the cursor color.
Definition: text_block.h:83
virtual void layout(const CanvasPtr &canvas, float max_width)=0
Layout objects.
Floating point color description class (for float).
Definition: color.h:630
virtual Sizef size() const =0
Size of component.
static std::shared_ptr< TextBlock > create()
virtual void set_cursor_pos(std::string::size_type pos)=0
Sets the cursor position.
Definition: text_block.h:78
int object_id
Definition: text_block.h:87
virtual void show_cursor()=0
Shows the cursor caret.
Type type
Definition: text_block.h:86
virtual void set_cursor_overwrite_mode(bool enable)=0
Toggles whether the cursor caret is shown as a solid box or a line.
virtual std::vector< Rectf > rect_by_id(int id) const =0
Returns the geometry of the object with the given id.
SpanAlign
Span Align.
Definition: text_block.h:49
2D (width,height) size structure - Float
Definition: size.h:180
virtual void add_text(const std::string &text, const FontPtr &font, const Colorf &color=Colorf::white, int id=-1)=0
Add text object.
Definition: text_block.h:82
2D (left,top,right,bottom) rectangle structure - Float
Definition: rect.h:505
virtual Rectf rect() const =0
Returns the geometry of the layout.
Component placed in the layout.
Definition: text_block.h:58
std::shared_ptr< Font > FontPtr
Definition: path.h:39
std::shared_ptr< Image > ImagePtr
Definition: image.h:116
virtual std::string combined_text() const =0
Get all text.
Type
Definition: text_block.h:76
virtual void draw_layout(const CanvasPtr &canvas)=0
Draw layout.
Definition: text_block.h:74
Definition: text_block.h:79
virtual float last_baseline_offset()=0
Returns the baseline offset for the last baseline.
virtual void draw_layout_ellipsis(const CanvasPtr &canvas, const Rectf &content_rect)=0
Draw layout generating ellipsis for clipped text.
Span layout class.
Definition: text_block.h:69
virtual float first_baseline_offset()=0
Returns the baseline offset for the first baseline.
virtual void set_selection_colors(const Colorf &foreground, const Colorf &background)=0
Set selection colors.
virtual void add_component(std::shared_ptr< SpanComponent > component, float baseline_offset=0.0f, int id=-1)=0
Add component object.
std::shared_ptr< Canvas > CanvasPtr
Definition: canvas.h:126
virtual void set_geometry(const Rectf &geometry)=0
Sets the component geometry after layout.
virtual void clear()=0
Removes all objects.
virtual void hide_cursor()=0
Hides the cursor caret.
Definition: Application/application.h:35
virtual HitTestResult hit_test(const CanvasPtr &canvas, const Pointf &pos)=0
Hit test which object is located at the specified position.
virtual void set_position(const Pointf &pos)=0
Set position of layout.
int offset
Definition: text_block.h:88