Data structure for an opened window. More...
#include <window_gui.h>
Public Member Functions | |
Window () | |
Empty constructor, initialization has been moved to InitNested() called from the constructor of the derived class. | |
virtual | ~Window () |
Remove window and all its child windows from the window stack. | |
FORCEINLINE void * | operator new[] (size_t size) |
Helper allocation function to disallow something. | |
FORCEINLINE void | operator delete (void *ptr) |
Helper allocation function to disallow something. | |
template<class NWID > | |
const NWID * | GetWidget (uint widnum) const |
Specialized case of Window::GetWidget for the nested widget base class. | |
template<class NWID > | |
NWID * | GetWidget (uint widnum) |
Get the nested widget with number widnum from the nested widget tree. | |
const Scrollbar * | GetScrollbar (uint widnum) const |
Return the Scrollbar to a widget index. | |
Scrollbar * | GetScrollbar (uint widnum) |
Return the Scrollbar to a widget index. | |
void | InitNested (const WindowDesc *desc, WindowNumber number=0) |
Perform complete initialization of the Window with nested widgets, to allow use. | |
void | CreateNestedTree (const WindowDesc *desc, bool fill_nested=true) |
Perform the first part of the initialization of a nested widget tree. | |
void | FinishInitNested (const WindowDesc *desc, WindowNumber window_number=0) |
Perform the second part of the initialization of a nested widget tree. | |
void | SetWidgetDisabledState (byte widget_index, bool disab_stat) |
Sets the enabled/disabled status of a widget. | |
void | DisableWidget (byte widget_index) |
Sets a widget to disabled. | |
void | EnableWidget (byte widget_index) |
Sets a widget to Enabled. | |
bool | IsWidgetDisabled (byte widget_index) const |
Gets the enabled/disabled status of a widget. | |
bool | IsWidgetFocused (byte widget_index) const |
Check if given widget is focused within this window. | |
bool | IsWidgetGloballyFocused (byte widget_index) const |
Check if given widget has user input focus. | |
void | SetWidgetLoweredState (byte widget_index, bool lowered_stat) |
Sets the lowered/raised status of a widget. | |
void | ToggleWidgetLoweredState (byte widget_index) |
Invert the lowered/raised status of a widget. | |
void | LowerWidget (byte widget_index) |
Marks a widget as lowered. | |
void | RaiseWidget (byte widget_index) |
Marks a widget as raised. | |
bool | IsWidgetLowered (byte widget_index) const |
Gets the lowered state of a widget. | |
void | UnfocusFocusedWidget () |
Makes no widget on this window have focus. | |
bool | SetFocusedWidget (byte widget_index) |
Set focus within this window to the given widget. | |
void | HandleButtonClick (byte widget) |
Do all things to make a button look clicked and mark it to be unclicked in a few ticks. | |
int | GetRowFromWidget (int clickpos, int widget, int padding, int line_height=-1) const |
Compute the row of a widget that a user clicked in. | |
void | RaiseButtons (bool autoraise=false) |
Raise the buttons of the window. | |
void CDECL | SetWidgetsDisabledState (bool disab_stat, int widgets,...) |
Sets the enabled/disabled status of a list of widgets. | |
void CDECL | SetWidgetsLoweredState (bool lowered_stat, int widgets,...) |
Sets the lowered/raised status of a list of widgets. | |
void | SetWidgetDirty (byte widget_index) const |
Invalidate a widget, i.e. | |
void | DrawWidgets () const |
Paint all widgets of a window. | |
void | DrawViewport () const |
Draw the viewport of this window. | |
void | DrawSortButtonState (int widget, SortButtonState state) const |
Draw a sort button's up or down arrow symbol. | |
void | DeleteChildWindows (WindowClass wc=WC_INVALID) const |
Delete all children a window might have in a head-recursive manner. | |
void | SetDirty () const |
Mark entire window as dirty (in need of re-paint). | |
void | ReInit (int rx=0, int ry=0) |
Re-initialize a window, and optionally change its size. | |
bool | IsShaded () const |
Is window shaded currently? | |
void | SetShaded (bool make_shaded) |
Set the shaded state of the window to make_shaded. | |
void | InvalidateData (int data=0) |
Mark this window's data as invalid (in need of re-computing). | |
virtual void | OnInit () |
Notification that the nested widget tree gets initialized. | |
virtual Point | OnInitialPosition (const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) |
Compute the initial position of the window. | |
virtual void | OnPaint () |
The window must be repainted. | |
virtual void | DrawWidget (const Rect &r, int widget) const |
Draw the contents of a nested widget. | |
virtual void | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
Update size and resize step of a widget in the window. | |
virtual void | SetStringParameters (int widget) const |
Initialize string parameters for a widget. | |
virtual void | OnFocus () |
Called when window gains focus. | |
virtual void | OnFocusLost () |
Called when window looses focus. | |
virtual EventState | OnKeyPress (uint16 key, uint16 keycode) |
A key has been pressed. | |
virtual EventState | OnCTRLStateChange () |
The state of the control key has changed. | |
virtual void | OnClick (Point pt, int widget, int click_count) |
A click with the left mouse button has been made on the window. | |
virtual bool | OnRightClick (Point pt, int widget) |
A click with the right mouse button has been made on the window. | |
virtual void | OnHover (Point pt, int widget) |
The mouse is hovering over a widget in the window, perform an action for it, like opening a custom tooltip. | |
virtual void | OnMouseDrag (Point pt, int widget) |
An 'object' is being dragged at the provided position, highlight the target if possible. | |
virtual void | OnDragDrop (Point pt, int widget) |
A dragged 'object' has been released. | |
virtual void | OnScroll (Point delta) |
Handle the request for (viewport) scrolling. | |
virtual void | OnMouseOver (Point pt, int widget) |
The mouse is currently moving over the window or has just moved outside of the window. | |
virtual void | OnMouseWheel (int wheel) |
The mouse wheel has been turned. | |
virtual void | OnMouseLoop () |
Called for every mouse loop run, which is at least once per (game) tick. | |
virtual void | OnTick () |
Called once per (game) tick. | |
virtual void | OnHundredthTick () |
Called once every 100 (game) ticks. | |
virtual void | OnTimeout () |
Called when this window's timeout has been reached. | |
virtual void | OnResize () |
Called after the window got resized. | |
virtual void | OnDropdownSelect (int widget, int index) |
A dropdown option associated to this window has been selected. | |
virtual void | OnQueryTextFinished (char *str) |
The query window opened from this window has closed. | |
virtual void | OnInvalidateData (int data=0) |
Some data on this window has become invalid. | |
virtual void | OnPlaceObject (Point pt, TileIndex tile) |
The user clicked some place on the map when a tile highlight mode has been set. | |
virtual void | OnVehicleSelect (const struct Vehicle *v) |
The user clicked on a vehicle while HT_VEHICLE has been set. | |
virtual void | OnPlaceObjectAbort () |
The user cancelled a tile highlight mode that has been set. | |
virtual void | OnPlaceDrag (ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) |
The user is dragging over the map when the tile highlight mode has been set. | |
virtual void | OnPlaceMouseUp (ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) |
The user has dragged over the map when the tile highlight mode has been set. | |
virtual void | OnPlacePresize (Point pt, TileIndex tile) |
The user moves over the map when a tile highlight mode has been set when the special mouse mode has been set to 'PRESIZE' mode. | |
virtual bool | IsNewGRFInspectable () const |
Is the data related to this window NewGRF inspectable? | |
virtual void | ShowNewGRFInspectWindow () const |
Show the NewGRF inspection window. | |
Data Fields | |
uint16 | flags4 |
Window flags,. | |
WindowClass | window_class |
Window class. | |
WindowNumber | window_number |
Window number within the window class. | |
int | left |
x position of left edge of the window | |
int | top |
y position of top edge of the window | |
int | width |
width of the window (number of pixels to the right in x direction) | |
int | height |
Height of the window (number of pixels down in y direction). | |
ResizeInfo | resize |
Resize information. | |
Owner | owner |
The owner of the content shown in this window. Company colour is acquired from this variable. | |
ViewportData * | viewport |
Pointer to viewport data, if present. | |
uint32 | desc_flags |
Window/widgets default flags setting. | |
const NWidgetCore * | nested_focus |
Currently focused nested widget, or NULL if no nested widget has focus. | |
NWidgetBase * | nested_root |
Root of the nested tree. | |
NWidgetBase ** | nested_array |
Array of pointers into the tree. Do not access directly, use Window::GetWidget() instead. | |
uint | nested_array_size |
Size of the nested array. | |
NWidgetStacked * | shade_select |
Selection widget (NWID_SELECTION) to use for shading the window. If NULL , window cannot shade. | |
Dimension | unshaded_size |
Last known unshaded size (only valid while shaded). | |
int | scrolling_scrollbar |
Widgetindex of just being dragged scrollbar. -1 of none is active. | |
Window * | parent |
Parent window. | |
Window * | z_front |
The window in front of us in z-order. | |
Window * | z_back |
The window behind us in z-order. | |
Protected Member Functions | |
void | InitializeData (const WindowDesc *desc, WindowNumber window_number) |
Initializes the data (except the position and initial size) of a new Window. | |
void | InitializePositionSize (int x, int y, int min_width, int min_height) |
Set the position and smallest size of the window. | |
void | FindWindowPlacementAndResize (int def_width, int def_height) |
Resize window towards the default size. |
Data structure for an opened window.
Definition at line 218 of file window_gui.h.
Window::Window | ( | ) |
Empty constructor, initialization has been moved to InitNested() called from the constructor of the derived class.
Definition at line 1304 of file window.cpp.
void Window::CreateNestedTree | ( | const WindowDesc * | desc, | |
bool | fill_nested = true | |||
) |
Perform the first part of the initialization of a nested widget tree.
Construct a nested widget tree in nested_root, and optionally fill the nested_array array to provide quick access to the uninitialized widgets. This is mainly useful for setting very basic properties.
desc | Window description. | |
fill_nested | Fill the nested_array (enabling is expensive!). |
Definition at line 1267 of file window.cpp.
References MakeWindowNWidgetTree(), nested_array, nested_array_size, nested_root, WindowDesc::nwid_length, and WindowDesc::nwid_parts.
Referenced by DropdownWindow::DropdownWindow(), InitNested(), NetworkContentListWindow::NetworkContentListWindow(), and VehicleDetailsWindow::VehicleDetailsWindow().
void Window::DeleteChildWindows | ( | WindowClass | wc = WC_INVALID |
) | const |
Delete all children a window might have in a head-recursive manner.
wc | Window class of the window to remove; WC_INVALID if class does not matter |
Definition at line 642 of file window.cpp.
References FindChildWindow().
Referenced by TimetableWindow::OnClick(), OrdersWindow::OnClick(), NewGRFWindow::OnClick(), NewGRFParametersWindow::OnClick(), TimetableWindow::OnInvalidateData(), OrdersWindow::OnInvalidateData(), NewGRFParametersWindow::OnInvalidateData(), and ~Window().
void Window::DisableWidget | ( | byte | widget_index | ) | [inline] |
Sets a widget to disabled.
widget_index | index of this widget in the window |
Definition at line 306 of file window_gui.h.
References SetWidgetDisabledState().
Referenced by CustomCurrencyWindow::OnClick(), AIDebugWindow::OnClick(), NewGRFWindow::OnInvalidateData(), AIDebugWindow::OnInvalidateData(), VehicleDetailsWindow::OnPaint(), TimetableWindow::OnPaint(), CompanyWindow::OnPaint(), AIDebugWindow::OnPaint(), SignListWindow::SetFilterString(), and BuildRoadToolbarWindow::UpdateOptionWidgetStatus().
void Window::DrawSortButtonState | ( | int | widget, | |
SortButtonState | state | |||
) | const |
Draw a sort button's up or down arrow symbol.
widget | Sort button widget | |
state | State of sort button |
Definition at line 559 of file widget.cpp.
References _current_text_dir, NWidgetBase::current_x, DOWNARROW, DrawString(), IsWidgetLowered(), nested_array, NWidgetBase::pos_x, NWidgetBase::pos_y, SA_HOR_CENTER, SBS_DOWN, SBS_OFF, TD_LTR, top, UPARROW, and WD_SORTBUTTON_ARROW_WIDTH.
Referenced by VehicleListWindow::DrawWidget(), TownDirectoryWindow::DrawWidget(), NetworkGameWindow::DrawWidget(), IndustryDirectoryWindow::DrawWidget(), VehicleGroupWindow::DrawWidget(), SaveLoadWindow::DrawWidget(), BuildVehicleWindow::DrawWidget(), BuildBridgeWindow::DrawWidget(), and NetworkContentListWindow::OnPaint().
virtual void Window::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [inline, virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
Reimplemented in AIListWindow, AISettingsWindow, AIConfigWindow, AIDebugWindow, BuildAirportWindow, ReplaceVehicleWindow, BuildBridgeWindow, BuildVehicleWindow, CheatWindow, CompanyFinancesWindow, SelectCompanyLiveryWindow, SelectCompanyManagerFaceWindow, CompanyWindow, BuyCompanyWindow, DepotWindow, EnginePreviewWindow, SaveLoadWindow, GenerateLandscapeWindow, GenerateProgressWindow, GraphLegendWindow, BaseGraphWindow, PaymentRatesGraphWindow, CompanyLeagueWindow, PerformanceRatingDetailWindow, VehicleGroupWindow, BuildIndustryWindow, IndustryDirectoryWindow, IndustryCargoesWindow, LandInfoWindow, AboutWindow, ErrmsgWindow, TooltipsWindow, QueryWindow, MusicTrackSelectionWindow, MusicWindow, NetworkChatWindow, NetworkContentDownloadStatusWindow, NetworkContentListWindow, NetworkGameWindow, NetworkStartServerWindow, NetworkLobbyWindow, NetworkClientListPopupWindow, NetworkClientListWindow, NetworkJoinStatusWindow, SpriteAlignerWindow, NewGRFParametersWindow, NewGRFWindow, NewsWindow, MessageHistoryWindow, MessageOptionsWindow, BuildObjectWindow, OrdersWindow, OskWindow, BuildRailStationWindow, BuildSignalWindow, BuildRailDepotWindow, BuildRailWaypointWindow, BuildRoadDepotWindow, BuildRoadStationWindow, GameOptionsWindow, GameSettingsWindow, SignListWindow, SmallMapWindow, CompanyStationsWindow, SelectStationWindow< T >, StatusBarWindow, SubsidyListWindow, ScenarioEditorLandscapeGenerationWindow, TimetableWindow, ScenarioEditorToolbarWindow, TownAuthorityWindow, TownViewWindow, TownDirectoryWindow, TransparenciesWindow, BuildTreesWindow, RefitWindow, VehicleListWindow, VehicleDetailsWindow, VehicleViewWindow, and DropdownWindow.
Definition at line 474 of file window_gui.h.
Referenced by NWidgetLeaf::Draw(), and NWidgetBackground::Draw().
void Window::EnableWidget | ( | byte | widget_index | ) | [inline] |
Sets a widget to Enabled.
widget_index | index of this widget in the window |
Definition at line 315 of file window_gui.h.
References SetWidgetDisabledState().
Referenced by CustomCurrencyWindow::OnClick(), SelectCompanyLiveryWindow::OnInvalidateData(), AIDebugWindow::OnInvalidateData(), TimetableWindow::OnPaint(), and SignListWindow::SetFilterString().
void Window::FindWindowPlacementAndResize | ( | int | def_width, | |
int | def_height | |||
) | [protected] |
Resize window towards the default size.
Prior to construction, a position for the new window (for its default size) has been found with LocalGetWindowPlacement(). Initially, the window is constructed with minimal size. Resizing the window to its default size is done here.
def_width | default width in pixels of the window | |
def_height | default height in pixels of the window |
Definition at line 988 of file window.cpp.
References FindWindowById(), height, ViewPort::left, left, max(), min(), OnResize(), resize, ResizeWindow(), SetDirty(), ResizeInfo::step_height, ResizeInfo::step_width, ViewPort::top, top, viewport, and width.
Referenced by FinishInitNested().
void Window::FinishInitNested | ( | const WindowDesc * | desc, | |
WindowNumber | window_number = 0 | |||
) |
Perform the second part of the initialization of a nested widget tree.
desc | Window description. | |
window_number | Number of the new window. |
Definition at line 1284 of file window.cpp.
References WindowDesc::default_height, WindowDesc::default_width, FindWindowPlacementAndResize(), InitializeData(), InitializePositionSize(), nested_root, OnInitialPosition(), and NWidgetBase::smallest_x.
Referenced by DropdownWindow::DropdownWindow(), InitNested(), NetworkContentListWindow::NetworkContentListWindow(), and VehicleDetailsWindow::VehicleDetailsWindow().
int Window::GetRowFromWidget | ( | int | clickpos, | |
int | widget, | |||
int | padding, | |||
int | line_height = -1 | |||
) | const |
Compute the row of a widget that a user clicked in.
clickpos | Vertical position of the mouse click. | |
widget | Widget number of the widget clicked in. | |
padding | Amount of empty space between the widget edge and the top of the first row. | |
line_height | Height of a single row. A negative value means using the vertical resize step of the widget. |
Definition at line 94 of file window.cpp.
References NWidgetBase::pos_y, and NWidgetBase::resize_y.
Referenced by Scrollbar::GetScrolledRowFromWidget(), TownAuthorityWindow::OnClick(), and MusicTrackSelectionWindow::OnClick().
Scrollbar * Window::GetScrollbar | ( | uint | widnum | ) |
Return the Scrollbar to a widget index.
widnum | Scrollbar widget index |
Definition at line 117 of file window.cpp.
const Scrollbar * Window::GetScrollbar | ( | uint | widnum | ) | const |
Return the Scrollbar to a widget index.
widnum | Scrollbar widget index |
Definition at line 107 of file window.cpp.
Referenced by DispatchMouseWheelEvent(), DropdownWindow::DropdownWindow(), NetworkContentListWindow::NetworkContentListWindow(), and VehicleDetailsWindow::VehicleDetailsWindow().
NWID * Window::GetWidget | ( | uint | widnum | ) | [inline] |
Get the nested widget with number widnum from the nested widget tree.
NWID | Type of the nested widget. |
widnum | Widget number of the widget to retrieve. |
NULL
otherwise. Definition at line 706 of file window_gui.h.
References nested_array, and nested_array_size.
const NWID * Window::GetWidget | ( | uint | widnum | ) | const [inline] |
Specialized case of Window::GetWidget for the nested widget base class.
Get the nested widget with number widnum from the nested widget tree.
NWID | Type of the nested widget. |
widnum | Widget number of the widget to retrieve. |
NULL
otherwise. Definition at line 729 of file window_gui.h.
Referenced by HandleScrollbarScrolling(), Scrollbar::SetCapacityFromWidget(), and ShowDropDownList().
void Window::HandleButtonClick | ( | byte | widget | ) |
Do all things to make a button look clicked and mark it to be unclicked in a few ticks.
widget | the widget to "click" |
Definition at line 265 of file window.cpp.
References flags4, LowerWidget(), SetWidgetDirty(), and WF_TIMEOUT_BEGIN.
Referenced by DispatchLeftClickEvent(), FoundTownWindow::OnClick(), ScenarioEditorLandscapeGenerationWindow::OnClick(), TerraformToolbarWindow::OnClick(), SmallMapWindow::OnClick(), NetworkStartServerWindow::OnClick(), BuildIndustryWindow::OnClick(), CreateScenarioWindow::OnClick(), GenerateLandscapeWindow::OnClick(), DepotWindow::OnDragDrop(), and SaveLoadWindow::OnKeyPress().
void Window::InitializeData | ( | const WindowDesc * | desc, | |
WindowNumber | window_number | |||
) | [protected] |
Initializes the data (except the position and initial size) of a new Window.
desc | Window description. | |
window_number | Number being assigned to the new window |
NULL
), nested_root and nested_array_size must be initialized. In addition, nested_array is either NULL
, or already initialized. Definition at line 890 of file window.cpp.
References _current_text_dir, NWidgetBase::AssignSizePosition(), WindowDesc::cls, WindowDesc::default_pos, desc_flags, EditBoxInGlobalFocus(), FindWindowByClass(), FindWindowById(), WindowDesc::flags, flags4, NWidgetBase::GetWidgetOfType(), INVALID_OWNER, nested_array, nested_array_size, nested_focus, nested_root, OnInit(), owner, resize, NWidgetBase::resize_x, NWidgetBase::resize_y, SetFocusedWindow(), NWidgetBase::SetupSmallestSize(), NWidgetBase::smallest_x, ST_SMALLEST, ResizeInfo::step_height, ResizeInfo::step_width, TD_RTL, WDP_CENTER, WF_CENTERED, window_class, WWT_EDITBOX, z_back, and z_front.
Referenced by FinishInitNested().
void Window::InitializePositionSize | ( | int | x, | |
int | y, | |||
int | sm_width, | |||
int | sm_height | |||
) | [protected] |
Set the position and smallest size of the window.
x | Offset in pixels from the left of the screen of the new window. | |
y | Offset in pixels from the top of the screen of the new window. | |
sm_width | Smallest width in pixels of the window. | |
sm_height | Smallest height in pixels of the window. |
Definition at line 970 of file window.cpp.
References height, left, top, and width.
Referenced by FinishInitNested().
void Window::InitNested | ( | const WindowDesc * | desc, | |
WindowNumber | window_number = 0 | |||
) |
Perform complete initialization of the Window with nested widgets, to allow use.
desc | Window description. | |
window_number | Number of the new window. |
Definition at line 1297 of file window.cpp.
References CreateNestedTree(), and FinishInitNested().
Referenced by NetworkContentDownloadStatusWindow::NetworkContentDownloadStatusWindow(), and SetDateWindow::SetDateWindow().
void Window::InvalidateData | ( | int | data = 0 |
) | [inline] |
Mark this window's data as invalid (in need of re-computing).
data | The data to invalidate with |
Definition at line 435 of file window_gui.h.
References OnInvalidateData(), and SetDirty().
Referenced by ChangeVehicleWindow(), DoZoomInOutWindow(), InvalidateWindowClassesData(), InvalidateWindowData(), NetworkContentListWindow::NetworkContentListWindow(), NewGRFConfirmationCallback(), RefitWindow::OnClick(), SignListWindow::OnClick(), GameDifficultyWindow::OnClick(), BuildSignalWindow::OnClick(), MessageOptionsWindow::OnClick(), NewGRFWindow::OnClick(), NewGRFParametersWindow::OnClick(), NetworkContentListWindow::OnClick(), GenerateLandscapeWindow::OnClick(), SaveLoadWindow::OnClick(), AIConfigWindow::OnClick(), NetworkContentListWindow::OnConnect(), NetworkContentListWindow::OnDownloadComplete(), RefitWindow::OnDragDrop(), MessageOptionsWindow::OnDropdownSelect(), NewGRFWindow::OnDropdownSelect(), GenerateLandscapeWindow::OnDropdownSelect(), NewGRFWindow::OnKeyPress(), NetworkContentListWindow::OnKeyPress(), NetworkChatWindow::OnKeyPress(), QueryStringWindow::OnKeyPress(), SmallMapWindow::OnPaint(), NewGRFWindow::OnQueryTextFinished(), GenerateLandscapeWindow::OnQueryTextFinished(), NetworkContentListWindow::OnReceiveContentInfo(), SaveLoadWindow::OnTimeout(), SignListWindow::SetFilterString(), GameOptionsWindow::SetMediaSet(), and ShowIndustryCargoesWindow().
virtual bool Window::IsNewGRFInspectable | ( | ) | const [inline, virtual] |
Is the data related to this window NewGRF inspectable?
Reimplemented in IndustryViewWindow, LandInfoWindow, and VehicleViewWindow.
Definition at line 688 of file window_gui.h.
Referenced by NWidgetLeaf::SetupSmallestSize().
bool Window::IsWidgetDisabled | ( | byte | widget_index | ) | const [inline] |
Gets the enabled/disabled status of a widget.
widget_index | index of this widget in the window |
Definition at line 325 of file window_gui.h.
References nested_array_size.
Referenced by BuildRailClick_Remove(), PerformanceRatingDetailWindow::DrawWidget(), HandlePlacePushButton(), MainToolbarWindow::OnClick(), BuildRoadToolbarWindow::OnClick(), NetworkLobbyWindow::OnClick(), NetworkGameWindow::OnClick(), PerformanceRatingDetailWindow::OnClick(), AIDebugWindow::OnClick(), DepotWindow::OnDragDrop(), DepotWindow::OnTimeout(), RailToolbar_CtrlChanged(), and RoadToolbar_CtrlChanged().
bool Window::IsWidgetFocused | ( | byte | widget_index | ) | const [inline] |
Check if given widget is focused within this window.
widget_index | : index of the widget in the window to check |
Definition at line 336 of file window_gui.h.
References NWidgetCore::index, and nested_focus.
Referenced by IsWidgetGloballyFocused(), and NetworkContentListWindow::OnKeyPress().
bool Window::IsWidgetGloballyFocused | ( | byte | widget_index | ) | const [inline] |
Check if given widget has user input focus.
This means that both the window has focus and that the given widget has focus within the window.
widget_index | : index of the widget in the window to check |
Definition at line 347 of file window_gui.h.
References IsWidgetFocused().
bool Window::IsWidgetLowered | ( | byte | widget_index | ) | const [inline] |
Gets the lowered state of a widget.
widget_index | index of this widget in the window |
Definition at line 397 of file window_gui.h.
References nested_array_size.
Referenced by BuildRailClick_Remove(), BuildSignalWindow::DrawSignalSprite(), DrawSortButtonState(), PaymentRatesGraphWindow::DrawWidget(), HandlePlacePushButton(), IndustryCargoesWindow::NotifySmallmap(), IndustryCargoesWindow::OnClick(), DepotWindow::OnClick(), IndustryCargoesWindow::OnInvalidateData(), VehicleListWindow::OnPaint(), ScenarioEditorLandscapeGenerationWindow::OnPaint(), VehicleGroupWindow::OnPaint(), BuildRailToolbarWindow::OnPlaceDrag(), BuildRailToolbarWindow::OnPlaceMouseUp(), BuildRoadToolbarWindow::OnPlaceObject(), ScenarioEditorToolbarWindow::OnTick(), MainToolbarWindow::OnTick(), MainToolbarWindow::OnTimeout(), ScenarioEditorLandscapeGenerationWindow::OnTimeout(), OrdersWindow::OnTimeout(), NetworkStartServerWindow::OnTimeout(), CreateScenarioWindow::OnTimeout(), GenerateLandscapeWindow::OnTimeout(), SaveLoadWindow::OnTimeout(), OrdersWindow::OrderClick_Goto(), RailToolbar_CtrlChanged(), RaiseButtons(), RoadToolbar_CtrlChanged(), ToggleRailButton_Remove(), ToggleRoadButton_Remove(), and BuildRoadToolbarWindow::UpdateOptionWidgetStatus().
void Window::LowerWidget | ( | byte | widget_index | ) | [inline] |
Marks a widget as lowered.
widget_index | index of this widget in the window |
Definition at line 378 of file window_gui.h.
References SetWidgetLoweredState().
Referenced by BuildRailStationWindow::CheckSelectedSize(), HandleButtonClick(), HandlePlacePushButton(), BuildTreesWindow::OnClick(), GameDifficultyWindow::OnClick(), BuildRoadStationWindow::OnClick(), BuildRoadDepotWindow::OnClick(), BuildRailDepotWindow::OnClick(), BuildRailStationWindow::OnClick(), SpriteAlignerWindow::OnClick(), PerformanceRatingDetailWindow::OnClick(), BuildDocksDepotWindow::OnClick(), BuildDocksStationWindow::OnClick(), CompanyWindow::OnClick(), SelectCompanyLiveryWindow::OnClick(), BuildSignalWindow::OnInvalidateData(), PerformanceRatingDetailWindow::OnInvalidateData(), AIDebugWindow::OnPaint(), OrdersWindow::OrderClick_Conditional(), OrdersWindow::OrderClick_Share(), ShowDropDownList(), SmallMapWindow::SwitchMapType(), and OskWindow::UpdateOskState().
virtual void Window::OnClick | ( | Point | pt, | |
int | widget, | |||
int | click_count | |||
) | [inline, virtual] |
A click with the left mouse button has been made on the window.
pt | the point inside the window that has been clicked. | |
widget | the clicked widget. | |
click_count | Number of fast consecutive clicks at same position |
Reimplemented in AIListWindow, AISettingsWindow, AIConfigWindow, AIDebugWindow, BuildAirToolbarWindow, BuildAirportWindow, ReplaceVehicleWindow, BuildBridgeWindow, BuildVehicleWindow, CheatWindow, CompanyFinancesWindow, SelectCompanyLiveryWindow, SelectCompanyManagerFaceWindow, CompanyWindow, BuyCompanyWindow, SetDateWindow, DepotWindow, BuildDocksToolbarWindow, BuildDocksStationWindow, BuildDocksDepotWindow, EnginePreviewWindow, SaveLoadWindow, GenerateLandscapeWindow, CreateScenarioWindow, GenerateProgressWindow, GraphLegendWindow, BaseGraphWindow, PerformanceHistoryGraphWindow, PaymentRatesGraphWindow, PerformanceRatingDetailWindow, VehicleGroupWindow, EndGameHighScoreBaseWindow, BuildIndustryWindow, IndustryViewWindow, IndustryDirectoryWindow, IndustryCargoesWindow, SelectGameWindow, QueryStringWindow, QueryWindow, MusicTrackSelectionWindow, MusicWindow, NetworkChatWindow, NetworkContentDownloadStatusWindow, NetworkContentListWindow, NetworkGameWindow, NetworkStartServerWindow, NetworkLobbyWindow, NetworkClientListWindow, NetworkJoinStatusWindow, NetworkCompanyPasswordWindow, SpriteAlignerWindow, NewGRFParametersWindow, NewGRFWindow, NewsWindow, MessageHistoryWindow, MessageOptionsWindow, BuildObjectWindow, OrdersWindow, OskWindow, BuildRailToolbarWindow, BuildRailStationWindow, BuildSignalWindow, BuildRailDepotWindow, BuildRailWaypointWindow, BuildRoadToolbarWindow, BuildRoadDepotWindow, BuildRoadStationWindow, GameOptionsWindow, GameDifficultyWindow, GameSettingsWindow, CustomCurrencyWindow, SignListWindow, SignWindow, SmallMapWindow, CompanyStationsWindow, StationViewWindow, SelectStationWindow< T >, StatusBarWindow, SubsidyListWindow, TerraformToolbarWindow, ScenarioEditorLandscapeGenerationWindow, TimetableWindow, MainToolbarWindow, ScenarioEditorToolbarWindow, TownAuthorityWindow, TownViewWindow, TownDirectoryWindow, FoundTownWindow, TransparenciesWindow, BuildTreesWindow, RefitWindow, VehicleListWindow, VehicleDetailsWindow, VehicleViewWindow, ExtraViewportWindow, WaypointWindow, and DropdownWindow.
Definition at line 531 of file window_gui.h.
Referenced by DispatchLeftClickEvent(), and OskWindow::OnClick().
virtual EventState Window::OnCTRLStateChange | ( | ) | [inline, virtual] |
The state of the control key has changed.
Reimplemented in DepotWindow, BuildRailToolbarWindow, and BuildRoadToolbarWindow.
Definition at line 522 of file window_gui.h.
References ES_NOT_HANDLED.
Referenced by HandleCtrlChanged().
virtual void Window::OnDragDrop | ( | Point | pt, | |
int | widget | |||
) | [inline, virtual] |
A dragged 'object' has been released.
pt | the point inside the window where the release took place. | |
widget | the widget where the release took place. |
Reimplemented in DepotWindow, VehicleGroupWindow, OrdersWindow, and RefitWindow.
Definition at line 561 of file window_gui.h.
Referenced by HandleDragDrop().
virtual void Window::OnDropdownSelect | ( | int | widget, | |
int | index | |||
) | [inline, virtual] |
A dropdown option associated to this window has been selected.
widget | the widget (button) that the dropdown is associated with. | |
index | the element in the dropdown that is selected. |
Reimplemented in BuildAirportWindow, ReplaceVehicleWindow, BuildBridgeWindow, BuildVehicleWindow, SelectCompanyLiveryWindow, SetDateWindow, GenerateLandscapeWindow, CreateScenarioWindow, VehicleGroupWindow, IndustryDirectoryWindow, NetworkGameWindow, NetworkStartServerWindow, NewGRFWindow, MessageOptionsWindow, BuildObjectWindow, OrdersWindow, BuildRailStationWindow, GameOptionsWindow, CompanyStationsWindow, MainToolbarWindow, ScenarioEditorToolbarWindow, and VehicleListWindow.
Definition at line 616 of file window_gui.h.
Referenced by DropdownWindow::OnMouseLoop().
virtual void Window::OnHover | ( | Point | pt, | |
int | widget | |||
) | [inline, virtual] |
The mouse is hovering over a widget in the window, perform an action for it, like opening a custom tooltip.
pt | The point where the mouse is hovering. | |
widget | The widget where the mouse is hovering. |
Reimplemented in IndustryCargoesWindow.
Definition at line 547 of file window_gui.h.
Referenced by DispatchHoverEvent().
virtual void Window::OnInit | ( | ) | [inline, virtual] |
Notification that the nested widget tree gets initialized.
The event can be used to perform general computations.
Reimplemented in BuildVehicleWindow, SelectCompanyManagerFaceWindow, PaymentRatesGraphWindow, BuildIndustryWindow, IndustryCargoesWindow, MessageOptionsWindow, SmallMapWindow, TerraformToolbarWindow, and RefitWindow.
Definition at line 447 of file window_gui.h.
Referenced by InitializeData(), and ReInit().
Point Window::OnInitialPosition | ( | const WindowDesc * | desc, | |
int16 | sm_width, | |||
int16 | sm_height, | |||
int | window_number | |||
) | [virtual] |
Compute the initial position of the window.
*desc | The pointer to the WindowDesc of the window to create. | |
sm_width | Smallest width of the window. | |
sm_height | Smallest height of the window. | |
window_number | The window number of the new window. |
Reimplemented in BuildBridgeWindow, SetDateWindow, ErrmsgWindow, TooltipsWindow, NetworkChatWindow, NetworkClientListPopupWindow, NewsWindow, StatusBarWindow, TerraformToolbarWindow, TransparenciesWindow, and DropdownWindow.
Definition at line 1254 of file window.cpp.
References LocalGetWindowPlacement().
Referenced by FinishInitNested().
virtual void Window::OnInvalidateData | ( | int | data = 0 |
) | [inline, virtual] |
Some data on this window has become invalid.
data | information about the changed data. |
Reimplemented in AIListWindow, AISettingsWindow, AIConfigWindow, AIDebugWindow, ReplaceVehicleWindow, BuildVehicleWindow, SelectCompanyLiveryWindow, DepotWindow, BuildDocksToolbarWindow, SaveLoadWindow, GenerateLandscapeWindow, GraphLegendWindow, BaseGraphWindow, PaymentRatesGraphWindow, CompanyLeagueWindow, PerformanceRatingDetailWindow, VehicleGroupWindow, BuildIndustryWindow, IndustryViewWindow, IndustryDirectoryWindow, IndustryCargoesWindow, SelectGameWindow, MainWindow, ErrmsgWindow, MusicTrackSelectionWindow, MusicWindow, NetworkChatWindow, NetworkContentListWindow, NetworkGameWindow, SpriteAlignerWindow, NewGRFParametersWindow, NewGRFWindow, NewsWindow, MessageHistoryWindow, MessageOptionsWindow, OrdersWindow, OskWindow, BuildSignalWindow, BuildRoadToolbarWindow, GameOptionsWindow, GameDifficultyWindow, SignListWindow, SmallMapWindow, CompanyStationsWindow, SelectStationWindow< T >, StatusBarWindow, SubsidyListWindow, TimetableWindow, MainToolbarWindow, ScenarioEditorToolbarWindow, TownViewWindow, TownDirectoryWindow, FoundTownWindow, TransparenciesWindow, BuildTreesWindow, RefitWindow, VehicleListWindow, VehicleDetailsWindow, ExtraViewportWindow, and WaypointWindow.
Definition at line 630 of file window_gui.h.
Referenced by InvalidateData().
virtual EventState Window::OnKeyPress | ( | uint16 | key, | |
uint16 | keycode | |||
) | [inline, virtual] |
A key has been pressed.
key | the Unicode value of the key. | |
keycode | the untranslated key code including shift state. |
Reimplemented in AIDebugWindow, BuildAirToolbarWindow, BuildBridgeWindow, IConsoleWindow, BuildDocksToolbarWindow, SaveLoadWindow, GenerateLandscapeWindow, EndGameHighScoreBaseWindow, MainWindow, ErrmsgWindow, QueryStringWindow, QueryWindow, NetworkChatWindow, NetworkContentListWindow, NetworkGameWindow, NetworkStartServerWindow, NetworkCompanyPasswordWindow, NewGRFWindow, NewsWindow, OrdersWindow, BuildRailToolbarWindow, BuildRoadToolbarWindow, SignListWindow, SignWindow, TerraformToolbarWindow, ScenarioEditorLandscapeGenerationWindow, MainToolbarWindow, ScenarioEditorToolbarWindow, and FoundTownWindow.
Definition at line 515 of file window_gui.h.
References ES_NOT_HANDLED.
Referenced by HandleKeypress().
virtual void Window::OnMouseDrag | ( | Point | pt, | |
int | widget | |||
) | [inline, virtual] |
An 'object' is being dragged at the provided position, highlight the target if possible.
pt | The point inside the window that the mouse hovers over. | |
widget | The widget the mouse hovers over. |
Reimplemented in DepotWindow, OrdersWindow, and RefitWindow.
Definition at line 554 of file window_gui.h.
Referenced by HandleMouseDrag().
virtual void Window::OnMouseOver | ( | Point | pt, | |
int | widget | |||
) | [inline, virtual] |
The mouse is currently moving over the window or has just moved outside of the window.
In the latter case pt is (-1, -1).
pt | the point inside the window that the mouse hovers over. | |
widget | the widget the mouse hovers over. |
Reimplemented in NetworkClientListWindow.
Definition at line 575 of file window_gui.h.
Referenced by HandleMouseOver().
virtual void Window::OnMouseWheel | ( | int | wheel | ) | [inline, virtual] |
The mouse wheel has been turned.
wheel | the amount of movement of the mouse wheel. |
Reimplemented in MainWindow, SmallMapWindow, and ExtraViewportWindow.
Definition at line 581 of file window_gui.h.
virtual void Window::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented in AIDebugWindow, BuildAirportWindow, ReplaceVehicleWindow, BuildVehicleWindow, CompanyFinancesWindow, SelectCompanyLiveryWindow, SelectCompanyManagerFaceWindow, CompanyWindow, IConsoleWindow, DepotWindow, BuildDocksStationWindow, BuildDocksDepotWindow, SaveLoadWindow, GenerateLandscapeWindow, CreateScenarioWindow, CompanyLeagueWindow, VehicleGroupWindow, EndGameWindow, HighScoreWindow, IndustryViewWindow, MainWindow, QueryStringWindow, NetworkChatWindow, NetworkContentListWindow, NetworkGameWindow, NetworkStartServerWindow, NetworkLobbyWindow, NetworkClientListWindow, NetworkCompanyPasswordWindow, NewGRFWindow, MessageHistoryWindow, OrdersWindow, OskWindow, BuildRailStationWindow, BuildRoadStationWindow, SignListWindow, SignWindow, SmallMapWindow, CompanyStationsWindow, StationViewWindow, ScenarioEditorLandscapeGenerationWindow, TimetableWindow, MainToolbarWindow, ScenarioEditorToolbarWindow, TownAuthorityWindow, FoundTownWindow, TransparenciesWindow, BuildTreesWindow, RefitWindow, VehicleListWindow, VehicleDetailsWindow, and VehicleViewWindow.
Definition at line 463 of file window_gui.h.
References DrawWidgets().
Referenced by DrawOverlappedWindow().
virtual void Window::OnPlaceDrag | ( | ViewportPlaceMethod | select_method, | |
ViewportDragDropSelectionProcess | select_proc, | |||
Point | pt | |||
) | [inline, virtual] |
The user is dragging over the map when the tile highlight mode has been set.
select_method | the method of selection (allowed directions) | |
select_proc | what will be created when the drag is over. | |
pt | the exact point on the map where the mouse is. |
Reimplemented in BuildAirToolbarWindow, BuildDocksToolbarWindow, BuildRailToolbarWindow, BuildRoadToolbarWindow, TerraformToolbarWindow, ScenarioEditorLandscapeGenerationWindow, and BuildTreesWindow.
Definition at line 660 of file window_gui.h.
Referenced by VpHandlePlaceSizingDrag().
virtual void Window::OnPlaceMouseUp | ( | ViewportPlaceMethod | select_method, | |
ViewportDragDropSelectionProcess | select_proc, | |||
Point | pt, | |||
TileIndex | start_tile, | |||
TileIndex | end_tile | |||
) | [inline, virtual] |
The user has dragged over the map when the tile highlight mode has been set.
select_method | the method of selection (allowed directions) | |
select_proc | what should be created. | |
pt | the exact point on the map where the mouse was released. | |
start_tile | the begin tile of the drag. | |
end_tile | the end tile of the drag. |
Reimplemented in BuildAirToolbarWindow, BuildDocksToolbarWindow, BuildRailToolbarWindow, BuildRoadToolbarWindow, TerraformToolbarWindow, ScenarioEditorLandscapeGenerationWindow, and BuildTreesWindow.
Definition at line 671 of file window_gui.h.
Referenced by PlaceRail_Bridge(), PlaceRoad_Bridge(), and VpHandlePlaceSizingDrag().
The user clicked some place on the map when a tile highlight mode has been set.
pt | the exact point on the map that has been clicked. | |
tile | the tile on the map that has been clicked. |
Reimplemented in BuildAirToolbarWindow, CompanyWindow, BuildDocksToolbarWindow, BuildIndustryWindow, OrdersWindow, BuildRailToolbarWindow, BuildRoadToolbarWindow, TerraformToolbarWindow, ScenarioEditorLandscapeGenerationWindow, MainToolbarWindow, ScenarioEditorToolbarWindow, FoundTownWindow, and BuildTreesWindow.
Definition at line 639 of file window_gui.h.
The user moves over the map when a tile highlight mode has been set when the special mouse mode has been set to 'PRESIZE' mode.
An example of this is the tile highlight for dock building.
pt | the exact point on the map where the mouse is. | |
tile | the tile on the map where the mouse is. |
Reimplemented in BuildDocksToolbarWindow, BuildRailToolbarWindow, and BuildRoadToolbarWindow.
Definition at line 680 of file window_gui.h.
virtual void Window::OnQueryTextFinished | ( | char * | str | ) | [inline, virtual] |
The query window opened from this window has closed.
str | the new value of the string, NULL if the window was cancelled or an empty string when the default button was pressed, i.e. StrEmpty(str). |
Reimplemented in AISettingsWindow, BuildVehicleWindow, CheatWindow, SelectCompanyManagerFaceWindow, CompanyWindow, DepotWindow, GenerateLandscapeWindow, CreateScenarioWindow, VehicleGroupWindow, IndustryViewWindow, NetworkGameWindow, NetworkStartServerWindow, NetworkJoinStatusWindow, SpriteAlignerWindow, NewGRFParametersWindow, NewGRFWindow, OrdersWindow, GameSettingsWindow, CustomCurrencyWindow, StationViewWindow, TimetableWindow, ScenarioEditorToolbarWindow, TownViewWindow, VehicleDetailsWindow, and WaypointWindow.
Definition at line 624 of file window_gui.h.
virtual void Window::OnResize | ( | ) | [inline, virtual] |
Called after the window got resized.
For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.
Reimplemented in AIListWindow, AISettingsWindow, AIDebugWindow, ReplaceVehicleWindow, BuildBridgeWindow, BuildVehicleWindow, DepotWindow, SaveLoadWindow, VehicleGroupWindow, BuildIndustryWindow, IndustryViewWindow, IndustryDirectoryWindow, IndustryCargoesWindow, MainWindow, NetworkContentListWindow, NetworkGameWindow, NetworkLobbyWindow, SpriteAlignerWindow, NewGRFParametersWindow, NewGRFWindow, MessageHistoryWindow, OrdersWindow, GameSettingsWindow, SignListWindow, CompanyStationsWindow, StationViewWindow, SelectStationWindow< T >, SubsidyListWindow, TimetableWindow, TownViewWindow, TownDirectoryWindow, RefitWindow, VehicleListWindow, VehicleDetailsWindow, VehicleViewWindow, ExtraViewportWindow, and WaypointWindow.
Definition at line 609 of file window_gui.h.
Referenced by FindWindowPlacementAndResize(), and ResizeWindow().
virtual bool Window::OnRightClick | ( | Point | pt, | |
int | widget | |||
) | [inline, virtual] |
A click with the right mouse button has been made on the window.
pt | the point inside the window that has been clicked. | |
widget | the clicked widget. |
Reimplemented in DepotWindow, and SmallMapWindow.
Definition at line 540 of file window_gui.h.
Referenced by DispatchRightClickEvent().
virtual void Window::OnScroll | ( | Point | delta | ) | [inline, virtual] |
Handle the request for (viewport) scrolling.
delta | the amount the viewport must be scrolled. |
Reimplemented in MainWindow, SmallMapWindow, and ExtraViewportWindow.
Definition at line 567 of file window_gui.h.
Referenced by HandleViewportScroll().
virtual void Window::OnVehicleSelect | ( | const struct Vehicle * | v | ) | [inline, virtual] |
The user clicked on a vehicle while HT_VEHICLE has been set.
v | clicked vehicle. It is guaranteed to be v->IsPrimaryVehicle() == true |
Definition at line 645 of file window_gui.h.
Referenced by VehicleClicked().
FORCEINLINE void Window::operator delete | ( | void * | ptr | ) | [inline] |
Helper allocation function to disallow something.
Don't free the window directly; it corrupts the linked list when iterating
ptr | the pointer not to free |
Reimplemented from ZeroedMemoryAllocator.
Definition at line 245 of file window_gui.h.
FORCEINLINE void* Window::operator new[] | ( | size_t | size | ) | [inline] |
Helper allocation function to disallow something.
Don't allow arrays; arrays of Windows are pointless as you need to destruct them all at the same time too, which is kinda hard.
size | the amount of space not to allocate |
Reimplemented from ZeroedMemoryAllocator.
Definition at line 235 of file window_gui.h.
void Window::RaiseButtons | ( | bool | autoraise = false |
) |
Raise the buttons of the window.
autoraise | Raise only the push buttons of the window. |
Definition at line 237 of file window.cpp.
References IsWidgetLowered(), nested_array, nested_array_size, RaiseWidget(), SetWidgetDirty(), and WWT_LAST.
Referenced by BuildIndustryWindow::OnClick(), CompanyWindow::OnPlaceObject(), BuildTreesWindow::OnPlaceObjectAbort(), FoundTownWindow::OnPlaceObjectAbort(), ScenarioEditorLandscapeGenerationWindow::OnPlaceObjectAbort(), TerraformToolbarWindow::OnPlaceObjectAbort(), BuildRoadToolbarWindow::OnPlaceObjectAbort(), BuildIndustryWindow::OnPlaceObjectAbort(), BuildDocksToolbarWindow::OnPlaceObjectAbort(), CompanyWindow::OnPlaceObjectAbort(), BuildAirToolbarWindow::OnPlaceObjectAbort(), and BuildIndustryWindow::OnTimeout().
void Window::RaiseWidget | ( | byte | widget_index | ) | [inline] |
Marks a widget as raised.
widget_index | index of this widget in the window |
Definition at line 387 of file window_gui.h.
References SetWidgetLoweredState().
Referenced by BuildRailStationWindow::CheckSelectedSize(), GameDifficultyWindow::OnClick(), BuildRoadStationWindow::OnClick(), BuildRoadDepotWindow::OnClick(), BuildRailDepotWindow::OnClick(), BuildSignalWindow::OnClick(), BuildRailStationWindow::OnClick(), PerformanceRatingDetailWindow::OnClick(), CreateScenarioWindow::OnClick(), BuildDocksDepotWindow::OnClick(), BuildDocksStationWindow::OnClick(), SelectCompanyLiveryWindow::OnClick(), AIDebugWindow::OnClick(), SpriteAlignerWindow::OnInvalidateData(), IndustryCargoesWindow::OnInvalidateData(), PerformanceRatingDetailWindow::OnInvalidateData(), GraphLegendWindow::OnInvalidateData(), VehicleGroupWindow::OnPaint(), AIDebugWindow::OnPaint(), OrdersWindow::OnPlaceObjectAbort(), DepotWindow::OnPlaceObjectAbort(), BuildTreesWindow::OnTimeout(), FoundTownWindow::OnTimeout(), MainToolbarWindow::OnTimeout(), ScenarioEditorLandscapeGenerationWindow::OnTimeout(), TerraformToolbarWindow::OnTimeout(), OrdersWindow::OnTimeout(), NetworkStartServerWindow::OnTimeout(), CreateScenarioWindow::OnTimeout(), GenerateLandscapeWindow::OnTimeout(), DepotWindow::OnTimeout(), AIDebugWindow::OnTimeout(), RaiseButtons(), ResetSignalVariant(), SmallMapWindow::SwitchMapType(), and BuildRoadToolbarWindow::UpdateOptionWidgetStatus().
void Window::ReInit | ( | int | rx = 0 , |
|
int | ry = 0 | |||
) |
Re-initialize a window, and optionally change its size.
rx | Horizontal resize of the window. | |
ry | Vertical resize of the window. |
Definition at line 566 of file window.cpp.
References _current_text_dir, NWidgetBase::AssignSizePosition(), height, max(), nested_root, OnInit(), resize, NWidgetBase::resize_x, NWidgetBase::resize_y, ResizeWindow(), SetDirty(), NWidgetBase::SetupSmallestSize(), NWidgetBase::smallest_x, NWidgetBase::smallest_y, ST_SMALLEST, ResizeInfo::step_height, ResizeInfo::step_width, TD_RTL, and width.
Referenced by DeleteNewGRFInspectWindow(), BuildObjectWindow::DrawWidget(), BuildRailToolbarWindow::ModifyRailType(), StationViewWindow::OnClick(), SelectCompanyManagerFaceWindow::OnClick(), SelectCompanyLiveryWindow::OnClick(), CompanyFinancesWindow::OnClick(), CompanyFinancesWindow::OnHundredthTick(), VehicleDetailsWindow::OnInvalidateData(), RefitWindow::OnInvalidateData(), TimetableWindow::OnInvalidateData(), SmallMapWindow::OnInvalidateData(), SelectCompanyLiveryWindow::OnInvalidateData(), StationViewWindow::OnPaint(), IndustryViewWindow::OnPaint(), CompanyFinancesWindow::OnPaint(), BuildVehicleWindow::OnPaint(), ReInitAllWindows(), and SetShaded().
bool Window::SetFocusedWidget | ( | byte | widget_index | ) |
Set focus within this window to the given widget.
The function however doesn't change which window has focus.
widget_index | Index of the widget in the window to set the focus to. |
Definition at line 177 of file window.cpp.
References nested_array, nested_array_size, nested_focus, and NWidgetBase::SetDirty().
Referenced by DispatchLeftClickEvent(), NetworkContentListWindow::NetworkContentListWindow(), FoundTownWindow::OnClick(), OskWindow::OnClick(), and SignListWindow::OnKeyPress().
void Window::SetShaded | ( | bool | make_shaded | ) |
Set the shaded state of the window to make_shaded.
make_shaded | If true , shade the window (roll up until just the title bar is visible), else unshade/unroll the window to its original size. |
Definition at line 602 of file window.cpp.
References height, ReInit(), NWidgetStacked::SetDisplayedPlane(), shade_select, NWidgetStacked::shown_plane, SZSP_HORIZONTAL, unshaded_size, and width.
Referenced by BringWindowToFrontById(), DispatchLeftClickEvent(), DispatchMouseWheelEvent(), and CompanyFinancesWindow::OnClick().
virtual void Window::SetStringParameters | ( | int | widget | ) | const [inline, virtual] |
Initialize string parameters for a widget.
Calls to this function are made during initialization to measure the size (that is as part of InitNested()), during drawing, and while re-initializing the window. Only for widgets that render text initializing is requested.
widget | Widget number. |
Reimplemented in AIConfigWindow, AIDebugWindow, BuildAirportWindow, ReplaceVehicleWindow, BuildVehicleWindow, CompanyFinancesWindow, SelectCompanyLiveryWindow, CompanyWindow, BuyCompanyWindow, SetDateWindow, DepotWindow, GenerateLandscapeWindow, CreateScenarioWindow, VehicleGroupWindow, BuildIndustryWindow, IndustryViewWindow, IndustryDirectoryWindow, IndustryCargoesWindow, SelectGameWindow, AboutWindow, ErrmsgWindow, QueryStringWindow, QueryWindow, MusicTrackSelectionWindow, NetworkGameWindow, NetworkStartServerWindow, NetworkLobbyWindow, NewGRFInspectWindow, SpriteAlignerWindow, NewGRFParametersWindow, NewGRFWindow, NewsWindow, BuildObjectWindow, OrdersWindow, OskWindow, BuildRailToolbarWindow, BuildRailStationWindow, BuildSignalWindow, GameOptionsWindow, GameDifficultyWindow, CustomCurrencyWindow, SignListWindow, SignWindow, SmallMapWindow, CompanyStationsWindow, StationViewWindow, TimetableWindow, TownAuthorityWindow, TownViewWindow, TownDirectoryWindow, RefitWindow, VehicleListWindow, VehicleDetailsWindow, VehicleViewWindow, ExtraViewportWindow, and WaypointWindow.
Definition at line 496 of file window_gui.h.
Referenced by NWidgetLeaf::Draw(), NWidgetBackground::Draw(), NWidgetLeaf::SetupSmallestSize(), and NWidgetBackground::SetupSmallestSize().
void Window::SetWidgetDirty | ( | byte | widget_index | ) | const |
Invalidate a widget, i.e.
mark it as being changed and in need of redraw.
widget_index | the widget to redraw. |
Definition at line 252 of file window.cpp.
References nested_array, and NWidgetBase::SetDirty().
Referenced by IndustryDirectoryWindow::BuildSortIndustriesList(), SignListWindow::ClearFilterTextWidget(), HandleButtonClick(), HandleZoomMessage(), RefitWindow::OnClick(), TransparenciesWindow::OnClick(), MusicWindow::OnClick(), IndustryCargoesWindow::OnClick(), SaveLoadWindow::OnClick(), DepotWindow::OnClick(), CompanyWindow::OnClick(), AIDebugWindow::OnClick(), DepotWindow::OnCTRLStateChange(), OrdersWindow::OnDragDrop(), SignListWindow::OnInvalidateData(), OskWindow::OnInvalidateData(), IndustryCargoesWindow::OnInvalidateData(), AIDebugWindow::OnInvalidateData(), RefitWindow::OnMouseDrag(), OrdersWindow::OnMouseDrag(), DepotWindow::OnMouseDrag(), OskWindow::OnMouseLoop(), AIDebugWindow::OnPaint(), BuildRoadToolbarWindow::OnPlaceObjectAbort(), OrdersWindow::OnPlaceObjectAbort(), VehicleGroupWindow::OnPlaceObjectAbort(), DepotWindow::OnPlaceObjectAbort(), NetworkStartServerWindow::OnQueryTextFinished(), CreateScenarioWindow::OnQueryTextFinished(), GenerateLandscapeWindow::OnQueryTextFinished(), MainToolbarWindow::OnTick(), StatusBarWindow::OnTick(), BuildTreesWindow::OnTimeout(), ScenarioEditorToolbarWindow::OnTimeout(), MainToolbarWindow::OnTimeout(), ScenarioEditorLandscapeGenerationWindow::OnTimeout(), TerraformToolbarWindow::OnTimeout(), OrdersWindow::OnTimeout(), NetworkStartServerWindow::OnTimeout(), CreateScenarioWindow::OnTimeout(), GenerateLandscapeWindow::OnTimeout(), DepotWindow::OnTimeout(), OrdersWindow::OrderClick_Conditional(), OrdersWindow::OrderClick_Goto(), OrdersWindow::OrderClick_Nonstop(), OrdersWindow::OrderClick_Share(), OrdersWindow::OrderClick_Unload(), RaiseButtons(), SignListWindow::SetFilterString(), SetWindowWidgetDirty(), ShowDropDownList(), BuildBridgeWindow::SortBridgeList(), CompanyStationsWindow::SortStationsList(), ToggleRailButton_Remove(), ToggleRoadButton_Remove(), and BuildRoadToolbarWindow::UpdateOptionWidgetStatus().
void Window::SetWidgetDisabledState | ( | byte | widget_index, | |
bool | disab_stat | |||
) | [inline] |
Sets the enabled/disabled status of a widget.
By default, widgets are enabled. On certain conditions, they have to be disabled.
widget_index | index of this widget in the window | |
disab_stat | status to use ie: disabled = true, enabled = false |
Definition at line 296 of file window_gui.h.
References nested_array, and nested_array_size.
Referenced by DisableWidget(), EnableWidget(), HandleZoomMessage(), RefitWindow::OnClick(), RefitWindow::OnInit(), WaypointWindow::OnInvalidateData(), GameDifficultyWindow::OnInvalidateData(), BuildSignalWindow::OnInvalidateData(), NewGRFWindow::OnInvalidateData(), NewGRFParametersWindow::OnInvalidateData(), NetworkContentListWindow::OnInvalidateData(), MusicTrackSelectionWindow::OnInvalidateData(), PerformanceRatingDetailWindow::OnInvalidateData(), GenerateLandscapeWindow::OnInvalidateData(), SaveLoadWindow::OnInvalidateData(), AIConfigWindow::OnInvalidateData(), VehicleDetailsWindow::OnPaint(), VehicleListWindow::OnPaint(), TownAuthorityWindow::OnPaint(), ScenarioEditorToolbarWindow::OnPaint(), MainToolbarWindow::OnPaint(), TimetableWindow::OnPaint(), StationViewWindow::OnPaint(), BuildRailStationWindow::OnPaint(), NetworkLobbyWindow::OnPaint(), NetworkGameWindow::OnPaint(), CreateScenarioWindow::OnPaint(), CompanyWindow::OnPaint(), SelectCompanyLiveryWindow::OnPaint(), CompanyFinancesWindow::OnPaint(), BuildIndustryWindow::SetButtons(), MessageOptionsWindow::SetMessageButtonStates(), SetWidgetsDisabledState(), SmallMapWindow::SetZoomLevel(), BuildRoadToolbarWindow::UpdateOptionWidgetStatus(), and OskWindow::UpdateOskState().
void Window::SetWidgetLoweredState | ( | byte | widget_index, | |
bool | lowered_stat | |||
) | [inline] |
Sets the lowered/raised status of a widget.
widget_index | index of this widget in the window | |
lowered_stat | status to use ie: lowered = true, raised = false |
Definition at line 357 of file window_gui.h.
References nested_array_size.
Referenced by LowerWidget(), FoundTownWindow::OnClick(), SmallMapWindow::OnClick(), SignListWindow::OnClick(), GameOptionsWindow::OnClick(), BuildRailStationWindow::OnClick(), MusicWindow::OnClick(), BuildAirportWindow::OnClick(), AIDebugWindow::OnClick(), TransparenciesWindow::OnInvalidateData(), GameOptionsWindow::OnInvalidateData(), BuildSignalWindow::OnInvalidateData(), MessageOptionsWindow::OnInvalidateData(), MusicWindow::OnInvalidateData(), MusicTrackSelectionWindow::OnInvalidateData(), SelectGameWindow::OnInvalidateData(), GenerateLandscapeWindow::OnInvalidateData(), TimetableWindow::OnPaint(), CreateScenarioWindow::OnPaint(), SelectCompanyManagerFaceWindow::OnPaint(), RaiseWidget(), SetWidgetsLoweredState(), and OskWindow::UpdateOskState().
void CDECL Window::SetWidgetsDisabledState | ( | bool | disab_stat, | |
int | widgets, | |||
... | ||||
) |
Sets the enabled/disabled status of a list of widgets.
By default, widgets are enabled. On certain conditions, they have to be disabled.
disab_stat | status to use ie: disabled = true, enabled = false | |
widgets | list of widgets ended by WIDGET_LIST_END |
Definition at line 200 of file window.cpp.
References SetWidgetDisabledState(), and WIDGET_LIST_END.
Referenced by VehicleDetailsWindow::OnClick(), BuildRoadToolbarWindow::OnInvalidateData(), NewGRFWindow::OnInvalidateData(), GenerateLandscapeWindow::OnInvalidateData(), BuildDocksToolbarWindow::OnInvalidateData(), SelectCompanyLiveryWindow::OnInvalidateData(), VehicleDetailsWindow::OnPaint(), VehicleListWindow::OnPaint(), MainToolbarWindow::OnPaint(), VehicleGroupWindow::OnPaint(), DepotWindow::OnPaint(), SelectCompanyManagerFaceWindow::OnPaint(), AIDebugWindow::OnPaint(), BuildRoadToolbarWindow::OnPlaceObjectAbort(), and BuildRoadToolbarWindow::UpdateOptionWidgetStatus().
void CDECL Window::SetWidgetsLoweredState | ( | bool | lowered_stat, | |
int | widgets, | |||
... | ||||
) |
Sets the lowered/raised status of a list of widgets.
lowered_stat | status to use ie: lowered = true, raised = false | |
widgets | list of widgets ended by WIDGET_LIST_END |
Definition at line 219 of file window.cpp.
References SetWidgetLoweredState(), and WIDGET_LIST_END.
Referenced by SelectCompanyManagerFaceWindow::OnPaint(), ScenarioEditorToolbarWindow::OnTimeout(), and BuildRoadToolbarWindow::UpdateOptionWidgetStatus().
virtual void Window::ShowNewGRFInspectWindow | ( | ) | const [inline, virtual] |
Show the NewGRF inspection window.
When this function is called it is up to the window to call and pass the right parameters to the ShowInspectWindow function.
Reimplemented in IndustryViewWindow, LandInfoWindow, and VehicleViewWindow.
Definition at line 696 of file window_gui.h.
Referenced by DispatchLeftClickEvent().
void Window::ToggleWidgetLoweredState | ( | byte | widget_index | ) | [inline] |
Invert the lowered/raised status of a widget.
widget_index | index of this widget in the window |
Definition at line 367 of file window_gui.h.
References nested_array_size.
Referenced by BuildRoadToolbarWindow::OnClick(), BuildRailStationWindow::OnClick(), NetworkCompanyPasswordWindow::OnClick(), IndustryCargoesWindow::OnClick(), PaymentRatesGraphWindow::OnClick(), GraphLegendWindow::OnClick(), DepotWindow::OnClick(), ScenarioEditorToolbarWindow::OnTick(), MainToolbarWindow::OnTick(), OrdersWindow::OrderClick_Goto(), ToggleRailButton_Remove(), and ToggleRoadButton_Remove().
void Window::UnfocusFocusedWidget | ( | ) |
Makes no widget on this window have focus.
The function however doesn't change which window has focus.
Definition at line 163 of file window.cpp.
References nested_focus, and NWidgetBase::SetDirty().
Referenced by FoundTownWindow::OnKeyPress(), and SignListWindow::OnKeyPress().
virtual void Window::UpdateWidgetSize | ( | int | widget, | |
Dimension * | size, | |||
const Dimension & | padding, | |||
Dimension * | fill, | |||
Dimension * | resize | |||
) | [inline, virtual] |
Update size and resize step of a widget in the window.
After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement, typically by computing the real maximal size of the content. Afterwards, size is taken to be the minimal size of the widget and resize is taken to contain the resize steps. For the convenience of the callee, padding contains the amount of padding between the content and the edge of the widget. This should be added to the returned size.
widget | Widget number. | |
size | Size of the widget. | |
padding | Recommended amount of space between the widget content and the widget edge. | |
fill | Fill step of the widget. | |
resize | Resize step of the widget. |
Reimplemented in AIListWindow, AISettingsWindow, AIConfigWindow, AIDebugWindow, BuildAirportWindow, ReplaceVehicleWindow, BuildBridgeWindow, BuildVehicleWindow, CheatWindow, CompanyFinancesWindow, SelectCompanyLiveryWindow, SelectCompanyManagerFaceWindow, CompanyWindow, BuyCompanyWindow, SetDateWindow, DepotWindow, EnginePreviewWindow, SaveLoadWindow, GenerateLandscapeWindow, CreateScenarioWindow, GenerateProgressWindow, BaseGraphWindow, PaymentRatesGraphWindow, CompanyLeagueWindow, PerformanceRatingDetailWindow, VehicleGroupWindow, BuildIndustryWindow, IndustryViewWindow, IndustryDirectoryWindow, IndustryCargoesWindow, SelectGameWindow, LandInfoWindow, AboutWindow, ErrmsgWindow, TooltipsWindow, QueryStringWindow, QueryWindow, MusicTrackSelectionWindow, MusicWindow, NetworkChatWindow, NetworkContentListWindow, NetworkGameWindow, NetworkStartServerWindow, NetworkLobbyWindow, NetworkClientListPopupWindow, NetworkClientListWindow, NetworkJoinStatusWindow, NewGRFInspectWindow, SpriteAlignerWindow, NewGRFParametersWindow, NewGRFWindow, NewsWindow, MessageHistoryWindow, MessageOptionsWindow, BuildObjectWindow, OrdersWindow, BuildRailStationWindow, BuildRailWaypointWindow, GameOptionsWindow, GameDifficultyWindow, GameSettingsWindow, CustomCurrencyWindow, SignListWindow, CompanyStationsWindow, StationViewWindow, SelectStationWindow< T >, StatusBarWindow, SubsidyListWindow, TimetableWindow, ScenarioEditorToolbarWindow, TownAuthorityWindow, TownViewWindow, TownDirectoryWindow, BuildTreesWindow, RefitWindow, VehicleListWindow, VehicleDetailsWindow, and VehicleViewWindow.
Definition at line 488 of file window_gui.h.
Referenced by NWidgetLeaf::SetupSmallestSize(), NWidgetBackground::SetupSmallestSize(), NWidgetMatrix::SetupSmallestSize(), and NWidgetStacked::SetupSmallestSize().
uint32 Window::desc_flags |
Window/widgets default flags setting.
Definition at line 263 of file window_gui.h.
Referenced by DeleteConstructionWindows(), DispatchLeftClickEvent(), InitializeData(), and MaybeBringWindowToFront().
uint16 Window::flags4 |
Window flags,.
Definition at line 249 of file window_gui.h.
Referenced by BringWindowToFrontById(), CheckSoftLimit(), DeleteAllNonVitalWindows(), DeleteNonVitalWindows(), DeleteWindowById(), DispatchLeftClickEvent(), NWidgetLeaf::Draw(), DrawWidgets(), DropdownWindow::DropdownWindow(), HandleAutoscroll(), HandleButtonClick(), HandleWindowDragging(), InitializeData(), MaybeBringWindowToFront(), BuildTreesWindow::OnClick(), CustomCurrencyWindow::OnClick(), GameSettingsWindow::OnClick(), NetworkStartServerWindow::OnClick(), IndustryViewWindow::OnClick(), CreateScenarioWindow::OnClick(), GenerateLandscapeWindow::OnClick(), CheatWindow::OnClick(), RelocateAllWindows(), StartWindowDrag(), StartWindowSizing(), and UpdateWindows().