Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::CanvasItemText Class Referencefinal

#include <canvas-item-text.h>

Inheritance diagram for Inkscape::CanvasItemText:
Inkscape::CanvasItem

Public Member Functions

 CanvasItemText (CanvasItemGroup *group)
 Create a null control text.
 
 CanvasItemText (CanvasItemGroup *group, Geom::Point const &p, Glib::ustring text, bool scaled=false)
 Create a control text.
 
void set_coord (Geom::Point const &p)
 Set a text position.
 
void set_bg_radius (double rad)
 Set a text position.
 
bool contains (Geom::Point const &p, double tolerance=0) override
 Returns true if point p (in canvas units) is within tolerance (canvas units) distance of text.
 
void set_text (Glib::ustring text)
 
void set_fontsize (double fontsize)
 
void set_border (double border)
 
void set_background (uint32_t background)
 
void set_anchor (Geom::Point const &anchor_pt)
 Set the anchor point, x and y between 0.0 and 1.0.
 
void set_adjust (Geom::Point const &adjust_pt)
 
void set_fixed_line (bool fixed_line)
 
Geom::Rect get_text_size () const
 
- Public Member Functions inherited from Inkscape::CanvasItem
 CanvasItem (CanvasItemContext *context)
 
 CanvasItem (CanvasItemGroup *parent)
 
 CanvasItem (CanvasItem const &)=delete
 
CanvasItemoperator= (CanvasItem const &)=delete
 
void unlink ()
 
UI::Widget::Canvasget_canvas () const
 
CanvasItemGroupget_parent () const
 
bool is_descendant_of (CanvasItem const *ancestor) const
 
void set_z_position (int zpos)
 
void raise_to_top ()
 
void lower_to_bottom ()
 
void request_update ()
 
void update (bool propagate)
 
virtual void visit_page_rects (std::function< void(Geom::Rect const &)> const &) const
 
Geom::OptRect const & get_bounds () const
 
void grab (EventMask event_mask, Glib::RefPtr< Gdk::Cursor > const &={})
 
void ungrab ()
 
void render (Inkscape::CanvasItemBuffer &buf) const
 
bool is_visible () const
 
virtual void set_visible (bool visible)
 
void request_redraw ()
 
virtual void set_fill (uint32_t rgba)
 
void set_fill (CanvasItemColor color)
 
void set_fill_pattern (Cairo::RefPtr< Cairo::Pattern > pattern)
 
virtual void set_stroke (uint32_t rgba)
 
void set_stroke (CanvasItemColor color)
 
void set_stroke_width (double width)
 Set the stroke width.
 
void set_outline (uint32_t color)
 Set the outline color.
 
void set_outline_width (double width)
 Set the outline width.
 
double get_effective_outline () const
 Get the effective outline.
 
void set_name (std::string &&name)
 
std::string const & get_name () const
 
void update_canvas_item_ctrl_sizes (int size_index)
 
void set_pickable (bool pickable)
 
bool is_pickable () const
 
sigc::connection connect_event (sigc::slot< bool(CanvasEvent const &)> const &slot)
 
virtual bool handle_event (CanvasEvent const &event)
 
void canvas_item_print_tree (int level=0, int zorder=0) const
 

Protected Member Functions

 ~CanvasItemText () override=default
 
void _update (bool propagate) override
 Update and redraw control text.
 
void _render (Inkscape::CanvasItemBuffer &buf) const override
 Render text to screen via Cairo.
 
Geom::Rect load_text_extents ()
 Load the sizes of the text extent using the given font.
 
- Protected Member Functions inherited from Inkscape::CanvasItem
virtual ~CanvasItem ()
 
Geom::Affine const & affine () const
 
virtual void _mark_net_invisible ()
 
virtual void _invalidate_ctrl_handles ()
 
template<typename F >
void defer (F &&f)
 

Protected Attributes

Geom::Point _p
 
Cairo::TextExtents _text_extent
 
Cairo::TextExtents _text_size
 
