OpenTTD Source 20261112-master-gbcbec5e63f
tree_gui.cpp
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#include "stdafx.h"
11#include "window_gui.h"
12#include "gfx_func.h"
13#include "tilehighlight_func.h"
14#include "company_func.h"
15#include "company_base.h"
16#include "command_func.h"
17#include "core/random_func.hpp"
18#include "sound_func.h"
19#include "zoom_func.h"
20#include "tree_map.h"
21#include "tree_cmd.h"
22
23#include "widgets/tree_widget.h"
24
25#include "table/sprites.h"
26#include "table/strings.h"
27#include "table/tree_land.h"
28
29#include "safeguards.h"
30
32uint PlaceTreeGroupAroundTile(TileIndex tile, TreeType treetype, uint radius, uint count, bool set_zone);
33
36 { 1621, PAL_NONE }, { 1635, PAL_NONE }, { 1656, PAL_NONE }, { 1579, PAL_NONE },
37 { 1607, PAL_NONE }, { 1593, PAL_NONE }, { 1614, PAL_NONE }, { 1586, PAL_NONE },
38 { 1663, PAL_NONE }, { 1677, PAL_NONE }, { 1691, PAL_NONE }, { 1705, PAL_NONE },
39 { 1711, PAL_NONE }, { 1746, PAL_NONE }, { 1753, PAL_NONE }, { 1732, PAL_NONE },
40 { 1739, PAL_NONE }, { 1718, PAL_NONE }, { 1725, PAL_NONE }, { 1760, PAL_NONE },
41 { 1838, PAL_NONE }, { 1844, PAL_NONE }, { 1866, PAL_NONE }, { 1871, PAL_NONE },
42 { 1899, PAL_NONE }, { 1935, PAL_NONE }, { 1928, PAL_NONE }, { 1915, PAL_NONE },
43 { 1887, PAL_NONE }, { 1908, PAL_NONE }, { 1824, PAL_NONE }, { 1943, PAL_NONE },
44 { 1950, PAL_NONE }, { 1957, PALETTE_TO_GREEN }, { 1964, PALETTE_TO_RED }, { 1971, PAL_NONE },
45 { 1978, PAL_NONE }, { 1985, PALETTE_TO_RED, }, { 1992, PALETTE_TO_PALE_GREEN }, { 1999, PALETTE_TO_YELLOW }, { 2006, PALETTE_TO_RED }
46};
47
53{
54 const uint16_t base = _tree_base_by_landscape[to_underlying(_settings_game.game_creation.landscape)];
55 const uint16_t count = _tree_count_by_landscape[to_underlying(_settings_game.game_creation.landscape)];
56
57 Dimension size, this_size;
58 Point offset;
59 /* Avoid to use it uninitialized */
60 size.width = ScaleGUITrad(32); // default width - WD_FRAMERECT_LEFT
61 size.height = ScaleGUITrad(39); // default height - BUTTON_BOTTOM_OFFSET
62 offset.x = 0;
63 offset.y = 0;
64
65 for (int i = base; i < base + count; i++) {
66 if (i >= (int)lengthof(tree_sprites)) return size;
67 this_size = GetSpriteSize(tree_sprites[i].sprite, &offset);
68 size.width = std::max<int>(size.width, 2 * std::max<int>(this_size.width, -offset.x));
69 size.height = std::max<int>(size.height, std::max<int>(this_size.height, -offset.y));
70 }
71
72 return size;
73}
74
75
79class BuildTreesWindow : public Window
80{
82 static const int BUTTON_BOTTOM_OFFSET = 7;
83
84 enum PlantingMode : uint8_t {
85 PM_NORMAL,
86 PM_FOREST_SM,
87 PM_FOREST_LG,
88 };
89
90 int tree_to_plant = -1;
91 PlantingMode mode = PM_NORMAL;
92
97 {
98 this->RaiseButtons();
99
100 const int current_tree = this->tree_to_plant;
101
102 if (this->tree_to_plant >= 0) {
103 /* Activate placement */
106 this->tree_to_plant = current_tree; // SetObjectToPlace may call ResetObjectToPlace which may reset tree_to_plant to -1
107 } else {
108 /* Deactivate placement */
110 }
111
112 if (this->tree_to_plant == TREE_INVALID) {
114 } else if (this->tree_to_plant >= 0) {
115 this->LowerWidget(WID_BT_TYPE_BUTTON_FIRST + this->tree_to_plant);
116 }
117
118 switch (this->mode) {
119 case PM_NORMAL: this->LowerWidget(WID_BT_MODE_NORMAL); break;
120 case PM_FOREST_SM: this->LowerWidget(WID_BT_MODE_FOREST_SM); break;
121 case PM_FOREST_LG: this->LowerWidget(WID_BT_MODE_FOREST_LG); break;
122 default: NOT_REACHED();
123 }
124
125 this->SetDirty();
126 }
127
128 void DoPlantForest(TileIndex tile)
129 {
130 TreeType treetype = (TreeType)this->tree_to_plant;
131 if (this->tree_to_plant == TREE_INVALID) {
132 treetype = (TreeType)(InteractiveRandomRange(_tree_count_by_landscape[to_underlying(_settings_game.game_creation.landscape)]) + _tree_base_by_landscape[to_underlying(_settings_game.game_creation.landscape)]);
133 }
134 const uint radius = this->mode == PM_FOREST_LG ? 12 : 5;
135 const uint count = this->mode == PM_FOREST_LG ? 12 : 5;
136 /* Create tropic zones only when the tree type is selected by the user and not picked randomly. */
137 PlaceTreeGroupAroundTile(tile, treetype, radius, count, this->tree_to_plant != TREE_INVALID);
138 }
139
140public:
141 BuildTreesWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc)
142 {
143 this->CreateNestedTree();
145
147 /* Show scenario editor tools in editor */
148 if (_game_mode != GameMode::Editor) {
150 }
152 }
153
154 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
155 {
156 if (widget >= WID_BT_TYPE_BUTTON_FIRST) {
157 /* Ensure tree type buttons are sized after the largest tree type */
159 size.width = d.width + padding.width;
160 size.height = d.height + padding.height + ScaleGUITrad(BUTTON_BOTTOM_OFFSET); // we need some more space
161 }
162 }
163
164 void DrawWidget(const Rect &r, WidgetID widget) const override
165 {
166 if (widget >= WID_BT_TYPE_BUTTON_FIRST) {
167 const int index = widget - WID_BT_TYPE_BUTTON_FIRST;
168 /* Trees "grow" in the centre on the bottom line of the buttons */
169 DrawSprite(tree_sprites[index].sprite, tree_sprites[index].pal, CentreBounds(r.left, r.right, 0), r.bottom - ScaleGUITrad(BUTTON_BOTTOM_OFFSET));
170 }
171 }
172
173 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
174 {
175 switch (widget) {
176 case WID_BT_TYPE_RANDOM: // tree of random type.
177 this->tree_to_plant = this->tree_to_plant == TREE_INVALID ? -1 : TREE_INVALID;
178 this->UpdateMode();
179 break;
180
181 case WID_BT_MANY_RANDOM: // place trees randomly over the landscape
185 break;
186
188 this->mode = PM_NORMAL;
189 this->UpdateMode();
190 break;
191
193 assert(_game_mode == GameMode::Editor);
194 this->mode = PM_FOREST_SM;
195 this->UpdateMode();
196 break;
197
199 assert(_game_mode == GameMode::Editor);
200 this->mode = PM_FOREST_LG;
201 this->UpdateMode();
202 break;
203
204 default:
205 if (widget >= WID_BT_TYPE_BUTTON_FIRST) {
206 const int index = widget - WID_BT_TYPE_BUTTON_FIRST;
207 this->tree_to_plant = this->tree_to_plant == index ? -1 : index;
208 this->UpdateMode();
209 }
210 break;
211 }
212 }
213
214 void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
215 {
216 if (_game_mode != GameMode::Editor && this->mode == PM_NORMAL) {
218 } else {
220 }
221 }
222
223 void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override
224 {
225 if (_game_mode != GameMode::Editor && this->mode == PM_NORMAL) {
226 VpSelectTilesWithMethod(pt.x, pt.y, select_method);
227 } else {
228 TileIndex tile = TileVirtXY(pt.x, pt.y);
229
230 if (this->mode == PM_NORMAL) {
231 Command<Commands::PlantTree>::Post(tile, tile, this->tree_to_plant, false);
232 } else {
233 this->DoPlantForest(tile);
234 }
235 }
236 }
237
238 void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override
239 {
240 if (_game_mode != GameMode::Editor && this->mode == PM_NORMAL && pt.x != -1 && select_proc == DDSP_PLANT_TREES) {
241 Command<Commands::PlantTree>::Post(STR_ERROR_CAN_T_PLANT_TREE_HERE, end_tile, start_tile, this->tree_to_plant, IsCtrlPressed());
242 }
243 }
244
245 void OnPlaceObjectAbort() override
246 {
247 this->tree_to_plant = -1;
248 this->UpdateMode();
249 }
250};
251
258static std::unique_ptr<NWidgetBase> MakeTreeTypeButtons()
259{
260 const uint8_t type_base = _tree_base_by_landscape[to_underlying(_settings_game.game_creation.landscape)];
261 const uint8_t type_count = _tree_count_by_landscape[to_underlying(_settings_game.game_creation.landscape)];
262
263 /* Toyland has 9 tree types, which look better in 3x3 than 4x3 */
264 const int num_columns = type_count == 9 ? 3 : 4;
265 const int num_rows = CeilDiv(type_count, num_columns);
266 uint8_t cur_type = type_base;
267
268 auto vstack = std::make_unique<NWidgetVertical>(NWidContainerFlag::EqualSize);
269 vstack->SetPIP(0, 1, 0);
270
271 for (int row = 0; row < num_rows; row++) {
272 auto hstack = std::make_unique<NWidgetHorizontal>(NWidContainerFlag::EqualSize);
273 hstack->SetPIP(0, 1, 0);
274 for (int col = 0; col < num_columns; col++) {
275 if (cur_type > type_base + type_count) break;
276 auto button = std::make_unique<NWidgetBackground>(WWT_PANEL, Colours::Grey, WID_BT_TYPE_BUTTON_FIRST + cur_type);
277 button->SetToolTip(STR_PLANT_TREE_TOOLTIP);
278 hstack->Add(std::move(button));
279 cur_type++;
280 }
281 vstack->Add(std::move(hstack));
282 }
283
284 return vstack;
285}
286
287static constexpr std::initializer_list<NWidgetPart> _nested_build_trees_widgets = {
290 NWidget(WWT_CAPTION, Colours::DarkGreen), SetStringTip(STR_PLANT_TREE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
293 EndContainer(),
295 NWidget(NWID_VERTICAL), SetPIP(0, 1, 0), SetPadding(2),
297 NWidget(WWT_TEXTBTN, Colours::Grey, WID_BT_TYPE_RANDOM), SetStringTip(STR_TREES_RANDOM_TYPE, STR_TREES_RANDOM_TYPE_TOOLTIP),
299 NWidget(NWID_VERTICAL), SetPIP(0, 1, 0),
301 NWidget(WWT_TEXTBTN, Colours::Grey, WID_BT_MODE_NORMAL), SetFill(1, 0), SetStringTip(STR_TREES_MODE_NORMAL_BUTTON, STR_TREES_MODE_NORMAL_TOOLTIP),
302 NWidget(WWT_TEXTBTN, Colours::Grey, WID_BT_MODE_FOREST_SM), SetFill(1, 0), SetStringTip(STR_TREES_MODE_FOREST_SM_BUTTON, STR_TREES_MODE_FOREST_SM_TOOLTIP),
303 NWidget(WWT_TEXTBTN, Colours::Grey, WID_BT_MODE_FOREST_LG), SetFill(1, 0), SetStringTip(STR_TREES_MODE_FOREST_LG_BUTTON, STR_TREES_MODE_FOREST_LG_TOOLTIP),
304 EndContainer(),
305 NWidget(WWT_PUSHTXTBTN, Colours::Grey, WID_BT_MANY_RANDOM), SetStringTip(STR_TREES_RANDOM_TREES_BUTTON, STR_TREES_RANDOM_TREES_TOOLTIP),
306 EndContainer(),
307 EndContainer(),
308 EndContainer(),
309 EndContainer(),
310};
311
314 WindowPosition::Automatic, "build_tree", 0, 0,
315 WindowClass::BuildTrees, WindowClass::None,
317 _nested_build_trees_widgets
318);
319
320void ShowBuildTreesToolbar()
321{
322 if (_game_mode != GameMode::Editor && !Company::IsValidID(_local_company)) return;
324}
PlantingMode mode
Current mode for planting.
Definition tree_gui.cpp:91
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
Definition tree_gui.cpp:164
void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
The user is dragging over the map when the tile highlight mode has been set.
Definition tree_gui.cpp:223
void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
The user has dragged over the map when the tile highlight mode has been set.
Definition tree_gui.cpp:238
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override
Update size and resize step of a widget in the window.
Definition tree_gui.cpp:154
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition tree_gui.cpp:173
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
Definition tree_gui.cpp:214
int tree_to_plant
Tree number to plant, TREE_INVALID for a random tree.
Definition tree_gui.cpp:90
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
Definition tree_gui.cpp:245
static const int BUTTON_BOTTOM_OFFSET
Visual Y offset of tree root from the bottom of the tree type buttons.
Definition tree_gui.cpp:82
void UpdateMode()
Update the GUI and enable/disable planting to reflect selected options.
Definition tree_gui.cpp:96
Functions related to commands.
Definition of stuff that is very close to a company, like the company struct itself.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Functions related to companies.
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23).
Definition enum_type.hpp:21
int CentreBounds(int min, int max, int size)
Determine where to position a centred object.
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Definition gfx.cpp:966
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
Definition gfx.cpp:1032
Functions related to the gfx engine.
bool IsCtrlPressed()
Test if the ctrl key is pressed.
Definition gfx_func.h:82
@ Invalid
Invalid marker.
Definition gfx_type.h:302
@ Grey
Grey.
Definition gfx_type.h:299
@ DarkGreen
Dark green.
Definition gfx_type.h:292
constexpr NWidgetPart NWidgetFunction(NWidgetFunctionType *func_ptr)
Obtain a nested widget (sub)tree from an external source.
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
constexpr NWidgetPart SetPIP(uint8_t pre, uint8_t inter, uint8_t post)
Widget part function for setting a pre/inter/post spaces.
constexpr NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left)
Widget part function for setting additional space around a widget.
constexpr NWidgetPart SetStringTip(StringID string, StringID tip={})
Widget part function for setting the string and tooltip.
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=INVALID_WIDGET)
Widget part function for starting a new 'real' widget.
static const CursorID SPR_CURSOR_TREE
Definition sprites.h:1576
void SetDirty() const
Mark entire window as dirty (in need of re-paint).
Definition window.cpp:1013
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
Definition gfx.cpp:1548
#define Point
Macro that prevents name conflicts between included headers.
static TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
Definition map_func.h:407
constexpr uint CeilDiv(uint a, uint b)
Computes ceil(a / b) for non-negative a and b.
@ Editor
In the scenario editor.
Definition openttd.h:21
Pseudo random number generator.
A number of safeguards to prevent using unsafe methods.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition settings.cpp:61
void SndConfirmBeep()
Play a beep sound for a confirm event if enabled in settings.
Definition sound.cpp:260
Functions related to sound.
This file contains all sprite-related enums and defines.
static const PaletteID PALETTE_TO_GREEN
Definition sprites.h:1769
static const PaletteID PALETTE_TO_RED
Definition sprites.h:1767
static const PaletteID PALETTE_TO_YELLOW
Definition sprites.h:1766
static const PaletteID PALETTE_TO_PALE_GREEN
Definition sprites.h:1764
Definition of base types and functions in a cross-platform compatible way.
#define lengthof(array)
Return the length of an fixed size array.
Definition stdafx.h:261
T y
Y coordinate.
T x
X coordinate.
Dimensions (a width and height) of a rectangle in 2D.
value_type height
The height of the rectangle.
value_type width
The width of the rectangle.
Combination of a palette sprite and a 'real' sprite.
Definition gfx_type.h:22
Specification of a rectangle with absolute coordinates of all edges.
High level window description.
Definition window_gui.h:171
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition window.cpp:1855
ResizeInfo resize
Resize information.
Definition window_gui.h:313
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
Definition window.cpp:1845
WindowClass window_class
Window class.
Definition window_gui.h:300
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition window.cpp:539
Window(WindowDesc &desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
Definition window.cpp:1879
const NWID * GetWidget(WidgetID widnum) const
Get the nested widget with number widnum from the nested widget tree.
void LowerWidget(WidgetID widget_index)
Marks a widget as lowered.
Definition window_gui.h:459
WindowNumber window_number
Window number within the window class.
Definition window_gui.h:301
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.
Definition tile_type.h:92
Functions related to tile highlights.
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
Selects tiles while dragging.
void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num)
Change the cursor and mouse click/drag handling to a mode for performing special operations like tile...
void VpStartDragging(ViewportDragDropSelectionProcess process)
Drag over the map while holding the left mouse down.
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process)
Prepare state for highlighting tiles while dragging with the mouse.
@ HT_DIAGONAL
Also allow 'diagonal rectangles'. Only usable in combination with HT_RECT or HT_POINT.
@ HT_RECT
rectangle (stations, depots, ...)
Command definitions related to tree tiles.
static Dimension GetMaxTreeSpriteSize()
Calculate the maximum size of all tree sprites.
Definition tree_gui.cpp:52
uint PlaceTreeGroupAroundTile(TileIndex tile, TreeType treetype, uint radius, uint count, bool set_zone)
Place some trees in a radius around a tile.
Definition tree_cmd.cpp:435
void PlaceTreesRandomly()
Place some trees randomly.
Definition tree_cmd.cpp:372
const PalSpriteID tree_sprites[]
Tree Sprites with their palettes.
Definition tree_gui.cpp:35
static std::unique_ptr< NWidgetBase > MakeTreeTypeButtons()
Make widgets for the current available tree types.
Definition tree_gui.cpp:258
static WindowDesc _build_trees_desc(WindowPosition::Automatic, "build_tree", 0, 0, WindowClass::BuildTrees, WindowClass::None, WindowDefaultFlag::Construction, _nested_build_trees_widgets)
Window definition for the tree building window.
Sprites to use and how to display them for tree tiles.
Map accessors for tree tiles.
TreeType
List of tree types along all landscape types.
Definition tree_map.h:25
@ TREE_INVALID
An invalid tree.
Definition tree_map.h:32
Types related to the tree widgets.
@ WID_BT_MANY_RANDOM
Button to build many random trees.
Definition tree_widget.h:20
@ WID_BT_SE_PANE
Selection pane to show/hide scenario editor tools.
Definition tree_widget.h:16
@ WID_BT_MODE_NORMAL
Select normal/rectangle planting mode.
Definition tree_widget.h:17
@ WID_BT_MODE_FOREST_SM
Select small forest planting mode.
Definition tree_widget.h:18
@ WID_BT_TYPE_BUTTON_FIRST
First tree type selection button. (This must be last in the enum.).
Definition tree_widget.h:21
@ WID_BT_MODE_FOREST_LG
Select large forest planting mode.
Definition tree_widget.h:19
@ WID_BT_TYPE_RANDOM
Button to build random type of tree.
Definition tree_widget.h:15
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects).
@ VPM_X_AND_Y
area of land in X and Y directions
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you've selected it.
@ DDSP_PLANT_TREES
Plant trees.
static RectPadding ScaleGUITrad(const RectPadding &r)
Scale a RectPadding to GUI zoom level.
Definition widget.cpp:49
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:66
@ WWT_TEXTBTN
(Toggle) Button with text
Definition widget_type.h:44
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:39
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX).
Definition widget_type.h:57
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX).
Definition widget_type.h:55
@ WWT_CAPTION
Window caption (window title between closebox and stickybox).
Definition widget_type.h:52
@ NWID_VERTICAL
Vertical container.
Definition widget_type.h:68
@ WWT_CLOSEBOX
Close box (at top-left of a window).
Definition widget_type.h:60
@ NWID_SELECTION
Stacked widgets, only one visible at a time (eg in a panel with tabs).
Definition widget_type.h:71
@ SZSP_HORIZONTAL
Display plane with zero size vertically, and filling and resizing horizontally.
@ EqualSize
Containers should keep all their (resizing) children equally large.
Functions, definitions and such used only by the GUI.
@ Construction
This window is used for construction; close it whenever changing company.
Definition window_gui.h:154
Twindow * AllocateWindowDescFront(WindowDesc &desc, WindowNumber window_number, Targs... extra_arguments)
Open a new window.
@ Automatic
Find a place automatically.
Definition window_gui.h:145
int WidgetID
Widget ID.
Definition window_type.h:21
Functions related to zooming.