OpenTTD Source 20251005-master-ga617d009cc
window_type.h
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 <http://www.gnu.org/licenses/>.
6 */
7
10#ifndef WINDOW_TYPE_H
11#define WINDOW_TYPE_H
12
14
20using WidgetID = int;
21
23static constexpr WidgetID INVALID_WIDGET = -1;
24
47
49enum WindowClass : uint16_t {
51
57
64
70
79
86
92
98
104
110
116
122
129
136
143
144
150
156
162
168
174
175
181
187
193
194
200
206
212
218
224
230
236
242
248
254
260
266
272
278
284
290
296
302
308
314
320
326
332
333
339
345
351
357
363
369
375
376
382
388
395
401
409
415
421
429
435
441
447
448
454
461
468
475
476
484
490
497
503
509
515
521
527
533
539
545
551
557
563
569
575
581
587
593
599
600
606
612
613
619
625
636
642
648
654
655
661
667
673
679
680
686
692
698
704
710
716
722
728
729 /*
730 * Help and manuals window; %Window numbers:
731 * - 0 = #HelpWindowWidgets
732 */
733 WC_HELPWIN,
734
735 WC_INVALID = 0xFFFF,
736};
737
746
747struct Window;
748
761private:
762 int32_t value = 0;
763public:
764 WindowNumber() = default;
765 WindowNumber(int32_t value) : value(value) {}
766 WindowNumber(ConvertibleThroughBase auto value) : value(value.base()) {}
767
768 /* Automatically convert to int32_t. */
769 operator int32_t() const { return value; }
770
771 /* Automatically convert to any other type that might be requested. */
772 template <typename T> requires (std::is_enum_v<T> || std::is_class_v<T>)
773 operator T() const { return static_cast<T>(value); };
774
775 constexpr bool operator==(const std::integral auto &rhs) const { return this->value == static_cast<int32_t>(rhs); }
776 constexpr bool operator==(const ConvertibleThroughBase auto &rhs) const { return this->value == static_cast<int32_t>(rhs.base()); }
777};
778
784
785#endif /* WINDOW_TYPE_H */
A type is considered 'convertible through base()' when it has a 'base()' function that returns someth...
Concept for unifying the convert through 'base()' behaviour of several 'strong' types.
Number to differentiate different windows of the same class.
Data structure for an opened window.
Definition window_gui.h:273
int WidgetID
Widget ID.
Definition window_type.h:20
WindowNumberEnum
Window numbers.
Definition window_type.h:26
@ WN_QUERY_STRING
Query string.
Definition window_type.h:34
@ WN_NETWORK_WINDOW_CONTENT_LIST
Network content list.
Definition window_type.h:41
@ WN_GAME_OPTIONS_NEWGRF_STATE
NewGRF settings.
Definition window_type.h:30
@ WN_NETWORK_STATUS_WINDOW_JOIN
Network join status.
Definition window_type.h:44
@ WN_GAME_OPTIONS_ABOUT
About window.
Definition window_type.h:29
@ WN_CONFIRM_POPUP_QUERY_BOOTSTRAP
Query popup confirm for bootstrap.
Definition window_type.h:38
@ WN_GAME_OPTIONS_GS
GS settings.
Definition window_type.h:28
@ WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD
Network content download status.
Definition window_type.h:45
@ WN_QUERY_STRING_SIGN
Query string for signs.
Definition window_type.h:35
@ WN_NETWORK_WINDOW_GAME
Network game window.
Definition window_type.h:40
@ WN_CONFIRM_POPUP_QUERY
Query popup confirm.
Definition window_type.h:37
@ WN_GAME_OPTIONS_GAME_OPTIONS
Game options.
Definition window_type.h:31
@ WN_GAME_OPTIONS_AI
AI settings.
Definition window_type.h:27
@ WN_NETWORK_WINDOW_START
Network start server.
Definition window_type.h:42
@ WN_GAME_OPTIONS_GAME_SETTINGS
Game settings.
Definition window_type.h:32
EventState
State of handling an event.
@ ES_HANDLED
The passed event is handled.
@ ES_NOT_HANDLED
The passed event is not handled.
GameOptionsInvalidationData
Data value for Window::OnInvalidateData() of windows with class WC_GAME_OPTIONS.
@ GOID_NEWGRF_CURRENT_LOADED
The current list of active NewGRF has been loaded.
@ GOID_NEWGRF_RESCANNED
NewGRFs were just rescanned.
@ GOID_NEWGRF_CHANGES_MADE
Changes have been made to a given NewGRF either through the palette or its parameters.
@ GOID_NEWGRF_LIST_EDITED
List of active NewGRFs is being edited.
static constexpr WidgetID INVALID_WIDGET
An invalid widget index.
Definition window_type.h:23
WindowClass
Window classes.
Definition window_type.h:49
@ WC_PERFORMANCE_HISTORY
Performance history graph; Window numbers:
@ WC_INVALID
Invalid window.
@ WC_LAND_INFO
Land info window; Window numbers:
@ WC_TOWN_AUTHORITY
Town authority; Window numbers:
@ WC_OSK
On Screen Keyboard; Window numbers:
@ WC_FRAMETIME_GRAPH
Frame time graph; Window numbers:
@ WC_WAYPOINT_VIEW
Waypoint view; Window numbers:
@ WC_COMPANY_LEAGUE
Company league window; Window numbers:
@ WC_CONSOLE
Console; Window numbers:
@ WC_SET_DATE
Set date; Window numbers:
@ WC_BUILD_STATION
Build station; Window numbers:
@ WC_NEWS_WINDOW
News window; Window numbers:
@ WC_HIGHSCORE
Highscore; Window numbers:
@ WC_BUILD_OBJECT
Build object; Window numbers:
@ WC_SIGN_LIST
Sign list; Window numbers:
@ WC_BUY_COMPANY
Buyout company (merger); Window numbers:
@ WC_SPRITE_ALIGNER
Sprite aligner (debug); Window numbers:
@ WC_COMPANY_INFRASTRUCTURE
Company infrastructure overview; Window numbers:
@ WC_PERFORMANCE_DETAIL
Performance detail window; Window numbers:
@ WC_ENDSCREEN
Endscreen; Window numbers:
@ WC_COMPANY_COLOUR
Company colour selection; Window numbers:
@ WC_PAYMENT_RATES
Payment rates graph; Window numbers:
@ WC_GRAPH_LEGEND
Legend for graphs; Window numbers:
@ WC_STATION_LIST
Station list; Window numbers:
@ WC_ROADVEH_LIST
Road vehicle list; Window numbers:
@ WC_LINKGRAPH_LEGEND
Linkgraph legend; Window numbers:
@ WC_STATUS_BAR
Statusbar (at the bottom of your screen); Window numbers:
Definition window_type.h:69
@ WC_FOUND_TOWN
Found a town; Window numbers:
@ WC_EXTRA_VIEWPORT
Extra viewport; Window numbers:
@ WC_GOAL_QUESTION
Popup with a set of buttons, designed to ask the user a question from a GameScript.
@ WC_INDUSTRY_DIRECTORY
Industry directory; Window numbers:
@ WC_VEHICLE_ORDERS
Vehicle orders; Window numbers:
@ WC_SEND_NETWORK_MSG
Chatbox; Window numbers:
@ WC_ERRMSG
Error message; Window numbers:
@ WC_BUILD_HOUSE
Build house; Window numbers:
@ WC_SCEN_BUILD_TOOLBAR
Scenario build toolbar; Window numbers:
Definition window_type.h:85
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
Definition window_type.h:78
@ WC_SELECT_GAME
Select game window; Window numbers:
@ WC_NETWORK_ASK_RELAY
Network ask relay window; Window numbers:
@ WC_VEHICLE_DEPOT
Depot view; Window numbers:
@ WC_SCRIPT_SETTINGS
Script settings; Window numbers:
@ WC_REPLACE_VEHICLE
Replace vehicle window; Window numbers:
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition window_type.h:50
@ WC_SCEN_LAND_GEN
Landscape generation (in Scenario Editor); Window numbers:
@ WC_SELECT_STATION
Select station (when joining stations); Window numbers:
@ WC_SCRIPT_LIST
Scripts list; Window numbers:
@ WC_CHEATS
Cheat window; Window numbers:
@ WC_SAVE_PRESET
Save preset; Window numbers:
@ WC_INDUSTRY_CARGOES
Industry cargoes chain; Window numbers:
@ WC_SHIPS_LIST
Ships list; Window numbers:
@ WC_MESSAGE_HISTORY
News history list; Window numbers:
@ WC_GOALS_LIST
Goals list; Window numbers:
@ WC_TRANSPARENCY_TOOLBAR
Transparency toolbar; Window numbers:
Definition window_type.h:97
@ WC_STATION_VIEW
Station view; Window numbers:
@ WC_MUSIC_TRACK_SELECTION
Music track selection; Window numbers:
@ WC_BUILD_SIGNAL
Build signal toolbar; Window numbers:
@ WC_OPERATING_PROFIT
Operating profit graph; Window numbers:
@ WC_MUSIC_WINDOW
Music window; Window numbers:
@ WC_BUILD_DEPOT
Build depot; Window numbers:
@ WC_INDUSTRY_PRODUCTION
Industry production history graph; Window numbers:
@ WC_ENGINE_PREVIEW
Engine preview window; Window numbers:
@ WC_CLIENT_LIST
Client list; Window numbers:
@ WC_CONFIRM_POPUP_QUERY
Popup with confirm question; Window numbers:
@ WC_GENERATE_LANDSCAPE
Generate landscape (newgame); Window numbers:
@ WC_CUSTOM_CURRENCY
Custom currency; Window numbers:
@ WC_MAIN_WINDOW
Main window; Window numbers:
Definition window_type.h:56
@ WC_TRUCK_STATION
Build truck station; Window numbers:
@ WC_TRAINS_LIST
Trains list; Window numbers:
@ WC_TOWN_VIEW
Town view; Window numbers:
@ WC_GAME_OPTIONS
Game options window; Window numbers:
@ WC_NETWORK_WINDOW
Network window; Window numbers:
@ WC_INDUSTRY_VIEW
Industry view; Window numbers:
@ WC_FINANCES
Finances of a company; Window numbers:
@ WC_SCRIPT_DEBUG
Script debug window; Window numbers:
@ WC_TEXTFILE
textfile; Window numbers:
@ WC_INCOME_GRAPH
Income graph; Window numbers:
@ WC_TOWN_DIRECTORY
Town directory; Window numbers:
@ WC_VEHICLE_REFIT
Vehicle refit; Window numbers:
@ WC_DROPDOWN_MENU
Drop down menu; Window numbers:
@ WC_NEWGRF_INSPECT
NewGRF inspect (debug); Window numbers:
@ WC_BUS_STATION
Build bus station; Window numbers:
@ WC_QUERY_STRING
Query string window; Window numbers:
@ WC_BUILD_WAYPOINT
Build waypoint; Window numbers:
@ WC_SMALLMAP
Small map; Window numbers:
@ WC_COMPANY_MANAGER_FACE
Alter company face window; Window numbers:
@ WC_BOOTSTRAP
Bootstrap; Window numbers:
@ WC_SAVELOAD
Saveload window; Window numbers:
@ WC_DELIVERED_CARGO
Delivered cargo graph; Window numbers:
@ WC_FRAMERATE_DISPLAY
Framerate display; Window numbers:
@ WC_GRF_PARAMETERS
NewGRF parameters; Window numbers:
@ WC_COMPANY_VALUE
Company value graph; Window numbers:
@ WC_BUILD_TREES
Build trees toolbar; Window numbers:
Definition window_type.h:91
@ WC_STORY_BOOK
Story book; Window numbers:
@ WC_MODAL_PROGRESS
Progress report of landscape generation; Window numbers:
@ WC_MAIN_TOOLBAR
Main toolbar (the long bar at the top); Window numbers:
Definition window_type.h:63
@ WC_TOOLTIPS
Tooltip window; Window numbers:
@ WC_SUBSIDIES_LIST
Subsidies list; Window numbers:
@ WC_VEHICLE_DETAILS
Vehicle details; Window numbers:
@ WC_COMPANY
Company view; Window numbers:
@ WC_BUILD_BRIDGE
Build bridge; Window numbers:
@ WC_NETWORK_STATUS_WINDOW
Network status window; Window numbers:
@ WC_VEHICLE_VIEW
Vehicle view; Window numbers:
@ WC_BUILD_VEHICLE
Build vehicle; Window numbers:
@ WC_BUILD_INDUSTRY
Build industry; Window numbers:
@ WC_VEHICLE_TIMETABLE
Vehicle timetable; Window numbers:
@ WC_AIRCRAFT_LIST
Aircraft list; Window numbers:
@ WC_SCREENSHOT
Screenshot window; Window numbers:
@ WC_NETWORK_ASK_SURVEY
Network ask survey window; Window numbers:
@ WC_TOWN_CARGO_GRAPH
Town cargo history graph; Window numbers: