OpenTTD Source 20241224-master-gf74b0cf984
|
Window functions not directly related to making/drawing windows. More...
#include "window_type.h"
#include "company_type.h"
#include "core/geometry_type.hpp"
#include "core/strong_typedef_type.hpp"
Go to the source code of this file.
Functions | |
Window * | FindWindowById (WindowClass cls, WindowNumber number) |
Find a window by its class and window number. | |
Window * | FindWindowByClass (WindowClass cls) |
Find any window by its class. | |
Window * | GetMainWindow () |
Get the main window, i.e. | |
void | ChangeWindowOwner (Owner old_owner, Owner new_owner) |
Change the owner of all the windows one company can take over from another company in the case of a company merger. | |
template<typename T , std::enable_if_t< std::is_base_of< StrongTypedefBase, T >::value, int > = 0> | |
Window * | FindWindowById (WindowClass cls, T number) |
void | ResizeWindow (Window *w, int x, int y, bool clamp_to_screen=true, bool schedule_resize=true) |
Resize the window. | |
int | PositionMainToolbar (Window *w) |
(Re)position main toolbar window at the screen. | |
int | PositionStatusbar (Window *w) |
(Re)position statusbar window at the screen. | |
int | PositionNewsMessage (Window *w) |
(Re)position news message window at the screen. | |
int | PositionNetworkChatWindow (Window *w) |
(Re)position network chat window at the screen. | |
int | GetMainViewTop () |
Return the top of the main view available for general use. | |
int | GetMainViewBottom () |
Return the bottom of the main view available for general use. | |
void | InitWindowSystem () |
(re)initialize the windowing system | |
void | UnInitWindowSystem () |
Close down the windowing system. | |
void | ResetWindowSystem () |
Reset the windowing system, by means of shutting it down followed by re-initialization. | |
void | SetupColoursAndInitialWindow () |
Initialise the default colours (remaps and the likes), and load the main windows. | |
void | InputLoop () |
Regular call from the global game loop. | |
void | InvalidateWindowData (WindowClass cls, WindowNumber number, int data=0, bool gui_scope=false) |
Mark window data of the window of a given class and specific window number as invalid (in need of re-computing) | |
void | InvalidateWindowClassesData (WindowClass cls, int data=0, bool gui_scope=false) |
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by default the invalidation is not considered to be called from GUI scope. | |
template<typename T , std::enable_if_t< std::is_base_of< StrongTypedefBase, T >::value, int > = 0> | |
void | InvalidateWindowData (WindowClass cls, T number, int data=0, bool gui_scope=false) |
void | CloseNonVitalWindows () |
Try to close a non-vital window. | |
void | CloseAllNonVitalWindows () |
It is possible that a stickied window gets to a position where the 'close' button is outside the gaming area. | |
void | DeleteAllMessages () |
Delete all messages and close their corresponding window (if any). | |
void | CloseConstructionWindows () |
Close all windows that are used for construction of vehicle etc. | |
void | HideVitalWindows () |
Close all always on-top windows to get an empty screen. | |
void | ShowVitalWindows () |
Show the vital in-game windows. | |
void | ReInitAllWindows (bool zoom_changed) |
Re-initialize all windows. | |
void | SetWindowWidgetDirty (WindowClass cls, WindowNumber number, WidgetID widget_index) |
Mark a particular widget in a particular window as dirty (in need of repainting) | |
void | SetWindowDirty (WindowClass cls, WindowNumber number) |
Mark window as dirty (in need of repainting) | |
void | SetWindowClassesDirty (WindowClass cls) |
Mark all windows of a particular class as dirty (in need of repainting) | |
template<typename T , std::enable_if_t< std::is_base_of< StrongTypedefBase, T >::value, int > = 0> | |
void | SetWindowDirty (WindowClass cls, T number) |
void | CloseWindowById (WindowClass cls, WindowNumber number, bool force=true, int data=0) |
Close a window by its class and window number (if it is open). | |
void | CloseWindowByClass (WindowClass cls, int data=0) |
Close all windows of a given class. | |
template<typename T , std::enable_if_t< std::is_base_of< StrongTypedefBase, T >::value, int > = 0> | |
void | CloseWindowById (WindowClass cls, T number, bool force=true, int data=0) |
bool | EditBoxInGlobalFocus () |
Check if an edit box is in global focus. | |
bool | FocusedWindowIsConsole () |
Check if a console is focused. | |
Point | GetCaretPosition () |
Window functions not directly related to making/drawing windows.
Definition in file window_func.h.
Change the owner of all the windows one company can take over from another company in the case of a company merger.
Do not change ownership of windows that need to be deleted once takeover is complete
old_owner | original owner of the window |
new_owner | the new owner of the window |
Definition at line 1188 of file window.cpp.
References WC_AIRCRAFT_LIST, WC_BUY_COMPANY, WC_COMPANY, WC_COMPANY_COLOUR, WC_COMPANY_INFRASTRUCTURE, WC_FINANCES, WC_ROADVEH_LIST, WC_SHIPS_LIST, WC_STATION_LIST, WC_TRAINS_LIST, and WC_VEHICLE_ORDERS.
Referenced by ChangeOwnershipOfCompanyItems().
void CloseAllNonVitalWindows | ( | ) |
It is possible that a stickied window gets to a position where the 'close' button is outside the gaming area.
You cannot close it then; except with this function. It closes all windows calling the standard function, then, does a little hacked loop of closing all stickied windows. Note that standard windows (status bar, etc.) are not stickied, so these aren't affected
Definition at line 3280 of file window.cpp.
References Window::Close(), WindowDesc::flags, WDF_NO_CLOSE, and Window::window_desc.
Referenced by GenerateWorld(), and MainWindow::OnHotkey().
void CloseConstructionWindows | ( | ) |
Close all windows that are used for construction of vehicle etc.
Once done with that invalidate the others to ensure they get refreshed too.
Definition at line 3305 of file window.cpp.
References Window::Close(), WindowDesc::flags, Window::SetDirty(), WDF_CONSTRUCTION, and Window::window_desc.
Referenced by SetLocalCompany().
void CloseNonVitalWindows | ( | ) |
Try to close a non-vital window.
Non-vital windows are windows other than the game selection, main toolbar, status bar, toolbar menu, and tooltip windows. Stickied windows are also considered vital.
Definition at line 3261 of file window.cpp.
References Window::Close(), WindowDesc::flags, Window::flags, WDF_NO_CLOSE, WF_STICKY, and Window::window_desc.
Referenced by MainWindow::OnHotkey().
void CloseWindowByClass | ( | WindowClass | cls, |
int | data | ||
) |
Close all windows of a given class.
cls | Window class of windows to delete |
Definition at line 1152 of file window.cpp.
Referenced by NewGRFWindow::AddGRFToActive(), ScriptListWindow::ChangeScript(), ScriptDebugWindow::ChangeToScript(), CleanupGeneration(), AIConfigWindow::Close(), GSConfigWindow::Close(), NewGRFWindow::Close(), GameOptionsWindow::Close(), ClientNetworkCoordinatorSocketHandler::CloseTurnHandler(), DoScanNewGRFFiles(), InvalidateNewGRFChangeWindows(), NewGRFConfirmationCallback(), NewGRFWindow::OnClick(), NewGRFWindow::OnDropdownSelect(), GameOptionsWindow::OnDropdownSelect(), VehicleGroupWindow::OnInvalidateData(), NewGRFWindow::OnKeyPress(), NewGRFWindow::OnNewGRFsScanned(), BuildDocksToolbarWindow::OnPlaceObjectAbort(), BuildRailToolbarWindow::OnPlaceObjectAbort(), BuildRoadToolbarWindow::OnPlaceObjectAbort(), RelocateAllWindows(), SetupEngines(), ShowAIConfigWindow(), ShowBuildAirToolbar(), ShowBuildBridgeWindow(), ShowBuildDocksToolbar(), ShowBuildRailToolbar(), ShowBuildRoadToolbar(), ShowCreateScenario(), ShowDropDownListAt(), ShowEndGameChart(), ShowGameOptions(), ShowGameSettings(), ShowGSConfigWindow(), ShowHighscoreTable(), ShowNetworkAskRelay(), ShowNetworkAskSurvey(), ShowNetworkChatQueryWindow(), ShowNewGRFSettings(), ShowQueryString(), ShowRenameSignWindow(), ShowSavePresetWindow(), ShowScriptListWindow(), ShowScriptSettingsWindow(), ShowSetDateWindow(), and NewGRFWindow::UpgradeCurrent().
void CloseWindowById | ( | WindowClass | cls, |
T | number, | ||
bool | force = true , |
||
int | data = 0 |
||
) |
Definition at line 80 of file window_func.h.
void CloseWindowById | ( | WindowClass | cls, |
WindowNumber | number, | ||
bool | force, | ||
int | data | ||
) |
Close a window by its class and window number (if it is open).
cls | Window class |
number | Number of the window within the window class |
force | force closing; if false don't close when stickied |
Definition at line 1140 of file window.cpp.
References Window::Close(), FindWindowById(), Window::flags, and WF_STICKY.
Referenced by ClientNetworkContentSocketHandler::BeforeDownload(), ClientNetworkGameSocketHandler::ClientError(), BuildAirToolbarWindow::Close(), BuildAirportWindow::Close(), DepotWindow::Close(), BuildDocksToolbarWindow::Close(), BuildDocksStationWindow::Close(), BuildRailToolbarWindow::Close(), BuildRailStationWindow::Close(), BuildRoadToolbarWindow::Close(), BuildRoadStationWindow::Close(), GameOptionsWindow::Close(), StationViewWindow::Close(), VehicleViewWindow::Close(), WaypointWindow::Close(), CloseCompanyWindows(), CmdCompanyCtrl(), CmdDeleteGroup(), CmdGoalQuestionAnswer(), CmdMoveRailVehicle(), DeleteAllMessages(), DeleteNewGRFInspectWindow(), GuiShowTooltips(), HideVitalWindows(), IConsoleSwitch(), MoveToNextNewsItem(), NetworkDisconnect(), NewVehicleAvailable(), NetworkContentDownloadStatusWindow::OnClick(), NetworkGameWindow::OnClick(), PickerWindow::OnClick(), BuildRailStationWindow::OnClick(), BuildRoadToolbarWindow::OnClick(), BuildRoadStationWindow::OnClick(), SelectStationWindow< T >::OnClick(), BuildAirToolbarWindow::OnInvalidateData(), BuildDocksToolbarWindow::OnInvalidateData(), BuildRailToolbarWindow::OnInvalidateData(), BuildRoadToolbarWindow::OnInvalidateData(), BuildAirToolbarWindow::OnPlaceObjectAbort(), BuildDocksToolbarWindow::OnPlaceObjectAbort(), BuildRailToolbarWindow::OnPlaceObjectAbort(), BuildRoadToolbarWindow::OnPlaceObjectAbort(), Vehicle::PreDestructor(), ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT(), RemoveAirport(), Vehicle::RemoveFromShared(), ShowBaseSetTextfileWindow(), ShowBuildRoadScenToolbar(), ShowCheatWindow(), ShowCustCurrency(), ShowLandInfo(), ShowMessageHistory(), ShowNetworkContentListWindow(), ShowNewsMessage(), ShowOnScreenKeyboard(), ShowReplaceGroupVehicleWindow(), ShowSaveLoadDialog(), ShowScriptTextfileWindow(), ShowTerraformToolbar(), ShowTimetableWindow(), ShowVehicleDetailsWindow(), ShowVehicleRefitWindow(), ToggleRailButton_Remove(), Depot::~Depot(), Station::~Station(), and Town::~Town().
void DeleteAllMessages | ( | ) |
Delete all messages and close their corresponding window (if any).
Definition at line 3293 of file window.cpp.
References CloseWindowById(), InitNewsItemStructs(), InvalidateWindowData(), SBI_NEWS_DELETED, WC_MESSAGE_HISTORY, WC_NEWS_WINDOW, and WC_STATUS_BAR.
Referenced by MenuClickNewspaper(), and MainWindow::OnHotkey().
bool EditBoxInGlobalFocus | ( | ) |
Check if an edit box is in global focus.
That is if focused window has a edit box as focused widget, or if a console is focused.
Definition at line 448 of file window.cpp.
References Window::nested_focus, NWidgetBase::type, WC_CONSOLE, Window::window_class, and WWT_EDITBOX.
Referenced by HandleKeypress(), HandleTextInput(), Window::InitializeData(), VideoDriver_Win32Base::PollEvent(), SetCandidatePos(), and SetCompositionPos().
Window * FindWindowByClass | ( | WindowClass | cls | ) |
Find any window by its class.
Useful when searching for a window that uses the window number as a WindowClass, like WC_SEND_NETWORK_MSG.
cls | Window class |
nullptr
if not available Definition at line 1113 of file window.cpp.
Referenced by GetAutoPlacePosition(), NetworkDrawChatMessage(), IndustryCargoesWindow::OnClick(), ShowScriptDebugWindow(), and UpdateNewGRFScanStatus().
Window * FindWindowById | ( | WindowClass | cls, |
T | number | ||
) |
Definition at line 24 of file window_func.h.
Window * FindWindowById | ( | WindowClass | cls, |
WindowNumber | number | ||
) |
Find a window by its class and window number.
cls | Window class |
number | Number of the window within the window class |
nullptr
if not available Definition at line 1098 of file window.cpp.
Referenced by BringWindowToFrontById(), BuildRailStationWindow::BuildRailStationGlobalHotkeys(), ChangeVehicleWindow(), CloseWindowById(), DeleteDepotHighlightOfVehicle(), DeleteRenameSignWindow(), EnsureVisibleCaption(), FindVehicleGroupWindow(), Window::FindWindowPlacementAndResize(), GenericPlaceSignals(), TileHighlightData::GetCallbackWnd(), GetMainViewBottom(), GetMainViewTop(), GetMainWindow(), GetToolbarAlignedWindowPosition(), HandleAutoSignalPlacement(), HandleKeypress(), HandleToolbarHotkey(), HideActiveErrorMessage(), HideActiveNewsMessage(), InitializeRoadGUI(), IsNewsTickerShown(), IsOSKOpenedFor(), LoadFromConfig(), LocalGetWindowPlacement(), MoveToNextNewsItem(), MoveToNextTickerItem(), NetworkContentDownloadStatusWindow::NetworkContentDownloadStatusWindow(), SavePresetWindow::OnClick(), BuildSignalWindow::OnClick(), NetworkChatWindow::OnInitialPosition(), NetworkContentListWindow::OnInvalidateData(), BuildRailToolbarWindow::OnPlaceDrag(), PositionWindow(), ReadyForNextNewsItem(), ReInitAllWindows(), ReinitGuiAfterToggleElrail(), RelocateAllWindows(), ResetSignalVariant(), ScrollMainWindowTo(), SetDefaultRailGui(), SetScreenshotWindowVisibility(), ShowErrorMessage(), ShowExtraViewportWindow(), ShowLastNewsMessage(), ShowScriptDebugWindow(), StationJoinerNeeded(), UnshowCriticalError(), and UpdateOSKOriginalText().
bool FocusedWindowIsConsole | ( | ) |
Check if a console is focused.
Definition at line 462 of file window.cpp.
References WC_CONSOLE, and Window::window_class.
Referenced by VideoDriver_SDL_Base::PollEvent().
int GetMainViewBottom | ( | ) |
Return the bottom of the main view available for general use.
Definition at line 2073 of file window.cpp.
References FindWindowById(), Window::top, and WC_STATUS_BAR.
Referenced by BuildBridgeWindow::OnInitialPosition(), TooltipsWindow::OnInitialPosition(), and DropdownWindow::UpdateSizeAndPosition().
int GetMainViewTop | ( | ) |
Return the top of the main view available for general use.
Definition at line 2062 of file window.cpp.
References FindWindowById(), Window::height, Window::top, and WC_MAIN_TOOLBAR.
Referenced by BuildBridgeWindow::OnInitialPosition(), ErrmsgWindow::OnInitialPosition(), TooltipsWindow::OnInitialPosition(), and DropdownWindow::UpdateSizeAndPosition().
Window * GetMainWindow | ( | ) |
Get the main window, i.e.
FindWindowById(WC_MAIN_WINDOW, 0). If the main window is not available, this function will trigger an assert.
Definition at line 1127 of file window.cpp.
References FindWindowById(), and WC_MAIN_WINDOW.
Referenced by DEF_CONSOLE_CMD(), SmallMapWindow::DrawMapIndicators(), HandleViewportScroll(), InitializeWindowViewport(), SmallMapWindow::OnClick(), VehicleViewWindow::OnClick(), ExtraViewportWindow::OnClick(), VehicleViewWindow::OnHotkey(), MainToolbarWindow::OnInvalidateData(), ScenarioEditorToolbarWindow::OnInvalidateData(), VehicleViewWindow::OnPaint(), SelectGameWindow::OnRealtimeTick(), ScrollMainWindowTo(), SetupScreenshotViewport(), ShowNetworkAskRelay(), ShowNetworkAskSurvey(), ShowQuery(), and SmallMapWindow::SmallMapCenterOnCurrentPos().
void HideVitalWindows | ( | ) |
Close all always on-top windows to get an empty screen.
Definition at line 3318 of file window.cpp.
References CloseWindowById(), WC_MAIN_TOOLBAR, and WC_STATUS_BAR.
Referenced by GenerateWorld(), and ShowEndGameChart().
void InitWindowSystem | ( | ) |
(re)initialize the windowing system
Definition at line 1782 of file window.cpp.
References _last_scroll_window, _mouse_hovering, _mouseover_last_w, _scrolling_viewport, IConsoleClose(), InitDepotWindowBlockSizes(), NWidgetLeaf::InvalidateDimensionCache(), SetupWidgetDimensions(), and ShowFirstError().
Referenced by openttd_main(), and ResetWindowSystem().
void InputLoop | ( | ) |
Regular call from the global game loop.
Definition at line 2993 of file window.cpp.
References _input_events_this_tick, CheckSoftLimit(), Window::DeleteClosedWindows(), HandleMouseEvents(), HasModalProgress(), and IsLocalCompany().
void InvalidateWindowClassesData | ( | WindowClass | cls, |
int | data, | ||
bool | gui_scope | ||
) |
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by default the invalidation is not considered to be called from GUI scope.
See InvalidateWindowData() for details on GUI-scope vs. command-scope.
cls | Window class |
data | The data to invalidate with |
gui_scope | Whether the call is done from GUI scope |
Definition at line 3236 of file window.cpp.
References Window::InvalidateData(), and Window::window_class.
Referenced by AddRemoveEngineFromAutoreplaceAndBuildWindows(), SmallMapWindow::BreakIndustryChainLink(), CalendarEnginesMonthlyLoop(), CcBuildWagon(), ChangeMinutesPerYear(), ScriptListWindow::ChangeScript(), ChangeTimekeepingUnits(), ClickChangeDateCheat(), ClickChangeMaxHlCheat(), ClickSetProdCheat(), CmdAlterGroup(), CmdBuildVehicle(), CmdCloneOrder(), CmdCompanyCtrl(), CmdCreateGoal(), CmdCreateStoryPage(), CmdCreateStoryPageElement(), CmdMoveOrder(), CmdMoveRailVehicle(), CmdRefitVehicle(), CmdRemoveGoal(), CmdRemoveStoryPage(), CmdRemoveStoryPageElement(), CmdRenamePresident(), CmdRenameVehicle(), CmdSellRailWagon(), CmdSetGoalCompleted(), CmdSetGoalProgress(), CmdSetGoalText(), CmdSetStoryPageDate(), CmdSetStoryPageTitle(), CmdUpdateStoryPageElement(), Vehicle::Crash(), DecloneOrder(), DeleteOrder(), OrderBackup::DoRestore(), DoScanNewGRFFiles(), GenerateDesertArea(), Vehicle::HandlePathfindingResult(), InsertOrder(), OrderList::InsertOrderAt(), InvalidateNewGRFChangeWindows(), MenuClickSettings(), NetworkAfterNewGRFScan(), IndustryCargoesWindow::NotifySmallmap(), ReplaceVehicleWindow::OnClick(), BuildVehicleWindow::OnClick(), Vehicle::PreDestructor(), ReadLanguagePack(), ReloadNewGRFData(), AI::Rescan(), RoadVehAccelerationModelChanged(), SetLocalCompany(), SetNewLandscapeType(), Game::StartNew(), AI::StartNew(), StartupEngines(), AI::Stop(), VideoDriver_SDL_Base::ToggleFullscreen(), VideoDriver_SDL::ToggleFullscreen(), VideoDriver_Win32Base::ToggleFullscreen(), Order::~Order(), and Station::~Station().
void InvalidateWindowData | ( | WindowClass | cls, |
T | number, | ||
int | data = 0 , |
||
bool | gui_scope = false |
||
) |
Definition at line 48 of file window_func.h.
void InvalidateWindowData | ( | WindowClass | cls, |
WindowNumber | number, | ||
int | data, | ||
bool | gui_scope | ||
) |
Mark window data of the window of a given class and specific window number as invalid (in need of re-computing)
Note that by default the invalidation is not considered to be called from GUI scope. That means only a part of invalidation is executed immediately. The rest is scheduled for the next redraw. The asynchronous execution is important to prevent GUI code being executed from command scope. When not in GUI-scope:
However, when invalidations are scheduled, then multiple calls may be scheduled before execution starts. Earlier scheduled invalidations may be called with invalidation-data, which is already invalid at the point of execution. That means some stuff requires to be executed immediately in command scope, while not everything may be executed in command scope. While GUI-scope calls have no restrictions on what they may do, they cannot assume the game to still be in the state when the invalidation was scheduled; passed IDs may have got invalid in the mean time.
Finally, note that invalidations triggered from commands or the game loop result in OnInvalidateData() being called twice. Once in command-scope, once in GUI-scope. So make sure to not process differential-changes twice.
cls | Window class |
number | Window number within the class |
data | The data to invalidate with |
gui_scope | Whether the call is done from GUI scope |
Definition at line 3219 of file window.cpp.
References Window::InvalidateData(), Window::window_class, and Window::window_number.
Referenced by ServerNetworkGameSocketHandler::AcceptConnection(), AcceptEnginePreview(), AddNewsItem(), AddRemoveEngineFromAutoreplaceAndBuildWindows(), Station::AfterStationTileSetChange(), AircraftLeaveHangar(), Subsidy::AwardTo(), MusicSystem::ChangeMusicSet(), MusicSystem::ChangePlaylist(), ChangePopulation(), ScriptListWindow::ChangeScript(), ChangeSoundSet(), CheckTrainStayInDepot(), NetworkChatWindow::Close(), NetworkContentDownloadStatusWindow::Close(), CmdAddSharedVehicleGroup(), CmdAddVehicleGroup(), CmdAlterGroup(), CmdBuildAirport(), CmdBuildBuoy(), CmdBuildRailWagon(), CmdBuildVehicle(), CmdCompanyAllowListCtrl(), CmdCompanyCtrl(), CmdConvertRail(), CmdConvertRoad(), CmdCreateGoal(), CmdCreateGroup(), CmdCreateLeagueTableElement(), CmdCreateStoryPage(), CmdDeleteGroup(), CmdIndustrySetText(), CmdMoveRailVehicle(), CmdPlaceSign(), CmdRefitVehicle(), CmdRemoveAllVehiclesGroup(), CmdRemoveGoal(), CmdRemoveLeagueTableElement(), CmdRemoveStoryPage(), CmdRenameSign(), CmdRenameStation(), CmdRenameTown(), CmdSellRailWagon(), CmdSetCompanyColour(), CmdSetGoalCompleted(), CmdSetGoalProgress(), CmdSetGoalText(), CmdSetGroupFlag(), CmdStartStopVehicle(), CmdTownCargoGoal(), CmdTownGrowthRate(), CmdTownRating(), CmdTownSetText(), CmdUpdateLeagueTableElementData(), CmdUpdateLeagueTableElementScore(), Company::Company(), Train::ConsistChanged(), CreateSubsidy(), DeleteAllMessages(), DeleteNewGRFInspectWindow(), DeleteNews(), DeleteNewsItem(), DeleteStationIfEmpty(), DeleteSubsidyWith(), DoCreateNewIndustry(), DoCreateTown(), DoScanNewGRFFiles(), DoStartupNewCompany(), StatusBarWindow::DrawWidget(), EnableEngineForCompany(), HandleMouseEvents(), InvalidateAutoreplaceWindow(), InvalidateNewGRFInspectWindow(), InvalidateVehicleOrder(), MoveToNextTickerItem(), NetworkChatWindow::NetworkChatWindow(), NetworkServerDoMove(), NewVehicleAvailable(), MusicSystem::Next(), NormaliseTrainHead(), ReplaceVehicleWindow::OnClick(), BuildVehicleWindow::OnClick(), GraphLegendWindow::OnClick(), MainWindow::OnInvalidateData(), MusicSystem::Play(), MusicSystem::PlaylistAdd(), MusicSystem::PlaylistRemove(), BaseStation::PostDestructor(), Company::PostDestructor(), Industry::PostDestructor(), Town::PostDestructor(), Vehicle::PreDestructor(), MusicSystem::Prev(), ServerNetworkGameSocketHandler::Receive_CLIENT_MAP_OK(), ClientNetworkGameSocketHandler::Receive_SERVER_CLIENT_INFO(), ClientNetworkGameSocketHandler::Receive_SERVER_CONFIG_UPDATE(), ClientNetworkGameSocketHandler::Receive_SERVER_ERROR_QUIT(), ClientNetworkGameSocketHandler::Receive_SERVER_JOIN(), ClientNetworkGameSocketHandler::Receive_SERVER_QUIT(), RecomputePrices(), ReloadNewGRFData(), RemoveAirport(), RemoveBuoy(), Vehicle::RemoveFromShared(), AI::Rescan(), ReverseTrainDirection(), SaveFileDone(), SaveFileStart(), SetLocalCompany(), ShowTicker(), MusicSystem::Shuffle(), MusicSystem::Stop(), MusicSystem::Unshuffle(), UpdateClientConfigValues(), UpdateNetworkGameWindow(), Waypoint::UpdateVirtCoord(), VehicleEnter_Track(), VehicleEnterDepot(), LinkGraphJob::~LinkGraphJob(), NetworkClientInfo::~NetworkClientInfo(), ServerNetworkGameSocketHandler::~ServerNetworkGameSocketHandler(), and Station::~Station().
int PositionMainToolbar | ( | Window * | w | ) |
(Re)position main toolbar window at the screen.
w | Window structure of the main toolbar window, may also be nullptr . |
Definition at line 3390 of file window.cpp.
References _settings_client, Debug, ClientSettings::gui, PositionWindow(), GUISettings::toolbar_pos, and WC_MAIN_TOOLBAR.
Referenced by RelocateAllWindows(), and v_PositionMainToolbar().
int PositionNetworkChatWindow | ( | Window * | w | ) |
(Re)position network chat window at the screen.
w | Window structure of the network chat window, may also be nullptr . |
Definition at line 3423 of file window.cpp.
References _settings_client, Debug, ClientSettings::gui, PositionWindow(), GUISettings::statusbar_pos, and WC_SEND_NETWORK_MSG.
Referenced by NetworkChatWindow::NetworkChatWindow(), RelocateAllWindows(), and v_PositionStatusbar().
int PositionNewsMessage | ( | Window * | w | ) |
(Re)position news message window at the screen.
w | Window structure of the news message window, may also be nullptr . |
Definition at line 3412 of file window.cpp.
References _settings_client, Debug, ClientSettings::gui, PositionWindow(), GUISettings::statusbar_pos, and WC_NEWS_WINDOW.
Referenced by RelocateAllWindows(), and v_PositionStatusbar().
int PositionStatusbar | ( | Window * | w | ) |
(Re)position statusbar window at the screen.
w | Window structure of the statusbar window, may also be nullptr . |
Definition at line 3401 of file window.cpp.
References _settings_client, Debug, ClientSettings::gui, PositionWindow(), GUISettings::statusbar_pos, and WC_STATUS_BAR.
Referenced by RelocateAllWindows(), and v_PositionStatusbar().
void ReInitAllWindows | ( | bool | zoom_changed | ) |
Re-initialize all windows.
zoom_changed | Set if windows are being re-initialized due to a zoom level changed. |
Definition at line 3335 of file window.cpp.
References _networking, FindWindowById(), InitDepotWindowBlockSizes(), NWidgetLeaf::InvalidateDimensionCache(), MarkWholeScreenDirty(), NetworkReInitChatBoxSize(), NetworkUndrawChatMessage(), RelocateAllWindows(), SetupWidgetDimensions(), WC_MAIN_TOOLBAR, WC_STATUS_BAR, and Window::window_class.
Referenced by CheckBlitter(), InvalidateNewGRFChangeWindows(), NewGRFConfirmationCallback(), GameOptionsWindow::OnClick(), GameOptionsWindow::OnDropdownSelect(), and GameOptionsWindow::OnMouseLoop().
void ResetWindowSystem | ( | ) |
Reset the windowing system, by means of shutting it down followed by re-initialization.
Definition at line 1818 of file window.cpp.
References InitWindowSystem(), TileHighlightData::Reset(), and UnInitWindowSystem().
Referenced by GenerateWorld(), InitializeWindowsAndCaches(), and LoadIntroGame().
void ResizeWindow | ( | Window * | w, |
int | delta_x, | ||
int | delta_y, | ||
bool | clamp_to_screen, | ||
bool | schedule_resize | ||
) |
Resize the window.
Update all the widgets of a window based on their resize flags Both the areas of the old window and the new sized window are set dirty ensuring proper redrawal.
w | Window to resize |
delta_x | Delta x-size of changed window (positive if larger, etc.) |
delta_y | Delta y-size of changed window |
clamp_to_screen | Whether to make sure the whole window stays visible |
Definition at line 2022 of file window.cpp.
References _current_text_dir, Ceil(), EnsureVisibleCaption(), Window::height, Window::left, Window::nested_root, Window::OnResize(), Window::ScheduleResize(), Window::SetDirty(), ST_RESIZE, TD_RTL, Window::top, and Window::width.
Referenced by DispatchLeftClickEvent(), TownAuthorityWindow::DrawRatings(), Window::FindWindowPlacementAndResize(), HandleWindowDragging(), BuildAirportWindow::OnPaint(), BuildDocksStationWindow::OnPaint(), Window::ReInit(), and RelocateAllWindows().
void SetupColoursAndInitialWindow | ( | ) |
Initialise the default colours (remaps and the likes), and load the main windows.
Definition at line 546 of file main_gui.cpp.
References Recolour, SetColourGradient(), and ShowVitalWindows().
Referenced by GenerateWorld(), InitializeWindowsAndCaches(), and LoadIntroGame().
void SetWindowClassesDirty | ( | WindowClass | cls | ) |
Mark all windows of a particular class as dirty (in need of repainting)
cls | Window class |
Definition at line 3127 of file window.cpp.
References Window::SetDirty(), and Window::window_class.
Referenced by Station::AddFacility(), AircraftLeaveHangar(), CalendarEnginesMonthlyLoop(), IntSettingDesc::ChangeValue(), CheckTrainStayInDepot(), CmdRenameDepot(), CmdReverseTrainDirection(), CmdSkipToOrder(), CmdStartStopVehicle(), MusicWindow::OnClick(), GameOptionsWindow::OnClick(), Aircraft::OnNewEconomyDay(), RoadVehicle::OnNewEconomyDay(), Ship::OnNewEconomyDay(), Train::OnNewEconomyDay(), ProcessOrders(), RecomputePrices(), RedrawSmallmap(), RemoveAirport(), RemoveDock(), RemoveFromRailBaseStation(), RemoveRoadStop(), AI::Rescan(), RoadVehAccelerationModelChanged(), StartupEngines(), TownActionBuyRights(), UpdateAllServiceInterval(), and VehicleEnterDepot().
void SetWindowDirty | ( | WindowClass | cls, |
T | number | ||
) |
Definition at line 71 of file window_func.h.
void SetWindowDirty | ( | WindowClass | cls, |
WindowNumber | number | ||
) |
Mark window as dirty (in need of repainting)
Definition at line 3101 of file window.cpp.
References Window::SetDirty(), Window::window_class, and Window::window_number.
Referenced by AgeVehicle(), AircraftEventHandler_AtTerminal(), Vehicle::BeginLoading(), ChangeIndustryProduction(), ChangeTimetable(), ChangeTownRating(), CheckTrainStayInDepot(), ClickChangeDateCheat(), NetworkContentDownloadStatusWindow::Close(), ClientNetworkCoordinatorSocketHandler::CloseConnection(), CmdAddVehicleGroup(), CmdAutofillTimetable(), CmdBuildAirport(), CmdBuildObject(), CmdBuildVehicle(), CmdChangeServiceInt(), CmdCompanyAllowListCtrl(), CmdDoTownAction(), CmdForceTrainProceed(), CmdMoveRailVehicle(), CmdPause(), CmdRefitVehicle(), CmdRenameDepot(), CmdReverseTrainDirection(), CmdSetAutoReplace(), CmdSetGroupFlag(), CmdSetTimetableStart(), CmdSetVehicleOnTime(), CmdStartStopVehicle(), CompaniesGenStatistics(), Train::ConsistChanged(), Vehicle::Crash(), DecreaseVehicleValue(), DeleteLastWagon(), DirtyCompanyInfrastructureWindows(), DoCreateNewIndustry(), DoStartupNewCompany(), Vehicle::HandleBreakdown(), IConsoleGUIPrint(), IndustryProductionCallback(), InvalidateCompanyWindows(), InvalidateVehicleOrder(), Vehicle::LeaveUnbunchingDepot(), LoadUnloadVehicle(), NewGRFParametersWindow::OnClick(), BuildSignalWindow::OnClick(), GenerateLandscapeWindow::OnDropdownSelect(), Aircraft::OnNewEconomyDay(), RoadVehicle::OnNewEconomyDay(), Ship::OnNewEconomyDay(), Train::OnNewEconomyDay(), Industry::PostDestructor(), GroundVehicle< T, Type >::PowerChanged(), Vehicle::PreDestructor(), ClientNetworkCoordinatorSocketHandler::Receive_GC_REGISTER_ACK(), ClientNetworkGameSocketHandler::Receive_SERVER_MAP_BEGIN(), ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DATA(), ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(), ClientNetworkGameSocketHandler::Receive_SERVER_MAP_SIZE(), ClientNetworkGameSocketHandler::Receive_SERVER_WAIT(), ClientNetworkCoordinatorSocketHandler::Register(), RemoveAirport(), RemoveOrderFromAllVehicles(), ClientNetworkGameSocketHandler::SendJoin(), SetTrainGroupID(), GRFConfig::SetValue(), SetViewportCatchmentStation(), SetViewportCatchmentTown(), SetViewportCatchmentWaypoint(), TownActionBribe(), TownActionFundBuildings(), TrainController(), TrainEnterStation(), TriggerIndustryProduction(), UpdateCompanyRatingAndValue(), UpdateTownGrowth(), UpdateTownGrowthRate(), UpdateTrainGroupID(), UpdateVehicleTimetable(), Town::UpdateVirtCoord(), Station::UpdateVirtCoord(), VehicleEnterDepot(), and VehicleServiceInDepot().
void SetWindowWidgetDirty | ( | WindowClass | cls, |
WindowNumber | number, | ||
WidgetID | widget_index | ||
) |
Mark a particular widget in a particular window as dirty (in need of repainting)
cls | Window class |
number | Window number in that class |
widget_index | Index number of the widget that needs repainting |
Definition at line 3114 of file window.cpp.
References Window::SetWidgetDirty(), Window::window_class, and Window::window_number.
Referenced by Station::AfterStationTileSetChange(), AircraftHandleDestTooFar(), Vehicle::BeginLoading(), CheckIfTrainNeedsService(), CmdOpenCloseAirport(), CmdRemoveFromRailStation(), CmdStartStopVehicle(), Vehicle::Crash(), Vehicle::HandlePathfindingResult(), InvalidateCompanyWindows(), MarkTrainAsStuck(), NormaliseTrainHead(), GroundVehicle< T, Type >::PowerChanged(), RemoveFromRailBaseStation(), RemoveRoadWaypointStop(), ReverseTrainDirection(), Vehicle::SendToDepot(), GroundVehicle< T, Type >::SetLastSpeed(), ShipAccelerate(), ShipMoveUpDownOnLock(), TryPathReserve(), UpdateAircraftSpeed(), UpdateAirplanesOnNewStation(), and UpdateStationAcceptance().
void ShowVitalWindows | ( | ) |
Show the vital in-game windows.
Definition at line 575 of file main_gui.cpp.
References AllocateToolbar(), and ShowStatusBar().
Referenced by _GenerateWorld(), HighScoreWindow::Close(), and SetupColoursAndInitialWindow().
void UnInitWindowSystem | ( | ) |
Close down the windowing system.
Definition at line 1804 of file window.cpp.
References _z_windows, Window::Close(), Window::DeleteClosedWindows(), and UnshowCriticalError().
Referenced by ResetWindowSystem(), and ShutdownGame().