Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
canvas-item-drawing.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
5/*
6 * Author:
7 * Tavmjong Bah
8 *
9 * Copyright (C) 2020 Tavmjong Bah
10 *
11 * Rewrite of _SPCanvasArena.
12 *
13 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
14 */
15
16#ifndef SEEN_CANVAS_ITEM_DRAWING_H
17#define SEEN_CANVAS_ITEM_DRAWING_H
18
19#include <memory>
20#include <sigc++/signal.h>
21
22#include "canvas-item.h"
23
24namespace Inkscape {
25
26class Drawing;
27class DrawingItem;
28class Updatecontext;
29
30class CanvasItemDrawing final : public CanvasItem
31{
32public:
34
35 // Selection
36 bool contains(Geom::Point const &p, double tolerance = 0) override;
37
38 // Display
40
41 // Drawing items
42 void set_active(Inkscape::DrawingItem *active) { _active_item = active; }
44
45 // Events
46 bool handle_event(CanvasEvent const &event) override;
47 void set_sticky(bool sticky) { _sticky = sticky; }
48 void set_pick_outline(bool pick_outline) { _pick_outline = pick_outline; }
49
50 // Signals
51 sigc::connection connect_drawing_event(sigc::slot<bool(CanvasEvent const &, Inkscape::DrawingItem *)> slot) {
52 return _drawing_event_signal.connect(slot);
53 }
54
55protected:
56 ~CanvasItemDrawing() override = default;
57
58 void _update(bool propagate) override;
59 void _render(Inkscape::CanvasItemBuffer &buf) const override;
60
61 // Selection
66
67 // Display
68 std::unique_ptr<Inkscape::Drawing> _drawing;
70
71 // Events
72 bool _cursor = false;
73 bool _sticky = false; // Pick anything, even if hidden.
74 bool _pick_outline = false;
75
76 // Signals
78};
79
80} // namespace Inkscape
81
82#endif // SEEN_CANVAS_ITEM_DRAWING_H
83
84/*
85 Local Variables:
86 mode:c++
87 c-file-style:"stroustrup"
88 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
89 indent-tabs-mode:nil
90 fill-column:99
91 End:
92*/
93// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
3x3 matrix representing an affine transformation.
Definition affine.h:70
Two-dimensional point that doubles as a vector.
Definition point.h:66
std::unique_ptr< Inkscape::Drawing > _drawing
bool handle_event(CanvasEvent const &event) override
Handle events directed at the drawing.
Inkscape::DrawingItem * get_active()
~CanvasItemDrawing() override=default
void _update(bool propagate) override
Update and redraw drawing.
Inkscape::Drawing * get_drawing()
bool contains(Geom::Point const &p, double tolerance=0) override
Returns true if point p (in canvas units) is inside some object in drawing.
void set_pick_outline(bool pick_outline)
void _render(Inkscape::CanvasItemBuffer &buf) const override
Render drawing to screen via Cairo.
Inkscape::DrawingItem * _picked_item
sigc::signal< bool(CanvasEvent const &, Inkscape::DrawingItem *)> _drawing_event_signal
Inkscape::DrawingItem * _active_item
void set_active(Inkscape::DrawingItem *active)
sigc::connection connect_drawing_event(sigc::slot< bool(CanvasEvent const &, Inkscape::DrawingItem *)> slot)
SVG drawing item for display.
constexpr Coord infinity()
Get a value representing infinity.
Definition coord.h:88
Helper class to stream background task notifications as a series of messages.
int buf
Abstract base class for events.
Class used when rendering canvas items.