Debian Codegraph @

radiant/dialog.h

raw symbols SCIP
1 /*
2 Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5 This file is part of GtkRadiant.
6
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #if !defined( INCLUDED_DIALOG_H )
23 #define INCLUDED_DIALOG_H
24
25 #include <list>
26 #include <uilib/uilib.h>
27 #include "property.h"
28
29 #include "generic/callback.h"
30 #include "gtkutil/dialog.h"
31 #include "generic/callback.h"
32 #include "string/string.h"
33
34 struct DLG_DATA
35 {
36 virtual ~DLG_DATA() = default;
37 virtual void release() = 0;
38 virtual void importData() const = 0;
39 virtual void exportData() const = 0;
40 };
41
42
43 template<typename FirstArgument>
44 class CallbackDialogData;
45
46 typedef std::list<DLG_DATA*> DialogDataList;
47
48 class Dialog {
49 ui::Window m_window;
50 DialogDataList m_data;
51 public:
52 ModalDialog m_modal;
53 ui::Window m_parent;
54
55 Dialog();
56
57 virtual ~Dialog();
58
59 /*!
60 start modal dialog box
61 you need to use AddModalButton to select eIDOK eIDCANCEL buttons
62 */
63 EMessageBoxReturn DoModal();
64
65 void EndModal(EMessageBoxReturn code);
66
67 virtual ui::Window BuildDialog() = 0;
68
69 virtual void exportData();
70
71 virtual void importData();
72
73 virtual void PreModal() {};
74
75 virtual void PostModal(EMessageBoxReturn code) {};
76
77 virtual void ShowDlg();
78
79 virtual void HideDlg();
80
81 void Create();
82
83 void Destroy();
84
85 ui::Window GetWidget() {
86 return m_window;
87 }
88
89 const ui::Window GetWidget() const {
90 return m_window;
91 }
92
93 ui::VBox addSpacer(ui::VBox vbox, int size);
94
95 ui::Label addLabel(ui::VBox vbox, const char *name, const char *text);
96
97 ui::CheckButton addCheckBox(ui::VBox vbox, const char *name, const char *flag, Property<bool> const &cb);
98
99 ui::CheckButton addCheckBox(ui::VBox vbox, const char *name, const char *flag, bool &data);
100
101 void addCombo(ui::VBox vbox, const char *name, StringArrayRange values, Property<int> const &cb);
102
103 void addCombo(ui::VBox vbox, const char *name, int &data, StringArrayRange values);
104
105 void addSlider(ui::VBox vbox, const char *name, int &data, gboolean draw_value, const char *low, const char *high,
106 double value, double lower, double upper, double step_increment, double page_increment);
107
108 void addRadio(ui::VBox vbox, const char *name, StringArrayRange names, Property<int> const &cb);
109
110 void addRadio(ui::VBox vbox, const char *name, int &data, StringArrayRange names);
111
112 void addRadioIcons(ui::VBox vbox, const char *name, StringArrayRange icons, Property<int> const &cb);
113
114 void addRadioIcons(ui::VBox vbox, const char *name, int &data, StringArrayRange icons);
115
116 ui::Widget addIntEntry(ui::VBox vbox, const char *name, Property<int> const &cb);
117
118 ui::Widget addEntry(ui::VBox vbox, const char *name, int &data) {
119 return addIntEntry(vbox, name, make_property(data));
120 }
121
122 ui::Widget addSizeEntry(ui::VBox vbox, const char *name, Property<std::size_t> const &cb);
123
124 ui::Widget addEntry(ui::VBox vbox, const char *name, std::size_t &data) {
125 return addSizeEntry(vbox, name, make_property(data));
126 }
127
128 ui::Widget addFloatEntry(ui::VBox vbox, const char *name, Property<float> const &cb);
129
130 ui::Widget addEntry(ui::VBox vbox, const char *name, float &data) {
131 return addFloatEntry(vbox, name, make_property(data));
132 }
133
134 ui::Widget addPathEntry(ui::VBox vbox, const char *name, bool browse_directory, Property<const char *> const &cb);
135
136 ui::Widget addPathEntry(ui::VBox vbox, const char *name, CopiedString &data, bool directory);
137
138 ui::SpinButton addSpinner(ui::VBox vbox, const char *name, int &data, double value, double lower, double upper);
139
140 ui::SpinButton
141 addSpinner(ui::VBox vbox, const char *name, double value, double lower, double upper, Property<int> const &cb);
142
143 ui::SpinButton
144 addSpinner(ui::VBox vbox, const char *name, double value, double lower, double upper, Property<float> const &cb);
145
146 protected:
147
148 void AddBoolToggleData(ui::ToggleButton object, Property<bool> const &cb);
149
150 void AddIntRadioData(ui::RadioButton object, Property<int> const &cb);
151
152 void AddTextEntryData(ui::Entry object, Property<const char *> const &cb);
153
154 void AddIntEntryData(ui::Entry object, Property<int> const &cb);
155
156 void AddSizeEntryData(ui::Entry object, Property<std::size_t> const &cb);
157
158 void AddFloatEntryData(ui::Entry object, Property<float> const &cb);
159
160 void AddFloatSpinnerData(ui::SpinButton object, Property<float> const &cb);
161
162 void AddIntSpinnerData(ui::SpinButton object, Property<int> const &cb);
163
164 void AddIntAdjustmentData(ui::Adjustment object, Property<int> const &cb);
165
166 void AddIntComboData(ui::ComboBox object, Property<int> const &cb);
167
168 void AddDialogData(ui::ToggleButton object, bool &data);
169
170 void AddDialogData(ui::RadioButton object, int &data);
171
172 void AddDialogData(ui::Entry object, CopiedString &data);
173
174 void AddDialogData(ui::Entry object, int &data);
175
176 void AddDialogData(ui::Entry object, std::size_t &data);
177
178 void AddDialogData(ui::Entry object, float &data);
179
180 void AddDialogData(ui::SpinButton object, float &data);
181
182 void AddDialogData(ui::SpinButton object, int &data);
183
184 void AddDialogData(ui::Adjustment object, int &data);
185
186 void AddDialogData(ui::ComboBox object, int &data);
187 };
188
189 #endif