bdfab6b29d29a4075138a13008d1e99c3e486d6b
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/scrolledwindow.h>
20 #include "ui/widget/panel.h"
21 //#include "ui/previewholder.h"
23 class SPObject;
25 namespace Inkscape {
27 class LayerManager;
29 namespace UI {
30 namespace Dialogs {
33 /**
34 * A panel that displays layers.
35 */
36 class LayersPanel : public Inkscape::UI::Widget::Panel
37 {
38 public:
39 LayersPanel();
40 virtual ~LayersPanel();
42 static LayersPanel& getInstance();
43 //virtual void setOrientation( Gtk::AnchorType how );
45 void setDesktop( SPDesktop* desktop );
47 protected:
48 //virtual void _handleAction( int setId, int itemId );
50 private:
51 class ModelColumns;
52 class InternalUIBounce;
54 LayersPanel(LayersPanel const &); // no copy
55 LayersPanel &operator=(LayersPanel const &); // no assign
57 static LayersPanel* instance;
59 void _styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback );
60 void _fireAction( unsigned int code );
61 Gtk::MenuItem& _addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id );
63 void _toggled( Glib::ustring const& str, int targetCol );
65 void _handleButtonEvent(GdkEventButton* evt);
66 void _handleRowChange( Gtk::TreeModel::Path const& path, Gtk::TreeModel::iterator const& iter );
68 void _pushTreeSelectionToCurrent();
69 void _checkTreeSelection();
71 void _takeAction( int val );
72 bool _executeAction();
74 void _selectLayer(SPObject *layer);
75 bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer);
77 void _layersChanged();
78 void _addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level );
80 SPObject* _selectedLayer();
82 // Hooked to the desktop:
83 sigc::connection _layerChangedConnection;
85 // Hooked to the layer manager:
86 sigc::connection _changedConnection;
87 sigc::connection _addedConnection;
88 sigc::connection _removedConnection;
90 int _maxNestDepth;
91 Inkscape::LayerManager* _mgr;
92 SPDesktop* _desktop;
93 ModelColumns* _model;
94 InternalUIBounce* _pending;
95 Glib::RefPtr<Gtk::TreeStore> _store;
96 std::vector<Gtk::Widget*> _watching;
97 std::vector<Gtk::Widget*> _watchingNonTop;
98 std::vector<Gtk::Widget*> _watchingNonBottom;
100 Gtk::Tooltips _tips;
101 Gtk::TreeView _tree;
102 Gtk::HBox _buttonsRow;
103 Gtk::ScrolledWindow _scroller;
104 Gtk::Menu _popupMenu;
105 };
109 } //namespace Dialogs
110 } //namespace UI
111 } //namespace Inkscape
115 #endif // SEEN_LAYERS_PANEL_H
117 /*
118 Local Variables:
119 mode:c++
120 c-file-style:"stroustrup"
121 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
122 indent-tabs-mode:nil
123 fill-column:99
124 End:
125 */
126 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :