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>
24 #include "selection.h"
26 namespace Inkscape {
27 namespace UI {
28 namespace Dialogs {
30 class LayerPropertiesDialog : public Gtk::Dialog {
31 public:
32 LayerPropertiesDialog();
33 virtual ~LayerPropertiesDialog();
35 Glib::ustring getName() const { return "LayerPropertiesDialog"; }
37 static void showRename(SPDesktop *desktop, SPObject *layer) {
38 _showDialog(Rename::instance(), desktop, layer);
39 }
40 static void showCreate(SPDesktop *desktop, SPObject *layer) {
41 _showDialog(Create::instance(), desktop, layer);
42 }
44 protected:
45 struct Strategy {
46 virtual ~Strategy() {}
47 virtual void setup(LayerPropertiesDialog &)=0;
48 virtual void perform(LayerPropertiesDialog &)=0;
49 };
50 struct Rename : public Strategy {
51 static Rename &instance() { static Rename instance; return instance; }
52 void setup(LayerPropertiesDialog &dialog);
53 void perform(LayerPropertiesDialog &dialog);
54 };
55 struct Create : public Strategy {
56 static Create &instance() { static Create instance; return instance; }
57 void setup(LayerPropertiesDialog &dialog);
58 void perform(LayerPropertiesDialog &dialog);
59 };
61 friend class Rename;
62 friend class Create;
64 Strategy *_strategy;
65 SPDesktop *_desktop;
66 SPObject *_layer;
68 Gtk::HBox _layer_name_hbox;
69 Gtk::Label _layer_name_label;
70 Gtk::Entry _layer_name_entry;
72 Gtk::Button _close_button;
73 Gtk::Button _apply_button;
75 sigc::connection _destroy_connection;
77 static LayerPropertiesDialog &_instance() {
78 static LayerPropertiesDialog instance;
79 return instance;
80 }
82 void _setDesktop(SPDesktop *desktop);
83 void _setLayer(SPObject *layer);
85 static void _showDialog(Strategy &strategy, SPDesktop *desktop, SPObject *layer);
86 void _apply();
87 void _close();
89 private:
90 LayerPropertiesDialog(LayerPropertiesDialog const &); // no copy
91 LayerPropertiesDialog &operator=(LayerPropertiesDialog const &); // no assign
92 };
94 } // namespace
95 } // namespace
96 } // namespace
99 #endif //INKSCAPE_DIALOG_LAYER_PROPERTIES_H
101 /*
102 Local Variables:
103 mode:c++
104 c-file-style:"stroustrup"
105 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
106 indent-tabs-mode:nil
107 fill-column:99
108 End:
109 */
110 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :