Window functions not directly related to making/drawing windows. More...
#include "window_type.h"
#include "company_type.h"
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. | |
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. | |
void | ResizeWindow (Window *w, int x, int y) |
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 | 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 () |
void | InputLoop () |
Regular call from the global game loop. | |
void | InvalidateWindowData (WindowClass cls, WindowNumber number, int data=0) |
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) |
Mark window data of all windows of a given class as invalid (in need of re-computing). | |
void | DeleteNonVitalWindows () |
Try to delete a non-vital window. | |
void | DeleteAllNonVitalWindows () |
It is possible that a stickied window gets to a position where the 'close' button is outside the gaming area. | |
void | DeleteConstructionWindows () |
Delete all windows that are used for construction of vehicle etc. | |
void | HideVitalWindows () |
Delete all always on-top windows to get an empty screen. | |
void | ShowVitalWindows () |
void | ReInitAllWindows () |
Re-initialize all windows. | |
void | SetWindowWidgetDirty (WindowClass cls, WindowNumber number, byte 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). | |
void | DeleteWindowById (WindowClass cls, WindowNumber number, bool force=true) |
Delete a window by its class and window number (if it is open). | |
void | DeleteWindowByClass (WindowClass cls) |
Delete all windows of a given class. |
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 778 of file window.cpp.
References Window::owner, and Window::window_class.
void DeleteAllNonVitalWindows | ( | ) |
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 2559 of file window.cpp.
References DeleteNonVitalWindows(), Window::flags4, and WF_STICKY.
Referenced by GenerateWorld(), and MainWindow::OnKeyPress().
void DeleteConstructionWindows | ( | ) |
Delete 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 2582 of file window.cpp.
References Window::desc_flags, Window::SetDirty(), and WDF_CONSTRUCTION.
Referenced by SetLocalCompany().
void DeleteNonVitalWindows | ( | ) |
Try to delete 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 2529 of file window.cpp.
References Window::flags4, WF_STICKY, and Window::window_class.
Referenced by DeleteAllNonVitalWindows(), and MainWindow::OnKeyPress().
void DeleteWindowByClass | ( | WindowClass | cls | ) |
Delete all windows of a given class.
cls | Window class of windows to delete |
Definition at line 730 of file window.cpp.
References Window::window_class.
Referenced by InvalidateNewGRFChangeWindows(), NewGRFConfirmationCallback(), NewGRFWindow::OnClick(), GameOptionsWindow::OnDropdownSelect(), NewGRFWindow::OnDropdownSelect(), VehicleGroupWindow::OnInvalidateData(), BuildRoadToolbarWindow::OnPlaceObjectAbort(), BuildRailToolbarWindow::OnPlaceObjectAbort(), BuildDocksToolbarWindow::OnPlaceObjectAbort(), ShowAIListWindow(), ShowAISettingsWindow(), ShowBuildAirToolbar(), ShowBuildBridgeWindow(), ShowBuildDocksToolbar(), ShowBuildRailToolbar(), ShowBuildRoadToolbar(), ShowEndGameChart(), ShowHighscoreTable(), ShowNewGRFSettings(), and ShowSetDateWindow().
void DeleteWindowById | ( | WindowClass | cls, | |
WindowNumber | number, | |||
bool | force | |||
) |
Delete 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 deletion; if false don't delete when stickied |
Definition at line 717 of file window.cpp.
References FindWindowById(), Window::flags4, and WF_STICKY.
Referenced by ClientNetworkContentSocketHandler::BeforeDownload(), CleanupGeneration(), ClientNetworkGameSocketHandler::ClientError(), CmdCompanyCtrl(), CmdDeleteGroup(), CmdMoveRailVehicle(), DeleteCompanyWindows(), DeleteNewGRFInspectWindow(), DispatchLeftClickEvent(), EnginesDailyLoop(), GuiShowTooltips(), HideVitalWindows(), IConsoleSwitch(), MoveToNextItem(), NetworkDisconnect(), SelectStationWindow< T >::OnClick(), BuildRoadStationWindow::OnClick(), BuildRoadToolbarWindow::OnClick(), BuildRailStationWindow::OnClick(), NetworkGameWindow::OnClick(), BuildRailStationWindow::OnDropdownSelect(), NetworkClientListPopupWindow::OnMouseLoop(), ScenarioEditorLandscapeGenerationWindow::OnPlaceObjectAbort(), TerraformToolbarWindow::OnPlaceObjectAbort(), BuildRoadToolbarWindow::OnPlaceObjectAbort(), BuildRailToolbarWindow::OnPlaceObjectAbort(), BuildDocksToolbarWindow::OnPlaceObjectAbort(), BuildAirToolbarWindow::OnPlaceObjectAbort(), PopupClientList(), Vehicle::PreDestructor(), RemoveAirport(), Vehicle::RemoveFromShared(), ShowAIConfigWindow(), ShowCheatWindow(), ShowCustCurrency(), ShowDropDownList(), ShowErrorMessage(), ShowGameDifficulty(), ShowGameOptions(), ShowGameSettings(), ShowMessageHistory(), ShowNetworkContentListWindow(), ShowNetworkLobbyWindow(), ShowNewsMessage(), ShowOnScreenKeyboard(), ShowQueryString(), ShowVehicleDetailsWindow(), ShowVehicleRefitWindow(), StartWindowDrag(), StartWindowSizing(), AI::Stop(), ToggleRailButton_Remove(), Depot::~Depot(), Station::~Station(), and Town::~Town().
Window* FindWindowByClass | ( | WindowClass | cls | ) |
Find any window by its class.
Useful when searching for a window that uses the window number as a WindowType, like WC_SEND_NETWORK_MSG.
cls | Window class |
NULL
if not available Definition at line 701 of file window.cpp.
References Window::window_class.
Referenced by GetAutoPlacePosition(), Window::InitializeData(), IsGoodAutoPlace1(), and IndustryCargoesWindow::OnClick().
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 |
NULL
if not available Definition at line 685 of file window.cpp.
References Window::window_class, and Window::window_number.
Referenced by BringWindowToFrontById(), ChangeVehicleWindow(), DeleteDepotHighlightOfVehicle(), DeleteNewGRFInspectWindow(), DeleteWindowById(), SmallMapWindow::DrawMapIndicators(), StatusBarWindow::DrawWidget(), EnsureVisibleCaption(), FindVehicleGroupWindow(), Window::FindWindowPlacementAndResize(), GenerateWorld(), GenericPlaceSignals(), TileHighlightData::GetCallbackWnd(), GetLobbyCompanyInfo(), GetMainViewBottom(), GetMainViewTop(), GetToolbarAlignedWindowPosition(), HandleAutoSignalPlacement(), HandleKeypress(), HandleViewportScroll(), Window::InitializeData(), IsNewsTickerShown(), LocalGetWindowPlacement(), MakeZoomedInScreenshot(), NetworkContentDownloadStatusWindow::NetworkContentDownloadStatusWindow(), ExtraViewportWindow::OnClick(), VehicleViewWindow::OnClick(), SmallMapWindow::OnClick(), NetworkChatWindow::OnInitialPosition(), ErrmsgWindow::OnInitialPosition(), ScenarioEditorToolbarWindow::OnInvalidateData(), MainToolbarWindow::OnInvalidateData(), NetworkContentListWindow::OnInvalidateData(), NetworkChatWindow::OnKeyPress(), QueryStringWindow::OnKeyPress(), DropdownWindow::OnMouseLoop(), BuildRailToolbarWindow::OnPlaceDrag(), PositionWindow(), ReadyForNextItem(), ReinitGuiAfterToggleElrail(), RelocateAllWindows(), ResetSignalVariant(), ScrollMainWindowTo(), SetDefaultRailGui(), ShowExtraViewPortWindow(), ShowLastNewsMessage(), ShowQuery(), StationJoinerNeeded(), and UpdateOSKOriginalText().
int GetMainViewBottom | ( | ) |
Return the bottom of the main view available for general use.
Definition at line 1617 of file window.cpp.
References FindWindowById(), and Window::top.
Referenced by TooltipsWindow::OnInitialPosition(), ErrmsgWindow::OnInitialPosition(), BuildBridgeWindow::OnInitialPosition(), and ShowDropDownList().
int GetMainViewTop | ( | ) |
Return the top of the main view available for general use.
Definition at line 1606 of file window.cpp.
References FindWindowById(), Window::height, and Window::top.
Referenced by TooltipsWindow::OnInitialPosition(), ErrmsgWindow::OnInitialPosition(), BuildBridgeWindow::OnInitialPosition(), and ShowDropDownList().
void InvalidateWindowClassesData | ( | WindowClass | cls, | |
int | data | |||
) |
Mark window data of all windows of a given class as invalid (in need of re-computing).
cls | Window class | |
data | The data to invalidate with |
Definition at line 2503 of file window.cpp.
References Window::InvalidateData(), and Window::window_class.
Referenced by AddRemoveEngineFromAutoreplaceAndBuildWindows(), ClickChangeDateCheat(), ClickSetProdCheat(), CmdBuildVehicle(), CmdCloneOrder(), CmdMoveOrder(), CmdMoveRailVehicle(), CmdPause(), CmdRefitVehicle(), CmdRenameVehicle(), CmdSellRailWagon(), Vehicle::Crash(), DecloneOrder(), DeleteOrder(), InsertOrder(), InvalidateNewGRFChangeWindows(), IndustryCargoesWindow::NotifySmallmap(), SmallMapWindow::OnClick(), NewGRFWindow::OnClick(), OnNewYear(), Vehicle::PreDestructor(), RoadVehAccelerationModelChanged(), SetNewLandscapeType(), and NetworkContentDownloadStatusWindow::~NetworkContentDownloadStatusWindow().
void InvalidateWindowData | ( | WindowClass | cls, | |
WindowNumber | number, | |||
int | data | |||
) |
Mark window data of the window of a given class and specific window number as invalid (in need of re-computing).
Definition at line 2490 of file window.cpp.
References Window::InvalidateData(), Window::window_class, and Window::window_number.
Referenced by AddRemoveEngineFromAutoreplaceAndBuildWindows(), Subsidy::AwardTo(), ChangePopulation(), CmdAddSharedVehicleGroup(), CmdAddVehicleGroup(), CmdBuildAirport(), CmdBuildBuoy(), CmdBuildDock(), CmdBuildRailStation(), CmdBuildRailWagon(), CmdBuildRoadStop(), CmdBuildVehicle(), CmdCompanyCtrl(), CmdConvertRail(), CmdCreateGroup(), CmdDeleteGroup(), CmdMoveRailVehicle(), CmdPlaceSign(), CmdRefitVehicle(), CmdRemoveAllVehiclesGroup(), CmdRenameGroup(), CmdRenameSign(), CmdRenameStation(), CmdRenameTown(), CmdSellRailWagon(), CmdSetCompanyColour(), CmdSetGroupReplaceProtection(), Company::Company(), Train::ConsistChanged(), DeleteStationIfEmpty(), DoCreateNewIndustry(), DoCreateTown(), StatusBarWindow::DrawWidget(), HandleMouseEvents(), IndustryDailyLoop(), InvalidateAutoreplaceWindow(), InvalidateVehicleOrder(), LoadUnloadVehicle(), AILog::Log(), MoveToNextItem(), NewVehicleAvailable(), NormaliseTrainHead(), GraphLegendWindow::OnClick(), MainWindow::OnInvalidateData(), Town::PostDestructor(), BaseStation::PostDestructor(), Industry::PostDestructor(), Company::PostDestructor(), Vehicle::PreDestructor(), RecomputePrices(), ReloadNewGRFData(), RemoveBuoy(), Vehicle::RemoveFromShared(), SaveFileDone(), SaveFileStart(), SetLocalCompany(), ShowTicker(), AI::StartNew(), AI::Stop(), UpdateNetworkGameWindow(), Waypoint::UpdateVirtCoord(), VehicleEnter_Track(), NetworkClientInfo::~NetworkClientInfo(), NetworkContentDownloadStatusWindow::~NetworkContentDownloadStatusWindow(), 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 NULL . |
Definition at line 2657 of file window.cpp.
References _settings_client, DEBUG, ClientSettings::gui, PositionWindow(), and GUISettings::toolbar_pos.
Referenced by RelocateAllWindows(), and v_PositionMainToolbar().
int PositionNewsMessage | ( | Window * | w | ) |
(Re)position news message window at the screen.
w | Window structure of the news message window, may also be NULL . |
Definition at line 2679 of file window.cpp.
References _settings_client, DEBUG, ClientSettings::gui, PositionWindow(), and GUISettings::statusbar_pos.
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 NULL . |
Definition at line 2668 of file window.cpp.
References _settings_client, DEBUG, ClientSettings::gui, PositionWindow(), and GUISettings::statusbar_pos.
Referenced by RelocateAllWindows(), and v_PositionStatusbar().
void ReInitAllWindows | ( | ) |
Re-initialize all windows.
Definition at line 2609 of file window.cpp.
References NWidgetLeaf::InvalidateDimensionCache(), MarkWholeScreenDirty(), NetworkReInitChatBoxSize(), Window::ReInit(), and RelocateAllWindows().
Referenced by InvalidateNewGRFChangeWindows(), LoadStringWidthTable(), NewGRFConfirmationCallback(), and GameOptionsWindow::OnDropdownSelect().
void ResizeWindow | ( | Window * | w, | |
int | delta_x, | |||
int | delta_y | |||
) |
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 |
Definition at line 1579 of file window.cpp.
References _current_text_dir, NWidgetBase::AssignSizePosition(), NWidgetBase::current_x, NWidgetBase::current_y, EnsureVisibleCaption(), Window::height, Window::left, max(), Window::nested_root, Window::OnResize(), NWidgetBase::resize_x, NWidgetBase::resize_y, Window::SetDirty(), NWidgetBase::smallest_x, NWidgetBase::smallest_y, ST_RESIZE, TD_RTL, Window::top, and Window::width.
Referenced by NetworkClientListWindow::CheckClientListHeight(), TownAuthorityWindow::DrawRatings(), Window::FindWindowPlacementAndResize(), HandleWindowDragging(), BuildRoadStationWindow::OnPaint(), BuildRailStationWindow::OnPaint(), BuildDocksStationWindow::OnPaint(), BuildAirportWindow::OnPaint(), Window::ReInit(), and RelocateAllWindows().
void SetWindowClassesDirty | ( | WindowClass | cls | ) |
Mark all windows of a particular class as dirty (in need of repainting).
cls | Window class |
Definition at line 2476 of file window.cpp.
References Window::SetDirty(), and Window::window_class.
Referenced by CmdRenameDepot(), CmdSkipToOrder(), CmdStartStopVehicle(), NewGRFParametersWindow::OnClick(), Train::OnNewDay(), Ship::OnNewDay(), RoadVehicle::OnNewDay(), OnNewDay(), Aircraft::OnNewDay(), OnNewMonth(), ProcessOrders(), RecomputePrices(), RedrawSmallmap(), RoadVehAccelerationModelChanged(), GRFParameterInfo::SetValue(), and NetworkContentDownloadStatusWindow::~NetworkContentDownloadStatusWindow().
void SetWindowDirty | ( | WindowClass | cls, | |
WindowNumber | number | |||
) |
Mark window as dirty (in need of repainting).
Definition at line 2448 of file window.cpp.
References Window::SetDirty(), Window::window_class, and Window::window_number.
Referenced by AddNewsItem(), AgeVehicle(), AircraftEventHandler_AtTerminal(), ChangePopulation(), ChangeTownRating(), ClickChangeDateCheat(), CmdAddVehicleGroup(), CmdAutofillTimetable(), CmdBuildAirport(), CmdBuildObject(), CmdBuildVehicle(), CmdBuyShareInCompany(), CmdChangeCompanySetting(), CmdChangeServiceInt(), CmdChangeSetting(), CmdDoTownAction(), CmdForceTrainProceed(), CmdPause(), CmdRefitVehicle(), CmdRenameDepot(), CmdReverseTrainDirection(), CmdSellShareInCompany(), CmdSetTimetableStart(), CmdSetVehicleOnTime(), CmdStartStopVehicle(), CompaniesGenStatistics(), CompaniesYearlyLoop(), Train::ConsistChanged(), Vehicle::Crash(), DeleteLastWagon(), DeleteNewsItem(), DoStartupNewCompany(), Vehicle::HandleBreakdown(), IConsoleGUIPrint(), IndustryDailyLoop(), IndustryProductionCallback(), InvalidateCompanyWindows(), InvalidateVehicleOrder(), LoadUnloadVehicle(), BuildSignalWindow::OnClick(), GameOptionsWindow::OnDropdownSelect(), Train::OnNewDay(), Ship::OnNewDay(), RoadVehicle::OnNewDay(), Aircraft::OnNewDay(), OnNewMonth(), GroundVehicle< T, Type >::PowerChanged(), Vehicle::PreDestructor(), RemoveAirport(), RemoveOrderFromAllVehicles(), SetSettingValue(), SetTrainGroupID(), TrainEnterStation(), TriggerIndustryProduction(), UpdateCompanyRatingAndValue(), UpdateTownGrowRate(), UpdateTrainGroupID(), Town::UpdateVirtCoord(), Station::UpdateVirtCoord(), and NetworkContentDownloadStatusWindow::~NetworkContentDownloadStatusWindow().
void SetWindowWidgetDirty | ( | WindowClass | cls, | |
WindowNumber | number, | |||
byte | 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 2462 of file window.cpp.
References Window::SetWidgetDirty(), Window::window_class, and Window::window_number.
Referenced by CmdBuildAirport(), CmdBuildDock(), CmdBuildRailStation(), CmdBuildRoadStop(), CmdRemoveFromRailStation(), CmdStartStopVehicle(), Vehicle::Crash(), MarkTrainAsStuck(), NormaliseTrainHead(), OnNewDay(), GroundVehicle< T, Type >::PowerChanged(), RemoveAirport(), RemoveDock(), RemoveFromRailBaseStation(), RemoveRailStation(), RemoveRoadStop(), RoadVehAccelerate(), Vehicle::SendToDepot(), TryPathReserve(), UpdateAircraftSpeed(), and UpdateStationAcceptance().