15 #define GETTEXT_DOMAIN "wesnoth-lib" 33 , always_save_fields_(false)
37 , allow_plugin_skip_(true)
38 , show_even_without_video_(false)
47 struct window_stack_handler {
48 window_stack_handler(std::unique_ptr<window>& win) :
local_window(win) {
51 ~window_stack_handler() {
90 window_stack_handler push_window_stack(
window_);
129 const std::string&
id,
130 const bool mandatory,
131 const std::function<
bool()> callback_load_value,
132 const std::function<
void(
bool)> callback_save_value,
133 const std::function<
void(
widget&)> callback_change,
134 const bool initial_fire)
149 const bool mandatory,
150 bool& linked_variable,
151 const std::function<
void(
widget&)> callback_change,
152 const bool initial_fire)
155 =
new field_bool(
id, mandatory, linked_variable, callback_change, initial_fire);
162 const std::string&
id,
163 const bool mandatory,
164 const std::function<
int()> callback_load_value,
165 const std::function<
void(
const int)> callback_save_value)
168 id, mandatory, callback_load_value, callback_save_value);
175 const bool mandatory,
176 int& linked_variable)
185 const std::string&
id,
186 const bool mandatory,
187 const std::function<std::string()> callback_load_value,
188 const std::function<
void(
const std::string&)> callback_save_value,
189 const bool capture_focus)
192 id, mandatory, callback_load_value, callback_save_value);
203 const bool mandatory,
204 std::string& linked_variable,
205 const bool capture_focus)
218 const bool mandatory,
219 const std::string& text,
220 const bool use_markup)
void keyboard_capture(widget *widget)
void set_callback(const std::string &name, callback_function)
std::unique_ptr< window > & local_window
void attach_to_window(window &window)
Attaches the field to a window.
bool show_even_without_video_
Show the dialog even with –nogui? Some dialogs need to be shown even when –nogui is specified if th...
Specialized field class for boolean.
void widget_finalize(window &window)
Finalizes the widget.
virtual void post_build(window &window)
Actions to be taken directly after the window is build.
virtual void finalize_fields(window &window, const bool save_fields)
When the dialog is closed with the OK status saves all fields.
bool allow_plugin_skip_
Allow plugins to skip through the dialog? Most dialogs install a plugins context to allow plugins to ...
static CVideo & get_singleton()
field_bool * register_bool(const std::string &id, const bool mandatory, const std::function< bool()> callback_load_value=nullptr, const std::function< void(bool)> callback_save_value=nullptr, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false)
Creates a new boolean field.
Implements some helper classes to ease adding fields to a dialog and hide the synchronization needed...
bool always_save_fields_
Always save the fields upon closing.
bool show(const unsigned auto_close_time=0)
Shows the window.
field< int, integer_selector > field_integer
void detach_from_window()
Detaches the field from a window.
field_text * register_text(const std::string &id, const bool mandatory, const std::function< std::string()> callback_load_value=nullptr, const std::function< void(const std::string &)> callback_save_value=nullptr, const bool capture_focus=false)
Creates a new text field.
std::vector< std::unique_ptr< class field_base > > fields_
Contains the automatically managed fields.
bool restore_
Restore the screen after showing?
field_integer * register_integer(const std::string &id, const bool mandatory, const std::function< int()> callback_load_value=nullptr, const std::function< void(int)> callback_save_value=nullptr)
Creates a new integer field.
void remove_from_window_stack(window *window)
Removes a entry from the open_window_stack list.
static void field(LexState *ls, struct ConsControl *cc)
Various uncategorised dialogs.
widget * find(const std::string &id, const bool must_be_active) override
See widget::find.
#define DOUBLE_CLICK_EVENT
virtual void init_fields(window &window)
Initializes all fields in the dialog and set the keyboard focus.
Default, unset return value.
Specialized field class for a styled_widget, used for labels and images.
field_label * register_label(const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false)
Registers a new styled_widget as a label.
virtual const std::string & window_id() const =0
The id of the window to build.
int retval_
The window's exit code (return value).
void widget_init(window &window)
Initializes the widget.
std::unique_ptr< window > window_
The window object build for this dialog.
std::unique_ptr< window > build_window() const
Builds the window.
virtual void pre_show(window &window)
Actions to be taken before showing the window.
retval
Default window/dialog return values.
std::unique_ptr< window > build(const builder_window::window_resolution &definition)
Builds a window.
Dialog was closed with the OK button.
virtual void post_show(window &window)
Actions to be taken after the window has been shown.
std::string focus_
Contains the widget that should get the focus when the window is shown.
A config object defines a single node in a WML file, with access to child nodes.
Specialized field class for text.
void set_retval(int retval)
Convenience wrapper to set the window's exit code.
base class of top level items, the only item which needs to store the final canvases to draw on...
Template class to implement the generic field implementation.
static plugins_manager * get()
std::vector< window * > open_window_stack
Keeps track of any open windows of any type (modal, non-modal, or tooltip) in the order in which they...