Code

make button labels translatable, and use HButtonBox versus HBox for better appearance
[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 _toggled( Glib::ustring const& str, int targetCol );
66     void _handleButtonEvent(GdkEventButton* evt);
67     void _handleRowChange( Gtk::TreeModel::Path const& path, Gtk::TreeModel::iterator const& iter );
69     void _pushTreeSelectionToCurrent();
70     void _checkTreeSelection();
72     void _takeAction( int val );
73     bool _executeAction();
75     void _updateLayer(SPObject *layer);
76     bool _checkForUpdated(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPObject* layer);
78     void _selectLayer(SPObject *layer);
79     bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer);
81     void _layersChanged();
82     void _addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level );
84     SPObject* _selectedLayer();
86     // Hooked to the layer manager:
87     sigc::connection _layerChangedConnection;
88     sigc::connection _layerUpdatedConnection;
89     sigc::connection _changedConnection;
90     sigc::connection _addedConnection;
91     sigc::connection _removedConnection;
93     int _maxNestDepth;
94     Inkscape::LayerManager* _mgr;
95     SPDesktop* _desktop;
96     ModelColumns* _model;
97     InternalUIBounce* _pending;
98     Glib::RefPtr<Gtk::TreeStore> _store;
99     std::vector<Gtk::Widget*> _watching;
100     std::vector<Gtk::Widget*> _watchingNonTop;
101     std::vector<Gtk::Widget*> _watchingNonBottom;
103     Gtk::Tooltips _tips;
104     Gtk::TreeView _tree;
105     Gtk::HButtonBox _buttonsRow;
106     Gtk::ScrolledWindow _scroller;
107     Gtk::Menu _popupMenu;
108 };
112 } //namespace Dialogs
113 } //namespace UI
114 } //namespace Inkscape
118 #endif // SEEN_LAYERS_PANEL_H
120 /*
121   Local Variables:
122   mode:c++
123   c-file-style:"stroustrup"
124   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
125   indent-tabs-mode:nil
126   fill-column:99
127   End:
128 */
129 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :