The Battle for Wesnoth  1.15.12+dev
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
gui2::dialogs::editor_resize_map Class Reference

This shows the dialog to resize the current map. More...

#include <resize_map.hpp>

Inheritance diagram for gui2::dialogs::editor_resize_map:

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 &copy_edge_terrain)
 Constructor. More...
 
- Public Member Functions inherited from gui2::dialogs::modal_dialog
 modal_dialog ()
 
virtual ~modal_dialog ()
 
bool show (const unsigned auto_close_time=0)
 Shows the window. More...
 
windowget_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_integerwidth_
 The execute function. More...
 
field_integerheight_
 The currently selected height. More...
 
int old_width_
 The original width. More...
 
int old_height_
 The original height. More...
 
EXPAND_DIRECTIONexpand_direction_
 The selected expansion direction. More...
 
toggle_buttondirection_buttons_ [9]
 The toggle buttons show the state of expand_direction_. More...
 

Additional Inherited Members

- Protected Member Functions inherited from gui2::dialogs::modal_dialog
field_boolregister_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_boolregister_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_integerregister_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_integerregister_integer (const std::string &id, const bool mandatory, int &linked_variable)
 Creates a new integer field. More...
 
field_textregister_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_textregister_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false)
 Creates a new text field. More...
 
field_labelregister_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_labelregister_image (const std::string &id, const bool mandatory, const std::string &filename)
 Registers a new styled_widget as image. More...
 
- Protected Attributes inherited from gui2::dialogs::modal_dialog
std::unique_ptr< windowwindow_
 The window object build for this dialog. More...
 

Detailed Description

This shows the dialog to resize the current map.

Key Type MandatoryDescription
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 48 of file resize_map.hpp.

Member Enumeration Documentation

◆ EXPAND_DIRECTION

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 51 of file resize_map.hpp.

Constructor & Destructor Documentation

◆ editor_resize_map()

gui2::dialogs::editor_resize_map::editor_resize_map ( int &  width,
int &  height,
EXPAND_DIRECTION expand_direction,
bool &  copy_edge_terrain 
)

Constructor.

Parameters
[in,out]widthThe parameter's usage is:
  • Input: The initial width of the map.
  • Output: The selected width of the map if the dialog returns retval::OK undefined otherwise.
[in,out]heightThe parameter's usage is:
  • Input: The initial height of the map.
  • Output: The selected height of the map if the dialog returns retval::OK undefined otherwise.
[out]expand_directionThe selected expand direction if the dialog returns retval::OK undefined otherwise.
[in,out]copy_edge_terrainThe parameter's usage is:
  • Input: The initial value of the copy edge toggle.
  • Output: The final value of the copy edge toggle if the dialog returns retval::OK undefined otherwise.

Definition at line 30 of file resize_map.cpp.

Member Function Documentation

◆ pre_show()

void gui2::dialogs::editor_resize_map::pre_show ( window window)
overrideprivatevirtual

Actions to be taken before showing the window.

At this point the registered fields are registered and initialized with their initial values.

Parameters
windowThe window to be shown.

Reimplemented from gui2::dialogs::modal_dialog.

Definition at line 47 of file resize_map.cpp.

References gui2::event::connect_signal_notify_modified(), direction_buttons_, i, gui2::toggle_button::set_value(), and update_expand_direction().

◆ set_direction_icon()

void gui2::dialogs::editor_resize_map::set_direction_icon ( int  index,
std::string  icon 
)
private

◆ update_expand_direction()

void gui2::dialogs::editor_resize_map::update_expand_direction ( )
private

◆ window_id()

virtual const std::string& gui2::dialogs::editor_resize_map::window_id ( ) const
overrideprivatevirtual

The id of the window to build.

Implements gui2::dialogs::modal_dialog.

Member Data Documentation

◆ direction_buttons_

toggle_button* gui2::dialogs::editor_resize_map::direction_buttons_[9]
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 121 of file resize_map.hpp.

Referenced by pre_show(), set_direction_icon(), and update_expand_direction().

◆ expand_direction_

EXPAND_DIRECTION& gui2::dialogs::editor_resize_map::expand_direction_
private

The selected expansion direction.

Definition at line 113 of file resize_map.hpp.

Referenced by update_expand_direction().

◆ height_

field_integer* gui2::dialogs::editor_resize_map::height_
private

The currently selected height.

Definition at line 104 of file resize_map.hpp.

Referenced by update_expand_direction().

◆ old_height_

int gui2::dialogs::editor_resize_map::old_height_
private

The original height.

Definition at line 110 of file resize_map.hpp.

Referenced by update_expand_direction().

◆ old_width_

int gui2::dialogs::editor_resize_map::old_width_
private

The original width.

Definition at line 107 of file resize_map.hpp.

Referenced by update_expand_direction().

◆ width_

field_integer* gui2::dialogs::editor_resize_map::width_
private

The execute function.

See modal_dialog for more information. The currently selected width.

Definition at line 101 of file resize_map.hpp.

Referenced by update_expand_direction().


The documentation for this class was generated from the following files: