blob: 15404b2e5c7c9513eed9ae64bc00b01736d39889 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/**
*
* \brief Dialog for renaming layers
*
* Author:
* Bryce W. Harrington <bryce@bryceharrington.com>
*
* Copyright (C) 2004 Bryce Harrington
*
* Released under GNU GPL. Read the file 'COPYING' for more information
*/
#ifndef INKSCAPE_DIALOG_LAYER_PROPERTIES_H
#define INKSCAPE_DIALOG_LAYER_PROPERTIES_H
#include <gtkmm/dialog.h>
#include <gtkmm/notebook.h>
#include <gtkmm/separator.h>
#include <gtkmm/frame.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
#include <gtkmm/table.h>
#include "selection.h"
namespace Inkscape {
namespace UI {
namespace Dialogs {
class LayerPropertiesDialog : public Gtk::Dialog {
public:
LayerPropertiesDialog();
virtual ~LayerPropertiesDialog();
Glib::ustring getName() const { return "LayerPropertiesDialog"; }
static void showRename(SPDesktop *desktop, SPObject *layer) {
_showDialog(Rename::instance(), desktop, layer);
}
static void showCreate(SPDesktop *desktop, SPObject *layer) {
_showDialog(Create::instance(), desktop, layer);
}
protected:
struct Strategy {
virtual ~Strategy() {}
virtual void setup(LayerPropertiesDialog &)=0;
virtual void perform(LayerPropertiesDialog &)=0;
};
struct Rename : public Strategy {
static Rename &instance() { static Rename instance; return instance; }
void setup(LayerPropertiesDialog &dialog);
void perform(LayerPropertiesDialog &dialog);
};
struct Create : public Strategy {
static Create &instance() { static Create instance; return instance; }
void setup(LayerPropertiesDialog &dialog);
void perform(LayerPropertiesDialog &dialog);
};
friend class Rename;
friend class Create;
Strategy *_strategy;
SPDesktop *_desktop;
SPObject *_layer;
Gtk::HBox _layer_name_hbox;
Gtk::Label _layer_name_label;
Gtk::Entry _layer_name_entry;
Gtk::Button _close_button;
Gtk::Button _apply_button;
sigc::connection _destroy_connection;
static LayerPropertiesDialog &_instance() {
static LayerPropertiesDialog instance;
return instance;
}
void _setDesktop(SPDesktop *desktop);
void _setLayer(SPObject *layer);
static void _showDialog(Strategy &strategy, SPDesktop *desktop, SPObject *layer);
void _apply();
void _close();
private:
LayerPropertiesDialog(LayerPropertiesDialog const &); // no copy
LayerPropertiesDialog &operator=(LayerPropertiesDialog const &); // no assign
};
} // namespace
} // namespace
} // namespace
#endif //INKSCAPE_DIALOG_LAYER_PROPERTIES_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
|