1 /*
2 * Inkscape::DocumentSubset - view of a document including only a subset
3 * of nodes
4 *
5 * Copyright 2006 MenTaLguY <mental@rydia.net>
6 *
7 * Released under GNU GPL, read the file 'COPYING' for more information
8 */
10 #ifndef SEEN_INKSCAPE_DOCUMENT_SUBSET_H
11 #define SEEN_INKSCAPE_DOCUMENT_SUBSET_H
13 #include <sigc++/connection.h>
14 #include <sigc++/functors/slot.h>
16 #include "gc-managed.h"
17 #include "gc-anchored.h"
19 class SPObject;
20 class SPDocument;
22 namespace Inkscape {
24 class DocumentSubset : public GC::Managed<>,
25 public GC::Anchored
26 {
27 public:
28 bool includes(SPObject *obj) const;
30 SPObject *parentOf(SPObject *obj) const;
31 unsigned childCount(SPObject *obj) const;
32 unsigned indexOf(SPObject *obj) const;
33 SPObject *nthChildOf(SPObject *obj, unsigned n) const;
35 sigc::connection connectChanged(sigc::slot<void> slot) const;
36 sigc::connection connectAdded(sigc::slot<void, SPObject *> slot) const;
37 sigc::connection connectRemoved(sigc::slot<void, SPObject *> slot) const;
39 protected:
40 DocumentSubset();
42 void _addOne(SPObject *obj);
43 void _removeOne(SPObject *obj) { _remove(obj, false); }
44 void _removeSubtree(SPObject *obj) { _remove(obj, true); }
45 void _clear();
47 private:
48 DocumentSubset(DocumentSubset const &); // no copy
49 void operator=(DocumentSubset const &); // no assign
51 void _remove(SPObject *obj, bool subtree);
53 class Relations;
55 Relations *_relations;
56 };
58 }
60 #endif
61 /*
62 Local Variables:
63 mode:c++
64 c-file-style:"stroustrup"
65 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
66 indent-tabs-mode:nil
67 fill-column:99
68 End:
69 */
70 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :