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