Geom::Point _anchor_position
 
Geom::Point _adjust_offset
 
Geom::Rect _text_box
 
Glib::ustring _text
 
std::string _fontname = "sans-serif"
 
double _fontsize = 10
 
double _border = 3
 
double _bg_rad = 0
 
uint32_t _background = 0x0000007f
 
bool _use_background = false
 
bool _fixed_line = false
 
bool _scaled = false
 
- Protected Attributes inherited from Inkscape::CanvasItem
CanvasItemContext_context
 
CanvasItemGroup_parent
 
Geom::OptRect _bounds
 
bool _need_update = false
 
bool _visible = true
 
bool _net_visible = true
 
bool _pickable = false
 
uint32_t _fill = CANVAS_ITEM_COLORS[CANVAS_ITEM_SECONDARY]
 
Cairo::RefPtr< Cairo::Pattern > _fill_pattern
 
uint32_t _stroke = CANVAS_ITEM_COLORS[CANVAS_ITEM_PRIMARY]
 
double _stroke_width = 1.0
 
uint32_t _outline = 0x0
 
double _outline_width = 0
 
std::string _name
 
sigc::signal< bool(CanvasEvent const &)> _event_signal
 

Additional Inherited Members

- Public Attributes inherited from Inkscape::CanvasItem
boost::intrusive::list_member_hook member_hook
 

Detailed Description

Definition at line 29 of file canvas-item-text.h.

Constructor & Destructor Documentation

◆ CanvasItemText() [1/2]

Inkscape::CanvasItemText::CanvasItemText ( CanvasItemGroup group)

Create a null control text.

Definition at line 31 of file canvas-item-text.cpp.

References Inkscape::CanvasItem::_fill, and Inkscape::CanvasItem::_name.

◆ CanvasItemText() [2/2]

Inkscape::CanvasItemText::CanvasItemText ( CanvasItemGroup group,
Geom::Point const &  p,
Glib::ustring  text,
bool  scaled = false 
)

Create a control text.

Point are in document coordinates.

Definition at line 41 of file canvas-item-text.cpp.

References Inkscape::CanvasItem::_fill, Inkscape::CanvasItem::_name, and Inkscape::CanvasItem::request_update().

◆ ~CanvasItemText()

Inkscape::CanvasItemText::~CanvasItemText ( )
overrideprotecteddefault

Member Function Documentation

◆ _render()

◆ _update()

◆ contains()

bool Inkscape::CanvasItemText::contains ( Geom::Point const &  p,
double  tolerance = 0 
)
overridevirtual

Returns true if point p (in canvas units) is within tolerance (canvas units) distance of text.

Reimplemented from Inkscape::CanvasItem.

Definition at line 80 of file canvas-item-text.cpp.

◆ get_text_size()

Geom::Rect Inkscape::CanvasItemText::get_text_size ( ) const

◆ load_text_extents()

Geom::Rect Inkscape::CanvasItemText::load_text_extents ( )
protected

Load the sizes of the text extent using the given font.

Definition at line 198 of file canvas-item-text.cpp.

References _border, _fixed_line, _fontname, _fontsize, _text, _text_extent, _text_size, Geom::GenericRect< Coord >::from_xywh(), and surface.

Referenced by _update().

◆ set_adjust()

void Inkscape::CanvasItemText::set_adjust ( Geom::Point const &  adjust_pt)

◆ set_anchor()

void Inkscape::CanvasItemText::set_anchor ( Geom::Point const &  anchor_pt)

Set the anchor point, x and y between 0.0 and 1.0.

Definition at line 232 of file canvas-item-text.cpp.

References _anchor_position, Inkscape::CanvasItem::defer(), and Inkscape::CanvasItem::request_update().

Referenced by Inkscape::UI::Tools::set_pos_and_anchor().

◆ set_background()

void Inkscape::CanvasItemText::set_background ( uint32_t  background)

◆ set_bg_radius()

void Inkscape::CanvasItemText::set_bg_radius ( double  rad)

