d92946a4c3af0660a1db5b002d71571255de83cc
1 /*
2 * Inkscape::LayerManager - a view of a document's layers, relative
3 * to a particular desktop
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_LAYER_MANAGER_H
11 #define SEEN_INKSCAPE_LAYER_MANAGER_H
13 #include "document-subset.h"
14 #include "gc-finalized.h"
15 #include "gc-soft-ptr.h"
16 #include <vector>
18 class SPDesktop;
19 class SPDocument;
21 namespace Inkscape {
23 class LayerManager : public DocumentSubset,
24 public GC::Finalized
25 {
26 public:
27 LayerManager(SPDesktop *desktop);
29 sigc::connection connectCurrentLayerChanged(const sigc::slot<void, SPObject *> & slot) {
30 return _layer_changed_signal.connect(slot);
31 }
33 sigc::connection connectLayerDetailsChanged(const sigc::slot<void, SPObject *> & slot) {
34 return _details_changed_signal.connect(slot);
35 }
37 private:
38 friend class LayerWatcher;
39 class LayerWatcher;
41 static void _objectModifiedCB( SPObject* obj, guint flags, LayerManager* mgr );
43 void _objectModified( SPObject* obj, guint flags );
44 void _setDocument(SPDocument *document);
45 void _rebuild();
46 void _selectedLayerChanged(SPObject *layer);
48 sigc::connection _layer_connection;
49 sigc::connection _document_connection;
50 sigc::connection _resource_connection;
52 GC::soft_ptr<SPDesktop> _desktop;
53 SPDocument *_document;
55 std::vector<LayerWatcher*> _watchers;
57 sigc::signal<void, SPObject *> _layer_changed_signal;
58 sigc::signal<void, SPObject *> _details_changed_signal;
59 };
61 }
63 #endif
64 /*
65 Local Variables:
66 mode:c++
67 c-file-style:"stroustrup"
68 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
69 indent-tabs-mode:nil
70 fill-column:99
71 End:
72 */
73 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :