This shows the dialog to resize the current map. More...
#include <resize_map.hpp>
Public Types | |
enum | EXPAND_DIRECTION { EXPAND_BOTTOM_RIGHT, EXPAND_BOTTOM, EXPAND_BOTTOM_LEFT, EXPAND_RIGHT, EXPAND_CENTER, EXPAND_LEFT, EXPAND_TOP_RIGHT, EXPAND_TOP, EXPAND_TOP_LEFT } |
Public Member Functions | |
editor_resize_map (int &width, int &height, EXPAND_DIRECTION &expand_direction, bool ©_edge_terrain) | |
Constructor. More... | |
![]() | |
modal_dialog () | |
virtual | ~modal_dialog () |
bool | show (const unsigned auto_close_time=0) |
Shows the window. More... | |
window * | get_window () const |
Returns a pointer to the dialog's window. More... | |
int | get_retval () const |
Returns the cached window exit code. More... | |
void | set_retval (int retval) |
Convenience wrapper to set the window's exit code. More... | |
void | set_always_save_fields (const bool always_save_fields) |
void | set_restore (const bool restore) |
void | set_allow_plugin_skip (const bool allow_plugin_skip) |
void | set_show_even_without_video (const bool show_even_without_video) |
Private Member Functions | |
void | update_expand_direction () |
void | set_direction_icon (int index, std::string icon) |
virtual void | pre_show (window &window) override |
Actions to be taken before showing the window. More... | |
virtual const std::string & | window_id () const override |
The id of the window to build. More... | |
Private Attributes | |
field_integer * | width_ |
The execute function. More... | |
field_integer * | height_ |
The currently selected height. More... | |
int | old_width_ |
The original width. More... | |
int | old_height_ |
The original height. More... | |
EXPAND_DIRECTION & | expand_direction_ |
The selected expansion direction. More... | |
toggle_button * | direction_buttons_ [9] |
The toggle buttons show the state of expand_direction_. More... | |
Additional Inherited Members | |
![]() | |
template<typename T , typename... Args> | |
T * | register_field (Args &&... args) |
Creates a new field of given type with given arguments. More... | |
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. More... | |
field_bool * | register_bool (const std::string &id, const bool mandatory, bool &linked_variable, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false) |
Creates a new boolean field. More... | |
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. More... | |
field_integer * | register_integer (const std::string &id, const bool mandatory, int &linked_variable) |
Creates a new integer field. More... | |
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. More... | |
field_text * | register_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false) |
Creates a new text field. More... | |
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. More... | |
field_label * | register_image (const std::string &id, const bool mandatory, const std::string &filename) |
Registers a new styled_widget as image. More... | |
![]() | |
std::unique_ptr< window > | window_ |
The window object build for this dialog. More... | |
This shows the dialog to resize the current map.
Key | Type | Mandatory | Description |
---|---|---|---|
old_width | label | no | Shows the old width of the map. |
old_height | label | no | Shows the old height of the map. |
width | slider | yes | Determines the new width of the map. |
height | slider | yes | Determines the new height of the map. |
copy_edge_terrain | boolean_selector | yes | Determines whether the border terrains should be used to expand or not. |
expand0 | toggle_button | yes | Determines in which direction to expand, shows the north east marker. |
expand1 | toggle_button | yes | Determines in which direction to expand, shows the north marker. |
expand2 | toggle_button | yes | Determines in which direction to expand, shows the north west marker. |
expand3 | toggle_button | yes | Determines in which direction to expand, shows the east marker. |
expand4 | toggle_button | yes | Determines in which direction to expand, shows the center marker. |
expand5 | toggle_button | yes | Determines in which direction to expand, shows the west marker. |
expand6 | toggle_button | yes | Determines in which direction to expand, shows the south east marker. |
expand7 | toggle_button | yes | Determines in which direction to expand, shows the south marker. |
expand8 | toggle_button | yes | Determines in which direction to expand, shows the south west marker. |
Definition at line 49 of file resize_map.hpp.
Enumerator | |
---|---|
EXPAND_BOTTOM_RIGHT | |
EXPAND_BOTTOM | |
EXPAND_BOTTOM_LEFT | |
EXPAND_RIGHT | |
EXPAND_CENTER | |
EXPAND_LEFT | |
EXPAND_TOP_RIGHT | |
EXPAND_TOP | |
EXPAND_TOP_LEFT |
Definition at line 52 of file resize_map.hpp.
gui2::dialogs::editor_resize_map::editor_resize_map | ( | int & | width, |
int & | height, | ||
EXPAND_DIRECTION & | expand_direction, | ||
bool & | copy_edge_terrain | ||
) |
Constructor.
[in,out] | width | The parameter's usage is:
|
[in,out] | height | The parameter's usage is:
|
[out] | expand_direction | The selected expand direction if the dialog returns retval::OK undefined otherwise. |
[in,out] | copy_edge_terrain | The parameter's usage is:
|
Definition at line 32 of file resize_map.cpp.
|
overrideprivatevirtual |
Actions to be taken before showing the window.
At this point the registered fields are registered and initialized with their initial values.
window | The window to be shown. |
Reimplemented from gui2::dialogs::modal_dialog.
Definition at line 49 of file resize_map.cpp.
References gui2::event::connect_signal_notify_modified(), direction_buttons_, i, gui2::toggle_button::set_value(), and update_expand_direction().
|
private |
Definition at line 87 of file resize_map.cpp.
References direction_buttons_, utf8::index(), and gui2::toggle_button::set_icon_name().
Referenced by update_expand_direction().
|
private |
Definition at line 95 of file resize_map.cpp.
References direction_buttons_, expand_direction_, gui2::field< T, W, CT >::get_widget_value(), height_, i, ne, nw, old_height_, old_width_, gui2::dialogs::resize_grid_xy_to_idx(), se, set_direction_icon(), gui2::toggle_button::set_value(), sw, swap(), and width_.
Referenced by pre_show().
|
overrideprivatevirtual |
The id of the window to build.
Implements gui2::dialogs::modal_dialog.
|
private |
The toggle buttons show the state of expand_direction_.
Allows both so select a direction and visually show the effect of the selection.
Definition at line 122 of file resize_map.hpp.
Referenced by pre_show(), set_direction_icon(), and update_expand_direction().
|
private |
The selected expansion direction.
Definition at line 114 of file resize_map.hpp.
Referenced by update_expand_direction().
|
private |
The currently selected height.
Definition at line 105 of file resize_map.hpp.
Referenced by update_expand_direction().
|
private |
The original height.
Definition at line 111 of file resize_map.hpp.
Referenced by update_expand_direction().
|
private |
The original width.
Definition at line 108 of file resize_map.hpp.
Referenced by update_expand_direction().
|
private |
The execute function.
See modal_dialog for more information. The currently selected width.
Definition at line 102 of file resize_map.hpp.
Referenced by update_expand_direction().