Code

f7a9f079959050e7cfc299e74418b4580d211c6b
[inkscape.git] / src / dialogs / layers-panel.h
2 #ifndef SEEN_LAYERS_PANEL_H
3 #define SEEN_LAYERS_PANEL_H
4 /*
5  * A simple dialog for layer UI.
6  *
7  * Authors:
8  *   Jon A. Cruz
9  *
10  * Copyright (C) 2006 Jon A. Cruz
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
15 #include <gtkmm/treeview.h>
16 #include <gtkmm/treestore.h>
17 #include <gtkmm/tooltips.h>
18 #include <gtkmm/scrolledwindow.h>
20 #include "ui/widget/panel.h"
21 //#include "ui/previewholder.h"
23 class SPObject;
25 namespace Inkscape {
27 class LayerManager;
29 namespace UI {
30 namespace Dialogs {
33 /**
34  * A panel that displays layers.
35  */
36 class LayersPanel : public Inkscape::UI::Widget::Panel
37 {
38 public:
39     LayersPanel();
40     virtual ~LayersPanel();
42     static LayersPanel& getInstance();
43     //virtual void setOrientation( Gtk::AnchorType how );
45     void setDesktop( SPDesktop* desktop );
47 protected:
48     //virtual void _handleAction( int setId, int itemId );
50 private:
51     class ModelColumns;
52     class InternalUIBounce;
54     LayersPanel(LayersPanel const &); // no copy
55     LayersPanel &operator=(LayersPanel const &); // no assign
57     static LayersPanel* instance;
59     void _styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback );
60     void _fireAction( unsigned int code );
61     Gtk::MenuItem& _addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id );
63     void _toggled( Glib::ustring const& str, int targetCol );
65     void _handleButtonEvent(GdkEventButton* evt);
66     void _handleRowChange( Gtk::TreeModel::Path const& path, Gtk::TreeModel::iterator const& iter );
68     void _pushTreeSelectionToCurrent();
69     void _checkTreeSelection();
71     void _takeAction( int val );
72     bool _executeAction();
74     void _updateLayer(SPObject *layer);
75     bool _checkForUpdated(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPObject* layer);
77     void _selectLayer(SPObject *layer);
78     bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer);
80     void _layersChanged();
81     void _addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level );
83     SPObject* _selectedLayer();
85     // Hooked to the layer manager:
86     sigc::connection _layerChangedConnection;
87     sigc::connection _layerUpdatedConnection;
88     sigc::connection _changedConnection;
89     sigc::connection _addedConnection;
90     sigc::connection _removedConnection;
92     int _maxNestDepth;
93     Inkscape::LayerManager* _mgr;
94     SPDesktop* _desktop;
95     ModelColumns* _model;
96     InternalUIBounce* _pending;
97     Glib::RefPtr<Gtk::TreeStore> _store;
98     std::vector<Gtk::Widget*> _watching;
99     std::vector<Gtk::Widget*> _watchingNonTop;
100     std::vector<Gtk::Widget*> _watchingNonBottom;
102     Gtk::Tooltips _tips;
103     Gtk::TreeView _tree;
104     Gtk::HBox _buttonsRow;
105     Gtk::ScrolledWindow _scroller;
106     Gtk::Menu _popupMenu;
107 };
111 } //namespace Dialogs
112 } //namespace UI
113 } //namespace Inkscape
117 #endif // SEEN_LAYERS_PANEL_H
119 /*
120   Local Variables:
121   mode:c++
122   c-file-style:"stroustrup"
123   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
124   indent-tabs-mode:nil
125   fill-column:99
126   End:
127 */
128 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :