1 /*
2 * A simple dialog for layer UI.
3 *
4 * Authors:
5 * Jon A. Cruz
6 *
7 * Copyright (C) 2006 Jon A. Cruz
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
12 #ifndef SEEN_LAYERS_PANEL_H
13 #define SEEN_LAYERS_PANEL_H
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>
22 #include <gtkmm/spinbutton.h>
23 #include <gtkmm/notebook.h>
25 //#include "ui/previewholder.h"
26 #include "ui/widget/panel.h"
27 #include "ui/widget/object-composite-settings.h"
29 class SPObject;
31 namespace Inkscape {
33 class LayerManager;
35 namespace UI {
36 namespace Dialogs {
39 /**
40 * A panel that displays layers.
41 */
42 class LayersPanel : public UI::Widget::Panel
43 {
44 public:
45 LayersPanel();
46 virtual ~LayersPanel();
48 //virtual void setOrientation( Gtk::AnchorType how );
50 static LayersPanel& getInstance();
52 void setDesktop( SPDesktop* desktop );
54 protected:
55 //virtual void _handleAction( int setId, int itemId );
57 private:
58 class ModelColumns;
59 class InternalUIBounce;
61 LayersPanel(LayersPanel const &); // no copy
62 LayersPanel &operator=(LayersPanel const &); // no assign
64 void _styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback );
65 void _fireAction( unsigned int code );
66 Gtk::MenuItem& _addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id );
68 void _preToggle( GdkEvent const *event );
69 void _toggled( Glib::ustring const& str, int targetCol );
71 void _handleButtonEvent(GdkEventButton* evt);
72 void _handleRowChange( Gtk::TreeModel::Path const& path, Gtk::TreeModel::iterator const& iter );
74 void _pushTreeSelectionToCurrent();
75 void _checkTreeSelection();
77 void _takeAction( int val );
78 bool _executeAction();
80 bool _rowSelectFunction( Glib::RefPtr<Gtk::TreeModel> const & model, Gtk::TreeModel::Path const & path, bool b );
82 void _updateLayer(SPObject *layer);
83 bool _checkForUpdated(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPObject* layer);
85 void _selectLayer(SPObject *layer);
86 bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer);
88 void _layersChanged();
89 void _addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level );
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;
100 // Internal
101 sigc::connection _selectedConnection;
103 int _maxNestDepth;
104 Inkscape::LayerManager* _mgr;
105 SPDesktop* _desktop;
106 ModelColumns* _model;
107 InternalUIBounce* _pending;
108 GdkEvent* _toggleEvent;
109 Glib::RefPtr<Gtk::TreeStore> _store;
110 std::vector<Gtk::Widget*> _watching;
111 std::vector<Gtk::Widget*> _watchingNonTop;
112 std::vector<Gtk::Widget*> _watchingNonBottom;
114 Gtk::Tooltips _tips;
115 Gtk::TreeView _tree;
116 Gtk::HButtonBox _buttonsRow;
117 Gtk::ScrolledWindow _scroller;
118 Gtk::Menu _popupMenu;
119 Gtk::SpinButton _spinBtn;
120 Gtk::VBox _layersPage;
122 UI::Widget::StyleSubject::CurrentLayer _subject;
123 UI::Widget::ObjectCompositeSettings _compositeSettings;
124 };
128 } //namespace Dialogs
129 } //namespace UI
130 } //namespace Inkscape
134 #endif // SEEN_LAYERS_PANEL_H
136 /*
137 Local Variables:
138 mode:c++
139 c-file-style:"stroustrup"
140 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
141 indent-tabs-mode:nil
142 fill-column:99
143 End:
144 */
145 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :