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 8 /** @file window_type.h Types related to windows */ 9 10 #ifndef WINDOW_TYPE_H 11 #define WINDOW_TYPE_H 12 13 /** %Window numbers. */ 14 enum WindowNumberEnum { 15 WN_GAME_OPTIONS_AI = 0, ///< AI settings. 16 WN_GAME_OPTIONS_ABOUT, ///< About window. 17 WN_GAME_OPTIONS_NEWGRF_STATE, ///< NewGRF settings. 18 WN_GAME_OPTIONS_GAME_OPTIONS, ///< Game options. 19 WN_GAME_OPTIONS_GAME_SETTINGS, ///< Game settings. 20 21 WN_QUERY_STRING = 0, ///< Query string. 22 WN_QUERY_STRING_SIGN, ///< Query string for signs. 23 24 WN_CONFIRM_POPUP_QUERY = 0, ///< Query popup confirm. 25 WN_CONFIRM_POPUP_QUERY_BOOTSTRAP, ///< Query popup confirm for bootstrap. 26 27 WN_NETWORK_WINDOW_GAME = 0, ///< Network game window. 28 WN_NETWORK_WINDOW_CONTENT_LIST, ///< Network content list. 29 WN_NETWORK_WINDOW_START, ///< Network start server. 30 31 WN_NETWORK_STATUS_WINDOW_JOIN = 0, ///< Network join status. 32 WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD, ///< Network content download status. 33 }; 34 35 /** %Window classes. */ 36 enum WindowClass { 37 WC_NONE, ///< No window, redirects to WC_MAIN_WINDOW. 38 39 /** 40 * Main window; %Window numbers: 41 * - 0 = #MainWidgets 42 */ 43 WC_MAIN_WINDOW = WC_NONE, 44 45 /** 46 * Main toolbar (the long bar at the top); %Window numbers: 47 * - 0 = #ToolbarNormalWidgets 48 * - 0 = #ToolbarEditorWidgets 49 */ 50 WC_MAIN_TOOLBAR, 51 52 /** 53 * Statusbar (at the bottom of your screen); %Window numbers: 54 * - 0 = #StatusbarWidgets 55 */ 56 WC_STATUS_BAR, 57 58 /** 59 * Build toolbar; %Window numbers: 60 * - #TRANSPORT_RAIL = #RailToolbarWidgets 61 * - #TRANSPORT_AIR = #AirportToolbarWidgets 62 * - #TRANSPORT_WATER = #DockToolbarWidgets 63 * - #TRANSPORT_ROAD = #RoadToolbarWidgets 64 */ 65 WC_BUILD_TOOLBAR, 66 67 /** 68 * Scenario build toolbar; %Window numbers: 69 * - #TRANSPORT_WATER = #DockToolbarWidgets 70 * - #TRANSPORT_ROAD = #RoadToolbarWidgets 71 */ 72 WC_SCEN_BUILD_TOOLBAR, 73 74 /** 75 * Build trees toolbar; %Window numbers: 76 * - 0 = #BuildTreesWidgets 77 */ 78 WC_BUILD_TREES, 79 80 /** 81 * Transparency toolbar; %Window numbers: 82 * - 0 = #TransparencyToolbarWidgets 83 */ 84 WC_TRANSPARENCY_TOOLBAR, 85 86 /** 87 * Build signal toolbar; %Window numbers: 88 * - #TRANSPORT_RAIL = #BuildSignalWidgets 89 */ 90 WC_BUILD_SIGNAL, 91 92 /** 93 * Small map; %Window numbers: 94 * - 0 = #SmallMapWidgets 95 */ 96 WC_SMALLMAP, 97 98 /** 99 * Error message; %Window numbers: 100 * - 0 = #ErrorMessageWidgets 101 */ 102 WC_ERRMSG, 103 104 /** 105 * Tooltip window; %Window numbers: 106 * - 0 = #ToolTipsWidgets 107 */ 108 WC_TOOLTIPS, 109 110 /** 111 * Query string window; %Window numbers: 112 * - #WN_QUERY_STRING = #QueryStringWidgets 113 * - #WN_QUERY_STRING_SIGN = #QueryEditSignWidgets 114 */ 115 WC_QUERY_STRING, 116 117 /** 118 * Popup with confirm question; %Window numbers: 119 * - #WN_CONFIRM_POPUP_QUERY = #QueryWidgets 120 * - #WN_CONFIRM_POPUP_QUERY_BOOTSTRAP = #BootstrapAskForDownloadWidgets 121 */ 122 WC_CONFIRM_POPUP_QUERY, 123 124 /** 125 * Popup with a set of buttons, designed to ask the user a question 126 * from a GameScript. %Window numbers: 127 * - uniqueid = #GoalQuestionWidgets 128 */ 129 WC_GOAL_QUESTION, 130 131 132 /** 133 * Saveload window; %Window numbers: 134 * - 0 = #SaveLoadWidgets 135 */ 136 WC_SAVELOAD, 137 138 /** 139 * Land info window; %Window numbers: 140 * - 0 = #LandInfoWidgets 141 */ 142 WC_LAND_INFO, 143 144 /** 145 * Drop down menu; %Window numbers: 146 * - 0 = #DropdownMenuWidgets 147 */ 148 WC_DROPDOWN_MENU, 149 150 /** 151 * On Screen Keyboard; %Window numbers: 152 * - 0 = #OnScreenKeyboardWidgets 153 */ 154 WC_OSK, 155 156 /** 157 * Set date; %Window numbers: 158 * - #VehicleID = #SetDateWidgets 159 */ 160 WC_SET_DATE, 161 162 163 /** 164 * AI settings; %Window numbers: 165 * - 0 = #AISettingsWidgets 166 */ 167 WC_AI_SETTINGS, 168 169 /** 170 * NewGRF parameters; %Window numbers: 171 * - 0 = #NewGRFParametersWidgets 172 */ 173 WC_GRF_PARAMETERS, 174 175 /** 176 * textfile; %Window numbers: 177 * - 0 = #TextfileWidgets 178 */ 179 WC_TEXTFILE, 180 181 182 /** 183 * Town authority; %Window numbers: 184 * - #TownID = #TownAuthorityWidgets 185 */ 186 WC_TOWN_AUTHORITY, 187 188 /** 189 * Vehicle details; %Window numbers: 190 * - #VehicleID = #VehicleDetailsWidgets 191 */ 192 WC_VEHICLE_DETAILS, 193 194 /** 195 * Vehicle refit; %Window numbers: 196 * - #VehicleID = #VehicleRefitWidgets 197 */ 198 WC_VEHICLE_REFIT, 199 200 /** 201 * Vehicle orders; %Window numbers: 202 * - #VehicleID = #OrderWidgets 203 */ 204 WC_VEHICLE_ORDERS, 205 206 /** 207 * Replace vehicle window; %Window numbers: 208 * - #VehicleType = #ReplaceVehicleWidgets 209 */ 210 WC_REPLACE_VEHICLE, 211 212 /** 213 * Vehicle timetable; %Window numbers: 214 * - #VehicleID = #VehicleTimetableWidgets 215 */ 216 WC_VEHICLE_TIMETABLE, 217 218 /** 219 * Company colour selection; %Window numbers: 220 * - #CompanyID = #SelectCompanyLiveryWidgets 221 */ 222 WC_COMPANY_COLOUR, 223 224 /** 225 * Alter company face window; %Window numbers: 226 * - #CompanyID = #SelectCompanyManagerFaceWidgets 227 */ 228 WC_COMPANY_MANAGER_FACE, 229 230 /** 231 * Select station (when joining stations); %Window numbers: 232 * - 0 = #JoinStationWidgets 233 */ 234 WC_SELECT_STATION, 235 236 /** 237 * News window; %Window numbers: 238 * - 0 = #NewsWidgets 239 */ 240 WC_NEWS_WINDOW, 241 242 /** 243 * Town directory; %Window numbers: 244 * - 0 = #TownDirectoryWidgets 245 */ 246 WC_TOWN_DIRECTORY, 247 248 /** 249 * Subsidies list; %Window numbers: 250 * - 0 = #SubsidyListWidgets 251 */ 252 WC_SUBSIDIES_LIST, 253 254 /** 255 * Industry directory; %Window numbers: 256 * - 0 = #IndustryDirectoryWidgets 257 */ 258 WC_INDUSTRY_DIRECTORY, 259 260 /** 261 * News history list; %Window numbers: 262 * - 0 = #MessageHistoryWidgets 263 */ 264 WC_MESSAGE_HISTORY, 265 266 /** 267 * Sign list; %Window numbers: 268 * - 0 = #SignListWidgets 269 */ 270 WC_SIGN_LIST, 271 272 /** 273 * AI list; %Window numbers: 274 * - 0 = #AIListWidgets 275 */ 276 WC_AI_LIST, 277 278 /** 279 * Goals list; %Window numbers: 280 * - 0 ; #GoalListWidgets 281 */ 282 WC_GOALS_LIST, 283 284 /** 285 * Story book; %Window numbers: 286 * - CompanyID = #StoryBookWidgets 287 */ 288 WC_STORY_BOOK, 289 290 /** 291 * Station list; %Window numbers: 292 * - #CompanyID = #StationListWidgets 293 */ 294 WC_STATION_LIST, 295 296 /** 297 * Trains list; %Window numbers: 298 * - Packed value = #GroupListWidgets / #VehicleListWidgets 299 */ 300 WC_TRAINS_LIST, 301 302 /** 303 * Road vehicle list; %Window numbers: 304 * - Packed value = #GroupListWidgets / #VehicleListWidgets 305 */ 306 WC_ROADVEH_LIST, 307 308 /** 309 * Ships list; %Window numbers: 310 * - Packed value = #GroupListWidgets / #VehicleListWidgets 311 */ 312 WC_SHIPS_LIST, 313 314 /** 315 * Aircraft list; %Window numbers: 316 * - Packed value = #GroupListWidgets / #VehicleListWidgets 317 */ 318 WC_AIRCRAFT_LIST, 319 320 321 /** 322 * Town view; %Window numbers: 323 * - #TownID = #TownViewWidgets 324 */ 325 WC_TOWN_VIEW, 326 327 /** 328 * Vehicle view; %Window numbers: 329 * - #VehicleID = #VehicleViewWidgets 330 */ 331 WC_VEHICLE_VIEW, 332 333 /** 334 * Station view; %Window numbers: 335 * - #StationID = #StationViewWidgets 336 */ 337 WC_STATION_VIEW, 338 339 /** 340 * Depot view; %Window numbers: 341 * - #TileIndex = #DepotWidgets 342 */ 343 WC_VEHICLE_DEPOT, 344 345 /** 346 * Waypoint view; %Window numbers: 347 * - #WaypointID = #WaypointWidgets 348 */ 349 WC_WAYPOINT_VIEW, 350 351 /** 352 * Industry view; %Window numbers: 353 * - #IndustryID = #IndustryViewWidgets 354 */ 355 WC_INDUSTRY_VIEW, 356 357 /** 358 * Company view; %Window numbers: 359 * - #CompanyID = #CompanyWidgets 360 */ 361 WC_COMPANY, 362 363 364 /** 365 * Build object; %Window numbers: 366 * - 0 = #BuildObjectWidgets 367 */ 368 WC_BUILD_OBJECT, 369 370 /** 371 * Build vehicle; %Window numbers: 372 * - #VehicleType = #BuildVehicleWidgets 373 * - #TileIndex = #BuildVehicleWidgets 374 */ 375 WC_BUILD_VEHICLE, 376 377 /** 378 * Build bridge; %Window numbers: 379 * - #TransportType = #BuildBridgeSelectionWidgets 380 */ 381 WC_BUILD_BRIDGE, 382 383 /** 384 * Build station; %Window numbers: 385 * - #TRANSPORT_AIR = #AirportPickerWidgets 386 * - #TRANSPORT_WATER = #DockToolbarWidgets 387 * - #TRANSPORT_RAIL = #BuildRailStationWidgets 388 */ 389 WC_BUILD_STATION, 390 391 /** 392 * Build bus station; %Window numbers: 393 * - #TRANSPORT_ROAD = #BuildRoadStationWidgets 394 */ 395 WC_BUS_STATION, 396 397 /** 398 * Build truck station; %Window numbers: 399 * - #TRANSPORT_ROAD = #BuildRoadStationWidgets 400 */ 401 WC_TRUCK_STATION, 402 403 /** 404 * Build depot; %Window numbers: 405 * - #TRANSPORT_WATER = #BuildDockDepotWidgets 406 * - #TRANSPORT_RAIL = #BuildRailDepotWidgets 407 * - #TRANSPORT_ROAD = #BuildRoadDepotWidgets 408 */ 409 WC_BUILD_DEPOT, 410 411 /** 412 * Build waypoint; %Window numbers: 413 * - #TRANSPORT_RAIL = #BuildRailWaypointWidgets 414 */ 415 WC_BUILD_WAYPOINT, 416 417 /** 418 * Found a town; %Window numbers: 419 * - 0 = #TownFoundingWidgets 420 */ 421 WC_FOUND_TOWN, 422 423 /** 424 * Build industry; %Window numbers: 425 * - 0 = #DynamicPlaceIndustriesWidgets 426 */ 427 WC_BUILD_INDUSTRY, 428 429 430 /** 431 * Select game window; %Window numbers: 432 * - 0 = #SelectGameIntroWidgets 433 */ 434 WC_SELECT_GAME, 435 436 /** 437 * Landscape generation (in Scenario Editor); %Window numbers: 438 * - 0 = #TerraformToolbarWidgets 439 * - 0 = #EditorTerraformToolbarWidgets 440 */ 441 WC_SCEN_LAND_GEN, 442 443 /** 444 * Generate landscape (newgame); %Window numbers: 445 * - GLWM_SCENARIO = #CreateScenarioWidgets 446 * - #GenerateLandscapeWindowMode = #GenerateLandscapeWidgets 447 */ 448 WC_GENERATE_LANDSCAPE, 449 450 /** 451 * Progress report of landscape generation; %Window numbers: 452 * - 0 = #GenerationProgressWidgets 453 * - 1 = #ScanProgressWidgets 454 */ 455 WC_MODAL_PROGRESS, 456 457 458 /** 459 * Network window; %Window numbers: 460 * - #WN_NETWORK_WINDOW_GAME = #NetworkGameWidgets 461 * - #WN_NETWORK_WINDOW_CONTENT_LIST = #NetworkContentListWidgets 462 * - #WN_NETWORK_WINDOW_START = #NetworkStartServerWidgets 463 */ 464 WC_NETWORK_WINDOW, 465 466 /** 467 * Client list; %Window numbers: 468 * - 0 = #ClientListWidgets 469 */ 470 WC_CLIENT_LIST, 471 472 /** 473 * Network status window; %Window numbers: 474 * - #WN_NETWORK_STATUS_WINDOW_JOIN = #NetworkJoinStatusWidgets 475 * - #WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD = #NetworkContentDownloadStatusWidgets 476 */ 477 WC_NETWORK_STATUS_WINDOW, 478 479 /** 480 * Network ask relay window; %Window numbers: 481 * - 0 - #NetworkAskRelayWidgets 482 */ 483 WC_NETWORK_ASK_RELAY, 484 485 /** 486 * Chatbox; %Window numbers: 487 * - #DestType = #NetWorkChatWidgets 488 */ 489 WC_SEND_NETWORK_MSG, 490 491 /** 492 * Company password query; %Window numbers: 493 * - 0 = #NetworkCompanyPasswordWidgets 494 */ 495 WC_COMPANY_PASSWORD_WINDOW, 496 497 498 /** 499 * Industry cargoes chain; %Window numbers: 500 * - 0 = #IndustryCargoesWidgets 501 */ 502 WC_INDUSTRY_CARGOES, 503 504 /** 505 * Legend for graphs; %Window numbers: 506 * - 0 = #GraphLegendWidgets 507 */ 508 WC_GRAPH_LEGEND, 509 510 /** 511 * Finances of a company; %Window numbers: 512 * - #CompanyID = #CompanyWidgets 513 */ 514 WC_FINANCES, 515 516 /** 517 * Income graph; %Window numbers: 518 * - 0 = #CompanyValueWidgets 519 */ 520 WC_INCOME_GRAPH, 521 522 /** 523 * Operating profit graph; %Window numbers: 524 * - 0 = #CompanyValueWidgets 525 */ 526 WC_OPERATING_PROFIT, 527 528 /** 529 * Delivered cargo graph; %Window numbers: 530 * - 0 = #CompanyValueWidgets 531 */ 532 WC_DELIVERED_CARGO, 533 534 /** 535 * Performance history graph; %Window numbers: 536 * - 0 = #PerformanceHistoryGraphWidgets 537 */ 538 WC_PERFORMANCE_HISTORY, 539 540 /** 541 * Company value graph; %Window numbers: 542 * - 0 = #CompanyValueWidgets 543 */ 544 WC_COMPANY_VALUE, 545 546 /** 547 * Company league window; %Window numbers: 548 * - 0 = #CompanyLeagueWidgets 549 */ 550 WC_COMPANY_LEAGUE, 551 552 /** 553 * Payment rates graph; %Window numbers: 554 * - 0 = #CargoPaymentRatesWidgets 555 */ 556 WC_PAYMENT_RATES, 557 558 /** 559 * Performance detail window; %Window numbers: 560 * - 0 = #PerformanceRatingDetailsWidgets 561 */ 562 WC_PERFORMANCE_DETAIL, 563 564 /** 565 * Company infrastructure overview; %Window numbers: 566 * - #CompanyID = #CompanyInfrastructureWidgets 567 */ 568 WC_COMPANY_INFRASTRUCTURE, 569 570 571 /** 572 * Buyout company (merger); %Window numbers: 573 * - #CompanyID = #BuyCompanyWidgets 574 */ 575 WC_BUY_COMPANY, 576 577 /** 578 * Engine preview window; %Window numbers: 579 * - #EngineID = #EnginePreviewWidgets 580 */ 581 WC_ENGINE_PREVIEW, 582 583 584 /** 585 * Music window; %Window numbers: 586 * - 0 = #MusicWidgets 587 */ 588 WC_MUSIC_WINDOW, 589 590 /** 591 * Music track selection; %Window numbers: 592 * - 0 = MusicTrackSelectionWidgets 593 */ 594 WC_MUSIC_TRACK_SELECTION, 595 596 /** 597 * Game options window; %Window numbers: 598 * - #WN_GAME_OPTIONS_AI = #AIConfigWidgets 599 * - #WN_GAME_OPTIONS_ABOUT = #AboutWidgets 600 * - #WN_GAME_OPTIONS_NEWGRF_STATE = #NewGRFStateWidgets 601 * - #WN_GAME_OPTIONS_GAME_OPTIONS = #GameOptionsWidgets 602 * - #WN_GAME_OPTIONS_GAME_SETTINGS = #GameSettingsWidgets 603 */ 604 WC_GAME_OPTIONS, 605 606 /** 607 * Custom currency; %Window numbers: 608 * - 0 = #CustomCurrencyWidgets 609 */ 610 WC_CUSTOM_CURRENCY, 611 612 /** 613 * Cheat window; %Window numbers: 614 * - 0 = #CheatWidgets 615 */ 616 WC_CHEATS, 617 618 /** 619 * Extra viewport; %Window numbers: 620 * - Ascending value = #ExtraViewportWidgets 621 */ 622 WC_EXTRA_VIEWPORT, 623 624 625 /** 626 * Console; %Window numbers: 627 * - 0 = #ConsoleWidgets 628 */ 629 WC_CONSOLE, 630 631 /** 632 * Bootstrap; %Window numbers: 633 * - 0 = #BootstrapBackgroundWidgets 634 */ 635 WC_BOOTSTRAP, 636 637 /** 638 * Highscore; %Window numbers: 639 * - 0 = #HighscoreWidgets 640 */ 641 WC_HIGHSCORE, 642 643 /** 644 * Endscreen; %Window numbers: 645 * - 0 = #HighscoreWidgets 646 */ 647 WC_ENDSCREEN, 648 649 650 /** 651 * AI debug window; %Window numbers: 652 * - 0 = #AIDebugWidgets 653 */ 654 WC_AI_DEBUG, 655 656 /** 657 * NewGRF inspect (debug); %Window numbers: 658 * - Packed value = #NewGRFInspectWidgets 659 */ 660 WC_NEWGRF_INSPECT, 661 662 /** 663 * Sprite aligner (debug); %Window numbers: 664 * - 0 = #SpriteAlignerWidgets 665 */ 666 WC_SPRITE_ALIGNER, 667 668 /** 669 * Linkgraph legend; %Window numbers: 670 * - 0 = #LinkGraphWidgets 671 */ 672 WC_LINKGRAPH_LEGEND, 673 674 /** 675 * Save preset; %Window numbers: 676 * - 0 = #SavePresetWidgets 677 */ 678 WC_SAVE_PRESET, 679 680 /** 681 * Framerate display; %Window numbers: 682 * - 0 = #FramerateDisplayWidgets 683 */ 684 WC_FRAMERATE_DISPLAY, 685 686 /** 687 * Frame time graph; %Window numbers: 688 * - 0 = #FrametimeGraphWindowWidgets 689 */ 690 WC_FRAMETIME_GRAPH, 691 692 /** 693 * Screenshot window; %Window numbers: 694 * - 0 = #ScreenshotWidgets 695 */ 696 WC_SCREENSHOT, 697 698 WC_INVALID = 0xFFFF, ///< Invalid window. 699 }; 700 701 /** Data value for #Window::OnInvalidateData() of windows with class #WC_GAME_OPTIONS. */ 702 enum GameOptionsInvalidationData { 703 GOID_DEFAULT = 0, 704 GOID_NEWGRF_RESCANNED, ///< NewGRFs were just rescanned. 705 GOID_NEWGRF_CURRENT_LOADED, ///< The current list of active NewGRF has been loaded. 706 GOID_NEWGRF_LIST_EDITED, ///< List of active NewGRFs is being edited. 707 GOID_NEWGRF_CHANGES_MADE, ///< Changes have been made to a given NewGRF either through the palette or its parameters. 708 GOID_NEWGRF_CHANGES_APPLIED, ///< The active NewGRF list changes have been applied. 709 }; 710 711 struct Window; 712 713 /** Number to differentiate different windows of the same class */ 714 typedef int32 WindowNumber; 715 716 /** State of handling an event. */ 717 enum EventState { 718 ES_HANDLED, ///< The passed event is handled. 719 ES_NOT_HANDLED, ///< The passed event is not handled. 720 }; 721 722 #endif /* WINDOW_TYPE_H */ 723