worldspawn/src/dialog.h

197 lines
5.5 KiB
C
Raw Permalink Normal View History

2020-11-17 03:16:16 -08:00
/*
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined( INCLUDED_DIALOG_H )
#define INCLUDED_DIALOG_H
#include <list>
#include <uilib/uilib.h>
#include "property.h"
#include "generic/callback.h"
#include "gtkutil/dialog.h"
#include "generic/callback.h"
#include "string/string.h"
struct DLG_DATA {
2021-08-04 13:23:18 -07:00
virtual ~DLG_DATA() = default;
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
virtual void release() = 0;
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
virtual void importData() const = 0;
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
virtual void exportData() const = 0;
2020-11-17 03:16:16 -08:00
};
template<typename FirstArgument>
class CallbackDialogData;
typedef std::list<DLG_DATA *> DialogDataList;
class Dialog {
2021-08-04 13:23:18 -07:00
ui::Window m_window;
DialogDataList m_data;
2020-11-17 03:16:16 -08:00
public:
2021-08-04 13:23:18 -07:00
ModalDialog m_modal;
ui::Window m_parent;
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
Dialog();
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
virtual ~Dialog();
2020-11-17 03:16:16 -08:00
/*!
start modal dialog box
you need to use AddModalButton to select eIDOK eIDCANCEL buttons
*/
2021-08-04 13:23:18 -07:00
EMessageBoxReturn DoModal();
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void EndModal(EMessageBoxReturn code);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
virtual ui::Window BuildDialog() = 0;
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
virtual void exportData();
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
virtual void importData();
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
virtual void PreModal()
{
};
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
virtual void PostModal(EMessageBoxReturn code)
{
};
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
virtual void ShowDlg();
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
virtual void HideDlg();
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void Create();
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void Destroy();
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::Window GetWidget()
{
return m_window;
}
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
const ui::Window GetWidget() const
{
return m_window;
}
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::CheckButton addCheckBox(ui::VBox vbox, const char *name, const char *flag, Property<bool> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::CheckButton addCheckBox(ui::VBox vbox, const char *name, const char *flag, bool &data);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void addCombo(ui::VBox vbox, const char *name, StringArrayRange values, Property<int> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void addCombo(ui::VBox vbox, const char *name, int &data, StringArrayRange values);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void addSlider(ui::VBox vbox, const char *name, int &data, gboolean draw_value, const char *low, const char *high,
double value, double lower, double upper, double step_increment, double page_increment);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void addRadio(ui::VBox vbox, const char *name, StringArrayRange names, Property<int> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void addRadio(ui::VBox vbox, const char *name, int &data, StringArrayRange names);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void addRadioIcons(ui::VBox vbox, const char *name, StringArrayRange icons, Property<int> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void addRadioIcons(ui::VBox vbox, const char *name, int &data, StringArrayRange icons);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::Widget addIntEntry(ui::VBox vbox, const char *name, Property<int> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::Widget addEntry(ui::VBox vbox, const char *name, int &data)
{
return addIntEntry(vbox, name, make_property(data));
}
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::Widget addSizeEntry(ui::VBox vbox, const char *name, Property<std::size_t> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::Widget addEntry(ui::VBox vbox, const char *name, std::size_t &data)
{
return addSizeEntry(vbox, name, make_property(data));
}
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::Widget addFloatEntry(ui::VBox vbox, const char *name, Property<float> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::Widget addEntry(ui::VBox vbox, const char *name, float &data)
{
return addFloatEntry(vbox, name, make_property(data));
}
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::Widget addPathEntry(ui::VBox vbox, const char *name, bool browse_directory, Property<const char *> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::Widget addPathEntry(ui::VBox vbox, const char *name, CopiedString &data, bool directory);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::SpinButton addSpinner(ui::VBox vbox, const char *name, int &data, double value, double lower, double upper);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::SpinButton
addSpinner(ui::VBox vbox, const char *name, double value, double lower, double upper, Property<int> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
ui::SpinButton
addSpinner(ui::VBox vbox, const char *name, double value, double lower, double upper, Property<float> const &cb);
2020-11-17 03:16:16 -08:00
protected:
2021-08-04 13:23:18 -07:00
void AddBoolToggleData(ui::ToggleButton object, Property<bool> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddIntRadioData(ui::RadioButton object, Property<int> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddTextEntryData(ui::Entry object, Property<const char *> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddIntEntryData(ui::Entry object, Property<int> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddSizeEntryData(ui::Entry object, Property<std::size_t> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddFloatEntryData(ui::Entry object, Property<float> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddFloatSpinnerData(ui::SpinButton object, Property<float> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddIntSpinnerData(ui::SpinButton object, Property<int> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddIntAdjustmentData(ui::Adjustment object, Property<int> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddIntComboData(ui::ComboBox object, Property<int> const &cb);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddDialogData(ui::ToggleButton object, bool &data);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddDialogData(ui::RadioButton object, int &data);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddDialogData(ui::Entry object, CopiedString &data);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddDialogData(ui::Entry object, int &data);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddDialogData(ui::Entry object, std::size_t &data);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddDialogData(ui::Entry object, float &data);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddDialogData(ui::SpinButton object, float &data);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddDialogData(ui::SpinButton object, int &data);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddDialogData(ui::Adjustment object, int &data);
2020-11-17 03:16:16 -08:00
2021-08-04 13:23:18 -07:00
void AddDialogData(ui::ComboBox object, int &data);
2020-11-17 03:16:16 -08:00
};
#endif