Code

Adding notification when managed layers change.
[inkscape.git] / src / layer-manager.h
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"
17 class SPDesktop;
18 class SPDocument;
20 namespace Inkscape {
22 class LayerManager : public DocumentSubset,
23                      public GC::Finalized
24 {
25 public:
26     LayerManager(SPDesktop *desktop);
28     sigc::connection connectCurrentLayerChanged(const sigc::slot<void, SPObject *> & slot) {
29         return _layer_changed_signal.connect(slot);
30     }
32     sigc::connection connectLayerDetailsChanged(const sigc::slot<void, SPObject *> & slot) {
33         return _details_changed_signal.connect(slot);
34     }
36 private:
37     static void _objectModifiedCB( SPObject* obj, guint flags, LayerManager* mgr );
39     void _objectModified( SPObject* obj, guint flags );
40     void _setDocument(SPDocument *document);
41     void _rebuild();
42     void _selectedLayerChanged(SPObject *layer);
44     sigc::connection _layer_connection;
45     sigc::connection _document_connection;
46     sigc::connection _resource_connection;
48     GC::soft_ptr<SPDesktop> _desktop;
49     SPDocument *_document;
51     sigc::signal<void, SPObject *>     _layer_changed_signal;
52     sigc::signal<void, SPObject *>     _details_changed_signal;
53 };
55 }
57 #endif
58 /*
59   Local Variables:
60   mode:c++
61   c-file-style:"stroustrup"
62   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
63   indent-tabs-mode:nil
64   fill-column:99
65   End:
66 */
67 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :