Add templated versions of CeilDiv and Ceil maths functions
[openttd-joker.git] / src / window_type.h
blob5d3a52ecdb858905f843423408d00891a4dd8581
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
10 /** @file window_type.h Types related to windows */
12 #ifndef WINDOW_TYPE_H
13 #define WINDOW_TYPE_H
15 /** %Window numbers. */
16 enum WindowNumberEnum {
17 WN_GAME_OPTIONS_AI = 0, ///< AI settings.
18 WN_GAME_OPTIONS_ABOUT, ///< About window.
19 WN_GAME_OPTIONS_NEWGRF_STATE, ///< NewGRF settings.
20 WN_GAME_OPTIONS_GAME_OPTIONS, ///< Game options.
21 WN_GAME_OPTIONS_GAME_SETTINGS, ///< Game settings.
23 WN_QUERY_STRING = 0, ///< Query string.
24 WN_QUERY_STRING_SIGN, ///< Query string for signs.
26 WN_CONFIRM_POPUP_QUERY = 0, ///< Query popup confirm.
27 WN_CONFIRM_POPUP_QUERY_BOOTSTRAP, ///< Query popup confirm for bootstrap.
29 WN_NETWORK_WINDOW_GAME = 0, ///< Network game window.
30 WN_NETWORK_WINDOW_LOBBY, ///< Network lobby window.
31 WN_NETWORK_WINDOW_CONTENT_LIST, ///< Network content list.
32 WN_NETWORK_WINDOW_START, ///< Network start server.
34 WN_NETWORK_STATUS_WINDOW_JOIN = 0, ///< Network join status.
35 WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD, ///< Network content download status.
38 /** %Window classes. */
39 enum WindowClass {
40 WC_NONE, ///< No window, redirects to WC_MAIN_WINDOW.
42 /**
43 * Main window; %Window numbers:
44 * - 0 = #MainWidgets
46 WC_MAIN_WINDOW = WC_NONE,
48 /**
49 * Main toolbar (the long bar at the top); %Window numbers:
50 * - 0 = #ToolbarNormalWidgets
51 * - 0 = #ToolbarEditorWidgets
53 WC_MAIN_TOOLBAR,
55 /**
56 * Statusbar (at the bottom of your screen); %Window numbers:
57 * - 0 = #StatusbarWidgets
59 WC_STATUS_BAR,
61 /**
62 * Build toolbar; %Window numbers:
63 * - #TRANSPORT_RAIL = #RailToolbarWidgets
64 * - #TRANSPORT_AIR = #AirportToolbarWidgets
65 * - #TRANSPORT_WATER = #DockToolbarWidgets
66 * - #TRANSPORT_ROAD = #RoadToolbarWidgets
68 WC_BUILD_TOOLBAR,
70 /**
71 * Scenario build toolbar; %Window numbers:
72 * - #TRANSPORT_WATER = #DockToolbarWidgets
73 * - #TRANSPORT_ROAD = #RoadToolbarWidgets
75 WC_SCEN_BUILD_TOOLBAR,
77 /**
78 * Build trees toolbar; %Window numbers:
79 * - 0 = #BuildTreesWidgets
81 WC_BUILD_TREES,
83 /**
84 * Transparency toolbar; %Window numbers:
85 * - 0 = #TransparencyToolbarWidgets
87 WC_TRANSPARENCY_TOOLBAR,
89 /**
90 * Build signal toolbar; %Window numbers:
91 * - #TRANSPORT_RAIL = #BuildSignalWidgets
93 WC_BUILD_SIGNAL,
95 /**
96 * Small map; %Window numbers:
97 * - 0 = #SmallMapWidgets
99 WC_SMALLMAP,
102 * Error message; %Window numbers:
103 * - 0 = #ErrorMessageWidgets
105 WC_ERRMSG,
108 * Tooltip window; %Window numbers:
109 * - 0 = #ToolTipsWidgets
111 WC_TOOLTIPS,
114 * Station rating tooltip window; %Window numbers:
115 * - 0 = #ToolTipsWidgets
117 WC_STATION_RATING_TOOLTIP,
120 * Query string window; %Window numbers:
121 * - #WN_QUERY_STRING = #QueryStringWidgets
122 * - #WN_QUERY_STRING_SIGN = #QueryEditSignWidgets
124 WC_QUERY_STRING,
127 * Popup with confirm question; %Window numbers:
128 * - #WN_CONFIRM_POPUP_QUERY = #QueryWidgets
129 * - #WN_CONFIRM_POPUP_QUERY_BOOTSTRAP = #BootstrapAskForDownloadWidgets
131 WC_CONFIRM_POPUP_QUERY,
134 * Popup with a set of buttons, designed to ask the user a question
135 * from a GameScript. %Window numbers:
136 * - uniqueid = #GoalQuestionWidgets
138 WC_GOAL_QUESTION,
142 * Saveload window; %Window numbers:
143 * - 0 = #SaveLoadWidgets
145 WC_SAVELOAD,
148 * Land info window; %Window numbers:
149 * - 0 = #LandInfoWidgets
151 WC_LAND_INFO,
154 * Drop down menu; %Window numbers:
155 * - 0 = #DropdownMenuWidgets
157 WC_DROPDOWN_MENU,
160 * On Screen Keyboard; %Window numbers:
161 * - 0 = #OnScreenKeyboardWidgets
163 WC_OSK,
166 * Set date; %Window numbers:
167 * - #VehicleID = #SetDateWidgets
169 WC_SET_DATE,
173 * AI settings; %Window numbers:
174 * - 0 = #AISettingsWidgets
176 WC_AI_SETTINGS,
179 * NewGRF parameters; %Window numbers:
180 * - 0 = #NewGRFParametersWidgets
182 WC_GRF_PARAMETERS,
185 * textfile; %Window numbers:
186 * - 0 = #TextfileWidgets
188 WC_TEXTFILE,
192 * Town authority; %Window numbers:
193 * - #TownID = #TownAuthorityWidgets
195 WC_TOWN_AUTHORITY,
198 * Vehicle details; %Window numbers:
199 * - #VehicleID = #VehicleDetailsWidgets
201 WC_VEHICLE_DETAILS,
204 * Vehicle refit; %Window numbers:
205 * - #VehicleID = #VehicleRefitWidgets
207 WC_VEHICLE_REFIT,
210 * Vehicle orders; %Window numbers:
211 * - #VehicleID = #OrderWidgets
213 WC_VEHICLE_ORDERS,
216 * Vehicle cargo type load orders; %Window numbers:
217 * - #VehicleID = #CargoTypeOrdersWidgets
219 WC_VEHICLE_CARGO_TYPE_LOAD_ORDERS,
222 * Vehicle cargo type unload orders; %Window numbers:
223 * - #VehicleID = #CargoTypeOrdersWidgets
225 WC_VEHICLE_CARGO_TYPE_UNLOAD_ORDERS,
228 * Replace vehicle window; %Window numbers:
229 * - #VehicleType = #ReplaceVehicleWidgets
231 WC_REPLACE_VEHICLE,
234 * Vehicle timetable; %Window numbers:
235 * - #VehicleID = #VehicleTimetableWidgets
237 WC_VEHICLE_TIMETABLE,
240 * Vehicle trip history; %Window numbers:
241 * - #VehicleID = #VehicleTripHistoryWidgets
243 WC_VEHICLE_TRIP_HISTORY,
246 * Company colour selection; %Window numbers:
247 * - #CompanyID = #SelectCompanyLiveryWidgets
249 WC_COMPANY_COLOUR,
252 * Alter company face window; %Window numbers:
253 * - #CompanyID = #SelectCompanyManagerFaceWidgets
255 WC_COMPANY_MANAGER_FACE,
258 * Select station (when joining stations); %Window numbers:
259 * - 0 = #JoinStationWidgets
261 WC_SELECT_STATION,
264 * News window; %Window numbers:
265 * - 0 = #NewsWidgets
267 WC_NEWS_WINDOW,
270 * Town directory; %Window numbers:
271 * - 0 = #TownDirectoryWidgets
273 WC_TOWN_DIRECTORY,
276 * Subsidies list; %Window numbers:
277 * - 0 = #SubsidyListWidgets
279 WC_SUBSIDIES_LIST,
282 * Industry directory; %Window numbers:
283 * - 0 = #IndustryDirectoryWidgets
285 WC_INDUSTRY_DIRECTORY,
288 * News history list; %Window numbers:
289 * - 0 = #MessageHistoryWidgets
291 WC_MESSAGE_HISTORY,
294 * Sign list; %Window numbers:
295 * - 0 = #SignListWidgets
297 WC_SIGN_LIST,
300 * AI list; %Window numbers:
301 * - 0 = #AIListWidgets
303 WC_AI_LIST,
306 * Goals list; %Window numbers:
307 * - 0 ; #GoalListWidgets
309 WC_GOALS_LIST,
312 * Story book; %Window numbers:
313 * - CompanyID = #StoryBookWidgets
315 WC_STORY_BOOK,
318 * Station list; %Window numbers:
319 * - #CompanyID = #StationListWidgets
321 WC_STATION_LIST,
324 * Trains list; %Window numbers:
325 * - Packed value = #GroupListWidgets / #VehicleListWidgets
327 WC_TRAINS_LIST,
330 * Road vehicle list; %Window numbers:
331 * - Packed value = #GroupListWidgets / #VehicleListWidgets
333 WC_ROADVEH_LIST,
336 * Ships list; %Window numbers:
337 * - Packed value = #GroupListWidgets / #VehicleListWidgets
339 WC_SHIPS_LIST,
342 * Aircraft list; %Window numbers:
343 * - Packed value = #GroupListWidgets / #VehicleListWidgets
345 WC_AIRCRAFT_LIST,
349 * Town view; %Window numbers:
350 * - #TownID = #TownViewWidgets
352 WC_TOWN_VIEW,
355 * Vehicle view; %Window numbers:
356 * - #VehicleID = #VehicleViewWidgets
358 WC_VEHICLE_VIEW,
361 * Station view; %Window numbers:
362 * - #StationID = #StationViewWidgets
364 WC_STATION_VIEW,
367 * Depot view; %Window numbers:
368 * - #TileIndex = #DepotWidgets
370 WC_VEHICLE_DEPOT,
373 * Waypoint view; %Window numbers:
374 * - #WaypointID = #WaypointWidgets
376 WC_WAYPOINT_VIEW,
379 * Industry view; %Window numbers:
380 * - #IndustryID = #IndustryViewWidgets
382 WC_INDUSTRY_VIEW,
385 * Company view; %Window numbers:
386 * - #CompanyID = #CompanyWidgets
388 WC_COMPANY,
392 * Build object; %Window numbers:
393 * - 0 = #BuildObjectWidgets
395 WC_BUILD_OBJECT,
398 * Build vehicle; %Window numbers:
399 * - #VehicleType = #BuildVehicleWidgets
400 * - #TileIndex = #BuildVehicleWidgets
402 WC_BUILD_VEHICLE,
405 * Build bridge; %Window numbers:
406 * - #TransportType = #BuildBridgeSelectionWidgets
408 WC_BUILD_BRIDGE,
411 * Build station; %Window numbers:
412 * - #TRANSPORT_AIR = #AirportPickerWidgets
413 * - #TRANSPORT_WATER = #DockToolbarWidgets
414 * - #TRANSPORT_RAIL = #BuildRailStationWidgets
416 WC_BUILD_STATION,
419 * Build bus station; %Window numbers:
420 * - #TRANSPORT_ROAD = #BuildRoadStationWidgets
422 WC_BUS_STATION,
425 * Build truck station; %Window numbers:
426 * - #TRANSPORT_ROAD = #BuildRoadStationWidgets
428 WC_TRUCK_STATION,
431 * Build depot; %Window numbers:
432 * - #TRANSPORT_WATER = #BuildDockDepotWidgets
433 * - #TRANSPORT_RAIL = #BuildRailDepotWidgets
434 * - #TRANSPORT_ROAD = #BuildRoadDepotWidgets
436 WC_BUILD_DEPOT,
439 * Build waypoint; %Window numbers:
440 * - #TRANSPORT_RAIL = #BuildRailWaypointWidgets
442 WC_BUILD_WAYPOINT,
445 * Found a town; %Window numbers:
446 * - 0 = #TownFoundingWidgets
448 WC_FOUND_TOWN,
451 * Build industry; %Window numbers:
452 * - 0 = #DynamicPlaceIndustriesWidgets
454 WC_BUILD_INDUSTRY,
458 * Select game window; %Window numbers:
459 * - 0 = #SelectGameIntroWidgets
461 WC_SELECT_GAME,
464 * Landscape generation (in Scenario Editor); %Window numbers:
465 * - 0 = #TerraformToolbarWidgets
466 * - 0 = #EditorTerraformToolbarWidgets
468 WC_SCEN_LAND_GEN,
471 * Generate landscape (newgame); %Window numbers:
472 * - GLWM_SCENARIO = #CreateScenarioWidgets
473 * - #GenerateLandscapeWindowMode = #GenerateLandscapeWidgets
475 WC_GENERATE_LANDSCAPE,
478 * Progress report of landscape generation; %Window numbers:
479 * - 0 = #GenerationProgressWidgets
480 * - 1 = #ScanProgressWidgets
482 WC_MODAL_PROGRESS,
486 * Network window; %Window numbers:
487 * - #WN_NETWORK_WINDOW_GAME = #NetworkGameWidgets
488 * - #WN_NETWORK_WINDOW_LOBBY = #NetworkLobbyWidgets
489 * - #WN_NETWORK_WINDOW_CONTENT_LIST = #NetworkContentListWidgets
490 * - #WN_NETWORK_WINDOW_START = #NetworkStartServerWidgets
492 WC_NETWORK_WINDOW,
495 * Client list; %Window numbers:
496 * - 0 = #ClientListWidgets
498 WC_CLIENT_LIST,
501 * Popup for the client list; %Window numbers:
502 * - #ClientID = #ClientListPopupWidgets
504 WC_CLIENT_LIST_POPUP,
507 * Network status window; %Window numbers:
508 * - #WN_NETWORK_STATUS_WINDOW_JOIN = #NetworkJoinStatusWidgets
509 * - #WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD = #NetworkContentDownloadStatusWidgets
511 WC_NETWORK_STATUS_WINDOW,
514 * Chatbox; %Window numbers:
515 * - #DestType = #NetWorkChatWidgets
517 WC_SEND_NETWORK_MSG,
520 * Company password query; %Window numbers:
521 * - 0 = #NetworkCompanyPasswordWidgets
523 WC_COMPANY_PASSWORD_WINDOW,
527 * Industry cargoes chain; %Window numbers:
528 * - 0 = #IndustryCargoesWidgets
530 WC_INDUSTRY_CARGOES,
533 * Legend for graphs; %Window numbers:
534 * - 0 = #GraphLegendWidgets
536 WC_GRAPH_LEGEND,
539 * Finances of a company; %Window numbers:
540 * - #CompanyID = #CompanyWidgets
542 WC_FINANCES,
545 * Income graph; %Window numbers:
546 * - 0 = #CompanyValueWidgets
548 WC_INCOME_GRAPH,
551 * Operating profit graph; %Window numbers:
552 * - 0 = #CompanyValueWidgets
554 WC_OPERATING_PROFIT,
557 * Delivered cargo graph; %Window numbers:
558 * - 0 = #CompanyValueWidgets
560 WC_DELIVERED_CARGO,
563 * Performance history graph; %Window numbers:
564 * - 0 = #PerformanceHistoryGraphWidgets
566 WC_PERFORMANCE_HISTORY,
569 * Company value graph; %Window numbers:
570 * - 0 = #CompanyValueWidgets
572 WC_COMPANY_VALUE,
575 * Company league window; %Window numbers:
576 * - 0 = #CompanyLeagueWidgets
578 WC_COMPANY_LEAGUE,
581 * Payment rates graph; %Window numbers:
582 * - 0 = #CargoPaymentRatesWidgets
584 WC_PAYMENT_RATES,
587 * Performance detail window; %Window numbers:
588 * - 0 = #PerformanceRatingDetailsWidgets
590 WC_PERFORMANCE_DETAIL,
593 * Company infrastructure overview; %Window numbers:
594 * - #CompanyID = #CompanyInfrastructureWidgets
596 WC_COMPANY_INFRASTRUCTURE,
600 * Buyout company (merger); %Window numbers:
601 * - #CompanyID = #BuyCompanyWidgets
603 WC_BUY_COMPANY,
606 * Engine preview window; %Window numbers:
607 * - #EngineID = #EnginePreviewWidgets
609 WC_ENGINE_PREVIEW,
613 * Music window; %Window numbers:
614 * - 0 = #MusicWidgets
616 WC_MUSIC_WINDOW,
619 * Music track selection; %Window numbers:
620 * - 0 = MusicTrackSelectionWidgets
622 WC_MUSIC_TRACK_SELECTION,
625 * Game options window; %Window numbers:
626 * - #WN_GAME_OPTIONS_AI = #AIConfigWidgets
627 * - #WN_GAME_OPTIONS_ABOUT = #AboutWidgets
628 * - #WN_GAME_OPTIONS_NEWGRF_STATE = #NewGRFStateWidgets
629 * - #WN_GAME_OPTIONS_GAME_OPTIONS = #GameOptionsWidgets
630 * - #WN_GAME_OPTIONS_GAME_SETTINGS = #GameSettingsWidgets
632 WC_GAME_OPTIONS,
635 * Custom currency; %Window numbers:
636 * - 0 = #CustomCurrencyWidgets
638 WC_CUSTOM_CURRENCY,
641 * Cheat window; %Window numbers:
642 * - 0 = #CheatWidgets
644 WC_CHEATS,
647 * Extra viewport; %Window numbers:
648 * - Ascending value = #ExtraViewportWidgets
650 WC_EXTRA_VIEW_PORT,
654 * Console; %Window numbers:
655 * - 0 = #ConsoleWidgets
657 WC_CONSOLE,
660 * Bootstrap; %Window numbers:
661 * - 0 = #BootstrapBackgroundWidgets
663 WC_BOOTSTRAP,
666 * Highscore; %Window numbers:
667 * - 0 = #HighscoreWidgets
669 WC_HIGHSCORE,
672 * Endscreen; %Window numbers:
673 * - 0 = #HighscoreWidgets
675 WC_ENDSCREEN,
679 * AI debug window; %Window numbers:
680 * - 0 = #AIDebugWidgets
682 WC_AI_DEBUG,
685 * NewGRF inspect (debug); %Window numbers:
686 * - Packed value = #NewGRFInspectWidgets
688 WC_NEWGRF_INSPECT,
691 * Sprite aligner (debug); %Window numbers:
692 * - 0 = #SpriteAlignerWidgets
694 WC_SPRITE_ALIGNER,
697 * Zoning toolbar.
699 WC_ZONING_TOOLBAR,
702 * Linkgraph legend; Window numbers:
703 * - 0 = #LinkGraphWidgets
705 WC_LINKGRAPH_LEGEND,
708 * Save preset; %Window numbers:
709 * - 0 = #SavePresetWidgets
711 WC_SAVE_PRESET,
714 * Plans window.
716 WC_PLANS,
719 * Trace restrict programme window; %Window numbers:
720 * - #TileIndex << 3 | #Track = #TraceRestrictWindow
722 WC_TRACE_RESTRICT,
725 * Trace restrict slot window; %Window numbers:
726 * - Packed value = #SlotListWidgets / #VehicleListWidgets
728 WC_TRACE_RESTRICT_SLOTS,
730 WC_TEMPLATEGUI_MAIN,
731 WC_TEMPLATEGUI_RPLALL,
732 WC_BUILD_VIRTUAL_TRAIN,
733 WC_CREATE_TEMPLATE,
737 * Signal program GUI; %Window numbers:
738 * - #SignalReference
740 WC_SIGNAL_PROGRAM,
743 * Departure boards
745 WC_DEPARTURES_BOARD,
747 WC_INVALID = 0xFFFF, ///< Invalid window.
750 /** Data value for #Window::OnInvalidateData() of windows with class #WC_GAME_OPTIONS. */
751 enum GameOptionsInvalidationData {
752 GOID_DEFAULT = 0,
753 GOID_NEWGRF_RESCANNED, ///< NewGRFs were just rescanned.
754 GOID_NEWGRF_LIST_EDITED, ///< List of active NewGRFs is being edited.
755 GOID_NEWGRF_PRESET_LOADED, ///< A NewGRF preset was picked.
758 struct Window;
760 /** Number to differentiate different windows of the same class */
761 typedef int32 WindowNumber;
763 /** State of handling an event. */
764 enum EventState {
765 ES_HANDLED, ///< The passed event is handled.
766 ES_NOT_HANDLED, ///< The passed event is not handled.
769 #endif /* WINDOW_TYPE_H */