Code

rolling back parts of the "default metadata preferences" patch that buliabyak forgot...
[inkscape.git] / src / dialogs / layers-panel.h
1 #ifndef SEEN_LAYERS_PANEL_H
2 #define SEEN_LAYERS_PANEL_H
3 /*
4  * A simple dialog for layer UI.
5  *
6  * Authors:
7  *   Jon A. Cruz
8  *
9  * Copyright (C) 2006 Jon A. Cruz
10  *
11  * Released under GNU GPL, read the file 'COPYING' for more information
12  */
14 #include <gtkmm/treeview.h>
15 #include <gtkmm/treestore.h>
16 #include <gtkmm/tooltips.h>
17 #include <gtkmm/scale.h>
18 #include <gtkmm/scrolledwindow.h>
19 #include <gtkmm/box.h>
20 #include <gtkmm/buttonbox.h>
21 #include <gtkmm/spinbutton.h>
23 //#include "ui/previewholder.h"
24 #include "ui/widget/panel.h"
25 #include "ui/widget/object-composite-settings.h"
27 class SPObject;
29 namespace Inkscape {
31 class LayerManager;
33 namespace UI {
34 namespace Dialogs {
37 /**
38  * A panel that displays layers.
39  */
40 class LayersPanel : public UI::Widget::Panel
41 {
42 public:
43     LayersPanel();
44     virtual ~LayersPanel();
46     //virtual void setOrientation( Gtk::AnchorType how );
47     
48     static LayersPanel& getInstance();
50     void setDesktop( SPDesktop* desktop );
52 protected:
53     //virtual void _handleAction( int setId, int itemId );
55 private:
56     class ModelColumns;
57     class InternalUIBounce;
59     LayersPanel(LayersPanel const &); // no copy
60     LayersPanel &operator=(LayersPanel const &); // no assign
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     SPObject* _selectedLayer();
91     // Hooked to the layer manager:
92     sigc::connection _layerChangedConnection;
93     sigc::connection _layerUpdatedConnection;
94     sigc::connection _changedConnection;
95     sigc::connection _addedConnection;
96     sigc::connection _removedConnection;
98     // Internal
99     sigc::connection _selectedConnection;
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::Menu _popupMenu;
117     Gtk::SpinButton _spinBtn;
119     UI::Widget::StyleSubject::CurrentLayer _subject;
120     UI::Widget::ObjectCompositeSettings _compositeSettings;
121 };
125 } //namespace Dialogs
126 } //namespace UI
127 } //namespace Inkscape
131 #endif // SEEN_LAYERS_PANEL_H
133 /*
134   Local Variables:
135   mode:c++
136   c-file-style:"stroustrup"
137   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
138   indent-tabs-mode:nil
139   fill-column:99
140   End:
141 */
142 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :