OpenTTD Source: src/misc_gui.cpp Source File

OpenTTD Source 15.0-RC2

misc_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
10#include "stdafx.h"
11#include "debug.h"
12#include "landscape.h"
13#include "error.h"
14#include "gui.h"
15#include "gfx_layout.h"
16#include "tilehighlight_func.h"
17#include "command_func.h"
18#include "company_func.h"
19#include "town.h"
20#include "string_func.h"
21#include "company_base.h"
22#include "station_base.h"
23#include "waypoint_base.h"
24#include "texteff.hpp"
25#include "strings_func.h"
26#include "window_func.h"
27#include "querystring_gui.h"
28#include "core/geometry_func.hpp"
29#include "newgrf_debug.h"
30#include "zoom_func.h"
31#include "viewport_func.h"
32#include "landscape_cmd.h"
33#include "station_cmd.h"
34#include "waypoint_cmd.h"
35#include "rev.h"
36#include "timer/timer.h"
37#include "timer/timer_window.h"
38#include "pathfinder/water_regions.h"
39
40#include "widgets/misc_widget.h"
41
42#include "table/strings.h"
43
44#include "safeguards.h"
45
47 enum OskActivation : uint8_t {
48 OSKA_DISABLED,
49 OSKA_DOUBLE_CLICK,
50 OSKA_SINGLE_CLICK,
51 OSKA_IMMEDIATELY,
52};
53
54
55static constexpr std::initializer_list<NWidgetPart> _nested_land_info_widgets = {
56 NWidget(NWID_HORIZONTAL),
57 NWidget(WWT_CLOSEBOX, COLOUR_GREY),
58 NWidget(WWT_CAPTION, COLOUR_GREY), SetStringTip(STR_LAND_AREA_INFORMATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
59 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_LI_LOCATION), SetAspect(WidgetDimensions::ASPECT_LOCATION), SetSpriteTip(SPR_GOTO_LOCATION, STR_LAND_AREA_INFORMATION_LOCATION_TOOLTIP),
60 NWidget(WWT_DEBUGBOX, COLOUR_GREY),
61 EndContainer(),
62 NWidget(WWT_PANEL, COLOUR_GREY, WID_LI_BACKGROUND), EndContainer(),
63};
64
65static WindowDesc _land_info_desc(
66 WDP_AUTO, {}, 0, 0,
67 WC_LAND_INFO, WC_NONE,
68 {},
69 _nested_land_info_widgets
70);
71
72 class LandInfoWindow : public Window {
73 StringList landinfo_data{};
74 std::string cargo_acceptance{};
75
76public:
77 TileIndex tile = INVALID_TILE;
78
79 void DrawWidget(const Rect &r, WidgetID widget) const override
80 {
81 if (widget != WID_LI_BACKGROUND) return;
82
83 Rect ir = r.Shrink(WidgetDimensions::scaled.frametext);
84 for (size_t i = 0; i < this->landinfo_data.size(); i++) {
85 DrawString(ir, this->landinfo_data[i], i == 0 ? TC_LIGHT_BLUE : TC_FROMSTRING, SA_HOR_CENTER);
86 ir.top += GetCharacterHeight(FS_NORMAL) + (i == 0 ? WidgetDimensions::scaled.vsep_wide : WidgetDimensions::scaled.vsep_normal);
87 }
88
89 if (!this->cargo_acceptance.empty()) {
90 DrawStringMultiLine(ir, GetString(STR_JUST_RAW_STRING, this->cargo_acceptance), TC_FROMSTRING, SA_CENTER);
91 }
92 }
93
94 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
95 {
96 if (widget != WID_LI_BACKGROUND) return;
97
98 size.height = WidgetDimensions::scaled.frametext.Vertical();
99 for (size_t i = 0; i < this->landinfo_data.size(); i++) {
100 uint width = GetStringBoundingBox(this->landinfo_data[i]).width + WidgetDimensions::scaled.frametext.Horizontal();
101 size.width = std::max(size.width, width);
102
103 size.height += GetCharacterHeight(FS_NORMAL) + (i == 0 ? WidgetDimensions::scaled.vsep_wide : WidgetDimensions::scaled.vsep_normal);
104 }
105
106 if (!this->cargo_acceptance.empty()) {
107 uint width = GetStringBoundingBox(this->cargo_acceptance).width + WidgetDimensions::scaled.frametext.Horizontal();
108 size.width = std::max(size.width, std::min(static_cast<uint>(ScaleGUITrad(300)), width));
109 size.height += GetStringHeight(GetString(STR_JUST_RAW_STRING, this->cargo_acceptance), size.width - WidgetDimensions::scaled.frametext.Horizontal());
110 }
111 }
112
113 LandInfoWindow(Tile tile) : Window(_land_info_desc), tile(tile)
114 {
115 this->InitNested();
116
117#if defined(_DEBUG)
118# define LANDINFOD_LEVEL 0
119#else
120# define LANDINFOD_LEVEL 1
121#endif
122 Debug(misc, LANDINFOD_LEVEL, "TILE: {0} (0x{0:x}) ({1},{2})", (TileIndex)tile, TileX(tile), TileY(tile));
123 Debug(misc, LANDINFOD_LEVEL, "type = 0x{:x}", tile.type());
124 Debug(misc, LANDINFOD_LEVEL, "height = 0x{:x}", tile.height());
125 Debug(misc, LANDINFOD_LEVEL, "m1 = 0x{:x}", tile.m1());
126 Debug(misc, LANDINFOD_LEVEL, "m2 = 0x{:x}", tile.m2());
127 Debug(misc, LANDINFOD_LEVEL, "m3 = 0x{:x}", tile.m3());
128 Debug(misc, LANDINFOD_LEVEL, "m4 = 0x{:x}", tile.m4());
129 Debug(misc, LANDINFOD_LEVEL, "m5 = 0x{:x}", tile.m5());
130 Debug(misc, LANDINFOD_LEVEL, "m6 = 0x{:x}", tile.m6());
131 Debug(misc, LANDINFOD_LEVEL, "m7 = 0x{:x}", tile.m7());
132 Debug(misc, LANDINFOD_LEVEL, "m8 = 0x{:x}", tile.m8());
133
134 PrintWaterRegionDebugInfo(tile);
135#undef LANDINFOD_LEVEL
136 }
137
138 void OnInit() override
139 {
140 Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
141
142 TileDesc td{};
143 td.owner_type[0] = STR_LAND_AREA_INFORMATION_OWNER; // At least one owner is displayed, though it might be "N/A".
144
145 CargoArray acceptance{};
146 AddAcceptedCargo(tile, acceptance, nullptr);
147 GetTileDesc(tile, td);
148
149 this->landinfo_data.clear();
150
151 /* Tiletype */
152 this->landinfo_data.push_back(GetString(td.str, td.dparam));
153
154 /* Up to four owners */
155 for (uint i = 0; i < 4; i++) {
156 if (td.owner_type[i] == STR_NULL) continue;
157
158 if (td.owner[i] == OWNER_NONE || td.owner[i] == OWNER_WATER) {
159 this->landinfo_data.push_back(GetString(td.owner_type[i], STR_LAND_AREA_INFORMATION_OWNER_N_A, std::monostate{}));
160 } else {
161 auto params = GetParamsForOwnedBy(td.owner[i], tile);
162 this->landinfo_data.push_back(GetStringWithArgs(td.owner_type[i], params));
163 }
164 }
165
166 /* Cost to clear/revenue when cleared */
167 Company *c = Company::GetIfValid(_local_company);
168 if (c != nullptr) {
169 assert(_current_company == _local_company);
170 CommandCost costclear = Command<CMD_LANDSCAPE_CLEAR>::Do(DoCommandFlag::QueryCost, tile);
171 if (costclear.Succeeded()) {
172 Money cost = costclear.GetCost();
173 StringID str;
174 if (cost < 0) {
175 cost = -cost; // Negate negative cost to a positive revenue
176 str = STR_LAND_AREA_INFORMATION_REVENUE_WHEN_CLEARED;
177 } else {
178 str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR;
179 }
180 this->landinfo_data.push_back(GetString(str, cost));
181 } else {
182 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A));
183 }
184 } else {
185 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A));
186 }
187
188 /* Location */
189 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_LANDINFO_COORDS, TileX(tile), TileY(tile), GetTileZ(tile)));
190
191 /* Tile index */
192 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_LANDINFO_INDEX, tile, tile));
193
194 /* Local authority */
195 if (t == nullptr) {
196 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY, STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE, std::monostate{}));
197 } else {
198 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY, STR_TOWN_NAME, t->index));
199 }
200
201 /* Build date */
202 if (td.build_date != CalendarTime::INVALID_DATE) {
203 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_BUILD_DATE, td.build_date));
204 }
205
206 /* Station class */
207 if (td.station_class != STR_NULL) {
208 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_STATION_CLASS, td.station_class));
209 }
210
211 /* Station type name */
212 if (td.station_name != STR_NULL) {
213 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_STATION_TYPE, td.station_name));
214 }
215
216 /* Airport class */
217 if (td.airport_class != STR_NULL) {
218 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_AIRPORT_CLASS, td.airport_class));
219 }
220
221 /* Airport name */
222 if (td.airport_name != STR_NULL) {
223 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_AIRPORT_NAME, td.airport_name));
224 }
225
226 /* Airport tile name */
227 if (td.airport_tile_name != STR_NULL) {
228 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_AIRPORTTILE_NAME, td.airport_tile_name));
229 }
230
231 /* Rail type name */
232 if (td.railtype != STR_NULL) {
233 this->landinfo_data.push_back(GetString(STR_LANG_AREA_INFORMATION_RAIL_TYPE, td.railtype));
234 }
235
236 /* Rail speed limit */
237 if (td.rail_speed != 0) {
238 this->landinfo_data.push_back(GetString(STR_LANG_AREA_INFORMATION_RAIL_SPEED_LIMIT, PackVelocity(td.rail_speed, VEH_TRAIN)));
239 }
240
241 /* Road type name */
242 if (td.roadtype != STR_NULL) {
243 this->landinfo_data.push_back(GetString(STR_LANG_AREA_INFORMATION_ROAD_TYPE, td.roadtype));
244 }
245
246 /* Road speed limit */
247 if (td.road_speed != 0) {
248 this->landinfo_data.push_back(GetString(STR_LANG_AREA_INFORMATION_ROAD_SPEED_LIMIT, PackVelocity(td.road_speed, VEH_ROAD)));
249 }
250
251 /* Tram type name */
252 if (td.tramtype != STR_NULL) {
253 this->landinfo_data.push_back(GetString(STR_LANG_AREA_INFORMATION_TRAM_TYPE, td.tramtype));
254 }
255
256 /* Tram speed limit */
257 if (td.tram_speed != 0) {
258 this->landinfo_data.push_back(GetString(STR_LANG_AREA_INFORMATION_TRAM_SPEED_LIMIT, PackVelocity(td.tram_speed, VEH_ROAD)));
259 }
260
261 /* Tile protection status */
262 if (td.town_can_upgrade.has_value()) {
263 this->landinfo_data.push_back(GetString(td.town_can_upgrade.value() ? STR_LAND_AREA_INFORMATION_TOWN_CAN_UPGRADE : STR_LAND_AREA_INFORMATION_TOWN_CANNOT_UPGRADE));
264 }
265
266 /* NewGRF name */
267 if (td.grf.has_value()) {
268 this->landinfo_data.push_back(GetString(STR_LAND_AREA_INFORMATION_NEWGRF_NAME, std::move(*td.grf)));
269 }
270
271 /* Cargo acceptance is displayed in a extra multiline */
272 auto line = BuildCargoAcceptanceString(acceptance, STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED);
273 if (line.has_value()) {
274 this->cargo_acceptance = std::move(*line);
275 } else {
276 this->cargo_acceptance.clear();
277 }
278 }
279
280 bool IsNewGRFInspectable() const override
281 {
282 return ::IsNewGRFInspectable(GetGrfSpecFeature(this->tile), this->tile.base());
283 }
284
285 void ShowNewGRFInspectWindow() const override
286 {
287 ::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), this->tile.base());
288 }
289
290 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
291 {
292 switch (widget) {
293 case WID_LI_LOCATION:
294 if (_ctrl_pressed) {
295 ShowExtraViewportWindow(this->tile);
296 } else {
297 ScrollMainWindowToTile(this->tile);
298 }
299 break;
300 }
301 }
302
308 void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
309 {
310 if (!gui_scope) return;
311
312 /* ReInit, "debug" sprite might have changed */
313 if (data == 1) this->ReInit();
314 }
315};
316
321 void ShowLandInfo(TileIndex tile)
322{
323 CloseWindowById(WC_LAND_INFO, 0);
324 new LandInfoWindow(tile);
325}
326
327static constexpr std::initializer_list<NWidgetPart> _nested_about_widgets = {
328 NWidget(NWID_HORIZONTAL),
329 NWidget(WWT_CLOSEBOX, COLOUR_GREY),
330 NWidget(WWT_CAPTION, COLOUR_GREY), SetStringTip(STR_ABOUT_OPENTTD, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
331 EndContainer(),
332 NWidget(WWT_PANEL, COLOUR_GREY), SetPIP(4, 2, 4),
333 NWidget(WWT_LABEL, INVALID_COLOUR), SetStringTip(STR_ABOUT_ORIGINAL_COPYRIGHT),
334 NWidget(WWT_LABEL, INVALID_COLOUR), SetStringTip(STR_ABOUT_VERSION),
335 NWidget(WWT_FRAME, COLOUR_GREY), SetPadding(0, 5, 1, 5),
336 NWidget(WWT_EMPTY, INVALID_COLOUR, WID_A_SCROLLING_TEXT),
337 EndContainer(),
338 NWidget(WWT_LABEL, INVALID_COLOUR, WID_A_WEBSITE),
339 NWidget(WWT_LABEL, INVALID_COLOUR, WID_A_COPYRIGHT),
340 EndContainer(),
341};
342
343static WindowDesc _about_desc(
344 WDP_CENTER, {}, 0, 0,
345 WC_GAME_OPTIONS, WC_NONE,
346 {},
347 _nested_about_widgets
348);
349
350static const std::initializer_list<const std::string_view> _credits = {
351 "Original design by Chris Sawyer",
352 "Original graphics by Simon Foster",
353 "",
354 "The OpenTTD team (in alphabetical order):",
355 " Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)",
356 " Christoph Elsenhans (frosch) - General coding (since 0.6)",
357 " Lo\u00efc Guilloux (glx) - General / Windows Expert (since 0.4.5)",
358 " Koen Bussemaker (Kuhnovic) - General / Ship pathfinder (since 14)",
359 " Charles Pigott (LordAro) - General / Correctness police (since 1.9)",
360 " Michael Lutz (michi_cc) - Path based signals (since 0.7)",
361 " Niels Martin Hansen (nielsm) - Music system, general coding (since 1.9)",
362 " Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)",
363 " Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods (since 0.4.5)",
364 " Remko Bijker (Rubidium) - Coder and way more (since 0.4.5)",
365 " Patric Stout (TrueBrain) - NoProgrammer (since 0.3), sys op",
366 " Tyler Trahan (2TallTyler) - General / Time Lord (since 13)",
367 " Richard Wheeler (zephyris) - Precision pixel production (since 15)",
368 "",
369 "Inactive Developers:",
370 " Grzegorz Duczy\u0144ski (adf88) - General coding (1.7 - 1.8)",
371 " Albert Hofkamp (Alberth) - GUI expert (0.7 - 1.9)",
372 " Jean-Fran\u00e7ois Claeys (Belugas) - GUI, NewGRF and more (0.4.5 - 1.0)",
373 " Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles (0.3 - 0.7)",
374 " Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)",
375 " Ulf Hermann (fonsinchen) - Cargo Distribution (1.3 - 1.6)",
376 " Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)",
377 " Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)",
378 " Attila B\u00e1n (MiHaMiX) - Developer WebTranslator 1 and 2 (0.3 - 0.5)",
379 " Ingo von Borstel (planetmaker) - General coding, Support (1.1 - 1.9)",
380 " Zden\u011bk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)",
381 " Jos\u00e9 Soler (Terkhen) - General coding (1.0 - 1.4)",
382 " Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)",
383 " Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)",
384 " Leif Linse (Zuu) - AI/Game Script (1.2 - 1.6)",
385 "",
386 "Retired Developers:",
387 " Tam\u00e1s Farag\u00f3 (Darkvater) - Ex-Lead coder (0.3 - 0.5)",
388 " Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)",
389 " Emil Djupfeld (egladil) - MacOSX (0.4.5 - 0.6)",
390 " Simon Sasburg (HackyKid) - Many bugfixes (0.4 - 0.4.5)",
391 " Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)",
392 " Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)",
393 " Petr Baudi\u0161 (pasky) - Many patches, NewGRF support (0.3 - 0.3)",
394 " Benedikt Br\u00fcggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)",
395 " Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)",
396 "",
397 "Special thanks go out to:",
398 " Josef Drexler - For his great work on TTDPatch",
399 " Marcin Grzegorczyk - Track foundations and for describing TTD internals",
400 " Stefan Mei\u00dfner (sign_de) - For his work on the console",
401 " Mike Ragsdale - OpenTTD installer",
402 " Christian Rosentreter (tokai) - MorphOS / AmigaOS port",
403 " Richard Kempton (richK) - additional airports, initial TGP implementation",
404 " Alberto Demichelis - Squirrel scripting language \u00a9 2003-2008",
405 " L. Peter Deutsch - MD5 implementation \u00a9 1999, 2000, 2002",
406 " Michael Blunck - Pre-signals and semaphores \u00a9 2003",
407 " George - Canal/Lock graphics \u00a9 2003-2004",
408 " Andrew Parkhouse (andythenorth) - River graphics",
409 " David Dallaston (Pikka) - Tram tracks",
410 " All Translators - Who made OpenTTD a truly international game",
411 " Bug Reporters - Without whom OpenTTD would still be full of bugs!",
412 "",
413 "",
414 "And last but not least:",
415 " Chris Sawyer - For an amazing game!"
416};
417
418 struct AboutWindow : public Window {
419 int text_position = 0;
420 int line_height = 0;
421 static const int num_visible_lines = 19;
422
423 AboutWindow() : Window(_about_desc)
424 {
425 this->InitNested(WN_GAME_OPTIONS_ABOUT);
426
427 this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y;
428 }
429
430 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
431 {
432 if (widget == WID_A_WEBSITE) return "Website: https://www.openttd.org";
433 if (widget == WID_A_COPYRIGHT) return GetString(STR_ABOUT_COPYRIGHT_OPENTTD, _openttd_revision_year);
434 return this->Window::GetWidgetString(widget, stringid);
435 }
436
437 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
438 {
439 if (widget != WID_A_SCROLLING_TEXT) return;
440
441 this->line_height = GetCharacterHeight(FS_NORMAL);
442
443 Dimension d;
444 d.height = this->line_height * num_visible_lines;
445
446 d.width = 0;
447 for (const auto &str : _credits) {
448 d.width = std::max(d.width, GetStringBoundingBox(str).width);
449 }
450 size = maxdim(size, d);
451 }
452
453 void DrawWidget(const Rect &r, WidgetID widget) const override
454 {
455 if (widget != WID_A_SCROLLING_TEXT) return;
456
457 int y = this->text_position;
458
459 /* Show all scrolling _credits */
460 for (const auto &str : _credits) {
461 if (y >= r.top + 7 && y < r.bottom - this->line_height) {
462 DrawString(r.left, r.right, y, str, TC_BLACK, SA_LEFT | SA_FORCE);
463 }
464 y += this->line_height;
465 }
466 }
467
473 const IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(2100) / GetCharacterHeight(FS_NORMAL), [this](uint count) {
474 this->text_position -= count;
475 /* If the last text has scrolled start a new from the start */
476 if (this->text_position < (int)(this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y - std::size(_credits) * this->line_height)) {
477 this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y;
478 }
479 this->SetWidgetDirty(WID_A_SCROLLING_TEXT);
480 }};
481};
482
483void ShowAboutWindow()
484{
485 CloseWindowByClass(WC_GAME_OPTIONS);
486 new AboutWindow();
487}
488
495 void ShowEstimatedCostOrIncome(Money cost, int x, int y)
496{
497 StringID msg = STR_MESSAGE_ESTIMATED_COST;
498
499 if (cost < 0) {
500 cost = -cost;
501 msg = STR_MESSAGE_ESTIMATED_INCOME;
502 }
503 ShowErrorMessage(GetEncodedString(msg, cost), {}, WL_INFO, x, y);
504}
505
513 void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
514{
515 if (cost == 0) {
516 return;
517 }
518 Point pt = RemapCoords(x, y, z);
519 StringID msg = STR_INCOME_FLOAT_COST;
520
521 if (cost < 0) {
522 cost = -cost;
523 msg = STR_INCOME_FLOAT_INCOME;
524 }
525 AddTextEffect(GetEncodedString(msg, cost), pt.x, pt.y, Ticks::DAY_TICKS, TE_RISING);
526}
527
536 void ShowFeederIncomeAnimation(int x, int y, int z, Money transfer, Money income)
537{
538 Point pt = RemapCoords(x, y, z);
539
540 if (income == 0) {
541 AddTextEffect(GetEncodedString(STR_FEEDER, transfer), pt.x, pt.y, Ticks::DAY_TICKS, TE_RISING);
542 } else {
543 StringID msg = STR_FEEDER_COST;
544 if (income < 0) {
545 income = -income;
546 msg = STR_FEEDER_INCOME;
547 }
548 AddTextEffect(GetEncodedString(msg, transfer, income), pt.x, pt.y, Ticks::DAY_TICKS, TE_RISING);
549 }
550}
551
561TextEffectID ShowFillingPercent(int x, int y, int z, uint8_t percent, StringID string)
562{
563 Point pt = RemapCoords(x, y, z);
564
565 assert(string != STR_NULL);
566
567 return AddTextEffect(GetEncodedString(string, percent), pt.x, pt.y, 0, TE_STATIC);
568}
569
575 void UpdateFillingPercent(TextEffectID te_id, uint8_t percent, StringID string)
576{
577 assert(string != STR_NULL);
578
579 UpdateTextEffect(te_id, GetEncodedString(string, percent));
580}
581
586 void HideFillingPercent(TextEffectID *te_id)
587{
588 if (*te_id == INVALID_TE_ID) return;
589
590 RemoveTextEffect(*te_id);
591 *te_id = INVALID_TE_ID;
592}
593
594static constexpr std::initializer_list<NWidgetPart> _nested_tooltips_widgets = {
595 NWidget(WWT_EMPTY, INVALID_COLOUR, WID_TT_BACKGROUND),
596};
597
598static WindowDesc _tool_tips_desc(
599 WDP_MANUAL, {}, 0, 0, // Coordinates and sizes are not used,
600 WC_TOOLTIPS, WC_NONE,
601 {WindowDefaultFlag::NoFocus, WindowDefaultFlag::NoClose},
602 _nested_tooltips_widgets
603);
604
606 struct TooltipsWindow : public Window
607{
608 EncodedString text{};
609 TooltipCloseCondition close_cond{};
610
611 TooltipsWindow(Window *parent, EncodedString &&text, TooltipCloseCondition close_tooltip) : Window(_tool_tips_desc), text(std::move(text))
612 {
613 this->parent = parent;
614 this->close_cond = close_tooltip;
615
616 this->InitNested();
617
618 this->flags.Reset(WindowFlag::WhiteBorder);
619 }
620
621 Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override
622 {
623 /* Find the free screen space between the main toolbar at the top, and the statusbar at the bottom.
624 * Add a fixed distance 2 so the tooltip floats free from both bars.
625 */
626 int scr_top = GetMainViewTop() + 2;
627 int scr_bot = GetMainViewBottom() - 2;
628
629 Point pt;
630
631 /* Correctly position the tooltip position, watch out for window and cursor size
632 * Clamp value to below main toolbar and above statusbar. If tooltip would
633 * go below window, flip it so it is shown above the cursor */
634 pt.y = SoftClamp(_cursor.pos.y + _cursor.total_size.y + _cursor.total_offs.y + 5, scr_top, scr_bot);
635 if (pt.y + sm_height > scr_bot) pt.y = std::min(_cursor.pos.y + _cursor.total_offs.y - 5, scr_bot) - sm_height;
636 pt.x = sm_width >= _screen.width ? 0 : SoftClamp(_cursor.pos.x - (sm_width >> 1), 0, _screen.width - sm_width);
637
638 return pt;
639 }
640
641 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
642 {
643 if (widget != WID_TT_BACKGROUND) return;
644
645 auto str = this->text.GetDecodedString();
646 size.width = std::min<uint>(GetStringBoundingBox(str).width, ScaleGUITrad(194));
647 size.height = GetStringHeight(str, size.width);
648
649 /* Increase slightly to have some space around the box. */
650 size.width += WidgetDimensions::scaled.framerect.Horizontal() + WidgetDimensions::scaled.fullbevel.Horizontal();
651 size.height += WidgetDimensions::scaled.framerect.Vertical() + WidgetDimensions::scaled.fullbevel.Vertical();
652 }
653
654 void DrawWidget(const Rect &r, WidgetID widget) const override
655 {
656 if (widget != WID_TT_BACKGROUND) return;
657 GfxFillRect(r, PC_BLACK);
658 GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), PC_LIGHT_YELLOW);
659
660 DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.framerect).Shrink(WidgetDimensions::scaled.fullbevel), this->text.GetDecodedString(), TC_BLACK, SA_CENTER);
661 }
662
663 void OnMouseLoop() override
664 {
665 /* Always close tooltips when the cursor is not in our window. */
666 if (!_cursor.in_window) {
667 this->Close();
668 return;
669 }
670
671 /* We can show tooltips while dragging tools. These are shown as long as
672 * we are dragging the tool. Normal tooltips work with hover or rmb. */
673 switch (this->close_cond) {
674 case TCC_RIGHT_CLICK: if (!_right_button_down) this->Close(); break;
675 case TCC_HOVER: if (!_mouse_hovering) this->Close(); break;
676 case TCC_NONE: break;
677
678 case TCC_EXIT_VIEWPORT: {
679 Window *w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y);
680 if (w == nullptr || IsPtInWindowViewport(w, _cursor.pos.x, _cursor.pos.y) == nullptr) this->Close();
681 break;
682 }
683 }
684 }
685};
686
693 void GuiShowTooltips(Window *parent, EncodedString &&text, TooltipCloseCondition close_tooltip)
694{
695 CloseWindowById(WC_TOOLTIPS, 0);
696
697 if (text.empty() || !_cursor.in_window) return;
698
699 new TooltipsWindow(parent, std::move(text), close_tooltip);
700}
701
702void QueryString::HandleEditBox(Window *w, WidgetID wid)
703{
704 if (w->IsWidgetGloballyFocused(wid) && this->text.HandleCaret()) {
705 w->SetWidgetDirty(wid);
706
707 /* For the OSK also invalidate the parent window */
708 if (w->window_class == WC_OSK) w->InvalidateData();
709 }
710}
711
712static int GetCaretWidth()
713{
714 return GetCharacterWidth(FS_NORMAL, '_');
715}
716
723 static Rect ScrollEditBoxTextRect(Rect r, const Textbuf &tb)
724{
725 const int linewidth = tb.pixels + GetCaretWidth();
726 const int boxwidth = r.Width();
727 if (linewidth <= boxwidth) return r;
728
729 /* Extend to cover whole string. This is left-aligned, adjusted by caret position. */
730 r = r.WithWidth(linewidth, false);
731
732 /* Slide so that the caret is at the centre unless limited by bounds of the line, i.e. near either end. */
733 return r.Translate(-std::clamp(tb.caretxoffs - (boxwidth / 2), 0, linewidth - boxwidth), 0);
734}
735
736void QueryString::DrawEditBox(const Window *w, WidgetID wid) const
737{
738 const NWidgetLeaf *wi = w->GetWidget<NWidgetLeaf>(wid);
739
740 assert((wi->type & WWT_MASK) == WWT_EDITBOX);
741
742 bool rtl = _current_text_dir == TD_RTL;
743 Dimension sprite_size = GetScaledSpriteSize(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT);
744 int clearbtn_width = sprite_size.width + WidgetDimensions::scaled.imgbtn.Horizontal();
745
746 Rect r = wi->GetCurrentRect();
747 Rect cr = r.WithWidth(clearbtn_width, !rtl);
748 Rect fr = r.Indent(clearbtn_width, !rtl);
749
750 DrawFrameRect(cr, wi->colour, wi->IsLowered() ? FrameFlag::Lowered : FrameFlags{});
751 DrawSpriteIgnorePadding(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT, PAL_NONE, cr, SA_CENTER);
752 if (this->text.GetText().empty()) GfxFillRect(cr.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(wi->colour, SHADE_DARKER), FILLRECT_CHECKER);
753
754 DrawFrameRect(fr, wi->colour, {FrameFlag::Lowered, FrameFlag::Darkened});
755 GfxFillRect(fr.Shrink(WidgetDimensions::scaled.bevel), PC_BLACK);
756
757 fr = fr.Shrink(WidgetDimensions::scaled.framerect);
758 /* Limit the drawing of the string inside the widget boundaries */
759 DrawPixelInfo dpi;
760 if (!FillDrawPixelInfo(&dpi, fr)) return;
761 /* Keep coordinates relative to the window. */
762 dpi.left += fr.left;
763 dpi.top += fr.top;
764
765 AutoRestoreBackup dpi_backup(_cur_dpi, &dpi);
766
767 /* We will take the current widget length as maximum width, with a small
768 * space reserved at the end for the caret to show */
769 const Textbuf *tb = &this->text;
770 fr = ScrollEditBoxTextRect(fr, *tb);
771
772 /* If we have a marked area, draw a background highlight. */
773 if (tb->marklength != 0) GfxFillRect(fr.left + tb->markxoffs, fr.top, fr.left + tb->markxoffs + tb->marklength - 1, fr.bottom, PC_GREY);
774
775 DrawString(fr.left, fr.right, CentreBounds(fr.top, fr.bottom, GetCharacterHeight(FS_NORMAL)), tb->GetText(), TC_YELLOW);
776 bool focussed = w->IsWidgetGloballyFocused(wid) || IsOSKOpenedFor(w, wid);
777 if (focussed && tb->caret) {
778 int caret_width = GetCaretWidth();
779 if (rtl) {
780 DrawString(fr.right - tb->pixels + tb->caretxoffs - caret_width, fr.right - tb->pixels + tb->caretxoffs, CentreBounds(fr.top, fr.bottom, GetCharacterHeight(FS_NORMAL)), "_", TC_WHITE);
781 } else {
782 DrawString(fr.left + tb->caretxoffs, fr.left + tb->caretxoffs + caret_width, CentreBounds(fr.top, fr.bottom, GetCharacterHeight(FS_NORMAL)), "_", TC_WHITE);
783 }
784 }
785}
786
793 Point QueryString::GetCaretPosition(const Window *w, WidgetID wid) const
794{
795 const NWidgetLeaf *wi = w->GetWidget<NWidgetLeaf>(wid);
796
797 assert((wi->type & WWT_MASK) == WWT_EDITBOX);
798
799 bool rtl = _current_text_dir == TD_RTL;
800 Dimension sprite_size = GetScaledSpriteSize(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT);
801 int clearbtn_width = sprite_size.width + WidgetDimensions::scaled.imgbtn.Horizontal();
802
803 Rect r = wi->GetCurrentRect().Indent(clearbtn_width, !rtl).Shrink(WidgetDimensions::scaled.framerect);
804
805 /* Clamp caret position to be inside out current width. */
806 const Textbuf *tb = &this->text;
807 r = ScrollEditBoxTextRect(r, *tb);
808
809 Point pt = {r.left + tb->caretxoffs, r.top};
810 return pt;
811}
812
821 Rect QueryString::GetBoundingRect(const Window *w, WidgetID wid, size_t from, size_t to) const
822{
823 const NWidgetLeaf *wi = w->GetWidget<NWidgetLeaf>(wid);
824
825 assert((wi->type & WWT_MASK) == WWT_EDITBOX);
826
827 bool rtl = _current_text_dir == TD_RTL;
828 Dimension sprite_size = GetScaledSpriteSize(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT);
829 int clearbtn_width = sprite_size.width + WidgetDimensions::scaled.imgbtn.Horizontal();
830
831 Rect r = wi->GetCurrentRect().Indent(clearbtn_width, !rtl).Shrink(WidgetDimensions::scaled.framerect);
832
833 /* Clamp caret position to be inside our current width. */
834 const Textbuf *tb = &this->text;
835 r = ScrollEditBoxTextRect(r, *tb);
836
837 /* Get location of first and last character. */
838 const auto p1 = GetCharPosInString(tb->GetText(), from, FS_NORMAL);
839 const auto p2 = from != to ? GetCharPosInString(tb->GetText(), to, FS_NORMAL) : p1;
840
841 return r.WithX(Clamp(r.left + p1.left, r.left, r.right), Clamp(r.left + p2.right, r.left, r.right));
842}
843
851ptrdiff_t QueryString::GetCharAtPosition(const Window *w, WidgetID wid, const Point &pt) const
852{
853 const NWidgetLeaf *wi = w->GetWidget<NWidgetLeaf>(wid);
854
855 assert((wi->type & WWT_MASK) == WWT_EDITBOX);
856
857 bool rtl = _current_text_dir == TD_RTL;
858 Dimension sprite_size = GetScaledSpriteSize(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT);
859 int clearbtn_width = sprite_size.width + WidgetDimensions::scaled.imgbtn.Horizontal();
860
861 Rect r = wi->GetCurrentRect().Indent(clearbtn_width, !rtl).Shrink(WidgetDimensions::scaled.framerect);
862
863 if (!IsInsideMM(pt.y, r.top, r.bottom)) return -1;
864
865 /* Clamp caret position to be inside our current width. */
866 const Textbuf *tb = &this->text;
867 r = ScrollEditBoxTextRect(r, *tb);
868
869 return ::GetCharAtPosition(tb->GetText(), pt.x - r.left);
870}
871
872void QueryString::ClickEditBox(Window *w, Point pt, WidgetID wid, int click_count, bool focus_changed)
873{
874 const NWidgetLeaf *wi = w->GetWidget<NWidgetLeaf>(wid);
875
876 assert((wi->type & WWT_MASK) == WWT_EDITBOX);
877
878 bool rtl = _current_text_dir == TD_RTL;
879 Dimension sprite_size = GetScaledSpriteSize(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT);
880 int clearbtn_width = sprite_size.width + WidgetDimensions::scaled.imgbtn.Horizontal();
881
882 Rect cr = wi->GetCurrentRect().WithWidth(clearbtn_width, !rtl);
883
884 if (IsInsideMM(pt.x, cr.left, cr.right)) {
885 if (!this->text.GetText().empty()) {
886 this->text.DeleteAll();
887 w->HandleButtonClick(wid);
888 w->OnEditboxChanged(wid);
889 }
890 return;
891 }
892
893 if (w->window_class != WC_OSK && _settings_client.gui.osk_activation != OSKA_DISABLED &&
894 (!focus_changed || _settings_client.gui.osk_activation == OSKA_IMMEDIATELY) &&
895 (click_count == 2 || _settings_client.gui.osk_activation != OSKA_DOUBLE_CLICK)) {
896 /* Open the OSK window */
897 ShowOnScreenKeyboard(w, wid);
898 }
899}
900
902 struct QueryStringWindow : public Window
903{
904 QueryString editbox;
905 QueryStringFlags flags{};
906
907 WidgetID last_user_action = INVALID_WIDGET;
908
909 QueryStringWindow(std::string_view str, StringID caption, uint max_bytes, uint max_chars, WindowDesc &desc, Window *parent, CharSetFilter afilter, QueryStringFlags flags) :
910 Window(desc), editbox(max_bytes, max_chars)
911 {
912 this->editbox.text.Assign(str);
913
914 if (!flags.Test(QueryStringFlag::AcceptUnchanged)) this->editbox.orig = this->editbox.text.GetText();
915
916 this->querystrings[WID_QS_TEXT] = &this->editbox;
917 this->editbox.caption = caption;
918 this->editbox.cancel_button = WID_QS_CANCEL;
919 this->editbox.ok_button = WID_QS_OK;
920 this->editbox.text.afilter = afilter;
921 this->flags = flags;
922
923 this->CreateNestedTree();
924 this->GetWidget<NWidgetStacked>(WID_QS_DEFAULT_SEL)->SetDisplayedPlane((this->flags.Test(QueryStringFlag::EnableDefault)) ? 0 : SZSP_NONE);
925 this->GetWidget<NWidgetStacked>(WID_QS_MOVE_SEL)->SetDisplayedPlane((this->flags.Test(QueryStringFlag::EnableMove)) ? 0 : SZSP_NONE);
926 this->FinishInitNested(WN_QUERY_STRING);
927
928 this->parent = parent;
929
930 this->SetFocusedWidget(WID_QS_TEXT);
931 }
932
933 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
934 {
935 if (widget == WID_QS_CAPTION) return GetString(this->editbox.caption);
936
937 return this->Window::GetWidgetString(widget, stringid);
938 }
939
940 void OnOk()
941 {
942 if (!this->editbox.orig.has_value() || this->editbox.text.GetText() != this->editbox.orig) {
943 assert(this->parent != nullptr);
944
945 this->parent->OnQueryTextFinished(std::string{this->editbox.text.GetText()});
946 this->editbox.handled = true;
947 }
948 }
949
950 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
951 {
952 switch (widget) {
953 case WID_QS_DEFAULT:
954 this->editbox.text.DeleteAll();
955 [[fallthrough]];
956
957 case WID_QS_OK:
958 this->OnOk();
959 [[fallthrough]];
960
961 case WID_QS_CANCEL:
962 this->Close();
963 break;
964
965 case WID_QS_MOVE:
966 this->last_user_action = widget;
967
968 if (Station::IsExpected(Station::Get(this->parent->window_number))) {
969 /* this is a station */
970 SetViewportStationRect(Station::Get(this->parent->window_number), !this->IsWidgetLowered(WID_QS_MOVE));
971 } else {
972 /* this is a waypoint */
973 SetViewportWaypointRect(Waypoint::Get(this->parent->window_number), !this->IsWidgetLowered(WID_QS_MOVE));
974 }
975
976 HandlePlacePushButton(this, WID_QS_MOVE, SPR_CURSOR_SIGN, HT_RECT);
977 break;
978 }
979 }
980
981 void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
982 {
983 switch (this->last_user_action) {
984 case WID_QS_MOVE: // Move name button
985 if (Station::IsExpected(Station::Get(this->parent->window_number))) {
986 /* this is a station */
987 Command<CMD_MOVE_STATION_NAME>::Post(STR_ERROR_CAN_T_MOVE_STATION_NAME, CcMoveStationName, this->parent->window_number, tile);
988 } else {
989 /* this is a waypoint */
990 Command<CMD_MOVE_WAYPOINT_NAME>::Post(STR_ERROR_CAN_T_MOVE_WAYPOINT_NAME, CcMoveWaypointName, this->parent->window_number, tile);
991 }
992 break;
993
994 default: NOT_REACHED();
995 }
996 }
997
998 void OnPlaceObjectAbort() override
999 {
1000 if (Station::IsExpected(Station::Get(this->parent->window_number))) {
1001 /* this is a station */
1002 SetViewportStationRect(Station::Get(this->parent->window_number), false);
1003 } else {
1004 /* this is a waypoint */
1005 SetViewportWaypointRect(Waypoint::Get(this->parent->window_number), false);
1006 }
1007
1008 this->RaiseButtons();
1009 }
1010
1011 void Close([[maybe_unused]] int data = 0) override
1012 {
1013 if (this->parent->window_class == WC_STATION_VIEW) SetViewportStationRect(Station::Get(this->parent->window_number), false);
1014 if (this->parent->window_class == WC_WAYPOINT_VIEW) SetViewportWaypointRect(Waypoint::Get(this->parent->window_number), false);
1015
1016 if (!this->editbox.handled && this->parent != nullptr) {
1017 Window *parent = this->parent;
1018 this->parent = nullptr; // so parent doesn't try to close us again
1019 parent->OnQueryTextFinished(std::nullopt);
1020 }
1021
1022 this->Window::Close();
1023 }
1024};
1025
1026static constexpr std::initializer_list<NWidgetPart> _nested_query_string_widgets = {
1027 NWidget(NWID_HORIZONTAL),
1028 NWidget(WWT_CLOSEBOX, COLOUR_GREY),
1029 NWidget(WWT_CAPTION, COLOUR_GREY, WID_QS_CAPTION), SetTextStyle(TC_WHITE),
1030 EndContainer(),
1031 NWidget(WWT_PANEL, COLOUR_GREY),
1032 NWidget(WWT_EDITBOX, COLOUR_GREY, WID_QS_TEXT), SetMinimalSize(256, 0), SetFill(1, 0), SetPadding(2, 2, 2, 2),
1033 EndContainer(),
1034 NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize),
1035 NWidget(NWID_SELECTION, INVALID_COLOUR, WID_QS_DEFAULT_SEL),
1036 NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_DEFAULT), SetMinimalSize(65, 12), SetFill(1, 1), SetStringTip(STR_BUTTON_DEFAULT),
1037 EndContainer(),
1038 NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_CANCEL), SetMinimalSize(65, 12), SetFill(1, 1), SetStringTip(STR_BUTTON_CANCEL),
1039 NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_OK), SetMinimalSize(65, 12), SetFill(1, 1), SetStringTip(STR_BUTTON_OK),
1040 NWidget(NWID_SELECTION, INVALID_COLOUR, WID_QS_MOVE_SEL),
1041 NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_MOVE), SetMinimalSize(65, 12), SetFill(1, 1), SetStringTip(STR_BUTTON_MOVE),
1042 EndContainer(),
1043 EndContainer(),
1044};
1045
1046static WindowDesc _query_string_desc(
1047 WDP_CENTER, {}, 0, 0,
1048 WC_QUERY_STRING, WC_NONE,
1049 {},
1050 _nested_query_string_widgets
1051);
1052
1062 void ShowQueryString(std::string_view str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
1063{
1064 assert(parent != nullptr);
1065
1066 CloseWindowByClass(WC_QUERY_STRING);
1067 new QueryStringWindow(str, caption, (flags.Test(QueryStringFlag::LengthIsInChars) ? MAX_CHAR_LENGTH : 1) * maxsize, maxsize, _query_string_desc, parent, afilter, flags);
1068}
1069
1073 struct QueryWindow : public Window {
1074 QueryCallbackProc *proc = nullptr;
1075 EncodedString caption{};
1076 EncodedString message{};
1077
1078 QueryWindow(WindowDesc &desc, EncodedString &&caption, EncodedString &&message, Window *parent, QueryCallbackProc *callback)
1079 : Window(desc), proc(callback), caption(std::move(caption)), message(std::move(message))
1080 {
1081 this->parent = parent;
1082
1083 this->CreateNestedTree();
1084 this->FinishInitNested(WN_CONFIRM_POPUP_QUERY);
1085 }
1086
1087 void Close([[maybe_unused]] int data = 0) override
1088 {
1089 if (this->proc != nullptr) this->proc(this->parent, false);
1090 this->Window::Close();
1091 }
1092
1093 void FindWindowPlacementAndResize(int, int, bool) override
1094 {
1095 /* Position query window over the calling window, ensuring it's within screen bounds. */
1096 this->left = SoftClamp(parent->left + (parent->width / 2) - (this->width / 2), 0, _screen.width - this->width);
1097 this->top = SoftClamp(parent->top + (parent->height / 2) - (this->height / 2), 0, _screen.height - this->height);
1098 this->SetDirty();
1099 }
1100
1101 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
1102 {
1103 switch (widget) {
1104 case WID_Q_CAPTION:
1105 return this->caption.GetDecodedString();
1106
1107 default:
1108 return this->Window::GetWidgetString(widget, stringid);
1109 }
1110 }
1111
1112 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
1113 {
1114 if (widget != WID_Q_TEXT) return;
1115
1116 size = GetStringMultiLineBoundingBox(this->message.GetDecodedString(), size);
1117 }
1118
1119 void DrawWidget(const Rect &r, WidgetID widget) const override
1120 {
1121 if (widget != WID_Q_TEXT) return;
1122
1123 DrawStringMultiLine(r, this->message.GetDecodedString(), TC_FROMSTRING, SA_CENTER);
1124 }
1125
1126 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
1127 {
1128 switch (widget) {
1129 case WID_Q_YES: {
1130 /* in the Generate New World window, clicking 'Yes' causes
1131 * CloseNonVitalWindows() to be called - we shouldn't be in a window then */
1132 QueryCallbackProc *proc = this->proc;
1133 Window *parent = this->parent;
1134 /* Prevent the destructor calling the callback function */
1135 this->proc = nullptr;
1136 this->Close();
1137 if (proc != nullptr) {
1138 proc(parent, true);
1139 proc = nullptr;
1140 }
1141 break;
1142 }
1143 case WID_Q_NO:
1144 this->Close();
1145 break;
1146 }
1147 }
1148
1149 EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
1150 {
1151 /* ESC closes the window, Enter confirms the action */
1152 switch (keycode) {
1153 case WKC_RETURN:
1154 case WKC_NUM_ENTER:
1155 if (this->proc != nullptr) {
1156 this->proc(this->parent, true);
1157 this->proc = nullptr;
1158 }
1159 [[fallthrough]];
1160
1161 case WKC_ESC:
1162 this->Close();
1163 return ES_HANDLED;
1164 }
1165 return ES_NOT_HANDLED;
1166 }
1167};
1168
1169static constexpr std::initializer_list<NWidgetPart> _nested_query_widgets = {
1170 NWidget(NWID_HORIZONTAL),
1171 NWidget(WWT_CLOSEBOX, COLOUR_RED),
1172 NWidget(WWT_CAPTION, COLOUR_RED, WID_Q_CAPTION),
1173 EndContainer(),
1174 NWidget(WWT_PANEL, COLOUR_RED),
1175 NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup),
1176 NWidget(WWT_TEXT, INVALID_COLOUR, WID_Q_TEXT), SetMinimalSize(200, 12),
1177 NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize), SetPIP(WidgetDimensions::unscaled.hsep_indent, WidgetDimensions::unscaled.hsep_indent, WidgetDimensions::unscaled.hsep_indent),
1178 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_Q_NO), SetMinimalSize(71, 12), SetFill(1, 1), SetStringTip(STR_QUIT_NO),
1179 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_Q_YES), SetMinimalSize(71, 12), SetFill(1, 1), SetStringTip(STR_QUIT_YES),
1180 EndContainer(),
1181 EndContainer(),
1182 EndContainer(),
1183};
1184
1185static WindowDesc _query_desc(
1186 WDP_CENTER, {}, 0, 0,
1187 WC_CONFIRM_POPUP_QUERY, WC_NONE,
1188 WindowDefaultFlag::Modal,
1189 _nested_query_widgets
1190);
1191
1202 void ShowQuery(EncodedString &&caption, EncodedString &&message, Window *parent, QueryCallbackProc *callback, bool focus)
1203{
1204 if (parent == nullptr) parent = GetMainWindow();
1205
1206 for (Window *w : Window::Iterate()) {
1207 if (w->window_class != WC_CONFIRM_POPUP_QUERY) continue;
1208
1209 QueryWindow *qw = dynamic_cast<QueryWindow *>(w);
1210 assert(qw != nullptr);
1211 if (qw->parent != parent || qw->proc != callback) continue;
1212
1213 qw->Close();
1214 break;
1215 }
1216
1217 QueryWindow *q = new QueryWindow(_query_desc, std::move(caption), std::move(message), parent, callback);
1218 if (focus) SetFocusedWindow(q);
1219}
BuildCargoAcceptanceString
std::optional< std::string > BuildCargoAcceptanceString(const CargoArray &acceptance, StringID label)
Build comma-separated cargo acceptance string.
Definition cargotype.cpp:267
BaseBitSet::Test
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
Definition base_bitset_type.hpp:141
BaseBitSet::Reset
constexpr Timpl & Reset()
Reset all bits.
Definition base_bitset_type.hpp:83
CommandCost
Common return value for all commands.
Definition command_type.h:24
CommandCost::Succeeded
bool Succeeded() const
Did this command succeed?
Definition command_type.h:168
CommandCost::GetCost
Money GetCost() const
The costs as made up to this moment.
Definition command_type.h:118
EncodedString
Container for an encoded string, created by GetEncodedString.
Definition strings_type.h:98
EncodedString::GetDecodedString
std::string GetDecodedString() const
Decode the encoded string.
Definition strings.cpp:207
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
IntervalTimer
An interval timer will fire every interval, and will continue to fire until it is deleted.
Definition timer.h:76
LandInfoWindow
Definition misc_gui.cpp:72
LandInfoWindow::DrawWidget
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
Definition misc_gui.cpp:79
LandInfoWindow::OnInvalidateData
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Definition misc_gui.cpp:308
LandInfoWindow::landinfo_data
StringList landinfo_data
Info lines to show.
Definition misc_gui.cpp:73
LandInfoWindow::cargo_acceptance
std::string cargo_acceptance
Centered multi-line string for cargo acceptance.
Definition misc_gui.cpp:74
LandInfoWindow::IsNewGRFInspectable
bool IsNewGRFInspectable() const override
Is the data related to this window NewGRF inspectable?
Definition misc_gui.cpp:280
LandInfoWindow::OnInit
void OnInit() override
Notification that the nested widget tree gets initialized.
Definition misc_gui.cpp:138
LandInfoWindow::OnClick
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition misc_gui.cpp:290
LandInfoWindow::UpdateWidgetSize
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 misc_gui.cpp:94
LandInfoWindow::ShowNewGRFInspectWindow
void ShowNewGRFInspectWindow() const override
Show the NewGRF inspection window.
Definition misc_gui.cpp:285
NWidgetBase::type
WidgetType type
Type of the widget / nested widget.
Definition widget_type.h:226
NWidgetCore::colour
Colours colour
Colour of this widget.
Definition widget_type.h:400
NWidgetCore::IsLowered
bool IsLowered() const
Return whether the widget is lowered.
Definition widget_type.h:446
NWidgetLeaf
Leaf widget.
Definition widget_type.h:928
OverflowSafeInt< int64_t >
Ticks::DAY_TICKS
static constexpr TimerGameTick::Ticks DAY_TICKS
1 day is 74 ticks; TimerGameCalendar::date_fract used to be uint16_t and incremented by 885.
Definition timer_game_tick.h:75
Tile
Wrapper class to abstract away the way the tiles are stored.
Definition map_func.h:25
TimerGameConst< struct Calendar >::INVALID_DATE
static constexpr TimerGame< struct Calendar >::Date INVALID_DATE
Representation of an invalid date.
Definition timer_game_common.h:193
WidgetDimensions::framerect
RectPadding framerect
Standard padding inside many panels.
Definition window_gui.h:40
WidgetDimensions::frametext
RectPadding frametext
Padding inside frame with text.
Definition window_gui.h:41
WidgetDimensions::scaled
static WidgetDimensions scaled
Widget dimensions scaled for current zoom level.
Definition window_gui.h:30
WidgetDimensions::imgbtn
RectPadding imgbtn
Padding around image button image.
Definition window_gui.h:34
WidgetDimensions::vsep_normal
int vsep_normal
Normal vertical spacing.
Definition window_gui.h:58
WidgetDimensions::vsep_wide
int vsep_wide
Wide vertical spacing.
Definition window_gui.h:60
WidgetDimensions::fullbevel
RectPadding fullbevel
Always-scaled bevel thickness.
Definition window_gui.h:39
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition window_gui.h:93
WidgetDimensions::bevel
RectPadding bevel
Bevel thickness, affected by "scaled bevels" game option.
Definition window_gui.h:38
command_func.h
Functions related to commands.
DoCommandFlag::QueryCost
@ QueryCost
query cost only, don't build.
company_base.h
Definition of stuff that is very close to a company, like the company struct itself.
GetParamsForOwnedBy
std::array< StringParameter, 2 > GetParamsForOwnedBy(Owner owner, TileIndex tile)
Set the right DParams for STR_ERROR_OWNED_BY.
Definition company_cmd.cpp:358
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition company_cmd.cpp:55
_current_company
CompanyID _current_company
Company currently doing an action.
Definition company_cmd.cpp:56
company_func.h
Functions related to companies.
OWNER_NONE
static constexpr Owner OWNER_NONE
The tile has no ownership.
Definition company_type.h:26
OWNER_WATER
static constexpr Owner OWNER_WATER
The tile/execution is done by "water".
Definition company_type.h:27
debug.h
Functions related to debugging.
Debug
#define Debug(category, level, format_string,...)
Output a line of debugging information.
Definition debug.h:37
error.h
Functions related to errors.
WL_INFO
@ WL_INFO
Used for DoCommand-like (and some non-fatal AI GUI) errors/information.
Definition error.h:24
ShowErrorMessage
void ShowErrorMessage(EncodedString &&summary_msg, int x, int y, CommandCost &cc)
Display an error message in a window.
Definition error_gui.cpp:290
GetCharacterHeight
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Definition fontcache.cpp:87
maxdim
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Definition geometry_func.cpp:22
geometry_func.hpp
Geometry functions.
CentreBounds
int CentreBounds(int min, int max, int size)
Determine where to position a centred object.
Definition geometry_type.hpp:26
GetStringHeight
int GetStringHeight(std::string_view str, int maxw, FontSize fontsize)
Calculates height of string (in pixels).
Definition gfx.cpp:712
GetStringBoundingBox
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition gfx.cpp:894
DrawString
int DrawString(int left, int right, int top, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
Definition gfx.cpp:665
_ctrl_pressed
bool _ctrl_pressed
Is Ctrl pressed?
Definition gfx.cpp:38
GetCharacterWidth
uint8_t GetCharacterWidth(FontSize size, char32_t key)
Return width of character glyph.
Definition gfx.cpp:1270
GetStringMultiLineBoundingBox
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion)
Calculate string bounding box for multi-line strings.
Definition gfx.cpp:748
DrawStringMultiLine
int DrawStringMultiLine(int left, int right, int top, int bottom, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
Definition gfx.cpp:782
GfxFillRect
void GfxFillRect(int left, int top, int right, int bottom, const std::variant< PixelColour, PaletteID > &colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
Definition gfx.cpp:115
FillDrawPixelInfo
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
Definition gfx.cpp:1565
_right_button_down
bool _right_button_down
Is right mouse button pressed?
Definition gfx.cpp:43
GetScaledSpriteSize
Dimension GetScaledSpriteSize(SpriteID sprid)
Scale sprite size for GUI.
Definition widget.cpp:68
GetCharPosInString
ParagraphLayouter::Position GetCharPosInString(std::string_view str, size_t pos, FontSize start_fontsize)
Get the leading corner of a character in a single-line string relative to the start of the string.
Definition gfx_layout.cpp:425
gfx_layout.h
Functions related to laying out the texts.
FS_NORMAL
@ FS_NORMAL
Index of the normal font in the font tables.
Definition gfx_type.h:249
SA_LEFT
@ SA_LEFT
Left align the text.
Definition gfx_type.h:388
SA_HOR_CENTER
@ SA_HOR_CENTER
Horizontally center the text.
Definition gfx_type.h:389
SA_FORCE
@ SA_FORCE
Force the alignment, i.e. don't swap for RTL languages.
Definition gfx_type.h:400
SA_CENTER
@ SA_CENTER
Center both horizontally and vertically.
Definition gfx_type.h:398
FILLRECT_CHECKER
@ FILLRECT_CHECKER
Draw only every second pixel, used for greying-out.
Definition gfx_type.h:346
SetFill
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition widget_type.h:1219
SetSpriteTip
constexpr NWidgetPart SetSpriteTip(SpriteID sprite, StringID tip={})
Widget part function for setting the sprite and tooltip.
Definition widget_type.h:1251
SetPIP
constexpr NWidgetPart SetPIP(uint8_t pre, uint8_t inter, uint8_t post)
Widget part function for setting a pre/inter/post spaces.
Definition widget_type.h:1375
SetPadding
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.
Definition widget_type.h:1332
SetStringTip
constexpr NWidgetPart SetStringTip(StringID string, StringID tip={})
Widget part function for setting the string and tooltip.
Definition widget_type.h:1240
SetAspect
constexpr NWidgetPart SetAspect(float ratio, AspectFlags flags=AspectFlag::ResizeX)
Widget part function for setting the aspect ratio.
Definition widget_type.h:1410
SetTextStyle
constexpr NWidgetPart SetTextStyle(TextColour colour, FontSize size=FS_NORMAL)
Widget part function for setting the text style.
Definition widget_type.h:1198
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition widget_type.h:1156
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition widget_type.h:1229
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=INVALID_WIDGET)
Widget part function for starting a new 'real' widget.
Definition widget_type.h:1424
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition window.cpp:966
gui.h
GUI functions that shouldn't be here.
ShowExtraViewportWindow
void ShowExtraViewportWindow(TileIndex tile=INVALID_TILE)
Show a new Extra Viewport window.
Definition viewport_gui.cpp:159
landscape.h
Functions related to OTTD's landscape.
RemapCoords
Point RemapCoords(int x, int y, int z)
Map 3D world or tile coordinate to equivalent 2D coordinate as used in the viewports and smallmap.
Definition landscape.h:81
landscape_cmd.h
Command definitions related to landscape (slopes etc.).
HandlePlacePushButton
bool HandlePlacePushButton(Window *w, WidgetID widget, CursorID cursor, HighLightStyle mode)
This code is shared for the majority of the pushbuttons.
Definition main_gui.cpp:63
TileY
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Definition map_func.h:437
TileX
static uint TileX(TileIndex tile)
Get the X component of a tile.
Definition map_func.h:427
IsInsideMM
constexpr bool IsInsideMM(const size_t x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
Definition math_func.hpp:267
SoftClamp
constexpr T SoftClamp(const T a, const T min, const T max)
Clamp a value between an interval.
Definition math_func.hpp:102
Clamp
constexpr T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
Definition math_func.hpp:79
GuiShowTooltips
void GuiShowTooltips(Window *parent, EncodedString &&text, TooltipCloseCondition close_tooltip)
Shows a tooltip.
Definition misc_gui.cpp:693
ShowQuery
void ShowQuery(EncodedString &&caption, EncodedString &&message, Window *parent, QueryCallbackProc *callback, bool focus)
Show a confirmation window with standard 'yes' and 'no' buttons The window is aligned to the centre o...
Definition misc_gui.cpp:1202
HideFillingPercent
void HideFillingPercent(TextEffectID *te_id)
Hide vehicle loading indicators.
Definition misc_gui.cpp:586
ShowCostOrIncomeAnimation
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
Display animated income or costs on the map.
Definition misc_gui.cpp:513
ShowEstimatedCostOrIncome
void ShowEstimatedCostOrIncome(Money cost, int x, int y)
Display estimated costs.
Definition misc_gui.cpp:495
OskActivation
OskActivation
Method to open the OSK.
Definition misc_gui.cpp:47
OSKA_SINGLE_CLICK
@ OSKA_SINGLE_CLICK
Single click after focus click opens OSK.
Definition misc_gui.cpp:50
OSKA_IMMEDIATELY
@ OSKA_IMMEDIATELY
Focusing click already opens OSK.
Definition misc_gui.cpp:51
OSKA_DISABLED
@ OSKA_DISABLED
The OSK shall not be activated at all.
Definition misc_gui.cpp:48
OSKA_DOUBLE_CLICK
@ OSKA_DOUBLE_CLICK
Double click on the edit box opens OSK.
Definition misc_gui.cpp:49
ShowLandInfo
void ShowLandInfo(TileIndex tile)
Show land information window.
Definition misc_gui.cpp:321
ShowFeederIncomeAnimation
void ShowFeederIncomeAnimation(int x, int y, int z, Money transfer, Money income)
Display animated feeder income.
Definition misc_gui.cpp:536
ShowQueryString
void ShowQueryString(std::string_view str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
Definition misc_gui.cpp:1062
UpdateFillingPercent
void UpdateFillingPercent(TextEffectID te_id, uint8_t percent, StringID string)
Update vehicle loading indicators.
Definition misc_gui.cpp:575
ShowFillingPercent
TextEffectID ShowFillingPercent(int x, int y, int z, uint8_t percent, StringID string)
Display vehicle loading indicators.
Definition misc_gui.cpp:561
ScrollEditBoxTextRect
static Rect ScrollEditBoxTextRect(Rect r, const Textbuf &tb)
Reposition edit text box rect based on textbuf length can caret position.
Definition misc_gui.cpp:723
misc_widget.h
Types related to the misc widgets.
WID_TT_BACKGROUND
@ WID_TT_BACKGROUND
Background of the window.
Definition misc_widget.h:21
WID_QS_MOVE_SEL
@ WID_QS_MOVE_SEL
Container for move button, which can be hidden.
Definition misc_widget.h:40
WID_QS_DEFAULT
@ WID_QS_DEFAULT
Default button.
Definition misc_widget.h:35
WID_QS_CAPTION
@ WID_QS_CAPTION
Caption of the window.
Definition misc_widget.h:33
WID_QS_TEXT
@ WID_QS_TEXT
Text of the query.
Definition misc_widget.h:34
WID_QS_MOVE
@ WID_QS_MOVE
Move button.
Definition misc_widget.h:39
WID_QS_CANCEL
@ WID_QS_CANCEL
Cancel button.
Definition misc_widget.h:37
WID_QS_DEFAULT_SEL
@ WID_QS_DEFAULT_SEL
Container for default button, which can be hidden.
Definition misc_widget.h:36
WID_QS_OK
@ WID_QS_OK
OK button.
Definition misc_widget.h:38
WID_A_WEBSITE
@ WID_A_WEBSITE
URL of OpenTTD website.
Definition misc_widget.h:27
WID_A_COPYRIGHT
@ WID_A_COPYRIGHT
Copyright string.
Definition misc_widget.h:28
WID_A_SCROLLING_TEXT
@ WID_A_SCROLLING_TEXT
The actually scrolling text.
Definition misc_widget.h:26
WID_Q_NO
@ WID_Q_NO
Yes button.
Definition misc_widget.h:47
WID_Q_YES
@ WID_Q_YES
No button.
Definition misc_widget.h:48
WID_Q_CAPTION
@ WID_Q_CAPTION
Caption of the window.
Definition misc_widget.h:45
WID_Q_TEXT
@ WID_Q_TEXT
Text of the query.
Definition misc_widget.h:46
WID_LI_BACKGROUND
@ WID_LI_BACKGROUND
Background of the window.
Definition misc_widget.h:16
WID_LI_LOCATION
@ WID_LI_LOCATION
Scroll to location.
Definition misc_widget.h:15
newgrf_debug.h
Functions/types related to NewGRF debugging.
GetGrfSpecFeature
GrfSpecFeature GetGrfSpecFeature(TileIndex tile)
Get the GrfSpecFeature associated with the tile.
Definition newgrf_debug_gui.cpp:760
GetColourGradient
PixelColour GetColourGradient(Colours colour, ColourShade shade)
Get colour gradient palette index.
Definition palette.cpp:388
PC_GREY
static constexpr PixelColour PC_GREY
Grey palette colour.
Definition palette_func.h:98
PC_BLACK
static constexpr PixelColour PC_BLACK
Black palette colour.
Definition palette_func.h:96
PC_LIGHT_YELLOW
static constexpr PixelColour PC_LIGHT_YELLOW
Light yellow palette colour.
Definition palette_func.h:110
querystring_gui.h
Base for the GUIs that have an edit box in them.
ShowOnScreenKeyboard
void ShowOnScreenKeyboard(Window *parent, WidgetID button)
Show the on-screen keyboard (osk) associated with a given textbox.
Definition osk_gui.cpp:391
IsOSKOpenedFor
bool IsOSKOpenedFor(const Window *w, WidgetID button)
Check whether the OSK is opened for a specific editbox.
Definition osk_gui.cpp:422
rev.h
declaration of OTTD revision dependent variables
safeguards.h
A number of safeguards to prevent using unsafe methods.
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition settings.cpp:61
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition settings.cpp:60
station_base.h
Base classes/functions for stations.
CcMoveStationName
void CcMoveStationName(Commands, const CommandCost &result, StationID station_id)
Callback function that is called after a name is moved.
Definition station_cmd.cpp:4525
station_cmd.h
Command definitions related to stations.
stdafx.h
Definition of base types and functions in a cross-platform compatible way.
string_func.h
Functions related to low-level strings.
CharSetFilter
CharSetFilter
Valid filter types for IsValidChar.
Definition string_type.h:24
StringList
std::vector< std::string > StringList
Type for a list of strings.
Definition string_type.h:60
GetStringWithArgs
void GetStringWithArgs(StringBuilder &builder, StringID string, StringParameters &args, uint case_index, bool game_script)
Get a parsed string with most special stringcodes replaced by the string parameters.
Definition strings.cpp:336
GetEncodedString
EncodedString GetEncodedString(StringID str)
Encode a string with no parameters into an encoded string.
Definition strings.cpp:90
GetString
std::string GetString(StringID string)
Resolve the given StringID into a std::string with formatting but no parameters.
Definition strings.cpp:424
_current_text_dir
TextDirection _current_text_dir
Text direction of the currently selected language.
Definition strings.cpp:56
strings_func.h
Functions related to OTTD's strings.
PackVelocity
int64_t PackVelocity(uint speed, VehicleType type)
Pack velocity and vehicle type for use with SCC_VELOCITY string parameter.
Definition strings_func.h:83
StringID
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Definition strings_type.h:19
TD_RTL
@ TD_RTL
Text is written right-to-left by default.
Definition strings_type.h:27
MAX_CHAR_LENGTH
static const int MAX_CHAR_LENGTH
Max. length of UTF-8 encoded unicode character.
Definition strings_type.h:21
AboutWindow
Definition misc_gui.cpp:418
AboutWindow::DrawWidget
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
Definition misc_gui.cpp:453
AboutWindow::UpdateWidgetSize
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 misc_gui.cpp:437
AboutWindow::scroll_interval
const IntervalTimer< TimerWindow > scroll_interval
Scroll the text in the about window slow.
Definition misc_gui.cpp:473
AboutWindow::GetWidgetString
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
Definition misc_gui.cpp:430
AboutWindow::text_position
int text_position
The top of the scrolling text.
Definition misc_gui.cpp:419
AboutWindow::num_visible_lines
static const int num_visible_lines
The number of lines visible simultaneously.
Definition misc_gui.cpp:421
AboutWindow::line_height
int line_height
The height of a single line.
Definition misc_gui.cpp:420
AutoRestoreBackup
Class to backup a specific variable and restore it upon destruction of this object to prevent stack v...
Definition backup_type.hpp:150
CargoArray
Class for storing amounts of cargo.
Definition cargo_type.h:111
ClientSettings::gui
GUISettings gui
settings related to the GUI
Definition settings_type.h:650
CommandHelper
Definition command_func.h:83
Company
Definition company_base.h:127
Coord2D< int >
Coord2D::y
T y
Y coordinate.
Definition geometry_type.hpp:35
Coord2D::x
T x
X coordinate.
Definition geometry_type.hpp:34
CursorVars::pos
Point pos
logical mouse position
Definition gfx_type.h:125
CursorVars::in_window
bool in_window
mouse inside this window, determines drawing logic
Definition gfx_type.h:147
CursorVars::total_size
Point total_size
union of sprite properties
Definition gfx_type.h:137
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition geometry_type.hpp:56
DrawPixelInfo
Data about how and where to blit pixels.
Definition gfx_type.h:157
EconomySettings::dist_local_authority
uint8_t dist_local_authority
distance for town local authority, default 20
Definition settings_type.h:545
GUISettings::osk_activation
uint8_t osk_activation
Mouse gesture to trigger the OSK.
Definition settings_type.h:230
GameSettings::economy
EconomySettings economy
settings to change the economy
Definition settings_type.h:642
Pool::PoolItem::index
Tindex index
Index of this pool item.
Definition pool_type.hpp:286
Pool::PoolItem<&_company_pool >::GetIfValid
static Titem * GetIfValid(auto index)
Returns Titem with given index.
Definition pool_type.hpp:398
QueryStringWindow
Class for the string query window.
Definition misc_gui.cpp:903
QueryStringWindow::OnPlaceObjectAbort
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
Definition misc_gui.cpp:998
QueryStringWindow::OnClick
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition misc_gui.cpp:950
QueryStringWindow::OnPlaceObject
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
Definition misc_gui.cpp:981
QueryStringWindow::Close
void Close(int data=0) override
Hide the window and all its child windows, and mark them for a later deletion.
Definition misc_gui.cpp:1011
QueryStringWindow::editbox
QueryString editbox
Editbox.
Definition misc_gui.cpp:904
QueryStringWindow::GetWidgetString
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
Definition misc_gui.cpp:933
QueryStringWindow::flags
QueryStringFlags flags
Flags controlling behaviour of the window.
Definition misc_gui.cpp:905
QueryStringWindow::last_user_action
WidgetID last_user_action
Last started user action.
Definition misc_gui.cpp:907
QueryString
Data stored about a string that can be modified in the GUI.
Definition querystring_gui.h:20
QueryString::ok_button
int ok_button
Widget button of parent window to simulate when pressing OK in OSK.
Definition querystring_gui.h:27
QueryString::cancel_button
int cancel_button
Widget button of parent window to simulate when pressing CANCEL in OSK.
Definition querystring_gui.h:28
QueryString::GetCharAtPosition
ptrdiff_t GetCharAtPosition(const Window *w, WidgetID wid, const Point &pt) const
Get the character that is rendered at a position.
Definition misc_gui.cpp:851
QueryString::GetCaretPosition
Point GetCaretPosition(const Window *w, WidgetID wid) const
Get the current caret position.
Definition misc_gui.cpp:793
QueryString::GetBoundingRect
Rect GetBoundingRect(const Window *w, WidgetID wid, size_t from, size_t to) const
Get the bounding rectangle for a range of the query string.
Definition misc_gui.cpp:821
QueryWindow
Window used for asking the user a YES/NO question.
Definition misc_gui.cpp:1073
QueryWindow::Close
void Close(int data=0) override
Hide the window and all its child windows, and mark them for a later deletion.
Definition misc_gui.cpp:1087
QueryWindow::UpdateWidgetSize
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 misc_gui.cpp:1112
QueryWindow::proc
QueryCallbackProc * proc
callback function executed on closing of popup. Window* points to parent, bool is true if 'yes' click...
Definition misc_gui.cpp:1074
QueryWindow::OnKeyPress
EventState OnKeyPress(char32_t key, uint16_t keycode) override
A key has been pressed.
Definition misc_gui.cpp:1149
QueryWindow::OnClick
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition misc_gui.cpp:1126
QueryWindow::GetWidgetString
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
Definition misc_gui.cpp:1101
QueryWindow::caption
EncodedString caption
caption for query window.
Definition misc_gui.cpp:1075
QueryWindow::message
EncodedString message
message for query window.
Definition misc_gui.cpp:1076
QueryWindow::FindWindowPlacementAndResize
void FindWindowPlacementAndResize(int, int, bool) override
Resize window towards the default size.
Definition misc_gui.cpp:1093
QueryWindow::DrawWidget
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
Definition misc_gui.cpp:1119
RectPadding::Horizontal
constexpr uint Horizontal() const
Get total horizontal padding of RectPadding.
Definition geometry_type.hpp:89
RectPadding::Vertical
constexpr uint Vertical() const
Get total vertical padding of RectPadding.
Definition geometry_type.hpp:95
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition geometry_type.hpp:101
Rect::WithWidth
Rect WithWidth(int width, bool end) const
Copy Rect and set its width.
Definition geometry_type.hpp:211
Rect::Width
int Width() const
Get width of Rect.
Definition geometry_type.hpp:111
Rect::Shrink
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Definition geometry_type.hpp:124
Rect::Indent
Rect Indent(int indent, bool end) const
Copy Rect and indent it from its position.
Definition geometry_type.hpp:224
Rect::WithX
Rect WithX(int new_left, int new_right) const
Create a new Rect, replacing the left and right coordiates.
Definition geometry_type.hpp:272
Rect::Translate
Rect Translate(int x, int y) const
Copy and translate Rect by x,y pixels.
Definition geometry_type.hpp:200
SpecializedStation< Station, false >::IsExpected
static bool IsExpected(const BaseStation *st)
Helper for checking whether the given station is of this type.
Definition base_station_base.h:229
SpecializedStation< Station, false >::Get
static Station * Get(auto index)
Gets station with given index.
Definition base_station_base.h:248
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
Textbuf
Helper/buffer for input fields.
Definition textbuf_type.h:30
Textbuf::pixels
uint16_t pixels
the current size of the string in pixels
Definition textbuf_type.h:35
Textbuf::markxoffs
uint16_t markxoffs
the start position of the marked area in pixels
Definition textbuf_type.h:41
Textbuf::DeleteAll
void DeleteAll()
Delete every character in the textbuffer.
Definition textbuf.cpp:112
Textbuf::GetText
std::string_view GetText() const
Get the current text.
Definition textbuf.cpp:284
Textbuf::caretxoffs
uint16_t caretxoffs
the current position of the caret in pixels
Definition textbuf_type.h:38
Textbuf::marklength
uint16_t marklength
the length of the marked area in pixels
Definition textbuf_type.h:42
Textbuf::Assign
void Assign(std::string_view text)
Copy a string into the textbuffer.
Definition textbuf.cpp:420
Textbuf::caret
bool caret
is the caret ("_") visible or not
Definition textbuf_type.h:36
Textbuf::afilter
CharSetFilter afilter
Allowed characters.
Definition textbuf_type.h:31
TileDesc
Tile description for the 'land area information' tool.
Definition tile_cmd.h:36
TileDesc::owner_type
std::array< StringID, 4 > owner_type
Type of each owner.
Definition tile_cmd.h:40
TooltipsWindow
Window for displaying a tooltip.
Definition misc_gui.cpp:607
TooltipsWindow::close_cond
TooltipCloseCondition close_cond
Condition for closing the window.
Definition misc_gui.cpp:609
TooltipsWindow::text
EncodedString text
String to display as tooltip.
Definition misc_gui.cpp:608
TooltipsWindow::OnMouseLoop
void OnMouseLoop() override
Called for every mouse loop run, which is at least once per (game) tick.
Definition misc_gui.cpp:663
TooltipsWindow::OnInitialPosition
Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override
Compute the initial position of the window.
Definition misc_gui.cpp:621
TooltipsWindow::UpdateWidgetSize
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 misc_gui.cpp:641
TooltipsWindow::DrawWidget
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
Definition misc_gui.cpp:654
Town
Town data structure.
Definition town.h:63
WindowDesc
High level window description.
Definition window_gui.h:168
Window
Data structure for an opened window.
Definition window_gui.h:274
Window::ReInit
void ReInit(int rx=0, int ry=0, bool reposition=false)
Re-initialize a window, and optionally change its size.
Definition window.cpp:978
Window::Close
virtual void Close(int data=0)
Hide the window and all its child windows, and mark them for a later deletion.
Definition window.cpp:1102
Window::IsWidgetGloballyFocused
bool IsWidgetGloballyFocused(WidgetID widget_index) const
Check if given widget has user input focus.
Definition window_gui.h:432
Window::FinishInitNested
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition window.cpp:1807
Window::querystrings
std::map< WidgetID, QueryString * > querystrings
QueryString associated to WWT_EDITBOX widgets.
Definition window_gui.h:321
Window::InvalidateData
void InvalidateData(int data=0, bool gui_scope=true)
Mark this window's data as invalid (in need of re-computing)
Definition window.cpp:3234
Window::parent
Window * parent
Parent window.
Definition window_gui.h:329
Window::SetWidgetDirty
void SetWidgetDirty(WidgetID widget_index) const
Invalidate a widget, i.e.
Definition window.cpp:556
Window::GetWidgetString
virtual std::string GetWidgetString(WidgetID widget, StringID stringid) const
Get the raw string for a widget.
Definition window.cpp:504
Window::resize
ResizeInfo resize
Resize information.
Definition window_gui.h:315
Window::CreateNestedTree
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
Definition window.cpp:1797
Window::window_class
WindowClass window_class
Window class.
Definition window_gui.h:302
Window::OnQueryTextFinished
virtual void OnQueryTextFinished(std::optional< std::string > str)
The query window opened from this window has closed.
Definition window_gui.h:786
Window::SetFocusedWidget
bool SetFocusedWidget(WidgetID widget_index)
Set focus within this window to the given widget.
Definition window.cpp:485
Window::RaiseButtons
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition window.cpp:530
Window::left
int left
x position of left edge of the window
Definition window_gui.h:310
Window::OnEditboxChanged
virtual void OnEditboxChanged(WidgetID widget)
The text in an editbox has been edited.
Definition window_gui.h:778
Window::top
int top
y position of top edge of the window
Definition window_gui.h:311
Window::GetWidget
const NWID * GetWidget(WidgetID widnum) const
Get the nested widget with number widnum from the nested widget tree.
Definition window_gui.h:983
Window::HandleButtonClick
void HandleButtonClick(WidgetID widget)
Do all things to make a button look clicked and mark it to be unclicked in a few ticks.
Definition window.cpp:595
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition window.cpp:1820
Window::flags
WindowFlags flags
Window flags.
Definition window_gui.h:301
Window::Iterate
AllWindows< false > Iterate
Iterate all windows in whatever order is easiest.
Definition window_gui.h:933
Window::height
int height
Height of the window (number of pixels down in y direction)
Definition window_gui.h:313
Window::width
int width
width of the window (number of pixels to the right in x direction)
Definition window_gui.h:312
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition window_gui.h:303
QueryStringFlag::EnableMove
@ EnableMove
enable the 'Move' button
QueryStringFlag::AcceptUnchanged
@ AcceptUnchanged
return success even when the text didn't change
QueryStringFlag::EnableDefault
@ EnableDefault
enable the 'Default' button ("\0" is returned)
QueryStringFlag::LengthIsInChars
@ LengthIsInChars
the length of the string is counted in characters
QueryCallbackProc
void QueryCallbackProc(Window *, bool)
Callback procedure for the ShowQuery method.
Definition textbuf_gui.h:28
texteff.hpp
Functions related to text effects.
TE_STATIC
@ TE_STATIC
Keep the text effect static.
Definition texteff.hpp:23
TE_RISING
@ TE_RISING
Make the text effect slowly go upwards.
Definition texteff.hpp:22
GetTileZ
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
Definition tile_map.cpp:116
INVALID_TILE
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition tile_type.h:95
tilehighlight_func.h
Functions related to tile highlights.
HT_RECT
@ HT_RECT
rectangle (stations, depots, ...)
Definition tilehighlight_type.h:21
timer.h
Definition of Interval and OneShot timers.
timer_window.h
Definition of the Window system.
town.h
Base of the town class.
ClosestTownFromTile
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold.
Definition town_cmd.cpp:3952
VEH_ROAD
@ VEH_ROAD
Road vehicle type.
Definition vehicle_type.h:26
VEH_TRAIN
@ VEH_TRAIN
Train vehicle type.
Definition vehicle_type.h:25
ScrollMainWindowToTile
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
Definition viewport.cpp:2592
SetViewportStationRect
void SetViewportStationRect(const Station *st, bool sel)
Select or deselect station for rectangle area highlight.
Definition viewport.cpp:3736
IsPtInWindowViewport
Viewport * IsPtInWindowViewport(const Window *w, int x, int y)
Is a xy position inside the viewport of the window?
Definition viewport.cpp:408
SetViewportWaypointRect
void SetViewportWaypointRect(const Waypoint *wp, bool sel)
Select or deselect waypoint for rectangle area highlight.
Definition viewport.cpp:3782
viewport_func.h
Functions related to (drawing on) viewports.
water_regions.h
Handles dividing the water in the map into regions to assist pathfinding.
waypoint_base.h
Base of waypoints.
CcMoveWaypointName
void CcMoveWaypointName(Commands, const CommandCost &result, StationID waypoint_id)
Callback function that is called after a name is moved.
Definition waypoint_cmd.cpp:657
waypoint_cmd.h
Command definitions related to waypoints.
DrawFrameRect
void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags)
Draw frame rectangle.
Definition widget.cpp:289
ScaleGUITrad
static RectPadding ScaleGUITrad(const RectPadding &r)
Scale a RectPadding to GUI zoom level.
Definition widget.cpp:49
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition widget_type.h:104
WWT_PUSHIMGBTN
@ WWT_PUSHIMGBTN
Normal push-button (no toggle button) with image caption.
Definition widget_type.h:105
WWT_LABEL
@ WWT_LABEL
Centered label.
Definition widget_type.h:48
WWT_EDITBOX
@ WWT_EDITBOX
a textbox for typing
Definition widget_type.h:62
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:66
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition widget_type.h:44
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:39
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:52
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition widget_type.h:68
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition widget_type.h:60
WWT_FRAME
@ WWT_FRAME
Frame.
Definition widget_type.h:51
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget tree.
Definition widget_type.h:37
WWT_TEXT
@ WWT_TEXT
Pure simple text.
Definition widget_type.h:49
WWT_DEBUGBOX
@ WWT_DEBUGBOX
NewGRF debug box (at top-right of a window, between WWT_CAPTION and WWT_SHADEBOX)
Definition widget_type.h:54
NWID_SELECTION
@ NWID_SELECTION
Stacked widgets, only one visible at a time (eg in a panel with tabs).
Definition widget_type.h:71
SZSP_NONE
@ SZSP_NONE
Display plane with zero size in both directions (none filling and resizing).
Definition widget_type.h:506
EqualSize
@ EqualSize
Containers should keep all their (resizing) children equally large.
Definition widget_type.h:541
CloseWindowById
void CloseWindowById(WindowClass cls, WindowNumber number, bool force, int data)
Close a window by its class and window number (if it is open).
Definition window.cpp:1193
GetMainWindow
Window * GetMainWindow()
Get the main window, i.e.
Definition window.cpp:1180
SetFocusedWindow
void SetFocusedWindow(Window *w)
Set the window that has the focus.
Definition window.cpp:421
FindWindowFromPt
Window * FindWindowFromPt(int x, int y)
Do a search for a window at specific coordinates.
Definition window.cpp:1842
GetMainViewTop
int GetMainViewTop()
Return the top of the main view available for general use.
Definition window.cpp:2136
CloseWindowByClass
void CloseWindowByClass(WindowClass cls, int data)
Close all windows of a given class.
Definition window.cpp:1205
GetMainViewBottom
int GetMainViewBottom()
Return the bottom of the main view available for general use.
Definition window.cpp:2147
_mouse_hovering
bool _mouse_hovering
The mouse is hovering over the same point.
Definition window.cpp:94
window_func.h
Window functions not directly related to making/drawing windows.
WindowDefaultFlag::NoClose
@ NoClose
This window can't be interactively closed.
WindowDefaultFlag::NoFocus
@ NoFocus
This window won't get focus/make any other window lose focus when click.
WindowDefaultFlag::Modal
@ Modal
The window is a modal child of some other window, meaning the parent is 'inactive'.
FrameFlag::Lowered
@ Lowered
If set the frame is lowered and the background colour brighter (ie. buttons when pressed)
WindowFlag::WhiteBorder
@ WhiteBorder
Window white border counter bit mask.
WDP_CENTER
@ WDP_CENTER
Center the window.
Definition window_gui.h:145
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition window_gui.h:144
WDP_MANUAL
@ WDP_MANUAL
Manually align the window (so no automatic location finding)
Definition window_gui.h:143
WidgetID
int WidgetID
Widget ID.
Definition window_type.h:20
WN_QUERY_STRING
@ WN_QUERY_STRING
Query string.
Definition window_type.h:34
WN_GAME_OPTIONS_ABOUT
@ WN_GAME_OPTIONS_ABOUT
About window.
Definition window_type.h:29
WN_CONFIRM_POPUP_QUERY
@ WN_CONFIRM_POPUP_QUERY
Query popup confirm.
Definition window_type.h:37
EventState
EventState
State of handling an event.
Definition window_type.h:780
ES_HANDLED
@ ES_HANDLED
The passed event is handled.
Definition window_type.h:781
ES_NOT_HANDLED
@ ES_NOT_HANDLED
The passed event is not handled.
Definition window_type.h:782
INVALID_WIDGET
static constexpr WidgetID INVALID_WIDGET
An invalid widget index.
Definition window_type.h:23
WC_LAND_INFO
@ WC_LAND_INFO
Land info window; Window numbers:
Definition window_type.h:155
WC_OSK
@ WC_OSK
On Screen Keyboard; Window numbers:
Definition window_type.h:167
WC_WAYPOINT_VIEW
@ WC_WAYPOINT_VIEW
Waypoint view; Window numbers:
Definition window_type.h:362
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition window_type.h:50
WC_STATION_VIEW
@ WC_STATION_VIEW
Station view; Window numbers:
Definition window_type.h:350
WC_CONFIRM_POPUP_QUERY
@ WC_CONFIRM_POPUP_QUERY
Popup with confirm question; Window numbers:
Definition window_type.h:135
WC_GAME_OPTIONS
@ WC_GAME_OPTIONS
Game options window; Window numbers:
Definition window_type.h:635
WC_QUERY_STRING
@ WC_QUERY_STRING
Query string window; Window numbers:
Definition window_type.h:128
WC_TOOLTIPS
@ WC_TOOLTIPS
Tooltip window; Window numbers:
Definition window_type.h:121
zoom_func.h
Functions related to zooming.