461134baab4d735e688afb3ef6d2736d880ce16c
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 void renameLayer( SPObject* obj, gchar const *label );
31 sigc::connection connectCurrentLayerChanged(const sigc::slot<void, SPObject *> & slot) {
32 return _layer_changed_signal.connect(slot);
33 }
35 sigc::connection connectLayerDetailsChanged(const sigc::slot<void, SPObject *> & slot) {
36 return _details_changed_signal.connect(slot);
37 }
39 private:
40 friend class LayerWatcher;
41 class LayerWatcher;
43 static void _objectModifiedCB( SPObject* obj, guint flags, LayerManager* mgr );
45 void _objectModified( SPObject* obj, guint flags );
46 void _setDocument(SPDocument *document);
47 void _rebuild();
48 void _selectedLayerChanged(SPObject *layer);
50 sigc::connection _layer_connection;
51 sigc::connection _document_connection;
52 sigc::connection _resource_connection;
54 GC::soft_ptr<SPDesktop> _desktop;
55 SPDocument *_document;
57 std::vector<LayerWatcher*> _watchers;
59 sigc::signal<void, SPObject *> _layer_changed_signal;
60 sigc::signal<void, SPObject *> _details_changed_signal;
61 };
63 }
65 #endif
66 /*
67 Local Variables:
68 mode:c++
69 c-file-style:"stroustrup"
70 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
71 indent-tabs-mode:nil
72 fill-column:99
73 End:
74 */
75 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :