15 #ifndef GUI_DIALOGS_DIALOG_HPP_INCLUDED
16 #define GUI_DIALOGS_DIALOG_HPP_INCLUDED
43 #define REGISTER_WINDOW(id) \
50 struct tregister_helper \
54 register_window(#id); \
58 tregister_helper register_helper; \
81 #define REGISTER_DIALOG2(type, id) \
82 REGISTER_WINDOW(id) const std::string& type::window_id() const \
84 static const std::string result(#id); \
93 #define REGISTER_DIALOG(window_id) REGISTER_DIALOG2(t##window_id, window_id)
156 bool show(
CVideo& video,
const unsigned auto_close_time = 0);
198 const bool mandatory,
199 const std::function<
bool()>& callback_load_value
200 = std::function<
bool()>(),
201 const std::function<
void(
const bool)>& callback_save_value
202 = std::function<
void(
const bool)>(),
203 const std::function<
void(
twidget&)>& callback_change
204 = std::function<
void(
twidget&)>());
223 const bool mandatory,
224 bool& linked_variable,
225 const std::function<
void(
twidget&)>& callback_change
226 = std::function<
void(
twidget&)>());
235 const bool mandatory,
236 const std::function<
int()>& callback_load_value
237 = std::function<
int()>(),
238 const std::function<
void(
const int)>& callback_save_value
239 = std::function<
void(
const int)>());
247 const bool mandatory,
248 int& linked_variable);
256 const bool mandatory,
257 const std::function<
std::string()>& callback_load_value
259 const std::function<
void(
const std::string&)>& callback_save_value
261 const bool capture_focus =
false);
269 const bool mandatory,
271 const bool capture_focus =
false);
291 const bool mandatory,
293 const bool use_markup =
false);
297 const bool mandatory,
tfield_label * register_image(const std::string &id, const bool mandatory, const std::string &filename)
Registers a new control as image.
virtual void pre_show(twindow &window)
Actions to be taken before showing the window.
bool always_save_fields_
Always save the fields upon closing.
virtual void post_build(twindow &window)
Actions to be taken directly after the window is build.
int retval_
Returns the window exit status, 0 means not shown.
bool show(CVideo &video, const unsigned auto_close_time=0)
Shows the window.
Template class to implement the generic field implementation.
void set_always_save_fields(const bool always_save_fields)
base class of top level items, the only item which needs to store the final canvases to draw on ...
A class inherited from ttext_box that displays its input as stars.
friend std::string unit_test_mark_as_tested(const tdialog &dialog)
Special helper function to get the id of the window.
virtual void post_show(twindow &window)
Actions to be taken after the window has been shown.
Abstract base class for all dialogs.
tfield_integer * register_integer(const std::string &id, const bool mandatory, const std::function< int()> &callback_load_value=std::function< int()>(), const std::function< void(const int)> &callback_save_value=std::function< void(const int)>())
Creates a new integer field.
void set_restore(const bool restore)
Contains all forward declarations for field.hpp.
bool restore_
Restore the screen after showing?
virtual void init_fields(twindow &window)
Initializes all fields in the dialog and set the keyboard focus.
tfield_label * register_label(const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false)
Registers a new control as a label.
twindow * build_window(CVideo &video) const
Builds the window.
std::vector< tfield_ * > fields_
Contains the automatically managed fields.
tfield_bool * register_bool(const std::string &id, const bool mandatory, const std::function< bool()> &callback_load_value=std::function< bool()>(), const std::function< void(const bool)> &callback_save_value=std::function< void(const bool)>(), const std::function< void(twidget &)> &callback_change=std::function< void(twidget &)>())
Creates a new boolean field.
virtual void finalize_fields(twindow &window, const bool save_fields)
When the dialog is closed with the OK status saves all fields.
std::string focus_
Contains the widget that should get the focus when the window is shown.
virtual const std::string & window_id() const =0
The id of the window to build.
Specialized field class for boolean.
tfield_text * register_text(const std::string &id, const bool mandatory, const std::function< std::string()> &callback_load_value=std::function< std::string()>(), const std::function< void(const std::string &)> &callback_save_value=std::function< void(const std::string &)>(), const bool capture_focus=false)
Creates a new text field.
GLsizei const GLcharARB ** string
Specialized field class for a control, used for labels and images.
Specialized field class for text.