2 Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
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.
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.
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
22 #if !defined( INCLUDED_DIALOG_H )
23 #define INCLUDED_DIALOG_H
26 #include <uilib/uilib.h>
29 #include "generic/callback.h"
30 #include "gtkutil/dialog.h"
31 #include "generic/callback.h"
32 #include "string/string.h"
36 virtual ~DLG_DATA() = default;
37 virtual void release() = 0;
38 virtual void importData() const = 0;
39 virtual void exportData() const = 0;
43 template<typename FirstArgument>
44 class CallbackDialogData;
46 typedef std::list<DLG_DATA*> DialogDataList;
50 DialogDataList m_data;
60 start modal dialog box
61 you need to use AddModalButton to select eIDOK eIDCANCEL buttons
63 EMessageBoxReturn DoModal();
65 void EndModal(EMessageBoxReturn code);
67 virtual ui::Window BuildDialog() = 0;
69 virtual void exportData();
71 virtual void importData();
73 virtual void PreModal() {};
75 virtual void PostModal(EMessageBoxReturn code) {};
77 virtual void ShowDlg();
79 virtual void HideDlg();
85 ui::Window GetWidget() {
89 const ui::Window GetWidget() const {
93 ui::CheckButton addCheckBox(ui::VBox vbox, const char *name, const char *flag, Property<bool> const &cb);
95 ui::CheckButton addCheckBox(ui::VBox vbox, const char *name, const char *flag, bool &data);
97 void addCombo(ui::VBox vbox, const char *name, StringArrayRange values, Property<int> const &cb);
99 void addCombo(ui::VBox vbox, const char *name, int &data, StringArrayRange values);
101 void addSlider(ui::VBox vbox, const char *name, int &data, gboolean draw_value, const char *low, const char *high,
102 double value, double lower, double upper, double step_increment, double page_increment);
104 void addRadio(ui::VBox vbox, const char *name, StringArrayRange names, Property<int> const &cb);
106 void addRadio(ui::VBox vbox, const char *name, int &data, StringArrayRange names);
108 void addRadioIcons(ui::VBox vbox, const char *name, StringArrayRange icons, Property<int> const &cb);
110 void addRadioIcons(ui::VBox vbox, const char *name, int &data, StringArrayRange icons);
112 ui::Widget addIntEntry(ui::VBox vbox, const char *name, Property<int> const &cb);
114 ui::Widget addEntry(ui::VBox vbox, const char *name, int &data) {
115 return addIntEntry(vbox, name, make_property(data));
118 ui::Widget addSizeEntry(ui::VBox vbox, const char *name, Property<std::size_t> const &cb);
120 ui::Widget addEntry(ui::VBox vbox, const char *name, std::size_t &data) {
121 return addSizeEntry(vbox, name, make_property(data));
124 ui::Widget addFloatEntry(ui::VBox vbox, const char *name, Property<float> const &cb);
126 ui::Widget addEntry(ui::VBox vbox, const char *name, float &data) {
127 return addFloatEntry(vbox, name, make_property(data));
130 ui::Widget addPathEntry(ui::VBox vbox, const char *name, bool browse_directory, Property<const char *> const &cb);
132 ui::Widget addPathEntry(ui::VBox vbox, const char *name, CopiedString &data, bool directory);
134 ui::SpinButton addSpinner(ui::VBox vbox, const char *name, int &data, double value, double lower, double upper);
137 addSpinner(ui::VBox vbox, const char *name, double value, double lower, double upper, Property<int> const &cb);
140 addSpinner(ui::VBox vbox, const char *name, double value, double lower, double upper, Property<float> const &cb);
144 void AddBoolToggleData(ui::ToggleButton object, Property<bool> const &cb);
146 void AddIntRadioData(ui::RadioButton object, Property<int> const &cb);
148 void AddTextEntryData(ui::Entry object, Property<const char *> const &cb);
150 void AddIntEntryData(ui::Entry object, Property<int> const &cb);
152 void AddSizeEntryData(ui::Entry object, Property<std::size_t> const &cb);
154 void AddFloatEntryData(ui::Entry object, Property<float> const &cb);
156 void AddFloatSpinnerData(ui::SpinButton object, Property<float> const &cb);
158 void AddIntSpinnerData(ui::SpinButton object, Property<int> const &cb);
160 void AddIntAdjustmentData(ui::Adjustment object, Property<int> const &cb);
162 void AddIntComboData(ui::ComboBox object, Property<int> const &cb);
164 void AddDialogData(ui::ToggleButton object, bool &data);
166 void AddDialogData(ui::RadioButton object, int &data);
168 void AddDialogData(ui::Entry object, CopiedString &data);
170 void AddDialogData(ui::Entry object, int &data);
172 void AddDialogData(ui::Entry object, std::size_t &data);
174 void AddDialogData(ui::Entry object, float &data);
176 void AddDialogData(ui::SpinButton object, float &data);
178 void AddDialogData(ui::SpinButton object, int &data);
180 void AddDialogData(ui::Adjustment object, int &data);
182 void AddDialogData(ui::ComboBox object, int &data);