Set a text position.

Position is in document coordinates.

Definition at line 68 of file canvas-item-text.cpp.

References _bg_rad, Inkscape::CanvasItem::defer(), and Inkscape::CanvasItem::request_update().

◆ set_border()

void Inkscape::CanvasItemText::set_border ( double  border)

◆ set_coord()

void Inkscape::CanvasItemText::set_coord ( Geom::Point const &  p)

Set a text position.

Position is in document coordinates.

Definition at line 56 of file canvas-item-text.cpp.

References _p, Inkscape::CanvasItem::defer(), and Inkscape::CanvasItem::request_update().

Referenced by Inkscape::UI::Tools::set_pos_and_anchor().

◆ set_fixed_line()

void Inkscape::CanvasItemText::set_fixed_line ( bool  fixed_line)

◆ set_fontsize()

void Inkscape::CanvasItemText::set_fontsize ( double  fontsize)

◆ set_text()

void Inkscape::CanvasItemText::set_text ( Glib::ustring  text)

Member Data Documentation

◆ _adjust_offset

Geom::Point Inkscape::CanvasItemText::_adjust_offset
protected

Definition at line 63 of file canvas-item-text.h.

Referenced by _update(), and set_adjust().

◆ _anchor_position

Geom::Point Inkscape::CanvasItemText::_anchor_position
protected

Definition at line 62 of file canvas-item-text.h.

Referenced by _update(), and set_anchor().

◆ _background

uint32_t Inkscape::CanvasItemText::_background = 0x0000007f
protected

Definition at line 70 of file canvas-item-text.h.

Referenced by _render(), and set_background().

◆ _bg_rad

double Inkscape::CanvasItemText::_bg_rad = 0
protected

Definition at line 69 of file canvas-item-text.h.

Referenced by _render(), and set_bg_radius().

◆ _border

double Inkscape::CanvasItemText::_border = 3
protected

Definition at line 68 of file canvas-item-text.h.

Referenced by get_text_size(), load_text_extents(), and set_border().

◆ _fixed_line

bool Inkscape::CanvasItemText::_fixed_line = false
protected

Definition at line 72 of file canvas-item-text.h.

Referenced by load_text_extents(), and set_fixed_line().

◆ _fontname

std::string Inkscape::CanvasItemText::_fontname = "sans-serif"
protected

Definition at line 66 of file canvas-item-text.h.

Referenced by _render(), and load_text_extents().

◆ _fontsize

double Inkscape::CanvasItemText::_fontsize = 10
protected

Definition at line 67 of file canvas-item-text.h.

Referenced by _render(), load_text_extents(), and set_fontsize().

◆ _p

Geom::Point Inkscape::CanvasItemText::_p
protected

Definition at line 59 of file canvas-item-text.h.

Referenced by _update(), and set_coord().

◆ _scaled

bool Inkscape::CanvasItemText::_scaled = false
protected

Definition at line 73 of file canvas-item-text.h.

Referenced by _render(), and _update().

◆ _text

Glib::ustring Inkscape::CanvasItemText::_text
protected

Definition at line 65 of file canvas-item-text.h.

Referenced by _render(), load_text_extents(), and set_text().

◆ _text_box

Geom::Rect Inkscape::CanvasItemText::_text_box
protected

Definition at line 64 of file canvas-item-text.h.

Referenced by _render(), and _update().

◆ _text_extent

Cairo::TextExtents Inkscape::CanvasItemText::_text_extent
protected

Definition at line 60 of file canvas-item-text.h.

Referenced by _render(), get_text_size(), and load_text_extents().

◆ _text_size

Cairo::TextExtents Inkscape::CanvasItemText::_text_size
protected

Definition at line 61 of file canvas-item-text.h.

Referenced by _render(), get_text_size(), and load_text_extents().

◆ _use_background

bool Inkscape::CanvasItemText::_use_background = false
protected

Definition at line 71 of file canvas-item-text.h.

Referenced by _render(), and set_background().


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