Code

76278fa4f6ff5ad14cc4c2cb2565bba38fb330f6
[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/scale.h>
19 #include <gtkmm/scrolledwindow.h>
20 #include <gtkmm/box.h>
21 #include <gtkmm/buttonbox.h>
23 #include "ui/widget/panel.h"
24 //#include "ui/previewholder.h"
26 class SPObject;
28 namespace Inkscape {
30 class LayerManager;
32 namespace UI {
33 namespace Dialogs {
36 /**
37  * A panel that displays layers.
38  */
39 class LayersPanel : public Inkscape::UI::Widget::Panel
40 {
41 public:
42     LayersPanel();
43     virtual ~LayersPanel();
45     static LayersPanel& getInstance();
46     //virtual void setOrientation( Gtk::AnchorType how );
48     void setDesktop( SPDesktop* desktop );
50 protected:
51     //virtual void _handleAction( int setId, int itemId );
53 private:
54     class ModelColumns;
55     class InternalUIBounce;
57     LayersPanel(LayersPanel const &); // no copy
58     LayersPanel &operator=(LayersPanel const &); // no assign
60     static LayersPanel* instance;
62     void _styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback );
63     void _fireAction( unsigned int code );
64     Gtk::MenuItem& _addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id );
66     void _preToggle( GdkEvent const *event );
67     void _toggled( Glib::ustring const& str, int targetCol );
69     void _handleButtonEvent(GdkEventButton* evt);
70     void _handleRowChange( Gtk::TreeModel::Path const& path, Gtk::TreeModel::iterator const& iter );
72     void _pushTreeSelectionToCurrent();
73     void _checkTreeSelection();
75     void _takeAction( int val );
76     bool _executeAction();
78     bool _rowSelectFunction( Glib::RefPtr<Gtk::TreeModel> const & model, Gtk::TreeModel::Path const & path, bool b );
80     void _updateLayer(SPObject *layer);
81     bool _checkForUpdated(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPObject* layer);
83     void _selectLayer(SPObject *layer);
84     bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer);
86     void _layersChanged();
87     void _addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level );
89     void _opacityChanged();
91     SPObject* _selectedLayer();
93     // Hooked to the layer manager:
94     sigc::connection _layerChangedConnection;
95     sigc::connection _layerUpdatedConnection;
96     sigc::connection _changedConnection;
97     sigc::connection _addedConnection;
98     sigc::connection _removedConnection;
99     sigc::connection _opacityConnection;
101     int _maxNestDepth;
102     Inkscape::LayerManager* _mgr;
103     SPDesktop* _desktop;
104     ModelColumns* _model;
105     InternalUIBounce* _pending;
106     GdkEvent* _toggleEvent;
107     Glib::RefPtr<Gtk::TreeStore> _store;
108     std::vector<Gtk::Widget*> _watching;
109     std::vector<Gtk::Widget*> _watchingNonTop;
110     std::vector<Gtk::Widget*> _watchingNonBottom;
112     Gtk::Tooltips _tips;
113     Gtk::TreeView _tree;
114     Gtk::HButtonBox _buttonsRow;
115     Gtk::ScrolledWindow _scroller;
116     Gtk::HBox _opacityBox;
117     Gtk::HScale _opacity;
118     Gtk::Menu _popupMenu;
119 };
123 } //namespace Dialogs
124 } //namespace UI
125 } //namespace Inkscape
129 #endif // SEEN_LAYERS_PANEL_H
131 /*
132   Local Variables:
133   mode:c++
134   c-file-style:"stroustrup"
135   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
136   indent-tabs-mode:nil
137   fill-column:99
138   End:
139 */
140 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :