Code

clicking toggles doesn't change selected layer.
[inkscape.git] / src / dialogs / layers-panel.h
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>
19 #include <gtkmm/buttonbox.h>
21 #include "ui/widget/panel.h"
22 //#include "ui/previewholder.h"
24 class SPObject;
26 namespace Inkscape {
28 class LayerManager;
30 namespace UI {
31 namespace Dialogs {
34 /**
35  * A panel that displays layers.
36  */
37 class LayersPanel : public Inkscape::UI::Widget::Panel
38 {
39 public:
40     LayersPanel();
41     virtual ~LayersPanel();
43     static LayersPanel& getInstance();
44     //virtual void setOrientation( Gtk::AnchorType how );
46     void setDesktop( SPDesktop* desktop );
48 protected:
49     //virtual void _handleAction( int setId, int itemId );
51 private:
52     class ModelColumns;
53     class InternalUIBounce;
55     LayersPanel(LayersPanel const &); // no copy
56     LayersPanel &operator=(LayersPanel const &); // no assign
58     static LayersPanel* instance;
60     void _styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback );
61     void _fireAction( unsigned int code );
62     Gtk::MenuItem& _addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id );
64     void _preToggle( GdkEvent const *event );
65     void _toggled( Glib::ustring const& str, int targetCol );
67     void _handleButtonEvent(GdkEventButton* evt);
68     void _handleRowChange( Gtk::TreeModel::Path const& path, Gtk::TreeModel::iterator const& iter );
70     void _pushTreeSelectionToCurrent();
71     void _checkTreeSelection();
73     void _takeAction( int val );
74     bool _executeAction();
76     bool _rowSelectFunction( Glib::RefPtr<Gtk::TreeModel> const & model, Gtk::TreeModel::Path const & path, bool b );
78     void _updateLayer(SPObject *layer);
79     bool _checkForUpdated(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPObject* layer);
81     void _selectLayer(SPObject *layer);
82     bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer);
84     void _layersChanged();
85     void _addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level );
87     SPObject* _selectedLayer();
89     // Hooked to the layer manager:
90     sigc::connection _layerChangedConnection;
91     sigc::connection _layerUpdatedConnection;
92     sigc::connection _changedConnection;
93     sigc::connection _addedConnection;
94     sigc::connection _removedConnection;
96     int _maxNestDepth;
97     Inkscape::LayerManager* _mgr;
98     SPDesktop* _desktop;
99     ModelColumns* _model;
100     InternalUIBounce* _pending;
101     GdkEvent* _toggleEvent;
102     Glib::RefPtr<Gtk::TreeStore> _store;
103     std::vector<Gtk::Widget*> _watching;
104     std::vector<Gtk::Widget*> _watchingNonTop;
105     std::vector<Gtk::Widget*> _watchingNonBottom;
107     Gtk::Tooltips _tips;
108     Gtk::TreeView _tree;
109     Gtk::HButtonBox _buttonsRow;
110     Gtk::ScrolledWindow _scroller;
111     Gtk::Menu _popupMenu;
112 };
116 } //namespace Dialogs
117 } //namespace UI
118 } //namespace Inkscape
122 #endif // SEEN_LAYERS_PANEL_H
124 /*
125   Local Variables:
126   mode:c++
127   c-file-style:"stroustrup"
128   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
129   indent-tabs-mode:nil
130   fill-column:99
131   End:
132 */
133 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :