62596e4071d3befafdaecfed64614a49f847bb46
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>
22 #include <gtkmm/notebook.h>
24 //#include "ui/previewholder.h"
25 #include "ui/widget/panel.h"
26 #include "ui/widget/object-composite-settings.h"
28 class SPObject;
30 namespace Inkscape {
32 class LayerManager;
34 namespace UI {
35 namespace Dialogs {
38 /**
39 * A panel that displays layers.
40 */
41 class LayersPanel : public UI::Widget::Panel
42 {
43 public:
44 LayersPanel();
45 virtual ~LayersPanel();
47 //virtual void setOrientation( Gtk::AnchorType how );
49 static LayersPanel& getInstance();
51 void setDesktop( SPDesktop* desktop );
53 protected:
54 //virtual void _handleAction( int setId, int itemId );
56 private:
57 class ModelColumns;
58 class InternalUIBounce;
60 LayersPanel(LayersPanel const &); // no copy
61 LayersPanel &operator=(LayersPanel const &); // no assign
63 void _styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback );
64 void _fireAction( unsigned int code );
65 Gtk::MenuItem& _addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id );
67 void _preToggle( GdkEvent const *event );
68 void _toggled( Glib::ustring const& str, int targetCol );
70 void _handleButtonEvent(GdkEventButton* evt);
71 void _handleRowChange( Gtk::TreeModel::Path const& path, Gtk::TreeModel::iterator const& iter );
73 void _pushTreeSelectionToCurrent();
74 void _checkTreeSelection();
76 void _takeAction( int val );
77 bool _executeAction();
79 bool _rowSelectFunction( Glib::RefPtr<Gtk::TreeModel> const & model, Gtk::TreeModel::Path const & path, bool b );
81 void _updateLayer(SPObject *layer);
82 bool _checkForUpdated(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPObject* layer);
84 void _selectLayer(SPObject *layer);
85 bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer);
87 void _layersChanged();
88 void _addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level );
90 SPObject* _selectedLayer();
92 // Hooked to the layer manager:
93 sigc::connection _layerChangedConnection;
94 sigc::connection _layerUpdatedConnection;
95 sigc::connection _changedConnection;
96 sigc::connection _addedConnection;
97 sigc::connection _removedConnection;
99 // Internal
100 sigc::connection _selectedConnection;
102 int _maxNestDepth;
103 Inkscape::LayerManager* _mgr;
104 SPDesktop* _desktop;
105 ModelColumns* _model;
106 InternalUIBounce* _pending;
107 GdkEvent* _toggleEvent;
108 Glib::RefPtr<Gtk::TreeStore> _store;
109 std::vector<Gtk::Widget*> _watching;
110 std::vector<Gtk::Widget*> _watchingNonTop;
111 std::vector<Gtk::Widget*> _watchingNonBottom;
113 Gtk::Tooltips _tips;
114 Gtk::TreeView _tree;
115 Gtk::HButtonBox _buttonsRow;
116 Gtk::ScrolledWindow _scroller;
117 Gtk::Menu _popupMenu;
118 Gtk::SpinButton _spinBtn;
119 Gtk::Notebook _notebook;
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 :