The Battle for Wesnoth  1.19.1+dev
resize_map.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2024
3  by Mark de Wever <koraq@xs4all.nl>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
19 
20 namespace gui2
21 {
22 
23 class toggle_button;
24 
25 namespace dialogs
26 {
27 
29 {
30 public:
41  };
42 
43  /**
44  * Constructor.
45  *
46  * @param [in, out] width The parameter's usage is:
47  * - Input: The initial width of the map.
48  * - Output: The selected width of the map if
49  * the dialog returns retval::OK
50  * undefined otherwise.
51  *
52  * @param [in, out] height The parameter's usage is:
53  * - Input: The initial height of the map.
54  * - Output: The selected height of the map if
55  * the dialog returns retval::OK
56  * undefined otherwise.
57  *
58  * @param [out] expand_direction
59  * The selected expand direction if the dialog
60  * returns retval::OK undefined
61  * otherwise.
62  *
63  * @param [in, out] copy_edge_terrain
64  * The parameter's usage is:
65  * - Input: The initial value of the copy edge
66  * toggle.
67  * - Output: The final value of the copy edge
68  * toggle if the dialog returns
69  * retval::OK undefined otherwise.
70  */
71  editor_resize_map(int& width,
72  int& height,
73  EXPAND_DIRECTION& expand_direction,
74  bool& copy_edge_terrain);
75 
76  /** The execute function. See @ref modal_dialog for more information. */
78 
79 private:
80  /** The currently selected width. */
82 
83  /** The currently selected height. */
85 
86  /** The original width. */
88 
89  /** The original height. */
91 
92  /** The selected expansion direction. */
94 
95  /**
96  * The toggle buttons show the state of expand_direction_.
97  *
98  * Allows both so select a direction and visually show the effect of the
99  * selection.
100  */
102 
104 
105  void set_direction_icon(int index, std::string icon);
106 
107  virtual void pre_show(window& window) override;
108 
109  virtual const std::string& window_id() const override;
110 };
111 
112 } // namespace dialogs
113 } // namespace gui2
int old_width_
The original width.
Definition: resize_map.hpp:87
virtual const std::string & window_id() const override
The ID of the window to build.
toggle_button * direction_buttons_[9]
The toggle buttons show the state of expand_direction_.
Definition: resize_map.hpp:101
field_integer * height_
The currently selected height.
Definition: resize_map.hpp:84
int old_height_
The original height.
Definition: resize_map.hpp:90
EXPAND_DIRECTION & expand_direction_
The selected expansion direction.
Definition: resize_map.hpp:93
void set_direction_icon(int index, std::string icon)
Definition: resize_map.cpp:87
editor_resize_map(int &width, int &height, EXPAND_DIRECTION &expand_direction, bool &copy_edge_terrain)
Constructor.
Definition: resize_map.cpp:31
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
Definition: resize_map.cpp:49
field_integer * width_
The execute function.
Definition: resize_map.hpp:81
Abstract base class for all modal dialogs.
Template class to implement the generic field implementation.
Definition: field.hpp:246
base class of top level items, the only item which needs to store the final canvases to draw on.
Definition: window.hpp:61
#define DEFINE_SIMPLE_EXECUTE_WRAPPER(dialog)
Adds a bare-bonesstatic execute function to a dialog class that immediately invokes and return the re...
Various uncategorised dialogs.
Generic file dialog.
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
Definition: unicode.cpp:70