ba135e20202522cca24e07ea93dc85c3dfc25f28
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;
53 LayersPanel(LayersPanel const &); // no copy
54 LayersPanel &operator=(LayersPanel const &); // no assign
56 static LayersPanel* instance;
58 void _styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback );
59 void _fireAction( unsigned int code );
60 Gtk::MenuItem& _addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id );
62 void _toggled( Glib::ustring const& str, int targetCol );
64 void _handleButtonEvent(GdkEventButton* evt);
65 void _handleRowChange( Gtk::TreeModel::Path const& path, Gtk::TreeModel::iterator const& iter );
67 void _checkTreeSelection();
69 void _takeAction( int val );
71 void _selectLayer(SPObject *layer);
72 bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer);
74 void _layersChanged();
76 SPObject* _selectedLayer();
78 // Hooked to the desktop:
79 sigc::connection _layerChangedConnection;
81 // Hooked to the layer manager:
82 sigc::connection _changedConnection;
83 sigc::connection _addedConnection;
84 sigc::connection _removedConnection;
86 Inkscape::LayerManager* _mgr;
87 SPDesktop* _desktop;
88 ModelColumns* _model;
89 Glib::RefPtr<Gtk::TreeStore> _store;
90 std::vector<Gtk::Widget*> _watching;
91 std::vector<Gtk::Widget*> _watchingNonTop;
92 std::vector<Gtk::Widget*> _watchingNonBottom;
94 Gtk::Tooltips _tips;
95 Gtk::TreeView _tree;
96 Gtk::HBox _buttonsRow;
97 Gtk::ScrolledWindow _scroller;
98 Gtk::Menu _popupMenu;
99 };
103 } //namespace Dialogs
104 } //namespace UI
105 } //namespace Inkscape
109 #endif // SEEN_LAYERS_PANEL_H
111 /*
112 Local Variables:
113 mode:c++
114 c-file-style:"stroustrup"
115 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
116 indent-tabs-mode:nil
117 fill-column:99
118 End:
119 */
120 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :