OpenTTD Source 20260531-master-g0e951f3528
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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#ifndef WINDOW_TYPE_H
11#define WINDOW_TYPE_H
12
14#include "core/enum_type.hpp"
15
21using WidgetID = int;
22
24static constexpr WidgetID INVALID_WIDGET = -1;
25
34
36enum class QueryStringWindowNumber : uint8_t {
39};
40
46
53
59
61enum class WindowClass : uint16_t {
63
68 MainWindow = WindowClass::None,
69
76
82
91
98
104
110
116
122
128
134
141
148
155
156
162
168
174
180
186
187
193
199
205
206
212
218
224
230
236
242
248
254
260
266
272
278
284
290
296
302
308
314
320
326
332
338
344
345
351
357
363
369
375
381
387
388
394
400
407
413
421
427
433
441
447
453
459
460
466
473
480
487
488
496
502
509
515
521
527
533
539
545
551
557
563
569
575
581
587
593
599
605
611
612
618
624
625
631
637
647
653
659
665
666
672
678
684
690
691
697
703
709
715
721
727
733
739
745
746 Invalid = 0xFFFF,
747};
748
757
758struct Window;
759
772private:
773 int32_t value = 0;
774public:
776 WindowNumber() = default;
777
786 template <typename T> requires is_scoped_enum_v<T>
788
793 operator int32_t() const { return value; }
794
799 template <typename T> requires (std::is_enum_v<T> || std::is_class_v<T>)
800 operator T() const { return static_cast<T>(value); };
801
807 constexpr bool operator==(const std::integral auto &rhs) const { return this->value == static_cast<int32_t>(rhs); }
809 constexpr bool operator==(const ConvertibleThroughBase auto &rhs) const { return this->value == static_cast<int32_t>(rhs.base()); }
811 template <typename T> requires is_scoped_enum_v<T>
812 constexpr bool operator==(const T &rhs) const { return this->value == static_cast<int32_t>(to_underlying(rhs)); }
813};
814
820
821#endif /* WINDOW_TYPE_H */
Main AI class.
Definition ai.hpp:19
Main Game class.
Definition game.hpp:20
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.
#define T
Climate temperate.
Definition engines.h:91
Type (helpers) for enums.
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23).
Definition enum_type.hpp:21
constexpr bool is_scoped_enum_v
Implementation of std::is_scoped_enum_v (from C++23).
Definition enum_type.hpp:24
bool GenerateLandscape(uint8_t mode)
void BuildObject(ObjectType type, TileIndex tile, CompanyID owner=OWNER_NONE, struct Town *town=nullptr, uint8_t view=0)
Actually build the object.
std::vector< Train * > TrainList
Helper type for lists/vectors of trains.
Definition rail_cmd.cpp:44
std::vector< RoadVehicle * > RoadVehicleList
Helper type for lists/vectors of road vehicles.
Definition road_cmd.cpp:52
std::set< Station *, StationCompare > StationList
List of stations.
Info about each of the cheats.
Definition cheat_type.h:16
Data stored about a string that can be modified in the GUI.
SaveLoad type struct.
Definition saveload.h:757
Settings related to scripts.
WindowNumber(ConvertibleThroughBase auto value)
Create a WindowNumber with the given value.
constexpr bool operator==(const T &rhs) const
Compare the right hand side against our window number.
WindowNumber(T value)
Create a WindowNumber with the given value.
constexpr bool operator==(const ConvertibleThroughBase auto &rhs) const
Compare the right hand side against our window number.
WindowNumber(int32_t value)
Create a WindowNumber with the given value.
WindowNumber()=default
Create a WindowNumber 0.
int32_t value
The identifier of the window.
constexpr bool operator==(const std::integral auto &rhs) const
Compare the right hand side against our window number.
Data structure for an opened window.
Definition window_gui.h:274
@ None
No visual effect.
Definition vehicle.cpp:2824
int WidgetID
Widget ID.
Definition window_type.h:21
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 WindowClass::GameOptions.
@ 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:24
ConfirmPopupQueryWindowNumber
Window numbers for PopupQuery windows.
Definition window_type.h:42
@ Bootstrap
Query popup confirm for bootstrap.
Definition window_type.h:44
QueryStringWindowNumber
Window numbers for QueryString windows.
Definition window_type.h:36
@ Default
Query string.
Definition window_type.h:37
GameOptionsWindowNumber
Window numbers for GameOptions windows.
Definition window_type.h:27
@ About
About window.
Definition window_type.h:30
@ NewGRFState
NewGRF settings.
Definition window_type.h:31
@ GameOptions
Game options.
Definition window_type.h:32
@ ScriptDebug
Script debug window; Window numbers:
@ VehicleView
Vehicle view; Window numbers:
@ PerformanceGraph
Performance history graph; Window numbers:
@ ScriptList
Scripts list; Window numbers:
@ SpriteAligner
Sprite aligner (debug); Window numbers:
@ VehicleOrders
Vehicle orders; Window numbers:
@ NetworkStatus
Network status window; Window numbers:
@ CompanyValueGraph
Company value graph; Window numbers:
@ TownAuthority
Town authority; Window numbers:
@ NewGRFParameters
NewGRF parameters; Window numbers:
@ OnScreenKeyboard
On Screen Keyboard; Window numbers:
@ MessageHistory
News history list; Window numbers:
@ ScenarioBuildToolbar
Scenario build toolbar; Window numbers:
Definition window_type.h:97
@ SetDate
Set date; Window numbers:
@ BuildToolbar
Build toolbar; Window numbers:
Definition window_type.h:90
@ AircraftList
Aircraft list; Window numbers:
@ EnginePreview
Engine preview window; Window numbers:
@ GoalQuestion
Popup with a set of buttons, designed to ask the user a question from a GameScript.
@ TransparencyToolbar
Transparency toolbar; Window numbers:
@ SmallMap
Small map; Window numbers:
@ Screenshot
Screenshot window; Window numbers:
@ ToolTips
Tooltip window; Window numbers:
@ VehicleDetails
Vehicle details; Window numbers:
@ Finances
Finances of a company; Window numbers:
@ NewGRFInspect
NewGRF inspect (debug); Window numbers:
@ Music
Music window; Window numbers:
@ TownView
Town view; Window numbers:
@ NetworkAskSurvey
Network ask survey window; Window numbers:
@ BuildSignal
Build signal toolbar; Window numbers:
@ Invalid
Invalid window.
@ IncomeGraph
Income graph; Window numbers:
@ SelectGame
Select game window; Window numbers:
@ TownDirectory
Town directory; Window numbers:
@ Statusbar
Statusbar (at the bottom of your screen); Window numbers:
Definition window_type.h:81
@ MainToolbar
Main toolbar (the long bar at the top); Window numbers:
Definition window_type.h:75
@ StoryBook
Story book; Window numbers:
@ Help
Help and manuals window; Window numbers:
@ SavePreset
Save preset; Window numbers:
@ ModalProgress
Progress report of landscape generation; Window numbers:
@ BuildIndustry
Build industry; Window numbers:
@ FramerateDisplay
Framerate display; Window numbers:
@ BuildStation
Build station; Window numbers:
@ CargoPaymentRatesGraph
Payment rates graph; Window numbers:
@ FoundTown
Found a town; Window numbers:
@ IndustryProductionGraph
Industry production history graph; Window numbers:
@ BuildBridge
Build bridge; Window numbers:
@ VehicleTimetable
Vehicle timetable; Window numbers:
@ WaypointView
Waypoint view; Window numbers:
@ BuildBusStation
Build bus station; Window numbers:
@ BuildVehicle
Build vehicle; Window numbers:
@ BuyCompany
Buyout company (merger); Window numbers:
@ ScenarioGenerateLandscape
Landscape generation (in Scenario Editor); Window numbers:
@ FrametimeGraph
Frame time graph; Window numbers:
@ ShipList
Ships list; Window numbers:
@ DeliveredCargoGraph
Delivered cargo graph; Window numbers:
@ JoinStation
Select station (when joining stations); Window numbers:
@ TownCargoGraph
Town cargo history graph; Window numbers:
@ VehicleRefit
Vehicle refit; Window numbers:
@ ReplaceVehicle
Replace vehicle window; Window numbers:
@ LandInfo
Land info window; Window numbers:
@ Textfile
textfile; Window numbers:
@ StationView
Station view; Window numbers:
@ Highscore
Highscore; Window numbers:
@ LinkGraphLegend
Linkgraph legend; Window numbers:
@ VehicleDepot
Depot view; Window numbers:
@ NetworkAskRelay
Network ask relay window; Window numbers:
@ MusicTrackSelection
Music track selection; Window numbers:
@ BuildTrees
Build trees toolbar; Window numbers:
@ Console
Console; Window numbers:
@ IndustryView
Industry view; Window numbers:
@ CompanyLeague
Company league window; Window numbers:
@ Endscreen
Endscreen; Window numbers:
@ CompanyLivery
Company colour selection; Window numbers:
@ SubsidyList
Subsidies list; Window numbers:
@ BuildDepot
Build depot; Window numbers:
@ GoalList
Goals list; Window numbers:
@ BuildHouse
Build house; Window numbers:
@ News
News window; Window numbers:
@ NetworkChat
Chatbox; Window numbers:
@ IndustryCargoes
Industry cargoes chain; Window numbers:
@ IndustryDirectory
Industry directory; Window numbers:
@ GraphLegend
Legend for graphs; Window numbers:
@ Network
Network window; Window numbers:
@ ErrorMessage
Error message; Window numbers:
@ BuildWaypoint
Build waypoint; Window numbers:
@ CustomCurrenty
Custom currency; Window numbers:
@ DropdownMenu
Drop down menu; Window numbers:
@ BuildTruckStation
Build truck station; Window numbers:
@ ConfirmPopupQuery
Popup with confirm question; Window numbers:
@ ExtraViewport
Extra viewport; Window numbers:
@ PerformanceDetail
Performance detail window; Window numbers:
@ OperatingProfitGraph
Operating profit graph; Window numbers:
@ NetworkClientList
Client list; Window numbers:
NetworkStatusWindowNumber
Window number for network status windows.
Definition window_type.h:55
@ Join
Network join status.
Definition window_type.h:56
@ ContentDownload
Network content download status.
Definition window_type.h:57
NetworkWindowNumber
Window numbers for network windows.
Definition window_type.h:48
@ ContentList
Network content list.
Definition window_type.h:50
@ StartServer
Network start server.
Definition window_type.h:51