OpenTTD Source 20250905-master-g122023be8d
|
Windowing system, widgets and events. More...
#include "stdafx.h"
#include "company_func.h"
#include "gfx_func.h"
#include "console_func.h"
#include "console_gui.h"
#include "viewport_func.h"
#include "progress.h"
#include "blitter/factory.hpp"
#include "zoom_func.h"
#include "vehicle_base.h"
#include "depot_func.h"
#include "window_func.h"
#include "tilehighlight_func.h"
#include "network/network.h"
#include "querystring_gui.h"
#include "strings_func.h"
#include "settings_type.h"
#include "settings_func.h"
#include "ini_type.h"
#include "newgrf_debug.h"
#include "hotkeys.h"
#include "toolbar_gui.h"
#include "statusbar_gui.h"
#include "error.h"
#include "game/game.hpp"
#include "video/video_driver.hpp"
#include "framerate_type.h"
#include "network/network_func.h"
#include "news_func.h"
#include "sound_func.h"
#include "timer/timer.h"
#include "timer/timer_window.h"
#include "table/strings.h"
#include "safeguards.h"
Go to the source code of this file.
Enumerations | |
enum | ViewportAutoscrolling : uint8_t { VA_DISABLED , VA_MAIN_VIEWPORT_FULLSCREEN , VA_MAIN_VIEWPORT , VA_EVERY_VIEWPORT } |
Values for _settings_client.gui.auto_scrolling. More... | |
enum | PreventHideDirection : uint8_t { PHD_UP , PHD_DOWN } |
Direction for moving the window. More... | |
enum | MouseClick : uint8_t { MC_NONE = 0 , MC_LEFT , MC_RIGHT , MC_DOUBLE_LEFT , MC_HOVER } |
Functions | |
static bool | DescSorter (WindowDesc *const &a, WindowDesc *const &b) |
Sort WindowDesc by ini_key. | |
void | SetFocusedWindow (Window *w) |
Set the window that has the focus. | |
bool | EditBoxInGlobalFocus () |
Check if an edit box is in global focus. | |
bool | FocusedWindowIsConsole () |
Check if a console is focused. | |
static void | StartWindowDrag (Window *w) |
Start window dragging. | |
static void | StartWindowSizing (Window *w, bool to_left) |
Start resizing a window. | |
static void | DispatchLeftClickEvent (Window *w, int x, int y, int click_count) |
Dispatch left mouse-button (possibly double) click in window. | |
static void | DispatchRightClickEvent (Window *w, int x, int y) |
Dispatch right mouse-button click in window. | |
static void | DispatchHoverEvent (Window *w, int x, int y) |
Dispatch hover of the mouse over a window. | |
static void | DispatchMouseWheelEvent (Window *w, NWidgetCore *nwid, int wheel) |
Dispatch the mousewheel-action to the window. | |
static bool | MayBeShown (const Window *w) |
Returns whether a window may be shown or not. | |
static void | DrawOverlappedWindow (Window *w, int left, int top, int right, int bottom) |
Generate repaint events for the visible part of window w within the rectangle. | |
void | DrawOverlappedWindowForAll (int left, int top, int right, int bottom) |
From a rectangle that needs redrawing, find the windows that intersect with the rectangle. | |
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 | CloseWindowById (WindowClass cls, WindowNumber number, bool force, int data) |
Close a window by its class and window number (if it is open). | |
void | CloseWindowByClass (WindowClass cls, int data) |
Close all windows of a given class. | |
void | CloseCompanyWindows (CompanyID id) |
Close all windows of a company. | |
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. | |
static void | BringWindowToFront (Window *w, bool dirty) |
On clicking on a window, make it the frontmost window of all windows with an equal or lower z-priority. | |
Window * | BringWindowToFrontById (WindowClass cls, WindowNumber number) |
Find a window and make it the relative top-window on the screen. | |
static bool | IsVitalWindow (const Window *w) |
static uint | GetWindowZPriority (WindowClass wc) |
Get the z-priority for a given window. | |
static bool | IsGoodAutoPlace1 (int left, int top, int width, int height, int toolbar_y, Point &pos) |
Decide whether a given rectangle is a good place to open a completely visible new window. | |
static bool | IsGoodAutoPlace2 (int left, int top, int width, int height, int toolbar_y, Point &pos) |
Decide whether a given rectangle is a good place to open a mostly visible new window. | |
static Point | GetAutoPlacePosition (int width, int height) |
Find a good place for opening a new window of a given width and height. | |
Point | GetToolbarAlignedWindowPosition (int window_width) |
Computer the position of the top-left corner of a window to be opened right under the toolbar. | |
static Point | LocalGetWindowPlacement (const WindowDesc &desc, int16_t sm_width, int16_t sm_height, int window_number) |
Compute the position of the top-left corner of a new window that is opened. | |
Window * | FindWindowFromPt (int x, int y) |
Do a search for a window at specific coordinates. | |
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. | |
static void | DecreaseWindowCounters () |
static void | HandlePlacePresize () |
static EventState | HandleMouseDragDrop () |
Handle dragging and dropping in mouse dragging mode (WSM_DRAGDROP). | |
static void | HandleMouseOver () |
Report position of the mouse to the underlying window. | |
static void | PreventHiding (int *nx, int *ny, const Rect &rect, const Window *v, int px, PreventHideDirection dir) |
Do not allow hiding of the rectangle with base coordinates nx and ny behind window v. | |
static void | EnsureVisibleCaption (Window *w, int nx, int ny) |
Make sure at least a part of the caption bar is still visible by moving the window if necessary. | |
void | ResizeWindow (Window *w, int delta_x, int delta_y, bool clamp_to_screen, bool schedule_resize) |
Resize the window. | |
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. | |
static EventState | HandleWindowDragging () |
Handle dragging/resizing of a window. | |
static void | HandleScrollbarScrolling (Window *w) |
Handle scrollbar scrolling with the mouse. | |
static EventState | HandleActiveWidget () |
Handle active widget (mouse dragging on widget) with the mouse. | |
static EventState | HandleViewportScroll () |
Handle viewport scrolling with the mouse. | |
static bool | MaybeBringWindowToFront (Window *w) |
Check if a window can be made relative top-most window, and if so do it. | |
void | HandleToolbarHotkey (int hotkey) |
Handle Toolbar hotkey events - can come from a source like the MacBook Touch Bar. | |
void | HandleKeypress (uint keycode, char32_t key) |
Handle keyboard input. | |
void | HandleCtrlChanged () |
State of CONTROL key has changed. | |
void | HandleTextInput (std::string_view str, bool marked, std::optional< size_t > caret, std::optional< size_t > insert_location, std::optional< size_t > replacement_end) |
Handle text input. | |
static void | HandleAutoscroll () |
If needed and switched on, perform auto scrolling (automatically moving window contents when mouse is near edge of the window). | |
EventState | VpHandlePlaceSizingDrag () |
Handle the mouse while dragging for placement/resizing. | |
const std::chrono::milliseconds | TIME_BETWEEN_DOUBLE_CLICK (500) |
Time between 2 left clicks before it becoming a double click. | |
static void | ScrollMainViewport (int x, int y) |
static void | HandleKeyScrolling () |
static void | MouseLoop (MouseClick click, int mousewheel) |
void | HandleMouseEvents () |
Handle a mouse event from the video driver. | |
static void | CheckSoftLimit () |
Check the soft limit of deletable (non vital, non sticky) windows. | |
void | InputLoop () |
Regular call from the global game loop. | |
bool | CanContinueRealtimeTick () |
void | CallWindowRealtimeTickEvent (uint delta_ms) |
Dispatch OnRealtimeTick event over all windows. | |
void | UpdateWindows () |
Update the continuously changing contents of the windows, such as the viewports. | |
void | SetWindowDirty (WindowClass cls, WindowNumber number) |
Mark window as dirty (in need of repainting) | |
void | SetWindowWidgetDirty (WindowClass cls, WindowNumber number, WidgetID widget_index) |
Mark a particular widget in a particular 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 | 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) | |
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. | |
void | CallWindowGameTickEvent () |
Dispatch OnGameTick event over all windows. | |
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 | ReInitWindow (Window *w, bool zoom_changed) |
void | ReInitAllWindows (bool zoom_changed) |
Re-initialize all windows. | |
static int | PositionWindow (Window *w, WindowClass clss, int setting) |
(Re)position a window at the screen. | |
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. | |
void | ChangeVehicleViewports (VehicleID from_index, VehicleID to_index) |
Switches viewports following vehicles, which get autoreplaced. | |
void | RelocateAllWindows (int neww, int newh) |
Relocate all windows to fit the new size of the game application screen. | |
Variables | |
static Point | _drag_delta |
delta between mouse cursor and upper left corner of dragged window | |
static Window * | _mouseover_last_w = nullptr |
Window of the last OnMouseOver event. | |
static Window * | _last_scroll_window = nullptr |
Window of the last scroll event. | |
WindowList | _z_windows |
List of windows opened at the screen sorted from the front to back. | |
bool | _window_highlight_colour = false |
If false, highlight is white, otherwise the by the widget defined colour. | |
Window * | _focused_window |
Point | _cursorpos_drag_start |
int | _scrollbar_start_pos |
int | _scrollbar_size |
uint8_t | _scroller_click_timeout = 0 |
bool | _scrolling_viewport |
A viewport is being scrolled with the mouse. | |
bool | _mouse_hovering |
The mouse is hovering over the same point. | |
SpecialMouseMode | _special_mouse_mode |
Mode of the mouse. | |
std::vector< WindowDesc * > * | _window_descs = nullptr |
List of all WindowDescs. | |
std::string | _windows_file |
Config file to store WindowDesc. | |
static bool | _dragging_window |
A window is being dragged or resized. | |
static constexpr int | MAX_OFFSET_DOUBLE_CLICK = 5 |
How much the mouse is allowed to move to call it a double click. | |
static constexpr int | MAX_OFFSET_HOVER = 5 |
Maximum mouse movement before stopping a hover event. | |
static const int8_t | scrollamt [16][2] |
Describes all the different arrow key combinations the game allows when it is in scrolling mode. | |
static std::chrono::time_point< std::chrono::steady_clock > | _realtime_tick_start |
static const IntervalTimer< TimerWindow > | window_interval (std::chrono::milliseconds(30), [](auto) { extern int _caret_timer;_caret_timer+=3;CursorTick();HandleKeyScrolling();HandleAutoscroll();DecreaseWindowCounters();}) |
Update various of window-related information on a regular interval. | |
static const IntervalTimer< TimerWindow > | highlight_interval (TIMER_BLINK_INTERVAL, [](auto) { _window_highlight_colour=!_window_highlight_colour;}) |
Blink the window highlight colour constantly. | |
static const IntervalTimer< TimerWindow > | white_border_interval (std::chrono::milliseconds(30), [](auto) { if(_network_dedicated) return;for(Window *w :Window::Iterate()) { if(w->flags.Test(WindowFlag::WhiteBorder) &&--w->white_border_timer==0) { w->flags.Reset(WindowFlag::WhiteBorder);w->SetDirty();} } }) |
Blink all windows marked with a white border. | |
Windowing system, widgets and events.
Definition in file window.cpp.
enum MouseClick : uint8_t |
Definition at line 2763 of file window.cpp.
enum PreventHideDirection : uint8_t |
Direction for moving the window.
Enumerator | |
---|---|
PHD_UP | Above v is a safe position. |
PHD_DOWN | Below v is a safe position. |
Definition at line 1983 of file window.cpp.
enum ViewportAutoscrolling : uint8_t |
Values for _settings_client.gui.auto_scrolling.
Definition at line 48 of file window.cpp.
|
static |
On clicking on a window, make it the frontmost window of all windows with an equal or lower z-priority.
The window is marked dirty for a repaint
w | window that is put into the relative foreground |
dirty | whether to mark the window dirty |
Definition at line 1394 of file window.cpp.
References _z_windows, GetWindowZPriority(), Window::SetDirty(), and Window::window_class.
Referenced by BringWindowToFrontById(), Window::InitializeData(), MaybeBringWindowToFront(), StartWindowDrag(), and StartWindowSizing().
Window * BringWindowToFrontById | ( | WindowClass | cls, |
WindowNumber | number | ||
) |
Find a window and make it the relative top-window on the screen.
The window gets unshaded if it was shaded, and a white border is drawn at its edges for a brief period of time to visualize its "activation".
cls | WindowClass of the window to activate |
number | WindowNumber of the window to activate |
Definition at line 1273 of file window.cpp.
References BringWindowToFront(), FindWindowById(), Window::IsShaded(), Window::SetDirty(), Window::SetShaded(), and Window::SetWhiteBorder().
Referenced by AllocateWindowDescFront(), DoSelectCompanyManagerFace(), NetworkContentListWindow::OnClick(), ShowBuyCompanyDialog(), ShowCompanyFinances(), ShowDepotWindow(), ShowGenerateWorldProgress(), ShowIndustryCargoesWindow(), and ShowScriptDebugWindow().
void CallWindowGameTickEvent | ( | ) |
Dispatch OnGameTick event over all windows.
Definition at line 3302 of file window.cpp.
References Window::OnGameTick().
Referenced by StateGameLoop().
void CallWindowRealtimeTickEvent | ( | uint | delta_ms | ) |
Dispatch OnRealtimeTick event over all windows.
Definition at line 3064 of file window.cpp.
References Window::OnRealtimeTick().
Referenced by UpdateWindows().
bool CanContinueRealtimeTick | ( | ) |
Definition at line 3055 of file window.cpp.
Switches viewports following vehicles, which get autoreplaced.
from_index | the old vehicle ID |
to_index | the new vehicle ID |
Definition at line 3489 of file window.cpp.
References Window::SetDirty(), and Window::viewport.
Referenced by CopyHeadSpecificThings().
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 1238 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().
|
static |
Check the soft limit of deletable (non vital, non sticky) windows.
Definition at line 3013 of file window.cpp.
References _settings_client, Window::Close(), Window::flags, ClientSettings::gui, Sticky, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), WC_MAIN_WINDOW, Window::window_class, and GUISettings::window_soft_limit.
Referenced by InputLoop().
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 3334 of file window.cpp.
References Window::Close(), WindowDesc::flags, NoClose, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and Window::window_desc.
Referenced by GenerateWorld(), and MainWindow::OnHotkey().
void CloseCompanyWindows | ( | CompanyID | id | ) |
Close all windows of a company.
We identify windows of a company by looking at the caption colour. If it is equal to the company ID then we say the window belongs to the company and should be closed
id | company identifier |
Definition at line 1218 of file window.cpp.
References CloseWindowById(), and WC_BUY_COMPANY.
Referenced by Company::~Company().
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 3359 of file window.cpp.
References Window::Close(), Construction, WindowDesc::flags, Window::SetDirty(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), 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 3315 of file window.cpp.
References Window::Close(), WindowDesc::flags, Window::flags, NoClose, Sticky, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), 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 1202 of file window.cpp.
Referenced by ScriptListWindow::ChangeScript(), ScriptDebugWindow::ChangeToScript(), CleanupGeneration(), AIConfigWindow::Close(), GSConfigWindow::Close(), NewGRFWindow::Close(), ClientNetworkCoordinatorSocketHandler::CloseTurnHandler(), DoScanNewGRFFiles(), InvalidateNewGRFChangeWindows(), NewGRFConfirmationCallback(), NewGRFWindow::OnClick(), NewGRFWindow::OnDropdownSelect(), GameOptionsWindow::OnDropdownSelect(), VehicleGroupWindow::OnInvalidateData(), NewGRFWindow::OnKeyPress(), BuildDocksToolbarWindow::OnPlaceObjectAbort(), BuildRailToolbarWindow::OnPlaceObjectAbort(), BuildRoadToolbarWindow::OnPlaceObjectAbort(), RelocateAllWindows(), SetupEngines(), ShowAIConfigWindow(), ShowBuildAirToolbar(), ShowBuildBridgeWindow(), ShowBuildDocksToolbar(), ShowBuildRailToolbar(), ShowBuildRoadToolbar(), ShowCreateScenario(), ShowDropDownListAt(), ShowEndGameChart(), ShowGameOptions(), ShowGSConfigWindow(), ShowHighscoreTable(), ShowNetworkAskRelay(), ShowNetworkAskSurvey(), ShowNetworkChatQueryWindow(), ShowNewGRFSettings(), ShowQueryString(), ShowRenameSignWindow(), ShowSavePresetWindow(), ShowScriptListWindow(), ShowScriptSettingsWindow(), ShowSetDateWindow(), and NewGRFWindow::UpgradeCurrent().
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 1190 of file window.cpp.
References Window::Close(), FindWindowById(), Window::flags, Sticky, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().
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(), 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(), ShowBuildRoadScenToolbar(), ShowCheatWindow(), ShowCustCurrency(), ShowLandInfo(), ShowMessageHistory(), ShowNetworkContentListWindow(), ShowNewsMessage(), ShowOnScreenKeyboard(), ShowReplaceGroupVehicleWindow(), ShowSaveLoadDialog(), ShowTerraformToolbar(), ShowTimetableWindow(), ShowVehicleDetailsWindow(), ShowVehicleRefitWindow(), ToggleRailButton_Remove(), Depot::~Depot(), Station::~Station(), and Town::~Town().
|
static |
Definition at line 1878 of file window.cpp.
void DeleteAllMessages | ( | ) |
Delete all messages and close their corresponding window (if any).
Definition at line 3347 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().
|
static |
Sort WindowDesc by ini_key.
Definition at line 168 of file window.cpp.
References WindowDesc::ini_key.
Referenced by WindowDesc::SaveToConfig().
|
static |
Dispatch hover of the mouse over a window.
w | Window to dispatch event in. |
x | X coordinate of the click. |
y | Y coordinate of the click. |
Definition at line 787 of file window.cpp.
References GetEncodedString(), NWidgetCore::GetToolTip(), GuiShowTooltips(), Window::nested_root, Window::OnHover(), and Window::OnTooltip().
|
static |
Dispatch left mouse-button (possibly double) click in window.
w | Window to dispatch event in |
x | X coordinate of the click |
y | Y coordinate of the click |
click_count | Number of fast consecutive clicks at same position |
< Index of the widget
Definition at line 613 of file window.cpp.
References _ctrl_pressed, Window::Close(), NWidgetCore::disp_flags, DropdownClosed, WindowDesc::flags, Window::flags, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Flip(), WindowDesc::GetDefaultHeight(), WindowDesc::GetDefaultWidth(), Window::GetQueryString(), Window::HandleButtonClick(), Window::height, NWidgetCore::IsDisabled(), Window::IsShaded(), Window::IsWidgetHighlighted(), Window::nested_root, Game::NewEvent(), NoFocus, NWID_HSCROLLBAR, NWID_VSCROLLBAR, Window::OnClick(), NWidgetBase::pos_x, WindowDesc::pref_height, WindowDesc::pref_sticky, WindowDesc::pref_width, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset(), Window::resize, ResizeWindow(), ScrollbarClickHandler(), NWidgetBase::SetDirty(), Window::SetFocusedWidget(), SetFocusedWindow(), NWidgetCore::SetLowered(), Window::SetShaded(), Window::SetTimeout(), Window::SetWidgetHighlight(), Window::ShowNewGRFInspectWindow(), StartWindowDrag(), StartWindowSizing(), ResizeInfo::step_height, ResizeInfo::step_width, Sticky, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), NWidgetBase::type, WC_DROPDOWN_MENU, WC_OSK, Window::width, Window::window_class, Window::window_desc, Window::window_number, WWT_CAPTION, WWT_CLOSEBOX, WWT_DEBUGBOX, WWT_DEFSIZEBOX, WWT_EDITBOX, WWT_EMPTY, WWT_LAST, WWT_RESIZEBOX, WWT_SHADEBOX, and WWT_STICKYBOX.
|
static |
Dispatch the mousewheel-action to the window.
The window will scroll any compatible scrollbars if the mouse is pointed over the bar or its contents
w | Window |
nwid | the widget where the scrollwheel was used |
wheel | scroll up or down |
Definition at line 815 of file window.cpp.
References Scrollbar::GetCapacity(), Scrollbar::GetCount(), Window::GetScrollbar(), NWidgetCore::GetScrollbarIndex(), NWID_VSCROLLBAR, Window::OnScrollbarScroll(), Window::SetDirty(), Window::SetShaded(), NWidgetBase::type, Scrollbar::UpdatePosition(), WWT_CAPTION, and WWT_SHADEBOX.
|
static |
Dispatch right mouse-button click in window.
w | Window to dispatch event in |
x | X coordinate of the click |
y | Y coordinate of the click |
Definition at line 758 of file window.cpp.
References _settings_client, Window::Close(), WindowDesc::flags, Window::flags, GetEncodedString(), NWidgetCore::GetToolTip(), ClientSettings::gui, GuiShowTooltips(), GUISettings::hover_delay_ms, Window::nested_root, NoClose, Window::OnRightClick(), Window::OnTooltip(), GUISettings::right_click_wnd_close, Sticky, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and Window::window_desc.
|
static |
Generate repaint events for the visible part of window w within the rectangle.
The function goes recursively upwards in the window stack, and splits the rectangle into multiple pieces at the window edges, so obscured parts are not redrawn.
w | Window that needs to be repainted |
left | Left edge of the rectangle that should be repainted |
top | Top edge of the rectangle that should be repainted |
right | Right edge of the rectangle that should be repainted |
bottom | Bottom edge of the rectangle that should be repainted |
Definition at line 880 of file window.cpp.
References DrawOverlappedWindow(), BlitterFactory::GetCurrentBlitter(), Window::height, Window::left, MayBeShown(), Min, Blitter::MoveTo(), Window::OnPaint(), Window::top, and Window::width.
Referenced by DrawOverlappedWindow(), and DrawOverlappedWindowForAll().
void DrawOverlappedWindowForAll | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom | ||
) |
From a rectangle that needs redrawing, find the windows that intersect with the rectangle.
These windows should be re-painted.
left | Left edge of the rectangle that should be repainted |
top | Top edge of the rectangle that should be repainted |
right | Right edge of the rectangle that should be repainted |
bottom | Bottom edge of the rectangle that should be repainted |
Definition at line 942 of file window.cpp.
References DrawOverlappedWindow(), and MayBeShown().
Referenced by RedrawScreenRect().
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 447 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().
|
static |
Make sure at least a part of the caption bar is still visible by moving the window if necessary.
w | The window to check. |
nx | The proposed new x-location of the window. |
ny | The proposed new y-location of the window. |
Definition at line 2038 of file window.cpp.
References Clamp(), FindWindowById(), Rect::Height(), Window::left, Window::nested_root, PHD_DOWN, PHD_UP, PreventHiding(), Window::top, Window::viewport, WC_MAIN_TOOLBAR, WC_STATUS_BAR, and WWT_CAPTION.
Referenced by HandleWindowDragging(), RelocateAllWindows(), and ResizeWindow().
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 1163 of file window.cpp.
Referenced by GetAutoPlacePosition(), NetworkDrawChatMessage(), IndustryCargoesWindow::OnClick(), ShowScriptDebugWindow(), and UpdateNewGRFScanStatus().
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 1148 of file window.cpp.
Referenced by BringWindowToFrontById(), BuildRailStationWindow::BuildRailStationGlobalHotkeys(), ViewportData::CancelFollow(), 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().
Window * FindWindowFromPt | ( | int | x, |
int | y | ||
) |
Do a search for a window at specific coordinates.
For this we start at the topmost window, obviously and work our way down to the bottom
x | position x to query |
y | position y to query |
Definition at line 1821 of file window.cpp.
References Window::height, IsInsideBS(), Window::left, MayBeShown(), Window::top, and Window::width.
Referenced by HandleAutoscroll(), HandleMouseOver(), HandleViewportScroll(), and TooltipsWindow::OnMouseLoop().
bool FocusedWindowIsConsole | ( | ) |
Check if a console is focused.
Definition at line 461 of file window.cpp.
References WC_CONSOLE, and Window::window_class.
Referenced by VideoDriver_SDL_Base::PollEvent().
|
static |
Find a good place for opening a new window of a given width and height.
width | Width of the new window |
height | Height of the new window |
Definition at line 1612 of file window.cpp.
References _current_text_dir, NWidgetLeaf::closebox_dimension, FindWindowByClass(), FS_NORMAL, GetCharacterHeight(), Window::height, IsGoodAutoPlace1(), IsGoodAutoPlace2(), Window::left, WidgetDimensions::scaled, TD_RTL, Window::top, WC_MAIN_TOOLBAR, WC_MAIN_WINDOW, Window::width, Window::window_class, Coord2D< T >::x, and Coord2D< T >::y.
Referenced by LocalGetWindowPlacement().
int GetMainViewBottom | ( | ) |
Return the bottom of the main view available for general use.
Definition at line 2126 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 2115 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 1177 of file window.cpp.
References FindWindowById(), and WC_MAIN_WINDOW.
Referenced by ConZoomToLevel(), 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().
Point GetToolbarAlignedWindowPosition | ( | int | window_width | ) |
Computer the position of the top-left corner of a window to be opened right under the toolbar.
window_width | the width of the window to get the position for |
Definition at line 1680 of file window.cpp.
References _current_text_dir, FindWindowById(), Window::height, Window::left, TD_RTL, Window::top, WC_MAIN_TOOLBAR, and Window::width.
Referenced by LocalGetWindowPlacement(), TerraformToolbarWindow::OnInitialPosition(), and TransparenciesWindow::OnInitialPosition().
|
static |
Get the z-priority for a given window.
This is used in comparison with other z-priority values; a window with a given z-priority will appear above other windows with a lower value, and below those with a higher one (the ordering within z-priorities is arbitrary).
wc | The window class of window to get the z-priority for |
Definition at line 1310 of file window.cpp.
References WC_CONFIRM_POPUP_QUERY, WC_CONSOLE, WC_CUSTOM_CURRENCY, WC_DROPDOWN_MENU, WC_ENDSCREEN, WC_ERRMSG, WC_GAME_OPTIONS, WC_GENERATE_LANDSCAPE, WC_GRF_PARAMETERS, WC_HIGHSCORE, WC_INVALID, WC_MAIN_TOOLBAR, WC_MAIN_WINDOW, WC_MODAL_PROGRESS, WC_NETWORK_ASK_RELAY, WC_NETWORK_STATUS_WINDOW, WC_NETWORK_WINDOW, WC_NEWS_WINDOW, WC_OSK, WC_QUERY_STRING, WC_SAVE_PRESET, WC_SAVELOAD, WC_SCRIPT_LIST, WC_SCRIPT_SETTINGS, WC_SEND_NETWORK_MSG, WC_STATUS_BAR, WC_TEXTFILE, and WC_TOOLTIPS.
Referenced by BringWindowToFront().
|
static |
Handle active widget (mouse dragging on widget) with the mouse.
Definition at line 2383 of file window.cpp.
References _left_button_down, CursorVars::delta, ES_HANDLED, ES_NOT_HANDLED, Window::GetWidget(), HandleScrollbarScrolling(), Window::left, Window::mouse_capture_widget, NWID_HSCROLLBAR, NWID_VSCROLLBAR, Window::OnClick(), CursorVars::pos, Window::SetWidgetDirty(), Window::top, Coord2D< T >::x, and Coord2D< T >::y.
|
static |
If needed and switched on, perform auto scrolling (automatically moving window contents when mouse is near edge of the window).
Definition at line 2726 of file window.cpp.
References _settings_client, GUISettings::auto_scrolling, DisableVpScroll, FindWindowFromPt(), Window::flags, ClientSettings::gui, HasModalProgress(), Viewport::height, IsPtInWindowViewport(), Viewport::left, CursorVars::pos, ScaleByZoom(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Viewport::top, VA_DISABLED, VA_EVERY_VIEWPORT, VA_MAIN_VIEWPORT_FULLSCREEN, Window::viewport, WC_MAIN_WINDOW, Viewport::width, Window::window_class, Coord2D< T >::x, Coord2D< T >::y, and Viewport::zoom.
void HandleCtrlChanged | ( | ) |
State of CONTROL key has changed.
Definition at line 2685 of file window.cpp.
References ES_HANDLED, and Window::OnCTRLStateChange().
Referenced by VideoDriver_SDL_Base::InputLoop(), and VideoDriver_Win32Base::InputLoop().
void HandleKeypress | ( | uint | keycode, |
char32_t | key | ||
) |
Handle keyboard input.
keycode | Virtual keycode of the key. |
key | Unicode character of the key. |
Definition at line 2629 of file window.cpp.
References HotkeyList::CheckMatch(), EditBoxInGlobalFocus(), ES_HANDLED, FindWindowById(), Window::HandleEditBoxKey(), HasModalProgress(), WindowDesc::hotkeys, IsLocalCompany(), Window::nested_focus, Window::OnHotkey(), Window::OnKeyPress(), WC_CONSOLE, WC_MAIN_TOOLBAR, Window::window_class, and Window::window_desc.
Referenced by HandleCharMsg(), and VideoDriver_SDL_Base::PollEvent().
|
static |
Definition at line 2815 of file window.cpp.
|
static |
Handle dragging and dropping in mouse dragging mode (WSM_DRAGDROP).
Definition at line 1936 of file window.cpp.
References _left_button_down, _special_mouse_mode, CursorVars::delta, ES_HANDLED, ES_NOT_HANDLED, TileHighlightData::GetCallbackWnd(), GetWidgetFromPos(), Window::left, Window::OnDragDrop(), Window::OnMouseDrag(), CursorVars::pos, ResetObjectToPlace(), Window::top, WSM_DRAGDROP, Coord2D< T >::x, and Coord2D< T >::y.
void HandleMouseEvents | ( | ) |
Handle a mouse event from the video driver.
Definition at line 2942 of file window.cpp.
References _left_button_clicked, _left_button_down, _mouse_hovering, _newgrf_debug_sprite_picker, _right_button_clicked, _right_button_down, _settings_client, abs(), NewGrfDebugSpritePicker::clicked_pixel, CursorVars::delta, BlitterFactory::GetCurrentBlitter(), ClientSettings::gui, HasModalProgress(), GUISettings::hover_delay_ms, CursorVars::in_window, IsLocalCompany(), MarkWholeScreenDirty(), MAX_OFFSET_DOUBLE_CLICK, MAX_OFFSET_HOVER, NewGrfDebugSpritePicker::mode, Blitter::MoveTo(), CursorVars::pos, NewGrfDebugSpritePicker::sprites, TIME_BETWEEN_DOUBLE_CLICK(), CursorVars::wheel, Coord2D< T >::x, and Coord2D< T >::y.
Referenced by InputLoop(), and VideoDriver_SDL_Base::PollEvent().
|
static |
Report position of the mouse to the underlying window.
Definition at line 1960 of file window.cpp.
References _mouseover_last_w, FindWindowFromPt(), Window::left, Window::nested_root, Window::OnMouseOver(), CursorVars::pos, Window::top, Coord2D< T >::x, and Coord2D< T >::y.
|
static |
Definition at line 1916 of file window.cpp.
|
static |
Handle scrollbar scrolling with the mouse.
w | window with active scrollbar. |
Definition at line 2343 of file window.cpp.
References _current_text_dir, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Any(), NWidgetCore::disp_flags, Scrollbar::GetCapacity(), Scrollbar::GetCount(), Window::GetWidget(), Window::mouse_capture_widget, NWID_HSCROLLBAR, Window::OnScrollbarScroll(), CursorVars::pos, RoundDivSU(), ScrollbarUp, Window::SetDirty(), Scrollbar::SetPosition(), TD_RTL, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), NWidgetBase::type, Scrollbar::UpdatePosition(), Coord2D< T >::x, and Coord2D< T >::y.
Referenced by HandleActiveWidget().
void HandleTextInput | ( | std::string_view | str, |
bool | marked, | ||
std::optional< size_t > | caret, | ||
std::optional< size_t > | insert_location, | ||
std::optional< size_t > | replacement_end | ||
) |
Handle text input.
str | Text string to input. |
marked | Is the input a marked composition string from an IME? |
caret | Move the caret to this point in the insertion string. |
Definition at line 2715 of file window.cpp.
References EditBoxInGlobalFocus(), Window::InsertTextString(), Window::nested_focus, WC_CONSOLE, and Window::window_class.
Referenced by CancelIMEComposition(), HandleIMEComposition(), and VideoDriver_SDL_Base::PollEvent().
void HandleToolbarHotkey | ( | int | hotkey | ) |
Handle Toolbar hotkey events - can come from a source like the MacBook Touch Bar.
hotkey | Hotkey code |
Definition at line 2612 of file window.cpp.
References ES_HANDLED, FindWindowById(), HasModalProgress(), WindowDesc::hotkeys, IsLocalCompany(), Window::OnHotkey(), WC_MAIN_TOOLBAR, and Window::window_desc.
|
static |
Handle viewport scrolling with the mouse.
Definition at line 2416 of file window.cpp.
References _last_scroll_window, _left_button_down, _right_button_down, _scrolling_viewport, _settings_client, CursorVars::delta, ES_HANDLED, ES_NOT_HANDLED, FindWindowFromPt(), CursorVars::fix_at, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::Get(), GetMainWindow(), ClientSettings::gui, Window::OnScroll(), CursorVars::pos, GUISettings::scroll_mode, ScrollMainWindowTo(), GUISettings::scrollwheel_scrolling, SWS_SCROLL_MAP, Window::viewport, VSM_MAP_LMB, VSM_VIEWPORT_RMB_FIXED, Coord2D< T >::x, Vehicle::x_pos, Coord2D< T >::y, Vehicle::y_pos, and Vehicle::z_pos.
|
static |
Handle dragging/resizing of a window.
Definition at line 2138 of file window.cpp.
References _drag_delta, _dragging_window, _left_button_down, _settings_client, abs(), CursorVars::delta, Dragging, EnsureVisibleCaption(), ES_HANDLED, ES_NOT_HANDLED, Window::flags, ClientSettings::gui, Window::height, Window::left, Window::nested_root, CursorVars::pos, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset(), Window::resize, ResizeWindow(), Window::SetDirty(), SizingLeft, SizingRight, ResizeInfo::step_height, ResizeInfo::step_width, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Window::top, Window::width, GUISettings::window_snap_radius, Coord2D< T >::x, and Coord2D< T >::y.
void HideVitalWindows | ( | ) |
Close all always on-top windows to get an empty screen.
Definition at line 3372 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 1835 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 3038 of file window.cpp.
References 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 3290 of file window.cpp.
References Window::InvalidateData(), and Window::window_class.
Referenced by AddRemoveEngineFromAutoreplaceAndBuildWindows(), SmallMapWindow::BreakIndustryChainLink(), CalendarEnginesMonthlyLoop(), CcBuildWagon(), 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(), OrderList::FreeChain(), 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_Win32Base::ToggleFullscreen(), and Station::~Station().
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 3273 of file window.cpp.
References Window::InvalidateData(), Window::window_class, and Window::window_number.
Referenced by ServerNetworkGameSocketHandler::AcceptConnection(), AcceptEnginePreview(), AddNewsItem(), AddRemoveEngineFromAutoreplaceAndBuildWindows(), AddVehicleToGroup(), 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(), 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(), UpdateWindows(), VehicleEnter_Track(), VehicleEnterDepot(), LinkGraphJob::~LinkGraphJob(), NetworkClientInfo::~NetworkClientInfo(), ServerNetworkGameSocketHandler::~ServerNetworkGameSocketHandler(), and Station::~Station().
|
static |
Decide whether a given rectangle is a good place to open a completely visible new window.
The new window should be within screen borders, and not overlap with another already existing window (except for the main window in the background).
left | Left edge of the rectangle |
top | Top edge of the rectangle |
width | Width of the rectangle |
height | Height of the rectangle |
toolbar_y | Height of main toolbar |
pos | If rectangle is good, use this parameter to return the top-left corner of the new window |
Definition at line 1537 of file window.cpp.
References Window::height, Window::left, Window::top, WC_MAIN_WINDOW, Window::width, Window::window_class, Coord2D< T >::x, and Coord2D< T >::y.
Referenced by GetAutoPlacePosition().
|
static |
Decide whether a given rectangle is a good place to open a mostly visible new window.
The new window should be mostly within screen borders, and not overlap with another already existing window (except for the main window in the background).
left | Left edge of the rectangle |
top | Top edge of the rectangle |
width | Width of the rectangle |
height | Height of the rectangle |
toolbar_y | Height of main toolbar |
pos | If rectangle is good, use this parameter to return the top-left corner of the new window |
Definition at line 1573 of file window.cpp.
References _current_text_dir, Window::height, Window::left, TD_RTL, Window::top, WC_MAIN_WINDOW, Window::width, Window::window_class, Coord2D< T >::x, and Coord2D< T >::y.
Referenced by GetAutoPlacePosition().
|
inlinestatic |
Definition at line 1288 of file window.cpp.
|
static |
Compute the position of the top-left corner of a new window that is opened.
By default position a child window at an offset of 10/10 of its parent. With the exception of WC_BUILD_TOOLBAR (build railway/roads/ship docks/airports) and WC_SCEN_LAND_GEN (landscaping). Whose child window has an offset of 0/toolbar-height of its parent. So it's exactly under the parent toolbar and no buttons will be covered. However if it falls too extremely outside window positions, reposition it to an automatic place.
*desc | The pointer to the WindowDesc to be created. |
sm_width | Smallest width of the window. |
sm_height | Smallest height of the window. |
window_number | The window number of the new window. |
Definition at line 1705 of file window.cpp.
References _current_text_dir, NWidgetLeaf::closebox_dimension, WindowDesc::default_pos, FindWindowById(), FS_NORMAL, GetAutoPlacePosition(), GetCharacterHeight(), WindowDesc::GetDefaultHeight(), WindowDesc::GetDefaultWidth(), GetToolbarAlignedWindowPosition(), Window::height, Window::left, WindowDesc::parent_cls, NWidgetLeaf::resizebox_dimension, WidgetDimensions::scaled, TD_RTL, Window::top, WC_BUILD_TOOLBAR, WC_NONE, WC_SCEN_LAND_GEN, WDP_ALIGN_TOOLBAR, WDP_AUTO, WDP_CENTER, WDP_MANUAL, Window::width, Coord2D< T >::x, and Coord2D< T >::y.
Referenced by Window::OnInitialPosition().
|
static |
Check if a window can be made relative top-most window, and if so do it.
If a window does not obscure any other windows, it will not be brought to the foreground. Also if the only obscuring windows are so-called system-windows, the window will not be moved. The function will return false when a child window of this window is a modal-popup; function returns a false and child window gets a white border
w | Window to bring relatively on-top |
Definition at line 2480 of file window.cpp.
References BringWindowToFront(), WindowDesc::flags, Window::height, Window::IsShaded(), Window::left, Modal, Window::parent, Window::SetDirty(), Window::SetWhiteBorder(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Window::top, Window::unshaded_size, WC_DROPDOWN_MENU, WC_MAIN_WINDOW, WC_TOOLTIPS, Window::width, Window::window_class, and Window::window_desc.
|
static |
Returns whether a window may be shown or not.
w | The window to consider. |
< The background, i.e. the game.
< The actual progress window.
< The abort window.
Definition at line 852 of file window.cpp.
References HasModalProgress(), WC_CONFIRM_POPUP_QUERY, WC_MAIN_WINDOW, WC_MODAL_PROGRESS, and Window::window_class.
Referenced by DrawOverlappedWindow(), DrawOverlappedWindowForAll(), and FindWindowFromPt().
|
static |
Definition at line 2834 of file window.cpp.
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 3444 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 3477 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 3466 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 3455 of file window.cpp.
References _settings_client, Debug, ClientSettings::gui, PositionWindow(), GUISettings::statusbar_pos, and WC_STATUS_BAR.
Referenced by RelocateAllWindows(), and v_PositionStatusbar().
|
static |
(Re)position a window at the screen.
w | Window structure of the window, may also be nullptr . |
clss | The class of the window to position. |
setting | The actual setting used for the window's position. |
Definition at line 3421 of file window.cpp.
References AddDirtyBlock(), FindWindowById(), Window::height, Window::left, Window::top, Window::viewport, Window::width, and Window::window_class.
Referenced by PositionMainToolbar(), PositionNetworkChatWindow(), PositionNewsMessage(), and PositionStatusbar().
|
static |
Do not allow hiding of the rectangle with base coordinates nx and ny behind window v.
If needed, move the window base coordinates to keep it visible.
nx | Base horizontal coordinate of the rectangle. |
ny | Base vertical coordinate of the rectangle. |
rect | Rectangle that must stay visible (horizontally, vertically, or both) |
v | Window lying in front of the rectangle. |
px | Previous horizontal base coordinate. |
dir | If no room horizontally, move the rectangle to the indicated position. |
Definition at line 1998 of file window.cpp.
References Rect::Height(), Window::height, Window::left, PHD_UP, Window::top, and Window::width.
Referenced by EnsureVisibleCaption().
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 3389 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 ReInitWindow | ( | Window * | w, |
bool | zoom_changed | ||
) |
Definition at line 3378 of file window.cpp.
void RelocateAllWindows | ( | int | neww, |
int | newh | ||
) |
Relocate all windows to fit the new size of the game application screen.
neww | New width of the game application screen |
newh | New height of the game application screen. |
Definition at line 3505 of file window.cpp.
References _toolbar_width, Centred, CloseWindowByClass(), EnsureVisibleCaption(), FindWindowById(), Window::flags, Window::height, IConsoleResize(), Window::left, PositionMainToolbar(), PositionNetworkChatWindow(), PositionNewsMessage(), PositionStatusbar(), ResizeWindow(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Window::top, WC_BOOTSTRAP, WC_CONSOLE, WC_DROPDOWN_MENU, WC_ENDSCREEN, WC_HIGHSCORE, WC_MAIN_TOOLBAR, WC_MAIN_WINDOW, WC_NEWS_WINDOW, WC_SEND_NETWORK_MSG, WC_STATUS_BAR, Window::width, and Window::window_class.
Referenced by GameSizeChanged(), and ReInitAllWindows().
void ResetWindowSystem | ( | ) |
Reset the windowing system, by means of shutting it down followed by re-initialization.
Definition at line 1871 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 redrawing.
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 2075 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().
|
static |
Definition at line 2778 of file window.cpp.
void SetFocusedWindow | ( | Window * | w | ) |
Set the window that has the focus.
w | The window to set the focus on |
Definition at line 421 of file window.cpp.
References Window::nested_focus, Window::OnFocus(), Window::OnFocusLost(), NWidgetBase::SetDirty(), WC_TOOLTIPS, and Window::window_class.
Referenced by DispatchLeftClickEvent(), Window::InitializeData(), Window::OnHotkey(), PickerWindow::OnHotkey(), and ShowQuery().
void SetWindowClassesDirty | ( | WindowClass | cls | ) |
Mark all windows of a particular class as dirty (in need of repainting)
cls | Window class |
Definition at line 3181 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, |
WindowNumber | number | ||
) |
Mark window as dirty (in need of repainting)
Definition at line 3155 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(), 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 3168 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(), MarkTrainAsStuck(), NormaliseTrainHead(), GroundVehicle< T, Type >::PowerChanged(), RemoveFromRailBaseStation(), RemoveRoadWaypointStop(), ReverseTrainDirection(), Vehicle::SendToDepot(), GroundVehicle< T, Type >::SetLastSpeed(), ShipAccelerate(), ShipMoveUpDownOnLock(), TryPathReserve(), UpdateAircraftSpeed(), UpdateAirplanesOnNewStation(), and UpdateStationAcceptance().
|
static |
Start window dragging.
w | Window to start dragging |
Definition at line 2310 of file window.cpp.
References _drag_delta, _dragging_window, BringWindowToFront(), Centred, Dragging, Window::flags, Window::left, CursorVars::pos, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set(), Window::top, Coord2D< T >::x, and Coord2D< T >::y.
Referenced by DispatchLeftClickEvent().
|
static |
Start resizing a window.
w | Window to start resizing. |
to_left | Whether to drag towards the left or not |
Definition at line 2327 of file window.cpp.
References _drag_delta, _dragging_window, BringWindowToFront(), Centred, Window::flags, CursorVars::pos, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set(), SizingLeft, SizingRight, Coord2D< T >::x, and Coord2D< T >::y.
Referenced by DispatchLeftClickEvent().
void UnInitWindowSystem | ( | ) |
Close down the windowing system.
Definition at line 1857 of file window.cpp.
References _z_windows, Window::Close(), Window::DeleteClosedWindows(), and UnshowCriticalError().
Referenced by ResetWindowSystem(), and ShutdownGame().
void UpdateWindows | ( | ) |
Update the continuously changing contents of the windows, such as the viewports.
Definition at line 3103 of file window.cpp.
References _network_dedicated, _newgrf_debug_sprite_picker, CallWindowRealtimeTickEvent(), DrawDirtyBlocks(), TimerManager< TTimerType >::Elapsed(), InvalidateWindowData(), Window::IsShaded(), NewGrfDebugSpritePicker::mode, NetworkDrawChatMessage(), PFE_DRAWING, PFE_DRAWWORLD, Window::ProcessHighlightedInvalidations(), ProcessPendingPerformanceMeasurements(), Window::ProcessScheduledInvalidations(), Window::ProcessScheduledResize(), PerformanceAccumulator::Reset(), UpdateViewportPosition(), Window::viewport, and WC_SPRITE_ALIGNER.
Referenced by VideoDriver_Null::MainLoop(), and VideoDriver::Tick().
|
extern |
Handle the mouse while dragging for placement/resizing.
Definition at line 3441 of file viewport.cpp.
References _left_button_down, _special_mouse_mode, ES_HANDLED, ES_NOT_HANDLED, TileHighlightData::GetCallbackWnd(), HT_DIR_MASK, HT_DRAG_MASK, HT_POINT, HT_RAIL, HT_RECT, TileHighlightData::new_pos, TileHighlightData::next_drawstyle, Window::OnPlaceDrag(), Window::OnPlaceMouseUp(), TileHighlightData::place_mode, ResetObjectToPlace(), TileHighlightData::select_method, TileHighlightData::select_proc, TileHighlightData::selend, TileHighlightData::selstart, SetTileSelectSize(), TileVirtXY(), VPM_RAILDIRS, VPM_SIGNALDIRS, WSM_DRAGGING, WSM_NONE, WSM_SIZING, Coord2D< T >::x, and Coord2D< T >::y.
Point _cursorpos_drag_start |
Definition at line 87 of file window.cpp.
|
static |
delta between mouse cursor and upper left corner of dragged window
Definition at line 55 of file window.cpp.
Referenced by HandleWindowDragging(), StartWindowDrag(), and StartWindowSizing().
|
static |
A window is being dragged or resized.
Definition at line 2132 of file window.cpp.
Referenced by HandleWindowDragging(), StartWindowDrag(), and StartWindowSizing().
Window* _focused_window |
Definition at line 85 of file window.cpp.
|
static |
Window of the last scroll event.
Definition at line 57 of file window.cpp.
Referenced by Window::Close(), HandleViewportScroll(), and InitWindowSystem().
bool _mouse_hovering |
The mouse is hovering over the same point.
Definition at line 94 of file window.cpp.
Referenced by HandleMouseEvents(), InitWindowSystem(), and TooltipsWindow::OnMouseLoop().
|
static |
Window of the last OnMouseOver event.
Definition at line 56 of file window.cpp.
Referenced by Window::Close(), HandleMouseOver(), and InitWindowSystem().
|
static |
Definition at line 3053 of file window.cpp.
int _scrollbar_size |
Definition at line 90 of file window.cpp.
int _scrollbar_start_pos |
Definition at line 89 of file window.cpp.
uint8_t _scroller_click_timeout = 0 |
Definition at line 91 of file window.cpp.
bool _scrolling_viewport |
A viewport is being scrolled with the mouse.
Definition at line 93 of file window.cpp.
Referenced by HandleViewportScroll(), InitWindowSystem(), and SmallMapWindow::OnRightClick().
SpecialMouseMode _special_mouse_mode |
Mode of the mouse.
Definition at line 96 of file window.cpp.
Referenced by DeleteDepotHighlightOfVehicle(), DeleteGroupHighlightOfVehicle(), HandleMouseDragDrop(), SetObjectToPlace(), VpHandlePlaceSizingDrag(), VpStartDragging(), and VpStartPlaceSizing().
std::vector<WindowDesc*>* _window_descs = nullptr |
List of all WindowDescs.
List of WindowDescs.
This is a pointer to ensure initialisation order with the various static WindowDesc instances.
Definition at line 102 of file window.cpp.
Referenced by WindowDesc::LoadFromConfig(), WindowDesc::SaveToConfig(), and WindowDesc::WindowDesc().
bool _window_highlight_colour = false |
If false, highlight is white, otherwise the by the widget defined colour.
Definition at line 78 of file window.cpp.
Referenced by Window::DrawWidgets().
std::string _windows_file |
Config file to store WindowDesc.
Definition at line 105 of file window.cpp.
Referenced by DeterminePaths(), WindowDesc::LoadFromConfig(), and WindowDesc::SaveToConfig().
WindowList _z_windows |
List of windows opened at the screen sorted from the front to back.
Definition at line 60 of file window.cpp.
Referenced by BringWindowToFront(), Window::DeleteClosedWindows(), UnInitWindowSystem(), and Window::Window().
|
staticconstexpr |
How much the mouse is allowed to move to call it a double click.
Definition at line 2771 of file window.cpp.
Referenced by HandleMouseEvents().
|
staticconstexpr |
Maximum mouse movement before stopping a hover event.
Definition at line 2772 of file window.cpp.
Referenced by HandleMouseEvents().
|
static |
Describes all the different arrow key combinations the game allows when it is in scrolling mode.
The real arrow keys are bitwise numbered as 1 = left 2 = up 4 = right 8 = down
Definition at line 2796 of file window.cpp.