The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
resize_map.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2016 by Mark de Wever <[email protected]>
3  Part of the Battle for Wesnoth Project http://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 #ifndef GUI_DIALOGS_EDITOR_RESIZE_MAP_HPP_INCLUDED
16 #define GUI_DIALOGS_EDITOR_RESIZE_MAP_HPP_INCLUDED
17 
18 #include "gui/dialogs/dialog.hpp"
19 
20 namespace gui2
21 {
22 
23 class ttoggle_button;
24 
26 {
27 public:
38  };
39 
40  /**
41  * Constructor.
42  *
43  * @param [in, out] width The parameter's usage is:
44  * - Input: The initial width of the map.
45  * - Output: The selected width of the map if
46  * the dialog returns @ref twindow::OK
47  * undefined otherwise.
48  *
49  * @param [in, out] height The parameter's usage is:
50  * - Input: The initial height of the map.
51  * - Output: The selected height of the map if
52  * the dialog returns @ref twindow::OK
53  * undefined otherwise.
54  *
55  * @param [out] expand_direction
56  * The selected expand direction if the dialog
57  * returns @ref twindow::OK undefined
58  * otherwise.
59  *
60  * @param [in, out] copy_edge_terrain
61  * The parameter's usage is:
62  * - Input: The initial value of the copy edge
63  * toggle.
64  * - Output: The final value of the copy edge
65  * toggle if the dialog returns @ref
66  * twindow::OK undefined otherwise.
67  */
69  int& height,
70  EXPAND_DIRECTION& expand_direction,
71  bool& copy_edge_terrain);
72 
73  /** The execute function see @ref tdialog for more information. */
74  static bool execute(int& width,
75  int& height,
76  EXPAND_DIRECTION& expand_direction,
77  bool& copy_edge_terrain,
78  CVideo& video)
79  {
80  return teditor_resize_map(
81  width, height, expand_direction, copy_edge_terrain)
82  .show(video);
83  }
84 
85 private:
86  /** The currently selected width. */
88 
89  /** The currently selected height. */
91 
92  /** The original width. */
94 
95  /** The original height. */
97 
98  /** The selected expansion direction. */
100 
101  /**
102  * The toggle buttons show the state of expand_direction_.
103  *
104  * Allows both so select a direction and visually show the effect of the
105  * selection.
106  */
108 
109  void update_expand_direction(twindow& window);
110 
111  void set_direction_icon(int index, std::string icon);
112 
113  /** Inherited from tdialog */
114  void pre_show(twindow& window);
115 
116  /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
117  virtual const std::string& window_id() const;
118 };
119 
120 } // namespace gui2
121 
122 #endif
ttoggle_button * direction_buttons_[9]
The toggle buttons show the state of expand_direction_.
Definition: resize_map.hpp:107
int old_width_
The original width.
Definition: resize_map.hpp:93
Template class to implement the generic field implementation.
Definition: field-fwd.hpp:36
Definition: video.hpp:58
tfield_integer * height_
The currently selected height.
Definition: resize_map.hpp:90
void update_expand_direction(twindow &window)
Definition: resize_map.cpp:158
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62
Class for a toggle button.
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
virtual const std::string & window_id() const
Inherited from tdialog, implemented by REGISTER_DIALOG.
Abstract base class for all dialogs.
Definition: dialog.hpp:121
teditor_resize_map(int &width, int &height, EXPAND_DIRECTION &expand_direction, bool &copy_edge_terrain)
Constructor.
Definition: resize_map.cpp:91
tfield_integer * width_
The currently selected width.
Definition: resize_map.hpp:87
EXPAND_DIRECTION & expand_direction_
The selected expansion direction.
Definition: resize_map.hpp:99
void pre_show(twindow &window)
Inherited from tdialog.
Definition: resize_map.cpp:107
static bool execute(int &width, int &height, EXPAND_DIRECTION &expand_direction, bool &copy_edge_terrain, CVideo &video)
The execute function see tdialog for more information.
Definition: resize_map.hpp:74
GLuint index
Definition: glew.h:1782
int old_height_
The original height.
Definition: resize_map.hpp:96
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
Definition: glew.h:1220
void set_direction_icon(int index, std::string icon)
Definition: resize_map.cpp:150
GLint GLint GLint GLint GLint GLint GLsizei width
Definition: glew.h:1220
GLsizei const GLcharARB ** string
Definition: glew.h:4503