Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::CanvasItemCtrl Class Reference

#include <canvas-item-ctrl.h>

Inheritance diagram for Inkscape::CanvasItemCtrl:
Inkscape::CanvasItem Inkscape::CanvasItemGuideHandle

Public Member Functions

 CanvasItemCtrl (CanvasItemGroup *group)
 Create a null control node.
 
 CanvasItemCtrl (CanvasItemGroup *group, CanvasItemCtrlType type)
 Create a control with type.
 
 CanvasItemCtrl (CanvasItemGroup *group, CanvasItemCtrlType type, Geom::Point const &p)
 Create a control ctrl.
 
void set_position (Geom::Point const &position)
 Set the position.
 
double closest_distance_to (Geom::Point const &p) const
 Returns distance between point in canvas units and position of ctrl.
 
bool contains (Geom::Point const &p, double tolerance=0) override
 If tolerance is zero, returns true if point p (in canvas units) is inside bounding box, else returns true if p (in canvas units) is within tolerance (canvas units) distance of ctrl.
 
void set_size (HandleSize rel_size)
 
void set_fill (uint32_t rgba) override
 
void set_stroke (uint32_t rgba) override
 
void set_shape (CanvasItemCtrlShape shape)
 
void set_size_via_index (int size_index)
 
void set_size_default ()
 
void set_anchor (SPAnchorType anchor)
 
void set_angle (double angle)
 
void set_type (CanvasItemCtrlType type)
 
void set_selected (bool selected=true)
 
void set_click (bool click=true)
 
void set_hover (bool hover=true)
 
void set_normal (bool selected=false)
 Reset the state to normal or normal selected.
 
void _set_size (int size)
 
- 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 ()
 
void set_fill (CanvasItemColor color)
 
void set_fill_pattern (Cairo::RefPtr< Cairo::Pattern > pattern)
 
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

 ~CanvasItemCtrl () override=default
 
void _update (bool propagate) override
 Update and redraw control ctrl.
 
void _render (CanvasItemBuffer &buf) const override
 Render ctrl to screen via Cairo.
 
void _invalidate_ctrl_handles () override
 
void build_cache (int device_scale) const
 Build object-specific cache.
 
float get_width () const
 
float get_total_width () const
 
- Protected Member Functions inherited from Inkscape::CanvasItem
virtual ~CanvasItem ()
 
Geom::Affine const & affine () const
 
virtual void _mark_net_invisible ()
 
template<typename F >
void defer (F &&f)
 

Private Member Functions

float get_stroke_width () const
 
int get_pixmap_width (int device_scale) const
 
void _dump ()
 

Private Attributes

Geom::Point _position
 
InitLock _built
 
std::shared_ptr< Cairo::ImageSurface const > _cache
 
Handles::TypeState _handle
 
CanvasItemCtrlShape _shape = CANVAS_ITEM_CTRL_SHAPE_SQUARE
 
uint32_t _fill = 0x000000ff
 
uint32_t _stroke = 0xffffffff
 
bool _shape_set = false
 
bool _fill_set = false
 
bool _stroke_set = false
 
bool _size_set = false
 
double _angle = 0
 
SPAnchorType _anchor = SP_ANCHOR_CENTER
 
int _width = 5
 
HandleSize _rel_size = HandleSize::NORMAL
 
Geom::Point _pos
 

Additional Inherited Members

- Public Attributes inherited from Inkscape::CanvasItem
boost::intrusive::list_member_hook member_hook
 
- 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
 

Detailed Description

Definition at line 36 of file canvas-item-ctrl.h.

Constructor & Destructor Documentation

◆ CanvasItemCtrl() [1/3]

Inkscape::CanvasItemCtrl::CanvasItemCtrl ( CanvasItemGroup group)

Create a null control node.

Definition at line 36 of file canvas-item-ctrl.cpp.

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

◆ CanvasItemCtrl() [2/3]

Inkscape::CanvasItemCtrl::CanvasItemCtrl ( CanvasItemGroup group,
CanvasItemCtrlType  type 
)

◆ CanvasItemCtrl() [3/3]

Inkscape::CanvasItemCtrl::CanvasItemCtrl ( CanvasItemGroup group,
CanvasItemCtrlType  type,
Geom::Point const &  p 
)

Create a control ctrl.

Point is in document coordinates.

Definition at line 136 of file canvas-item-ctrl.cpp.

References _position, and Inkscape::CanvasItem::request_update().

◆ ~CanvasItemCtrl()

Inkscape::CanvasItemCtrl::~CanvasItemCtrl ( )
overrideprotecteddefault

Member Function Documentation

◆ _dump()

◆ _invalidate_ctrl_handles()

void Inkscape::CanvasItemCtrl::_invalidate_ctrl_handles ( )
overrideprotectedvirtual

◆ _render()

void Inkscape::CanvasItemCtrl::_render ( CanvasItemBuffer buf) const
overrideprotectedvirtual

Render ctrl to screen via Cairo.

Implements Inkscape::CanvasItem.

Definition at line 485 of file canvas-item-ctrl.cpp.

References _built, _cache, _pos, buf, build_cache(), and InitLock::init().

Referenced by _dump().

◆ _set_size()

void Inkscape::CanvasItemCtrl::_set_size ( int  size)

◆ _update()

◆ build_cache()

void Inkscape::CanvasItemCtrl::build_cache ( int  device_scale) const
protected

◆ closest_distance_to()

double Inkscape::CanvasItemCtrl::closest_distance_to ( Geom::Point const &  p) const

Returns distance between point in canvas units and position of ctrl.

Definition at line 158 of file canvas-item-ctrl.cpp.

References _position, Inkscape::CanvasItem::affine(), and Geom::distance().

Referenced by contains().

◆ contains()

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

