Code

NR:: => Geom:: for much of src/ui and src/widgets
[inkscape.git] / src / dialogs / layer-properties.h
1 /**
2  *
3  * \brief  Dialog for renaming layers
4  *
5  * Author:
6  *   Bryce W. Harrington <bryce@bryceharrington.com>
7  *
8  * Copyright (C) 2004 Bryce Harrington
9  *
10  * Released under GNU GPL.  Read the file 'COPYING' for more information
11  */
13 #ifndef INKSCAPE_DIALOG_LAYER_PROPERTIES_H
14 #define INKSCAPE_DIALOG_LAYER_PROPERTIES_H
16 #include <gtkmm/dialog.h>
17 #include <gtkmm/notebook.h>
18 #include <gtkmm/separator.h>
19 #include <gtkmm/frame.h>
20 #include <gtkmm/entry.h>
21 #include <gtkmm/label.h>
22 #include <gtkmm/table.h>
23 #include <gtkmm/combobox.h>
24 #include <gtkmm/liststore.h>
26 #include "selection.h"
27 #include "layer-fns.h"
29 namespace Inkscape {
30 namespace UI {
31 namespace Dialogs {
33 class LayerPropertiesDialog : public Gtk::Dialog {
34  public:
35     LayerPropertiesDialog();
36     virtual ~LayerPropertiesDialog();
38     Glib::ustring     getName() const { return "LayerPropertiesDialog"; }
40     static void showRename(SPDesktop *desktop, SPObject *layer) {
41         _showDialog(Rename::instance(), desktop, layer);
42     }
43     static void showCreate(SPDesktop *desktop, SPObject *layer) {
44         _showDialog(Create::instance(), desktop, layer);
45     }
47 protected:
48     struct Strategy {
49         virtual ~Strategy() {}
50         virtual void setup(LayerPropertiesDialog &)=0;
51         virtual void perform(LayerPropertiesDialog &)=0;
52     };
53     struct Rename : public Strategy {
54         static Rename &instance() { static Rename instance; return instance; }
55         void setup(LayerPropertiesDialog &dialog);
56         void perform(LayerPropertiesDialog &dialog);
57     };
58     struct Create : public Strategy {
59         static Create &instance() { static Create instance; return instance; }
60         void setup(LayerPropertiesDialog &dialog);
61         void perform(LayerPropertiesDialog &dialog);
62     };
64     friend class Rename;
65     friend class Create;
67     Strategy *_strategy;
68     SPDesktop *_desktop;
69     SPObject *_layer;
71     class PositionDropdownColumns : public Gtk::TreeModel::ColumnRecord {
72     public:
73         Gtk::TreeModelColumn<LayerRelativePosition> position;
74         Gtk::TreeModelColumn<Glib::ustring> name;
76         PositionDropdownColumns() {
77             add(position); add(name);
78         }
79     };
81     Gtk::Label        _layer_name_label;
82     Gtk::Entry        _layer_name_entry;
83     Gtk::Label        _layer_position_label;
84     Gtk::ComboBox     _layer_position_combo;
85     Gtk::Table        _layout_table;
86     bool              _position_visible;
88     PositionDropdownColumns _dropdown_columns;
89     Gtk::CellRendererText _label_renderer;
90     Glib::RefPtr<Gtk::ListStore> _dropdown_list;
92     Gtk::Button       _close_button;
93     Gtk::Button       _apply_button;
95     sigc::connection    _destroy_connection;
97     static LayerPropertiesDialog &_instance() {
98         static LayerPropertiesDialog instance;
99         return instance;
100     }
102     void _setDesktop(SPDesktop *desktop);
103     void _setLayer(SPObject *layer);
105     static void _showDialog(Strategy &strategy, SPDesktop *desktop, SPObject *layer);
106     void _apply();
107     void _close();
109     void _setup_position_controls();
110     void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row);
112 private:
113     LayerPropertiesDialog(LayerPropertiesDialog const &); // no copy
114     LayerPropertiesDialog &operator=(LayerPropertiesDialog const &); // no assign
115 };
117 } // namespace
118 } // namespace
119 } // namespace
122 #endif //INKSCAPE_DIALOG_LAYER_PROPERTIES_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 :