Inkscape
Vector Graphics Editor
|
#include <canvas-item-text.h>
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 |
![]() | |
CanvasItem (CanvasItemContext *context) | |
CanvasItem (CanvasItemGroup *parent) | |
CanvasItem (CanvasItem const &)=delete | |
CanvasItem & | operator= (CanvasItem const &)=delete |
void | unlink () |
UI::Widget::Canvas * | get_canvas () const |
CanvasItemGroup * | get_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. | |
![]() | |
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 |
![]() | |
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 | |
![]() | |
boost::intrusive::list_member_hook | member_hook |
Definition at line 29 of file canvas-item-text.h.
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.
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().
|
overrideprotecteddefault |
|
overrideprotectedvirtual |
Render text to screen via Cairo.
Implements Inkscape::CanvasItem.
Definition at line 123 of file canvas-item-text.cpp.
References _background, _bg_rad, Inkscape::CanvasItem::_fill, _fontname, _fontsize, _scaled, _text, _text_box, _text_extent, _text_size, _use_background, Inkscape::CanvasItem::affine(), buf, geom_to_cairo(), Geom::GenericRect< C >::height(), ink_cairo_set_source_color(), Geom::GenericRect< C >::min(), w, and Geom::GenericRect< C >::width().
|
overrideprotectedvirtual |
Update and redraw control text.
Implements Inkscape::CanvasItem.
Definition at line 88 of file canvas-item-text.cpp.
References _adjust_offset, _anchor_position, Inkscape::CanvasItem::_bounds, _p, _scaled, _text_box, Inkscape::CanvasItem::affine(), floor(), Geom::GenericRect< C >::height(), load_text_extents(), Inkscape::CanvasItem::request_redraw(), Geom::Rect::roundOutwards(), Geom::GenericRect< C >::width(), Geom::Point::x(), and Geom::Point::y().
|
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.
Geom::Rect Inkscape::CanvasItemText::get_text_size | ( | ) | const |
Definition at line 189 of file canvas-item-text.cpp.
References _border, _text_extent, _text_size, and Geom::GenericRect< Coord >::from_xywh().
|
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().
void Inkscape::CanvasItemText::set_adjust | ( | Geom::Point const & | adjust_pt | ) |
Definition at line 241 of file canvas-item-text.cpp.
References _adjust_offset, Inkscape::CanvasItem::defer(), and Inkscape::CanvasItem::request_update().
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().
void Inkscape::CanvasItemText::set_background | ( | uint32_t | background | ) |
Definition at line 218 of file canvas-item-text.cpp.
References _background, _use_background, Inkscape::CanvasItem::defer(), and Inkscape::CanvasItem::request_redraw().
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().
void Inkscape::CanvasItemText::set_border | ( | double | border | ) |
Definition at line 259 of file canvas-item-text.cpp.
References _border, border, Inkscape::CanvasItem::defer(), and Inkscape::CanvasItem::request_update().
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().
void Inkscape::CanvasItemText::set_fixed_line | ( | bool | fixed_line | ) |
Definition at line 250 of file canvas-item-text.cpp.
References _fixed_line, Inkscape::CanvasItem::defer(), and Inkscape::CanvasItem::request_update().
void Inkscape::CanvasItemText::set_fontsize | ( | double | fontsize | ) |
Definition at line 180 of file canvas-item-text.cpp.
References _fontsize, Inkscape::CanvasItem::defer(), and Inkscape::CanvasItem::request_update().
void Inkscape::CanvasItemText::set_text | ( | Glib::ustring | text | ) |
Definition at line 171 of file canvas-item-text.cpp.
References _text, Inkscape::CanvasItem::defer(), and Inkscape::CanvasItem::request_update().
|
protected |
Definition at line 63 of file canvas-item-text.h.
Referenced by _update(), and set_adjust().
|
protected |
Definition at line 62 of file canvas-item-text.h.
Referenced by _update(), and set_anchor().
|
protected |
Definition at line 70 of file canvas-item-text.h.
Referenced by _render(), and set_background().
|
protected |
Definition at line 69 of file canvas-item-text.h.
Referenced by _render(), and set_bg_radius().
|
protected |
Definition at line 68 of file canvas-item-text.h.
Referenced by get_text_size(), load_text_extents(), and set_border().
|
protected |
Definition at line 72 of file canvas-item-text.h.
Referenced by load_text_extents(), and set_fixed_line().
|
protected |
Definition at line 66 of file canvas-item-text.h.
Referenced by _render(), and load_text_extents().
|
protected |
Definition at line 67 of file canvas-item-text.h.
Referenced by _render(), load_text_extents(), and set_fontsize().
|
protected |
Definition at line 59 of file canvas-item-text.h.
Referenced by _update(), and set_coord().
|
protected |
Definition at line 73 of file canvas-item-text.h.
|
protected |
Definition at line 65 of file canvas-item-text.h.
Referenced by _render(), load_text_extents(), and set_text().
|
protected |
Definition at line 64 of file canvas-item-text.h.
|
protected |
Definition at line 60 of file canvas-item-text.h.
Referenced by _render(), get_text_size(), and load_text_extents().
|
protected |
Definition at line 61 of file canvas-item-text.h.
Referenced by _render(), get_text_size(), and load_text_extents().
|
protected |
Definition at line 71 of file canvas-item-text.h.
Referenced by _render(), and set_background().