summaryrefslogtreecommitdiffstats
path: root/src/display/control/canvas-item-group.h
blob: 4ab5884dc4696ff7ba2bd18acf4299acfb1db31b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef SEEN_CANVAS_ITEM_GROUP_H
#define SEEN_CANVAS_ITEM_GROUP_H

/**
 * A CanvasItem that contains other CanvasItems.
 */
/*
 * Author:
 *   Tavmjong Bah
 *
 * Copyright (C) 2020 Tavmjong Bah
 *
 * Rewrite of SPCanvasGroup
 *
 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
 */

#include "canvas-item.h"

namespace Inkscape {

class CanvasItemGroup final : public CanvasItem
{
public:
    CanvasItemGroup(CanvasItemGroup *group);
    CanvasItemGroup(CanvasItemContext *context);

    // Geometry
    void visit_page_rects(std::function<void(Geom::Rect const &)> const &) const override;

    // Selection
    CanvasItem *pick_item(Geom::Point const &p);

protected:
    friend class CanvasItem; // access to items
    friend class CanvasItemContext; // access to destructor

    ~CanvasItemGroup() override;

    void _update(bool propagate) override;
    void _mark_net_invisible() override;
    void _render(Inkscape::CanvasItemBuffer &buf) const override;

    /**
     * Type for linked list storing CanvasItems.
     * Used to speed deletion when a group contains a large number of items (as in nodes for a complex path).
     */
    using CanvasItemList = boost::intrusive::list<
        Inkscape::CanvasItem,
        boost::intrusive::member_hook<Inkscape::CanvasItem, boost::intrusive::list_member_hook<>,
                                      &Inkscape::CanvasItem::member_hook>>;

    CanvasItemList items;
};

} // namespace Inkscape

#endif // SEEN_CANVAS_ITEM_H

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :