b253aae27ed659cf4a6639f6e062dbb685e895a2
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>
22 #include <gtkmm/spinbutton.h>
24 #include "ui/widget/panel.h"
25 //#include "ui/previewholder.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 Inkscape::UI::Widget::Panel
41 {
42 public:
43 LayersPanel();
44 virtual ~LayersPanel();
46 static LayersPanel& getInstance();
47 //virtual void setOrientation( Gtk::AnchorType how );
49 void setDesktop( SPDesktop* desktop );
51 protected:
52 //virtual void _handleAction( int setId, int itemId );
54 private:
55 class ModelColumns;
56 class InternalUIBounce;
58 LayersPanel(LayersPanel const &); // no copy
59 LayersPanel &operator=(LayersPanel const &); // no assign
61 static LayersPanel* instance;
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 void _opacityChanged();
92 SPObject* _selectedLayer();
94 // Hooked to the layer manager:
95 sigc::connection _layerChangedConnection;
96 sigc::connection _layerUpdatedConnection;
97 sigc::connection _changedConnection;
98 sigc::connection _addedConnection;
99 sigc::connection _removedConnection;
100 sigc::connection _opacityConnection;
102 // Internal
103 sigc::connection _selectedConnection;
105 int _maxNestDepth;
106 Inkscape::LayerManager* _mgr;
107 SPDesktop* _desktop;
108 ModelColumns* _model;
109 InternalUIBounce* _pending;
110 GdkEvent* _toggleEvent;
111 Glib::RefPtr<Gtk::TreeStore> _store;
112 std::vector<Gtk::Widget*> _watching;
113 std::vector<Gtk::Widget*> _watchingNonTop;
114 std::vector<Gtk::Widget*> _watchingNonBottom;
116 Gtk::Tooltips _tips;
117 Gtk::TreeView _tree;
118 Gtk::HButtonBox _buttonsRow;
119 Gtk::ScrolledWindow _scroller;
120 Gtk::HBox _opacityBox;
121 Gtk::HScale _opacity;
122 Gtk::Menu _popupMenu;
123 Gtk::SpinButton _spinBtn;
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 :