If tolerance is zero, returns true if point p (in canvas units) is inside bounding box, else returns true if p (in canvas units) is within tolerance (canvas units) distance of ctrl.

The latter assumes ctrl center anchored.

Reimplemented from Inkscape::CanvasItem.

Definition at line 169 of file canvas-item-ctrl.cpp.

References Inkscape::CanvasItem::_bounds, and closest_distance_to().

◆ get_pixmap_width()

int Inkscape::CanvasItemCtrl::get_pixmap_width ( int  device_scale) const
private

Definition at line 261 of file canvas-item-ctrl.cpp.

References get_total_width().

Referenced by build_cache().

◆ get_stroke_width()

float Inkscape::CanvasItemCtrl::get_stroke_width ( ) const
private

◆ get_total_width()

float Inkscape::CanvasItemCtrl::get_total_width ( ) const
protected

◆ get_width()

float Inkscape::CanvasItemCtrl::get_width ( ) const
protected

◆ set_anchor()

void Inkscape::CanvasItemCtrl::set_anchor ( SPAnchorType  anchor)

◆ set_angle()

void Inkscape::CanvasItemCtrl::set_angle ( double  angle)

◆ set_click()

void Inkscape::CanvasItemCtrl::set_click ( bool  click = true)

◆ set_fill()

void Inkscape::CanvasItemCtrl::set_fill ( uint32_t  rgba)
overridevirtual

◆ set_hover()

void Inkscape::CanvasItemCtrl::set_hover ( bool  hover = true)

◆ set_normal()

void Inkscape::CanvasItemCtrl::set_normal ( bool  selected = false)

◆ set_position()

void Inkscape::CanvasItemCtrl::set_position ( Geom::Point const &  position)

Set the position.

Point is in document coordinates.

Definition at line 146 of file canvas-item-ctrl.cpp.

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

◆ set_selected()

void Inkscape::CanvasItemCtrl::set_selected ( bool  selected = true)

◆ set_shape()

◆ set_size()

void Inkscape::CanvasItemCtrl::set_size ( HandleSize  rel_size)

◆ set_size_default()

void Inkscape::CanvasItemCtrl::set_size_default ( )

Definition at line 265 of file canvas-item-ctrl.cpp.

References Inkscape::get_size_default(), set_size_via_index(), and Inkscape::size.

Referenced by CanvasItemCtrl(), and set_type().

◆ set_size_via_index()

void Inkscape::CanvasItemCtrl::set_size_via_index ( int  size_index)

◆ set_stroke()

void Inkscape::CanvasItemCtrl::set_stroke ( uint32_t  rgba)
overridevirtual

◆ set_type()

Member Data Documentation

◆ _anchor

SPAnchorType Inkscape::CanvasItemCtrl::_anchor = SP_ANCHOR_CENTER
private

Definition at line 95 of file canvas-item-ctrl.h.

Referenced by _update(), and set_anchor().

◆ _angle

double Inkscape::CanvasItemCtrl::_angle = 0
private

Definition at line 94 of file canvas-item-ctrl.h.

Referenced by _update(), build_cache(), and set_angle().

◆ _built

◆ _cache

std::shared_ptr<Cairo::ImageSurface const> Inkscape::CanvasItemCtrl::_cache
mutableprivate

Definition at line 84 of file canvas-item-ctrl.h.

Referenced by _render(), and build_cache().

◆ _fill

uint32_t Inkscape::CanvasItemCtrl::_fill = 0x000000ff
private

Definition at line 88 of file canvas-item-ctrl.h.

Referenced by build_cache(), and set_fill().

◆ _fill_set

bool Inkscape::CanvasItemCtrl::_fill_set = false
private

Definition at line 91 of file canvas-item-ctrl.h.

Referenced by build_cache(), and set_fill().

◆ _handle

◆ _pos

Geom::Point Inkscape::CanvasItemCtrl::_pos
private

Definition at line 98 of file canvas-item-ctrl.h.

Referenced by _render(), and _update().

◆ _position

Geom::Point Inkscape::CanvasItemCtrl::_position
private

Definition at line 81 of file canvas-item-ctrl.h.

Referenced by _dump(), _update(), CanvasItemCtrl(), closest_distance_to(), and set_position().

◆ _rel_size

HandleSize Inkscape::CanvasItemCtrl::_rel_size = HandleSize::NORMAL
private

Definition at line 97 of file canvas-item-ctrl.h.

Referenced by set_size(), and set_size_via_index().

◆ _shape

CanvasItemCtrlShape Inkscape::CanvasItemCtrl::_shape = CANVAS_ITEM_CTRL_SHAPE_SQUARE
private

Definition at line 87 of file canvas-item-ctrl.h.

Referenced by _update(), build_cache(), and set_shape().

◆ _shape_set

bool Inkscape::CanvasItemCtrl::_shape_set = false
private

Definition at line 90 of file canvas-item-ctrl.h.

Referenced by _update(), build_cache(), and set_shape().

◆ _size_set

bool Inkscape::CanvasItemCtrl::_size_set = false
private

Definition at line 93 of file canvas-item-ctrl.h.

◆ _stroke

uint32_t Inkscape::CanvasItemCtrl::_stroke = 0xffffffff
private

Definition at line 89 of file canvas-item-ctrl.h.

Referenced by build_cache(), and set_stroke().

◆ _stroke_set

bool Inkscape::CanvasItemCtrl::_stroke_set = false
private

Definition at line 92 of file canvas-item-ctrl.h.

Referenced by build_cache(), and set_stroke().

◆ _width

int Inkscape::CanvasItemCtrl::_width = 5
private

Definition at line 96 of file canvas-item-ctrl.h.

Referenced by _set_size(), get_stroke_width(), and get_width().


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