Fix: Don't allow right-click to close world generation progress window. (#13084)
[openttd-github.git] / src / window_type.h
blob76cef11f9bf205192a0045f800b8d70f8b074c80
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 */
8 /** @file window_type.h Types related to windows */
10 #ifndef WINDOW_TYPE_H
11 #define WINDOW_TYPE_H
13 /**
14 * Widget ID.
15 * Even though the ID is signed, actual IDs must be non-negative.
16 * Negative IDs are used for special cases, like denoting 'no widget'.
18 using WidgetID = int;
20 /** %Window numbers. */
21 enum WindowNumberEnum {
22 WN_GAME_OPTIONS_AI = 0, ///< AI settings.
23 WN_GAME_OPTIONS_GS, ///< GS settings.
24 WN_GAME_OPTIONS_ABOUT, ///< About window.
25 WN_GAME_OPTIONS_NEWGRF_STATE, ///< NewGRF settings.
26 WN_GAME_OPTIONS_GAME_OPTIONS, ///< Game options.
27 WN_GAME_OPTIONS_GAME_SETTINGS, ///< Game settings.
29 WN_QUERY_STRING = 0, ///< Query string.
30 WN_QUERY_STRING_SIGN, ///< Query string for signs.
32 WN_CONFIRM_POPUP_QUERY = 0, ///< Query popup confirm.
33 WN_CONFIRM_POPUP_QUERY_BOOTSTRAP, ///< Query popup confirm for bootstrap.
35 WN_NETWORK_WINDOW_GAME = 0, ///< Network game window.
36 WN_NETWORK_WINDOW_CONTENT_LIST, ///< Network content list.
37 WN_NETWORK_WINDOW_START, ///< Network start server.
39 WN_NETWORK_STATUS_WINDOW_JOIN = 0, ///< Network join status.
40 WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD, ///< Network content download status.
43 /** %Window classes. */
44 enum WindowClass {
45 WC_NONE, ///< No window, redirects to WC_MAIN_WINDOW.
47 /**
48 * Main window; %Window numbers:
49 * - 0 = #MainWidgets
51 WC_MAIN_WINDOW = WC_NONE,
53 /**
54 * Main toolbar (the long bar at the top); %Window numbers:
55 * - 0 = #ToolbarNormalWidgets
56 * - 0 = #ToolbarEditorWidgets
58 WC_MAIN_TOOLBAR,
60 /**
61 * Statusbar (at the bottom of your screen); %Window numbers:
62 * - 0 = #StatusbarWidgets
64 WC_STATUS_BAR,
66 /**
67 * Build toolbar; %Window numbers:
68 * - #TRANSPORT_RAIL = #RailToolbarWidgets
69 * - #TRANSPORT_AIR = #AirportToolbarWidgets
70 * - #TRANSPORT_WATER = #DockToolbarWidgets
71 * - #TRANSPORT_ROAD = #RoadToolbarWidgets
73 WC_BUILD_TOOLBAR,
75 /**
76 * Scenario build toolbar; %Window numbers:
77 * - #TRANSPORT_WATER = #DockToolbarWidgets
78 * - #TRANSPORT_ROAD = #RoadToolbarWidgets
80 WC_SCEN_BUILD_TOOLBAR,
82 /**
83 * Build trees toolbar; %Window numbers:
84 * - 0 = #BuildTreesWidgets
86 WC_BUILD_TREES,
88 /**
89 * Transparency toolbar; %Window numbers:
90 * - 0 = #TransparencyToolbarWidgets
92 WC_TRANSPARENCY_TOOLBAR,
94 /**
95 * Build signal toolbar; %Window numbers:
96 * - #TRANSPORT_RAIL = #BuildSignalWidgets
98 WC_BUILD_SIGNAL,
101 * Small map; %Window numbers:
102 * - 0 = #SmallMapWidgets
104 WC_SMALLMAP,
107 * Error message; %Window numbers:
108 * - 0 = #ErrorMessageWidgets
110 WC_ERRMSG,
113 * Tooltip window; %Window numbers:
114 * - 0 = #ToolTipsWidgets
116 WC_TOOLTIPS,
119 * Query string window; %Window numbers:
120 * - #WN_QUERY_STRING = #QueryStringWidgets
121 * - #WN_QUERY_STRING_SIGN = #QueryEditSignWidgets
123 WC_QUERY_STRING,
126 * Popup with confirm question; %Window numbers:
127 * - #WN_CONFIRM_POPUP_QUERY = #QueryWidgets
128 * - #WN_CONFIRM_POPUP_QUERY_BOOTSTRAP = #BootstrapAskForDownloadWidgets
130 WC_CONFIRM_POPUP_QUERY,
133 * Popup with a set of buttons, designed to ask the user a question
134 * from a GameScript. %Window numbers:
135 * - uniqueid = #GoalQuestionWidgets
137 WC_GOAL_QUESTION,
141 * Saveload window; %Window numbers:
142 * - 0 = #SaveLoadWidgets
144 WC_SAVELOAD,
147 * Land info window; %Window numbers:
148 * - 0 = #LandInfoWidgets
150 WC_LAND_INFO,
153 * Drop down menu; %Window numbers:
154 * - 0 = #DropdownMenuWidgets
156 WC_DROPDOWN_MENU,
159 * On Screen Keyboard; %Window numbers:
160 * - 0 = #OnScreenKeyboardWidgets
162 WC_OSK,
165 * Set date; %Window numbers:
166 * - #VehicleID = #SetDateWidgets
168 WC_SET_DATE,
172 * Script settings; %Window numbers:
173 * - 0 = #ScriptSettingsWidgets
175 WC_SCRIPT_SETTINGS,
178 * NewGRF parameters; %Window numbers:
179 * - 0 = #NewGRFParametersWidgets
181 WC_GRF_PARAMETERS,
184 * textfile; %Window numbers:
185 * - 0 = #TextfileWidgets
187 WC_TEXTFILE,
191 * Town authority; %Window numbers:
192 * - #TownID = #TownAuthorityWidgets
194 WC_TOWN_AUTHORITY,
197 * Vehicle details; %Window numbers:
198 * - #VehicleID = #VehicleDetailsWidgets
200 WC_VEHICLE_DETAILS,
203 * Vehicle refit; %Window numbers:
204 * - #VehicleID = #VehicleRefitWidgets
206 WC_VEHICLE_REFIT,
209 * Vehicle orders; %Window numbers:
210 * - #VehicleID = #OrderWidgets
212 WC_VEHICLE_ORDERS,
215 * Replace vehicle window; %Window numbers:
216 * - #VehicleType = #ReplaceVehicleWidgets
218 WC_REPLACE_VEHICLE,
221 * Vehicle timetable; %Window numbers:
222 * - #VehicleID = #VehicleTimetableWidgets
224 WC_VEHICLE_TIMETABLE,
227 * Company colour selection; %Window numbers:
228 * - #CompanyID = #SelectCompanyLiveryWidgets
230 WC_COMPANY_COLOUR,
233 * Alter company face window; %Window numbers:
234 * - #CompanyID = #SelectCompanyManagerFaceWidgets
236 WC_COMPANY_MANAGER_FACE,
239 * Select station (when joining stations); %Window numbers:
240 * - 0 = #JoinStationWidgets
242 WC_SELECT_STATION,
245 * News window; %Window numbers:
246 * - 0 = #NewsWidgets
248 WC_NEWS_WINDOW,
251 * Town directory; %Window numbers:
252 * - 0 = #TownDirectoryWidgets
254 WC_TOWN_DIRECTORY,
257 * Subsidies list; %Window numbers:
258 * - 0 = #SubsidyListWidgets
260 WC_SUBSIDIES_LIST,
263 * Industry directory; %Window numbers:
264 * - 0 = #IndustryDirectoryWidgets
266 WC_INDUSTRY_DIRECTORY,
269 * News history list; %Window numbers:
270 * - 0 = #MessageHistoryWidgets
272 WC_MESSAGE_HISTORY,
275 * Sign list; %Window numbers:
276 * - 0 = #SignListWidgets
278 WC_SIGN_LIST,
281 * Scripts list; %Window numbers:
282 * - 0 = #ScriptListWidgets
284 WC_SCRIPT_LIST,
287 * Goals list; %Window numbers:
288 * - 0 ; #GoalListWidgets
290 WC_GOALS_LIST,
293 * Story book; %Window numbers:
294 * - CompanyID = #StoryBookWidgets
296 WC_STORY_BOOK,
299 * Station list; %Window numbers:
300 * - #CompanyID = #StationListWidgets
302 WC_STATION_LIST,
305 * Trains list; %Window numbers:
306 * - Packed value = #GroupListWidgets / #VehicleListWidgets
308 WC_TRAINS_LIST,
311 * Road vehicle list; %Window numbers:
312 * - Packed value = #GroupListWidgets / #VehicleListWidgets
314 WC_ROADVEH_LIST,
317 * Ships list; %Window numbers:
318 * - Packed value = #GroupListWidgets / #VehicleListWidgets
320 WC_SHIPS_LIST,
323 * Aircraft list; %Window numbers:
324 * - Packed value = #GroupListWidgets / #VehicleListWidgets
326 WC_AIRCRAFT_LIST,
330 * Town view; %Window numbers:
331 * - #TownID = #TownViewWidgets
333 WC_TOWN_VIEW,
336 * Vehicle view; %Window numbers:
337 * - #VehicleID = #VehicleViewWidgets
339 WC_VEHICLE_VIEW,
342 * Station view; %Window numbers:
343 * - #StationID = #StationViewWidgets
345 WC_STATION_VIEW,
348 * Depot view; %Window numbers:
349 * - #TileIndex = #DepotWidgets
351 WC_VEHICLE_DEPOT,
354 * Waypoint view; %Window numbers:
355 * - #WaypointID = #WaypointWidgets
357 WC_WAYPOINT_VIEW,
360 * Industry view; %Window numbers:
361 * - #IndustryID = #IndustryViewWidgets
363 WC_INDUSTRY_VIEW,
366 * Company view; %Window numbers:
367 * - #CompanyID = #CompanyWidgets
369 WC_COMPANY,
373 * Build object; %Window numbers:
374 * - 0 = #BuildObjectWidgets
376 WC_BUILD_OBJECT,
379 * Build house; %Window numbers:
380 * - 0 = #BuildHouseWidgets
382 WC_BUILD_HOUSE,
385 * Build vehicle; %Window numbers:
386 * - #VehicleType = #BuildVehicleWidgets
387 * - #TileIndex = #BuildVehicleWidgets
389 WC_BUILD_VEHICLE,
392 * Build bridge; %Window numbers:
393 * - #TransportType = #BuildBridgeSelectionWidgets
395 WC_BUILD_BRIDGE,
398 * Build station; %Window numbers:
399 * - #TRANSPORT_AIR = #AirportPickerWidgets
400 * - #TRANSPORT_WATER = #DockToolbarWidgets
401 * - #TRANSPORT_RAIL = #BuildRailStationWidgets
403 WC_BUILD_STATION,
406 * Build bus station; %Window numbers:
407 * - #TRANSPORT_ROAD = #BuildRoadStationWidgets
409 WC_BUS_STATION,
412 * Build truck station; %Window numbers:
413 * - #TRANSPORT_ROAD = #BuildRoadStationWidgets
415 WC_TRUCK_STATION,
418 * Build depot; %Window numbers:
419 * - #TRANSPORT_WATER = #BuildDockDepotWidgets
420 * - #TRANSPORT_RAIL = #BuildRailDepotWidgets
421 * - #TRANSPORT_ROAD = #BuildRoadDepotWidgets
423 WC_BUILD_DEPOT,
426 * Build waypoint; %Window numbers:
427 * - #TRANSPORT_RAIL = #BuildRailWaypointWidgets
429 WC_BUILD_WAYPOINT,
432 * Found a town; %Window numbers:
433 * - 0 = #TownFoundingWidgets
435 WC_FOUND_TOWN,
438 * Build industry; %Window numbers:
439 * - 0 = #DynamicPlaceIndustriesWidgets
441 WC_BUILD_INDUSTRY,
445 * Select game window; %Window numbers:
446 * - 0 = #SelectGameIntroWidgets
448 WC_SELECT_GAME,
451 * Landscape generation (in Scenario Editor); %Window numbers:
452 * - 0 = #TerraformToolbarWidgets
453 * - 0 = #EditorTerraformToolbarWidgets
455 WC_SCEN_LAND_GEN,
458 * Generate landscape (newgame); %Window numbers:
459 * - GLWM_SCENARIO = #CreateScenarioWidgets
460 * - #GenerateLandscapeWindowMode = #GenerateLandscapeWidgets
462 WC_GENERATE_LANDSCAPE,
465 * Progress report of landscape generation; %Window numbers:
466 * - 0 = #GenerationProgressWidgets
467 * - 1 = #ScanProgressWidgets
469 WC_MODAL_PROGRESS,
473 * Network window; %Window numbers:
474 * - #WN_NETWORK_WINDOW_GAME = #NetworkGameWidgets
475 * - #WN_NETWORK_WINDOW_CONTENT_LIST = #NetworkContentListWidgets
476 * - #WN_NETWORK_WINDOW_START = #NetworkStartServerWidgets
478 WC_NETWORK_WINDOW,
481 * Client list; %Window numbers:
482 * - 0 = #ClientListWidgets
484 WC_CLIENT_LIST,
487 * Network status window; %Window numbers:
488 * - #WN_NETWORK_STATUS_WINDOW_JOIN = #NetworkJoinStatusWidgets
489 * - #WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD = #NetworkContentDownloadStatusWidgets
491 WC_NETWORK_STATUS_WINDOW,
494 * Network ask relay window; %Window numbers:
495 * - 0 - #NetworkAskRelayWidgets
497 WC_NETWORK_ASK_RELAY,
500 * Network ask survey window; %Window numbers:
501 * - 0 - #NetworkAskSurveyWidgets
503 WC_NETWORK_ASK_SURVEY,
506 * Chatbox; %Window numbers:
507 * - #DestType = #NetWorkChatWidgets
509 WC_SEND_NETWORK_MSG,
512 * Industry cargoes chain; %Window numbers:
513 * - 0 = #IndustryCargoesWidgets
515 WC_INDUSTRY_CARGOES,
518 * Legend for graphs; %Window numbers:
519 * - 0 = #GraphLegendWidgets
521 WC_GRAPH_LEGEND,
524 * Finances of a company; %Window numbers:
525 * - #CompanyID = #CompanyWidgets
527 WC_FINANCES,
530 * Income graph; %Window numbers:
531 * - 0 = #CompanyValueWidgets
533 WC_INCOME_GRAPH,
536 * Operating profit graph; %Window numbers:
537 * - 0 = #CompanyValueWidgets
539 WC_OPERATING_PROFIT,
542 * Delivered cargo graph; %Window numbers:
543 * - 0 = #CompanyValueWidgets
545 WC_DELIVERED_CARGO,
548 * Performance history graph; %Window numbers:
549 * - 0 = #PerformanceHistoryGraphWidgets
551 WC_PERFORMANCE_HISTORY,
554 * Company value graph; %Window numbers:
555 * - 0 = #CompanyValueWidgets
557 WC_COMPANY_VALUE,
560 * Company league window; %Window numbers:
561 * - 0 = #CompanyLeagueWidgets
563 WC_COMPANY_LEAGUE,
566 * Payment rates graph; %Window numbers:
567 * - 0 = #CargoPaymentRatesWidgets
569 WC_PAYMENT_RATES,
572 * Performance detail window; %Window numbers:
573 * - 0 = #PerformanceRatingDetailsWidgets
575 WC_PERFORMANCE_DETAIL,
578 * Industry production history graph; %Window numbers:
579 * - #IndustryID = #IndustryProductionGraphWidgets
581 WC_INDUSTRY_PRODUCTION,
584 * Company infrastructure overview; %Window numbers:
585 * - #CompanyID = #CompanyInfrastructureWidgets
587 WC_COMPANY_INFRASTRUCTURE,
591 * Buyout company (merger); %Window numbers:
592 * - #CompanyID = #BuyCompanyWidgets
594 WC_BUY_COMPANY,
597 * Engine preview window; %Window numbers:
598 * - #EngineID = #EnginePreviewWidgets
600 WC_ENGINE_PREVIEW,
604 * Music window; %Window numbers:
605 * - 0 = #MusicWidgets
607 WC_MUSIC_WINDOW,
610 * Music track selection; %Window numbers:
611 * - 0 = MusicTrackSelectionWidgets
613 WC_MUSIC_TRACK_SELECTION,
616 * Game options window; %Window numbers:
617 * - #WN_GAME_OPTIONS_AI = #AIConfigWidgets
618 * - #WN_GAME_OPTIONS_GS = #GSConfigWidgets
619 * - #WN_GAME_OPTIONS_ABOUT = #AboutWidgets
620 * - #WN_GAME_OPTIONS_NEWGRF_STATE = #NewGRFStateWidgets
621 * - #WN_GAME_OPTIONS_GAME_OPTIONS = #GameOptionsWidgets
622 * - #WN_GAME_OPTIONS_GAME_SETTINGS = #GameSettingsWidgets
624 WC_GAME_OPTIONS,
627 * Custom currency; %Window numbers:
628 * - 0 = #CustomCurrencyWidgets
630 WC_CUSTOM_CURRENCY,
633 * Cheat window; %Window numbers:
634 * - 0 = #CheatWidgets
636 WC_CHEATS,
639 * Extra viewport; %Window numbers:
640 * - Ascending value = #ExtraViewportWidgets
642 WC_EXTRA_VIEWPORT,
646 * Console; %Window numbers:
647 * - 0 = #ConsoleWidgets
649 WC_CONSOLE,
652 * Bootstrap; %Window numbers:
653 * - 0 = #BootstrapBackgroundWidgets
655 WC_BOOTSTRAP,
658 * Highscore; %Window numbers:
659 * - 0 = #HighscoreWidgets
661 WC_HIGHSCORE,
664 * Endscreen; %Window numbers:
665 * - 0 = #HighscoreWidgets
667 WC_ENDSCREEN,
671 * Script debug window; %Window numbers:
672 * - Ascending value = #ScriptDebugWidgets
674 WC_SCRIPT_DEBUG,
677 * NewGRF inspect (debug); %Window numbers:
678 * - Packed value = #NewGRFInspectWidgets
680 WC_NEWGRF_INSPECT,
683 * Sprite aligner (debug); %Window numbers:
684 * - 0 = #SpriteAlignerWidgets
686 WC_SPRITE_ALIGNER,
689 * Linkgraph legend; %Window numbers:
690 * - 0 = #LinkGraphWidgets
692 WC_LINKGRAPH_LEGEND,
695 * Save preset; %Window numbers:
696 * - 0 = #SavePresetWidgets
698 WC_SAVE_PRESET,
701 * Framerate display; %Window numbers:
702 * - 0 = #FramerateDisplayWidgets
704 WC_FRAMERATE_DISPLAY,
707 * Frame time graph; %Window numbers:
708 * - 0 = #FrametimeGraphWindowWidgets
710 WC_FRAMETIME_GRAPH,
713 * Screenshot window; %Window numbers:
714 * - 0 = #ScreenshotWidgets
716 WC_SCREENSHOT,
719 * Help and manuals window; %Window numbers:
720 * - 0 = #HelpWindowWidgets
722 WC_HELPWIN,
724 WC_INVALID = 0xFFFF, ///< Invalid window.
727 /** Data value for #Window::OnInvalidateData() of windows with class #WC_GAME_OPTIONS. */
728 enum GameOptionsInvalidationData {
729 GOID_DEFAULT = 0,
730 GOID_NEWGRF_RESCANNED, ///< NewGRFs were just rescanned.
731 GOID_NEWGRF_CURRENT_LOADED, ///< The current list of active NewGRF has been loaded.
732 GOID_NEWGRF_LIST_EDITED, ///< List of active NewGRFs is being edited.
733 GOID_NEWGRF_CHANGES_MADE, ///< Changes have been made to a given NewGRF either through the palette or its parameters.
734 GOID_NEWGRF_CHANGES_APPLIED, ///< The active NewGRF list changes have been applied.
737 struct Window;
739 /** Number to differentiate different windows of the same class */
740 typedef int32_t WindowNumber;
742 /** State of handling an event. */
743 enum EventState {
744 ES_HANDLED, ///< The passed event is handled.
745 ES_NOT_HANDLED, ///< The passed event is not handled.
748 #endif /* WINDOW_TYPE_H */