OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
Window Struct Reference

Data structure for an opened window. More...

`#include <window_gui.h>`

Inheritance diagram for Window:

## Public Member Functions
| Window (WindowDesc *desc)
| 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.
void * | operator new[] (size_t size)
| Helper allocation function to disallow something.
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.
const QueryString * | GetQueryString (uint widnum) const
| Return the querystring associated to a editbox.
QueryString * | GetQueryString (uint widnum)
| Return the querystring associated to a editbox.
virtual const char * | GetFocusedText () const
| Get the current input text if an edit box has the focus.
virtual const char * | GetCaret () const
| Get the string at the caret if an edit box has the focus.
virtual const char * | GetMarkedText (size_t *length) const
| Get the range of the currently marked input text.
virtual Point | GetCaretPosition () const
| Get the current caret position if an edit box has the focus.
virtual Rect | GetTextBoundingRect (const char *from, const char *to) const
| Get the bounding rectangle for a text range if an edit box has the focus.
virtual const char * | GetTextCharacterAtPosition (const Point &pt) const
| Get the character that is rendered at a position by the focused edit box.
void | InitNested (WindowNumber number=0)
| Perform complete initialization of the Window with nested widgets, to allow use.
void | CreateNestedTree (bool fill_nested=true)
| Perform the first part of the initialization of a nested widget tree.
void | FinishInitNested (WindowNumber window_number=0)
| Perform the second part of the initialization of a nested widget tree.
void | SetTimeout ()
| Set the timeout flag of the window and initiate the timer.
void | SetWhiteBorder ()
| Set the timeout flag of the window and initiate the timer.
void | DisableAllWidgetHighlight ()
| Disable the highlighted status of all widgets.
void | SetWidgetHighlight (byte widget_index, TextColour highlighted_colour)
| Sets the highlighted status of a widget.
bool | IsWidgetHighlighted (byte widget_index) const
| Gets the highlighted status of a widget.
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 (int widget_index)
| Set focus within this window to the given widget.
EventState | HandleEditBoxKey (int wid, WChar key, uint16 keycode)
| Process keypress for editbox widget.
virtual void | InsertTextString (int wid, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end)
| Insert a text string at the cursor position into the edit box 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, bool gui_scope=true)
| Mark this window's data as invalid (in need of re-computing)
void | ProcessScheduledInvalidations ()
| Process all scheduled invalidations.
void | ProcessHighlightedInvalidations ()
| Process all invalidation of highlighted widgets.
virtual void | OnInit ()
| Notification that the nested widget tree gets initialized.
virtual void | ApplyDefaults ()
| Read default values from WindowDesc configuration an apply them to the window.
virtual Point | OnInitialPosition (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 (WChar key, uint16 keycode)
| A key has been pressed.
virtual EventState | OnHotkey (int hotkey)
| A hotkey 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 | OnDropdownClose (Point pt, int widget, int index, bool instant_close)
| A dropdown window associated to this window has been closed.
virtual void | OnEditboxChanged (int widget)
| The text in an editbox has been edited.
virtual void | OnQueryTextFinished (char *str)
| The query window opened from this window has closed.
virtual void | OnInvalidateData (int data=0, bool gui_scope=true)
| 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 bool | 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.
Public Member Functions inherited from ZeroedMemoryAllocator
void * | operator new (size_t size)
| Memory allocator for a single class instance.
void | operator delete[] (void *ptr)
| Memory release for an array of class instances.

## Static Public Member Functions
static int | SortButtonWidth ()
| Get width of up/down arrow of sort button state.

## Data Fields
WindowDesc * | window_desc
| Window description.
WindowFlags | flags
| Window flags.
WindowClass | window_class
| Window class.
WindowNumber | window_number
| Window number within the window class.
uint8 | timeout_timer
| Timer value of the WF_TIMEOUT for flags.
uint8 | white_border_timer
| Timer value of the WF_WHITE_BORDER for flags.
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.
const NWidgetCore * | nested_focus
| Currently focused nested widget, or `NULL` if no nested widget has focus.
SmallMap< int, QueryString * > | querystrings
| QueryString associated to WWT_EDITBOX widgets.
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 if 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 (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.
virtual void | FindWindowPlacementAndResize (int def_width, int def_height)
| Resize window towards the default size.

## Protected Attributes
SmallVector< int, 4 > | scheduled_invalidation_data
| Data of scheduled OnInvalidateData() calls.

## Detailed Description

Data structure for an opened window.

Definition at line 271 of file window_gui.h.

## Constructor & Destructor Documentation

Window::Window | ( | WindowDesc * | desc | ) |

Empty constructor, initialization has been moved to InitNested() called from the constructor of the derived class.

Parameters

  desc | The description of the window.

Definition at line 1843 of file window.cpp.

## Member Function Documentation

void Window::CreateNestedTree | ( | 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.

Parameters

  fill_nested | Fill the nested_array (enabling is expensive!).

Note
  Filling the nested array requires an additional traversal through the nested widget tree, and is best performed by FinishInitNested rather than here.

Definition at line 1804 of file window.cpp.

References MakeWindowNWidgetTree(), nested_array, nested_array_size, nested_root, WindowDesc::nwid_parts, and window_desc.

Referenced by AIDebugWindow::AIDebugWindow(), AIListWindow::AIListWindow(), AISettingsWindow::AISettingsWindow(), DropdownWindow::DropdownWindow(), InitNested(), NetworkContentListWindow::NetworkContentListWindow(), SavePresetWindow::SavePresetWindow(), VehicleDetailsWindow::VehicleDetailsWindow(), and WaypointWindow::WaypointWindow().

void Window::DeleteChildWindows | ( | WindowClass | wc = `WC_INVALID` | ) | const

Delete all children a window might have in a head-recursive manner.

Parameters

  wc | Window class of the window to remove; WC_INVALID if class does not matter

Definition at line 1047 of file window.cpp.

References FindChildWindow().

Referenced by NewGRFParametersWindow::OnClick(), AISettingsWindow::OnClick(), TimetableWindow::OnClick(), NewGRFWindow::OnClick(), OrdersWindow::OnClick(), TimetableWindow::OnInvalidateData(), NewGRFParametersWindow::OnInvalidateData(), OrdersWindow::OnInvalidateData(), NewGRFWindow::OnNewGRFsScanned(), and ~Window().

void Window::DisableWidget | ( | byte | widget_index | ) |
| inline

Sets a widget to disabled.

Parameters

  widget_index | index of this widget in the window

Definition at line 397 of file window_gui.h.

References SetWidgetDisabledState().

Referenced by CustomCurrencyWindow::OnClick(), NewGRFWindow::OnInvalidateData(), CompanyWindow::OnInvalidateData(), TimetableWindow::OnPaint(), VehicleDetailsWindow::OnPaint(), and BuildRoadToolbarWindow::UpdateOptionWidgetStatus().

void Window::DrawSortButtonState | ( | int | widget,
|  | SortButtonState | state
| ) |  | const

Draw a sort button's up or down arrow symbol.

Parameters

  widget | Sort button widget
  state | State of sort button

Definition at line 638 of file widget.cpp.

References _current_text_dir, NWidgetBase::current_x, NWidgetBase::current_y, DrawSprite(), IsWidgetLowered(), nested_array, NWidgetBase::pos_x, NWidgetBase::pos_y, SBS_DOWN, SBS_OFF, and TD_LTR.

Referenced by BuildBridgeWindow::DrawWidget(), SaveLoadWindow::DrawWidget(), VehicleGroupWindow::DrawWidget(), NetworkGameWindow::DrawWidget(), TownDirectoryWindow::DrawWidget(), IndustryDirectoryWindow::DrawWidget(), BuildVehicleWindow::DrawWidget(), VehicleListWindow::DrawWidget(), and StationViewWindow::OnPaint().

virtual void Window::DrawWidget | ( | const Rect & | r,
|  | int | widget
| ) |  | const
| inline virtual

Draw the contents of a nested widget.

Parameters

  r | Rectangle occupied by the widget.
  widget | Number of the widget to draw.

Note
  This method may not change any state, it may only use drawing functions.

Reimplemented in VehicleViewWindow, IndustryCargoesWindow, BuyCompanyWindow, ScenarioEditorToolbarWindow, SelectStationWindow< T >, ScanProgressWindow, CompanyWindow, SavePresetWindow, VehicleDetailsWindow, NetworkJoinStatusWindow, GameSettingsWindow, NetworkClientListWindow, BuildRailWaypointWindow, NetworkClientListPopupWindow, CompanyInfrastructureWindow, BuildRailDepotWindow, VehicleListWindow, BuildSignalWindow, BuildVehicleWindow, NetworkLobbyWindow, PerformanceRatingDetailWindow, IndustryDirectoryWindow, SelectCompanyManagerFaceWindow, GenerateProgressWindow, AIDebugWindow, CompanyLeagueWindow, QueryWindow, BuildRailStationWindow, NetworkStartServerWindow, OrdersWindow, MessageHistoryWindow, BuildRoadStationWindow, PaymentRatesGraphWindow, BuildRoadDepotWindow, SpriteAlignerWindow, NewGRFWindow, AIConfigWindow, TownDirectoryWindow, RefitWindow, TooltipsWindow, SelectCompanyLiveryWindow, MusicWindow, NetworkGameWindow, ScenarioEditorLandscapeGenerationWindow, VehicleGroupWindow, BaseGraphWindow, GenerateLandscapeWindow, StoryBookWindow, AboutWindow, NetworkChatWindow, GoalQuestionWindow, BuildIndustryWindow, CompanyStationsWindow, MusicTrackSelectionWindow, NewsWindow, DepotWindow, BuildAirportWindow, AISettingsWindow, ReplaceVehicleWindow, TimetableWindow, SaveLoadWindow, CompanyFinancesWindow, GameOptionsWindow, TownViewWindow, ErrmsgWindow, NewGRFParametersWindow, CheatWindow, BuildBridgeWindow, DropdownWindow, BuildObjectWindow, SignListWindow, TownAuthorityWindow, SmallMapWindow, SubsidyListWindow, StatusBarWindow, AIListWindow, EnginePreviewWindow, BuildTreesWindow, LinkGraphLegendWindow, OskWindow, LandInfoWindow, SelectGameWindow, BootstrapBackground, GraphLegendWindow, TransparenciesWindow, and TextfileWindow.

Definition at line 564 of file window_gui.h.

Referenced by NWidgetBackground::Draw(), and NWidgetLeaf::Draw().

void Window::EnableWidget | ( | byte | widget_index | ) |
| inline

Sets a widget to Enabled.

Parameters

  widget_index | index of this widget in the window

Definition at line 406 of file window_gui.h.

References SetWidgetDisabledState().

Referenced by CustomCurrencyWindow::OnClick(), and SelectCompanyLiveryWindow::OnInvalidateData().

void Window::FindWindowPlacementAndResize | ( | int | def_width,
|  | int | def_height
| ) |  |
| protected virtual

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.

Parameters

  def_width | default width in pixels of the window
  def_height | default height in pixels of the window

See Also
  Window::Window(), Window::InitializeData(), Window::InitializePositionSize()

Reimplemented in ScenarioEditorToolbarWindow, MainToolbarWindow, NetworkChatWindow, and StatusBarWindow.

Definition at line 1498 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, WC_MAIN_TOOLBAR, WC_STATUS_BAR, and width.

Referenced by FinishInitNested().

void Window::FinishInitNested | ( | WindowNumber | window_number = `0` | ) |

Perform the second part of the initialization of a nested widget tree.

Parameters

  window_number | Number of the new window.

Definition at line 1820 of file window.cpp.

References ApplyDefaults(), FindWindowPlacementAndResize(), WindowDesc::GetDefaultHeight(), WindowDesc::GetDefaultWidth(), InitializeData(), InitializePositionSize(), nested_root, OnInitialPosition(), NWidgetBase::smallest_x, and window_desc.

Referenced by AIDebugWindow::AIDebugWindow(), AIListWindow::AIListWindow(), AISettingsWindow::AISettingsWindow(), DropdownWindow::DropdownWindow(), InitNested(), NetworkContentListWindow::NetworkContentListWindow(), SavePresetWindow::SavePresetWindow(), VehicleDetailsWindow::VehicleDetailsWindow(), and WaypointWindow::WaypointWindow().

const char * Window::GetCaret | ( |  | ) | const
| virtual

Get the string at the caret if an edit box has the focus.

Returns
  The text at the caret or NULL if no edit box is focused.

Reimplemented in IConsoleWindow.

Definition at line 361 of file window.cpp.

References QueryString::GetCaret(), GetQueryString(), NWidgetCore::index, nested_focus, NWidgetBase::type, and WWT_EDITBOX.

Point Window::GetCaretPosition | ( |  | ) | const
| virtual

Get the current caret position if an edit box has the focus.

Returns
  Top-left location of the caret, relative to the window.

Reimplemented in IConsoleWindow.

Definition at line 388 of file window.cpp.

References QueryString::GetCaretPosition(), GetQueryString(), NWidgetCore::index, nested_focus, NWidgetBase::type, and WWT_EDITBOX.

Referenced by SetCandidatePos(), and SetCompositionPos().

const char * Window::GetFocusedText | ( |  | ) | const
| virtual

Get the current input text if an edit box has the focus.

Returns
  The currently focused input text or NULL if no input focused.

Reimplemented in IConsoleWindow.

Definition at line 348 of file window.cpp.

References GetQueryString(), QueryString::GetText(), NWidgetCore::index, nested_focus, NWidgetBase::type, and WWT_EDITBOX.

const char * Window::GetMarkedText | ( | size_t * | length | ) | const
| virtual

Get the range of the currently marked input text.

Parameters

  [out] | length | Length of the marked text.

Returns
  Pointer to the start of the marked text or NULL if no text is marked.

Reimplemented in IConsoleWindow.

Definition at line 375 of file window.cpp.

References QueryString::GetMarkedText(), GetQueryString(), NWidgetCore::index, nested_focus, NWidgetBase::type, and WWT_EDITBOX.

const QueryString * Window::GetQueryString | ( | uint | widnum | ) | const

Return the querystring associated to a editbox.

Parameters

  widnum | Editbox widget index

Returns
  QueryString or NULL.

Definition at line 327 of file window.cpp.

References SmallVector< T, S >::End(), SmallMap< T, U, S >::Find(), and querystrings.

Referenced by DispatchLeftClickEvent(), NWidgetLeaf::Draw(), GetCaret(), GetCaretPosition(), GetFocusedText(), GetMarkedText(), GetTextBoundingRect(), GetTextCharacterAtPosition(), HandleEditBoxKey(), and InsertTextString().

QueryString * Window::GetQueryString | ( | uint | widnum | ) |

Return the querystring associated to a editbox.

Parameters

  widnum | Editbox widget index

Returns
  QueryString or NULL.

Definition at line 338 of file window.cpp.

References SmallVector< T, S >::End(), SmallMap< T, U, S >::Find(), and querystrings.

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.

Parameters

  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.

Returns
  Row number clicked at. If clicked at a wrong position, #INT_MAX is returned.

Note
  The widget does not know where a list printed at the widget ends, so below a list is not a wrong position.

Definition at line 199 of file window.cpp.

References NWidgetBase::pos_y, and NWidgetBase::resize_y.

Referenced by Scrollbar::GetScrolledRowFromWidget(), TownAuthorityWindow::OnClick(), and MusicTrackSelectionWindow::OnClick().

const Scrollbar * Window::GetScrollbar | ( | uint | widnum | ) | const

Return the Scrollbar to a widget index.

Parameters

  widnum | Scrollbar widget index

Returns
  Scrollbar to the widget

Definition at line 307 of file window.cpp.

Referenced by AIDebugWindow::AIDebugWindow(), AIListWindow::AIListWindow(), AISettingsWindow::AISettingsWindow(), DispatchMouseWheelEvent(), DropdownWindow::DropdownWindow(), NetworkContentListWindow::NetworkContentListWindow(), SavePresetWindow::SavePresetWindow(), and VehicleDetailsWindow::VehicleDetailsWindow().

Scrollbar * Window::GetScrollbar | ( | uint | widnum | ) |

Return the Scrollbar to a widget index.

Parameters

  widnum | Scrollbar widget index

Returns
  Scrollbar to the widget

Definition at line 317 of file window.cpp.

Rect Window::GetTextBoundingRect | ( | const char * | from,
|  | const char * | to
| ) |  | const
| virtual

Get the bounding rectangle for a text range if an edit box has the focus.

Parameters

  from | Start of the string range.
  to | End of the string range.

Returns
  Rectangle encompassing the string range, relative to the window.

Reimplemented in IConsoleWindow.

Definition at line 404 of file window.cpp.

References QueryString::GetBoundingRect(), GetQueryString(), NWidgetCore::index, nested_focus, NWidgetBase::type, and WWT_EDITBOX.

const char * Window::GetTextCharacterAtPosition | ( | const Point & | pt | ) | const
| virtual

Get the character that is rendered at a position by the focused edit box.

Parameters

  pt | The position to test.

Returns
  Pointer to the character at the position or NULL if no character is at the position.

Reimplemented in IConsoleWindow.

Definition at line 419 of file window.cpp.

References QueryString::GetCharAtPosition(), GetQueryString(), NWidgetCore::index, nested_focus, NWidgetBase::type, and WWT_EDITBOX.

template<class NWID >

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.

Template Parameters

  NWID | Type of the nested widget.

Parameters

  widnum | Widget number of the widget to retrieve.

Returns
  The requested widget if it is instantiated, `NULL` otherwise.

Definition at line 814 of file window_gui.h.

Referenced by QueryString::GetBoundingRect(), QueryString::GetCaretPosition(), QueryString::GetCharAtPosition(), LinkGraphOverlay::GetWidgetDpi(), HandleScrollbarScrolling(), Scrollbar::SetCapacityFromWidget(), LinkGraphOverlay::SetCargoMask(), LinkGraphOverlay::SetCompanyMask(), and ShowDropDownList().

template<class NWID >

NWID * Window::GetWidget | ( | uint | widnum | ) |
| inline

Get the nested widget with number widnum from the nested widget tree.

Template Parameters

  NWID | Type of the nested widget.

Parameters

  widnum | Widget number of the widget to retrieve.

Returns
  The requested widget if it is instantiated, `NULL` otherwise.

Definition at line 804 of file window_gui.h.

References nested_array, and nested_array_size.

void Window::HandleButtonClick | ( | byte | widget | ) |

Do all things to make a button look clicked and mark it to be unclicked in a few ticks.

Parameters

  widget | the widget to "click"

Definition at line 615 of file window.cpp.

References LowerWidget(), SetTimeout(), and SetWidgetDirty().

Referenced by DispatchLeftClickEvent(), SmallMapWindow::OnClick(), SaveLoadWindow::OnClick(), GenerateLandscapeWindow::OnClick(), BuildIndustryWindow::OnClick(), ScenarioEditorLandscapeGenerationWindow::OnClick(), CreateScenarioWindow::OnClick(), NetworkStartServerWindow::OnClick(), and DepotWindow::OnDragDrop().

EventState Window::HandleEditBoxKey | ( | int | wid,
|  | WChar | key,
|  | uint16 | keycode
| ) |  |

Process keypress for editbox widget.

Parameters

  wid | Editbox widget.
  key | the Unicode value of the key.
  keycode | the untranslated key code including shift state.

Returns
  ES_HANDLED if the key press has been handled and no other window should receive the event.

Definition at line 2552 of file window.cpp.

References QueryString::ACTION_CLEAR, QueryString::ACTION_DESELECT, QueryString::ACTION_NOTHING, Textbuf::bytes, QueryString::cancel_button, Textbuf::DeleteAll(), ES_HANDLED, ES_NOT_HANDLED, GetQueryString(), HKPR_CANCEL, HKPR_CONFIRM, HKPR_CURSOR, HKPR_EDITING, HKPR_NOT_HANDLED, InvalidateData(), QueryString::ok_button, OnClick(), OnEditboxChanged(), SetWidgetDirty(), UnfocusFocusedWidget(), WC_OSK, WID_OSK_CANCEL, WID_OSK_OK, and window_class.

Referenced by HandleKeypress().

void Window::InitializeData | ( | WindowNumber | window_number | ) |
| protected

Initializes the data (except the position and initial size) of a new Window.

Parameters

  desc | Window description.
  window_number | Number being assigned to the new window

Returns
  Window pointer of the newly created window

Precondition
  If nested widgets are used (widget is `NULL`), nested_root and nested_array_size must be initialized. In addition, nested_array is either `NULL`, or already initialized.

Definition at line 1438 of file window.cpp.

References _current_text_dir, AddWindowToZOrdering(), NWidgetBase::AssignSizePosition(), WindowDesc::cls, WindowDesc::default_pos, EditBoxInGlobalFocus(), flags, 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(), SetWhiteBorder(), NWidgetBase::smallest_x, ST_SMALLEST, ResizeInfo::step_height, ResizeInfo::step_width, TD_RTL, WDP_CENTER, WF_CENTERED, window_class, window_desc, window_number, and WWT_EDITBOX.

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.

Parameters

  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 1480 of file window.cpp.

References height, left, top, and width.

Referenced by FinishInitNested().

void Window::InitNested | ( | WindowNumber | window_number = `0` | ) |

Perform complete initialization of the Window with nested widgets, to allow use.

Parameters

  window_number | Number of the new window.

Definition at line 1833 of file window.cpp.

References CreateNestedTree(), and FinishInitNested().

Referenced by BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow(), BootstrapAskForDownloadWindow::BootstrapAskForDownloadWindow(), NetworkChatWindow::NetworkChatWindow(), ScanProgressWindow::ScanProgressWindow(), and SetDateWindow::SetDateWindow().

void Window::InsertTextString | ( | int | wid,
|  | const char * | str,
|  | bool | marked,
|  | const char * | caret,
|  | const char * | insert_location,
|  | const char * | replacement_end
| ) |  |
| virtual

Insert a text string at the cursor position into the edit box widget.

Parameters

  wid | Edit box widget.
  str | Text string to insert.

Reimplemented in IConsoleWindow.

Definition at line 2696 of file window.cpp.

References GetQueryString(), Textbuf::InsertString(), OnEditboxChanged(), and SetWidgetDirty().

Referenced by HandleTextInput().

void Window::InvalidateData | ( | int | data = `0`,
|  | bool | gui_scope = `true`
| ) |  |

Mark this window's data as invalid (in need of re-computing)

Parameters

  data | The data to invalidate with
  gui_scope | Whether the function is called from GUI scope.

Definition at line 3161 of file window.cpp.

References SmallVector< T, S >::Append(), OnInvalidateData(), scheduled_invalidation_data, and SetDirty().

Referenced by NewGRFWindow::AddGRFToActive(), AIDebugWindow::AIDebugWindow(), AIDebugWindow::ChangeToAI(), ChangeVehicleWindow(), DoZoomInOutWindow(), HandleEditBoxKey(), InvalidateWindowClassesData(), InvalidateWindowData(), NetworkContentListWindow::NetworkContentListWindow(), NewGRFConfirmationCallback(), TextfileWindow::OnClick(), OskWindow::OnClick(), SignListWindow::OnClick(), NewGRFParametersWindow::OnClick(), SaveLoadWindow::OnClick(), GenerateLandscapeWindow::OnClick(), AIConfigWindow::OnClick(), RefitWindow::OnClick(), NewGRFWindow::OnClick(), AIDebugWindow::OnClick(), BuildSignalWindow::OnClick(), GameSettingsWindow::OnClick(), RefitWindow::OnDragDrop(), NewGRFWindow::OnDragDrop(), GenerateLandscapeWindow::OnDropdownSelect(), NewGRFWindow::OnDropdownSelect(), GameSettingsWindow::OnDropdownSelect(), NewGRFWindow::OnEditboxChanged(), GameSettingsWindow::OnEditboxChanged(), NewGRFWindow::OnKeyPress(), SmallMapWindow::OnPaint(), AIDebugWindow::OnPaint(), CompanyWindow::OnPaint(), GenerateLandscapeWindow::OnQueryTextFinished(), NewGRFWindow::OnQueryTextFinished(), SaveLoadWindow::OnTimeout(), SignListWindow::SetFilterString(), GameOptionsWindow::SetMediaSet(), and ShowIndustryCargoesWindow().

virtual bool Window::IsNewGRFInspectable | ( |  | ) | const
| inline virtual

Is the data related to this window NewGRF inspectable?

Returns
  true iff it is inspectable.

Reimplemented in VehicleViewWindow, IndustryViewWindow, and LandInfoWindow.

Definition at line 786 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.

Parameters

  widget_index | index of this widget in the window

Returns
  status of the widget ie: disabled = true, enabled = false

Definition at line 416 of file window_gui.h.

References nested_array_size.

Referenced by BuildRailClick_Remove(), LinkGraphLegendWindow::DrawWidget(), PerformanceRatingDetailWindow::DrawWidget(), HandlePlacePushButton(), LinkGraphLegendWindow::OnClick(), BuildRoadToolbarWindow::OnClick(), NetworkGameWindow::OnClick(), AIDebugWindow::OnClick(), PerformanceRatingDetailWindow::OnClick(), NetworkLobbyWindow::OnClick(), MainToolbarWindow::OnClick(), DepotWindow::OnDragDrop(), DepotWindow::OnTimeout(), RailToolbar_CtrlChanged(), RoadToolbar_CtrlChanged(), LinkGraphLegendWindow::SetOverlay(), LinkGraphLegendWindow::UpdateOverlayCargoes(), and LinkGraphLegendWindow::UpdateOverlayCompanies().

bool Window::IsWidgetFocused | ( | byte | widget_index | ) | const
| inline

Check if given widget is focused within this window.

Parameters

  widget_index | : index of the widget in the window to check

Returns
  true if given widget is the focused window in this window

Definition at line 427 of file window_gui.h.

References NWidgetCore::index, and nested_focus.

Referenced by IsWidgetGloballyFocused().

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.

Parameters

  widget_index | : index of the widget in the window to check

Returns
  true if given widget is the focused window in this window and this window has focus

Definition at line 438 of file window_gui.h.

References IsWidgetFocused().

bool Window::IsWidgetHighlighted | ( | byte | widget_index | ) | const

Gets the highlighted status of a widget.

Parameters

  widget_index | index of this widget in the window

Returns
  status of the widget ie: highlighted = true, not highlighted = false

Definition at line 263 of file window.cpp.

References nested_array_size.

Referenced by DispatchLeftClickEvent(), and ProcessHighlightedInvalidations().

bool Window::IsWidgetLowered | ( | byte | widget_index | ) | const
| inline

Gets the lowered state of a widget.

Parameters

  widget_index | index of this widget in the window

Returns
  status of the widget ie: lowered = true, raised= false

Definition at line 488 of file window_gui.h.

References nested_array_size.

Referenced by BuildRailClick_Remove(), BuildSignalWindow::DrawSignalSprite(), DrawSortButtonState(), TextfileWindow::DrawWidget(), PaymentRatesGraphWindow::DrawWidget(), BuildSignalWindow::DrawWidget(), HandlePlacePushButton(), IndustryCargoesWindow::NotifySmallmap(), DepotWindow::OnClick(), CompanyWindow::OnClick(), IndustryCargoesWindow::OnClick(), IndustryCargoesWindow::OnInvalidateData(), VehicleGroupWindow::OnPaint(), ScenarioEditorLandscapeGenerationWindow::OnPaint(), VehicleListWindow::OnPaint(), BuildRailToolbarWindow::OnPlaceDrag(), BuildRailToolbarWindow::OnPlaceMouseUp(), BuildRoadToolbarWindow::OnPlaceObject(), MainToolbarWindow::OnTick(), ScenarioEditorToolbarWindow::OnTick(), ScenarioEditorLandscapeGenerationWindow::OnTimeout(), SaveLoadWindow::OnTimeout(), GenerateLandscapeWindow::OnTimeout(), CreateScenarioWindow::OnTimeout(), NetworkStartServerWindow::OnTimeout(), MainToolbarWindow::OnTimeout(), RailToolbar_CtrlChanged(), RaiseButtons(), RoadToolbar_CtrlChanged(), TextfileWindow::SetupScrollbars(), ToggleRailButton_Remove(), ToggleRoadButton_Remove(), BuildRoadToolbarWindow::UpdateOptionWidgetStatus(), LinkGraphLegendWindow::UpdateOverlayCargoes(), and LinkGraphLegendWindow::UpdateOverlayCompanies().

void Window::LowerWidget | ( | byte | widget_index | ) |
| inline

Marks a widget as lowered.

Parameters

  widget_index | index of this widget in the window

Definition at line 469 of file window_gui.h.

References SetWidgetLoweredState().

Referenced by BuildRailStationWindow::CheckSelectedSize(), HandleButtonClick(), HandlePlacePushButton(), BuildDocksStationWindow::OnClick(), BuildDocksDepotWindow::OnClick(), SelectCompanyLiveryWindow::OnClick(), BuildRoadDepotWindow::OnClick(), SpriteAlignerWindow::OnClick(), BuildRoadStationWindow::OnClick(), BuildRailStationWindow::OnClick(), PerformanceRatingDetailWindow::OnClick(), BuildRailDepotWindow::OnClick(), StationViewWindow::OnClick(), CompanyWindow::OnClick(), PerformanceRatingDetailWindow::OnInvalidateData(), BuildSignalWindow::OnInvalidateData(), ShowDropDownList(), and SmallMapWindow::SwitchMapType().

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.

Parameters

  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 VehicleViewWindow, IndustryCargoesWindow, BuyCompanyWindow, CustomCurrencyWindow, ScenarioEditorToolbarWindow, SelectStationWindow< T >, CompanyWindow, NetworkCompanyPasswordWindow, VehicleDetailsWindow, SavePresetWindow, NetworkJoinStatusWindow, MainToolbarWindow, GameSettingsWindow, NetworkClientListWindow, StationViewWindow, BuildRailWaypointWindow, BuildRailDepotWindow, VehicleListWindow, BuildSignalWindow, NetworkLobbyWindow, PerformanceRatingDetailWindow, IndustryDirectoryWindow, SelectCompanyManagerFaceWindow, BuildVehicleWindow, AIDebugWindow, BuildRailStationWindow, GenerateProgressWindow, OrdersWindow, QueryWindow, FoundTownWindow, NetworkStartServerWindow, MessageHistoryWindow, BuildRoadStationWindow, QueryStringWindow, PaymentRatesGraphWindow, CreateScenarioWindow, NewGRFWindow, RefitWindow, SpriteAlignerWindow, BuildRoadDepotWindow, IndustryViewWindow, AIConfigWindow, TownDirectoryWindow, PerformanceHistoryGraphWindow, DepotWindow, SelectCompanyLiveryWindow, NetworkGameWindow, VehicleGroupWindow, MusicWindow, StoryBookWindow, ScenarioEditorLandscapeGenerationWindow, BaseGraphWindow, BuildDocksDepotWindow, BuildIndustryWindow, GenerateLandscapeWindow, BuildRailToolbarWindow, TimetableWindow, SaveLoadWindow, CompanyStationsWindow, NetworkChatWindow, SignWindow, BuildAirportWindow, ReplaceVehicleWindow, BuildDocksStationWindow, AISettingsWindow, CompanyFinancesWindow, NewsWindow, GameOptionsWindow, TownViewWindow, GoalQuestionWindow, MusicTrackSelectionWindow, BuildRoadToolbarWindow, BuildObjectWindow, CheatWindow, NewGRFParametersWindow, BuildBridgeWindow, TownAuthorityWindow, DropdownWindow, SignListWindow, StatusBarWindow, AIListWindow, SmallMapWindow, TerraformToolbarWindow, SetDateWindow, BuildDocksToolbarWindow, EnginePreviewWindow, SelectGameWindow, BuildTreesWindow, OskWindow, LinkGraphLegendWindow, BuildAirToolbarWindow, ExtraViewportWindow, WaypointWindow, GraphLegendWindow, TransparenciesWindow, EndGameHighScoreBaseWindow, GoalListWindow, SubsidyListWindow, and TextfileWindow.

Definition at line 620 of file window_gui.h.

Referenced by DispatchLeftClickEvent(), HandleEditBoxKey(), OskWindow::OnClick(), and OnHotkey().

virtual EventState Window::OnCTRLStateChange | ( |  | ) |
| inline virtual

The state of the control key has changed.

Returns
  ES_HANDLED if the change has been handled and no other window should receive the event.

Reimplemented in DepotWindow, BuildRailToolbarWindow, and BuildRoadToolbarWindow.

Definition at line 611 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.

Parameters

  pt | the point inside the window where the release took place.
  widget | the widget where the release took place.

Reimplemented in OrdersWindow, NewGRFWindow, DepotWindow, RefitWindow, and VehicleGroupWindow.

Definition at line 650 of file window_gui.h.

Referenced by HandleMouseDragDrop().

void Window::OnDropdownClose | ( | Point | pt,
|  | int | widget,
|  | int | index,
|  | bool | instant_close
| ) |  |
| virtual

A dropdown window associated to this window has been closed.

Parameters

  pt | the point inside the window the mouse resides on after closure.
  widget | the widget (button) that the dropdown is associated with.
  index | the element in the dropdown that is selected.
  instant_close | whether the dropdown was configured to close on mouse up.

Reimplemented in GameSettingsWindow, AISettingsWindow, and NewGRFParametersWindow.

Definition at line 280 of file window.cpp.

References NWidgetCore::disp_flags, GetWidgetFromPos(), ND_DROPDOWN_ACTIVE, NWID_BUTTON_DROPDOWN, OnDropdownSelect(), RaiseWidget(), SetWidgetDirty(), and NWidgetBase::type.

virtual void Window::OnDropdownSelect | ( | int | widget,
|  | int | index
| ) |  |
| inline virtual

A dropdown option associated to this window has been selected.

Parameters

  widget | the widget (button) that the dropdown is associated with.
  index | the element in the dropdown that is selected.

Reimplemented in IndustryCargoesWindow, ScenarioEditorToolbarWindow, GameSettingsWindow, VehicleDetailsWindow, StationViewWindow, MainToolbarWindow, VehicleListWindow, BuildVehicleWindow, IndustryDirectoryWindow, OrdersWindow, NetworkStartServerWindow, NewGRFWindow, CreateScenarioWindow, TownDirectoryWindow, VehicleGroupWindow, SelectCompanyLiveryWindow, NetworkGameWindow, GenerateLandscapeWindow, StoryBookWindow, CompanyStationsWindow, AISettingsWindow, BuildAirportWindow, ReplaceVehicleWindow, GameOptionsWindow, NewGRFParametersWindow, BuildBridgeWindow, and SetDateWindow.

Definition at line 705 of file window_gui.h.

Referenced by OnDropdownClose(), and DropdownWindow::OnMouseLoop().

virtual void Window::OnEditboxChanged | ( | int | widget | ) |
| inline virtual

The text in an editbox has been edited.

Parameters

  widget | The widget of the editbox.

Reimplemented in GameSettingsWindow, NewGRFWindow, AIDebugWindow, NetworkStartServerWindow, NetworkGameWindow, NetworkChatWindow, SignListWindow, and OskWindow.

Definition at line 713 of file window_gui.h.

Referenced by HandleEditBoxKey(), InsertTextString(), and OskWindow::OnEditboxChanged().

EventState Window::OnHotkey | ( | int | hotkey | ) |
| virtual

A hotkey has been pressed.

Parameters

  hotkey | Hotkey index, by default a widget index of a button or editbox.

Returns
  ES_HANDLED if the key press has been handled, and the hotkey is not unavailable for some reason.

Reimplemented in ScenarioEditorToolbarWindow, MainToolbarWindow, OrdersWindow, BuildRailToolbarWindow, BuildRoadToolbarWindow, MainWindow, and SignListWindow.

Definition at line 590 of file window.cpp.

References ES_HANDLED, ES_NOT_HANDLED, NWidgetCore::IsDisabled(), IsShaded(), OnClick(), SetFocusedWidget(), SetFocusedWindow(), NWidgetBase::type, and WWT_EDITBOX.

Referenced by AIDebugGlobalHotkeys(), AirportToolbarGlobalHotkeys(), DockToolbarGlobalHotkeys(), HandleKeypress(), RailToolbarGlobalHotkeys(), RoadToolbarGlobalHotkeys(), SignListGlobalHotkeys(), TerraformToolbarEditorGlobalHotkeys(), and TerraformToolbarGlobalHotkeys().

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.

Parameters

  pt | The point where the mouse is hovering.
  widget | The widget where the mouse is hovering.

Reimplemented in IndustryCargoesWindow.

Definition at line 636 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.

Note
  nested_root and/or nested_array (normally accessed via GetWidget()) may not exist during this call.

Reimplemented in IndustryCargoesWindow, BuildSignalWindow, SelectCompanyManagerFaceWindow, BuildVehicleWindow, PaymentRatesGraphWindow, RefitWindow, BuildIndustryWindow, SmallMapWindow, TerraformToolbarWindow, BuildTreesWindow, LandInfoWindow, and SelectGameWindow.

Definition at line 536 of file window_gui.h.

Referenced by InitializeData(), and ReInit().

Point Window::OnInitialPosition | ( | int16 | sm_width,
|  | int16 | sm_height,
|  | int | window_number
| ) |  |
| virtual

Compute the initial position of the window.

Parameters

  sm_width | Smallest width of the window.
  sm_height | Smallest height of the window.
  window_number | The window number of the new window.

Returns
  Initial position of the top-left corner of the window.

Reimplemented in NetworkClientListPopupWindow, TooltipsWindow, NetworkChatWindow, NewsWindow, TerraformToolbarWindow, ErrmsgWindow, BuildBridgeWindow, DropdownWindow, TransparenciesWindow, StatusBarWindow, and SetDateWindow.

Definition at line 1792 of file window.cpp.

References LocalGetWindowPlacement(), and window_desc.

Referenced by FinishInitNested().

virtual void Window::OnInvalidateData | ( | int | data = `0`,
|  | bool | gui_scope = `true`
| ) |  |
| inline virtual

Some data on this window has become invalid.

Parameters

  data | information about the changed data.
  gui_scope | Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See InvalidateWindowData() for details.

Reimplemented in VehicleViewWindow, IndustryCargoesWindow, ScenarioEditorToolbarWindow, CompanyWindow, SelectStationWindow< T >, GameSettingsWindow, MainToolbarWindow, StationViewWindow, VehicleDetailsWindow, CompanyInfrastructureWindow, VehicleListWindow, BuildSignalWindow, PerformanceRatingDetailWindow, IndustryDirectoryWindow, BuildVehicleWindow, AIDebugWindow, CompanyLeagueWindow, NewGRFWindow, FoundTownWindow, MessageHistoryWindow, IndustryViewWindow, SpriteAlignerWindow, PaymentRatesGraphWindow, AIConfigWindow, TownDirectoryWindow, OrdersWindow, RefitWindow, SelectCompanyLiveryWindow, NetworkGameWindow, DepotWindow, SaveLoadWindow, StoryBookWindow, BuildIndustryWindow, CompanyStationsWindow, MusicWindow, AISettingsWindow, ReplaceVehicleWindow, GameOptionsWindow, BaseGraphWindow, NetworkChatWindow, TownViewWindow, NewsWindow, NewGRFParametersWindow, MainWindow, BuildRailToolbarWindow, VehicleGroupWindow, GenerateLandscapeWindow, LandInfoWindow, BuildRoadToolbarWindow, SignListWindow, MusicTrackSelectionWindow, GoalListWindow, ErrmsgWindow, TimetableWindow, AIListWindow, SubsidyListWindow, OskWindow, StatusBarWindow, SmallMapWindow, ExtraViewportWindow, EnginePreviewWindow, TransparenciesWindow, BuildDocksToolbarWindow, WaypointWindow, LinkGraphLegendWindow, GraphLegendWindow, BuildAirToolbarWindow, and SelectGameWindow.

Definition at line 728 of file window_gui.h.

Referenced by InvalidateData(), and ProcessScheduledInvalidations().

virtual EventState Window::OnKeyPress | ( | WChar | key,
|  | uint16 | keycode
| ) |  |
| inline virtual

A key has been pressed.

Parameters

  key | the Unicode value of the key.
  keycode | the untranslated key code including shift state.

Returns
  ES_HANDLED if the key press has been handled and no other window should receive the event.

Reimplemented in NewGRFWindow, QueryWindow, NetworkGameWindow, SaveLoadWindow, NetworkChatWindow, NewsWindow, ErrmsgWindow, BuildBridgeWindow, IConsoleWindow, and EndGameHighScoreBaseWindow.

Definition at line 602 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.

Parameters

  pt | The point inside the window that the mouse hovers over.
  widget | The widget the mouse hovers over.

Reimplemented in OrdersWindow, NewGRFWindow, RefitWindow, DepotWindow, and VehicleGroupWindow.

Definition at line 643 of file window_gui.h.

Referenced by HandleMouseDragDrop().

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).

Parameters

  pt | the point inside the window that the mouse hovers over.
  widget | the widget the mouse hovers over.

Reimplemented in NetworkClientListWindow, and SmallMapWindow.

Definition at line 664 of file window_gui.h.

Referenced by HandleMouseOver().

virtual void Window::OnMouseWheel | ( | int | wheel | ) |
| inline virtual

The mouse wheel has been turned.

Parameters

  wheel | the amount of movement of the mouse wheel.

Reimplemented in MainWindow, IConsoleWindow, SmallMapWindow, and ExtraViewportWindow.

Definition at line 670 of file window_gui.h.

virtual void Window::OnPaint | ( |  | ) |
| inline virtual

The window must be repainted.

Note
  This method should not change any state, it should only use drawing functions.

Reimplemented in VehicleViewWindow, ScenarioEditorToolbarWindow, VehicleDetailsWindow, CompanyWindow, MainToolbarWindow, NetworkClientListWindow, GameSettingsWindow, VehicleListWindow, BuildVehicleWindow, NetworkLobbyWindow, IndustryDirectoryWindow, StationViewWindow, SelectCompanyManagerFaceWindow, CompanyLeagueWindow, AIDebugWindow, OrdersWindow, MessageHistoryWindow, BuildRailStationWindow, BuildRoadStationWindow, CreateScenarioWindow, TownDirectoryWindow, IndustryViewWindow, DepotWindow, SelectCompanyLiveryWindow, RefitWindow, NetworkGameWindow, ScenarioEditorLandscapeGenerationWindow, BuildDocksDepotWindow, SaveLoadWindow, StoryBookWindow, VehicleGroupWindow, AISettingsWindow, BuildDocksStationWindow, BuildAirportWindow, ReplaceVehicleWindow, CompanyFinancesWindow, CompanyStationsWindow, NewGRFParametersWindow, TimetableWindow, GoalListWindow, MainWindow, IConsoleWindow, SignListWindow, SmallMapWindow, HighScoreWindow, EndGameWindow, TownAuthorityWindow, and TransparenciesWindow.

Definition at line 553 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.

Parameters

  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 BuildRailToolbarWindow, ScenarioEditorLandscapeGenerationWindow, BuildRoadToolbarWindow, TerraformToolbarWindow, BuildDocksToolbarWindow, BuildTreesWindow, and BuildAirToolbarWindow.

Definition at line 758 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.

Parameters

  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 BuildRailToolbarWindow, ScenarioEditorLandscapeGenerationWindow, BuildRoadToolbarWindow, TerraformToolbarWindow, BuildDocksToolbarWindow, BuildTreesWindow, and BuildAirToolbarWindow.

Definition at line 769 of file window_gui.h.

Referenced by PlaceRail_Bridge(), PlaceRoad_Bridge(), and VpHandlePlaceSizingDrag().

virtual void Window::OnPlaceObject | ( | Point | pt,
|  | TileIndex | tile
| ) |  |
| inline virtual

The user clicked some place on the map when a tile highlight mode has been set.

Parameters

  pt | the exact point on the map that has been clicked.
  tile | the tile on the map that has been clicked.

Reimplemented in ScenarioEditorToolbarWindow, CompanyWindow, MainToolbarWindow, OrdersWindow, FoundTownWindow, ScenarioEditorLandscapeGenerationWindow, BuildRailToolbarWindow, BuildIndustryWindow, BuildRoadToolbarWindow, BuildObjectWindow, TerraformToolbarWindow, BuildDocksToolbarWindow, BuildTreesWindow, and BuildAirToolbarWindow.

Definition at line 736 of file window_gui.h.

virtual void Window::OnPlacePresize | ( | Point | pt,
|  | TileIndex | tile
| ) |  |
| inline virtual

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.

Parameters

  pt | the exact point on the map where the mouse is.
  tile | the tile on the map where the mouse is.

Reimplemented in BuildRailToolbarWindow, BuildRoadToolbarWindow, and BuildDocksToolbarWindow.

Definition at line 778 of file window_gui.h.

virtual void Window::OnQueryTextFinished | ( | char * | str | ) |
| inline virtual

The query window opened from this window has closed.

Parameters

  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 CustomCurrencyWindow, ScenarioEditorToolbarWindow, CompanyWindow, VehicleDetailsWindow, GameSettingsWindow, NetworkJoinStatusWindow, StationViewWindow, SelectCompanyManagerFaceWindow, BuildVehicleWindow, OrdersWindow, NetworkStartServerWindow, NewGRFWindow, CreateScenarioWindow, IndustryViewWindow, SpriteAlignerWindow, NetworkGameWindow, DepotWindow, VehicleGroupWindow, GenerateLandscapeWindow, TimetableWindow, AISettingsWindow, TownViewWindow, NewGRFParametersWindow, CheatWindow, and WaypointWindow.

Definition at line 721 of file window_gui.h.

Referenced by SavePresetWindow::OnClick().

virtual void Window::OnResize | ( |  | ) |
| inline virtual

Called after the window got resized.

For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.

Reimplemented in IndustryCargoesWindow, VehicleViewWindow, SelectStationWindow< T >, GameSettingsWindow, VehicleDetailsWindow, SavePresetWindow, StationViewWindow, VehicleListWindow, NetworkLobbyWindow, OrdersWindow, BuildVehicleWindow, IndustryDirectoryWindow, AIDebugWindow, BuildRailStationWindow, MessageHistoryWindow, DepotWindow, SpriteAlignerWindow, IndustryViewWindow, RefitWindow, TownDirectoryWindow, NetworkGameWindow, VehicleGroupWindow, NewGRFWindow, SaveLoadWindow, TimetableWindow, CompanyStationsWindow, StoryBookWindow, BuildIndustryWindow, AISettingsWindow, ReplaceVehicleWindow, TownViewWindow, NewGRFParametersWindow, MainWindow, BuildObjectWindow, GoalListWindow, BuildBridgeWindow, SignListWindow, AIListWindow, SubsidyListWindow, WaypointWindow, ExtraViewportWindow, and TextfileWindow.

Definition at line 698 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.

Parameters

  pt | the point inside the window that has been clicked.
  widget | the clicked widget.

Returns
  true if the click was actually handled, i.e. do not show a tooltip if tooltip-on-right-click is enabled.

Reimplemented in DepotWindow, and SmallMapWindow.

Definition at line 629 of file window_gui.h.

Referenced by DispatchRightClickEvent().

virtual void Window::OnScroll | ( | Point | delta | ) |
| inline virtual

Handle the request for (viewport) scrolling.

Parameters

  delta | the amount the viewport must be scrolled.

Reimplemented in MainWindow, SmallMapWindow, and ExtraViewportWindow.

Definition at line 656 of file window_gui.h.

Referenced by HandleViewportScroll().

virtual bool Window::OnVehicleSelect | ( | const struct Vehicle * | v | ) |
| inline virtual

The user clicked on a vehicle while HT_VEHICLE has been set.

Parameters

  v | clicked vehicle. It is guaranteed to be v->IsPrimaryVehicle() == true

Returns
  True if the click is handled, false if it is ignored.

Definition at line 743 of file window_gui.h.

Referenced by VehicleClicked().

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

Parameters

  ptr | the pointer not to free

Reimplemented from ZeroedMemoryAllocator.

Definition at line 300 of file window_gui.h.

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.

Parameters

  size | the amount of space not to allocate

Reimplemented from ZeroedMemoryAllocator.

Definition at line 290 of file window_gui.h.

void Window::RaiseButtons | ( | bool | autoraise = `false` | ) |

Raise the buttons of the window.

Parameters

  autoraise | Raise only the push buttons of the window.

Definition at line 553 of file window.cpp.

References NWidgetBase::GetWidgetOfType(), IsWidgetLowered(), nested_array, nested_array_size, nested_root, RaiseWidget(), NWidgetBase::SetDirty(), NWidgetCore::SetLowered(), SetWidgetDirty(), NWidgetBase::type, WWT_DEFSIZEBOX, WWT_EDITBOX, and WWT_LAST.

Referenced by BuildIndustryWindow::OnClick(), CompanyWindow::OnClick(), CompanyWindow::OnPlaceObject(), BuildAirToolbarWindow::OnPlaceObjectAbort(), BuildTreesWindow::OnPlaceObjectAbort(), BuildDocksToolbarWindow::OnPlaceObjectAbort(), TerraformToolbarWindow::OnPlaceObjectAbort(), BuildRoadToolbarWindow::OnPlaceObjectAbort(), BuildIndustryWindow::OnPlaceObjectAbort(), ScenarioEditorLandscapeGenerationWindow::OnPlaceObjectAbort(), FoundTownWindow::OnPlaceObjectAbort(), CompanyWindow::OnPlaceObjectAbort(), and BuildIndustryWindow::OnTimeout().

void Window::RaiseWidget | ( | byte | widget_index | ) |
| inline

Marks a widget as raised.

Parameters

  widget_index | index of this widget in the window

Definition at line 478 of file window_gui.h.

References SetWidgetLoweredState().

Referenced by BuildRailStationWindow::CheckSelectedSize(), BuildDocksStationWindow::OnClick(), BuildDocksDepotWindow::OnClick(), SelectCompanyLiveryWindow::OnClick(), BuildRoadDepotWindow::OnClick(), CreateScenarioWindow::OnClick(), BuildRoadStationWindow::OnClick(), BuildRailStationWindow::OnClick(), PerformanceRatingDetailWindow::OnClick(), BuildSignalWindow::OnClick(), BuildRailDepotWindow::OnClick(), OnDropdownClose(), GraphLegendWindow::OnInvalidateData(), SpriteAlignerWindow::OnInvalidateData(), PerformanceRatingDetailWindow::OnInvalidateData(), IndustryCargoesWindow::OnInvalidateData(), VehicleGroupWindow::OnPaint(), DepotWindow::OnPlaceObjectAbort(), ScenarioEditorLandscapeGenerationWindow::OnTimeout(), GenerateLandscapeWindow::OnTimeout(), CreateScenarioWindow::OnTimeout(), DepotWindow::OnTimeout(), NetworkStartServerWindow::OnTimeout(), MainToolbarWindow::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.

Parameters

  rx | Horizontal resize of the window.
  ry | Vertical resize of the window.

Note
  For just resizing the window, use ResizeWindow instead.

Definition at line 970 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 BuildObjectWindow::DrawWidget(), BuildRailToolbarWindow::ModifyRailType(), CompanyFinancesWindow::OnClick(), SelectCompanyLiveryWindow::OnClick(), SelectCompanyManagerFaceWindow::OnClick(), StationViewWindow::OnClick(), CompanyFinancesWindow::OnHundredthTick(), SmallMapWindow::OnInvalidateData(), TimetableWindow::OnInvalidateData(), LandInfoWindow::OnInvalidateData(), SelectCompanyLiveryWindow::OnInvalidateData(), RefitWindow::OnInvalidateData(), CompanyInfrastructureWindow::OnInvalidateData(), VehicleDetailsWindow::OnInvalidateData(), StationViewWindow::OnInvalidateData(), CompanyFinancesWindow::OnPaint(), DepotWindow::OnPaint(), IndustryViewWindow::OnPaint(), BuildRailStationWindow::OnPaint(), StationViewWindow::OnPaint(), BuildVehicleWindow::OnPaint(), CompanyWindow::OnPaint(), ReInitAllWindows(), BuildObjectWindow::SelectOtherObject(), and SetShaded().

bool Window::SetFocusedWidget | ( | int | widget_index | ) |

Set focus within this window to the given widget.

The function however doesn't change which window has focus.

Parameters

  widget_index | Index of the widget in the window to set the focus to.

Returns
  Focus has changed.

Definition at line 484 of file window.cpp.

References VideoDriver::EditBoxLostFocus(), VideoDriver::GetInstance(), nested_array, nested_array_size, nested_focus, NWidgetBase::SetDirty(), NWidgetBase::type, and WWT_EDITBOX.

Referenced by DispatchLeftClickEvent(), NetworkChatWindow::NetworkChatWindow(), NetworkContentListWindow::NetworkContentListWindow(), FoundTownWindow::OnClick(), SignListWindow::OnHotkey(), OnHotkey(), and SavePresetWindow::SavePresetWindow().

void Window::SetShaded | ( | bool | make_shaded | ) |

Set the shaded state of the window to make_shaded.

Parameters

  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.

Note
  The method uses Window::ReInit(), thus after the call, the whole window should be considered changed.

Definition at line 1006 of file window.cpp.

References height, nested_focus, ReInit(), NWidgetStacked::SetDisplayedPlane(), shade_select, NWidgetStacked::shown_plane, SZSP_HORIZONTAL, UnfocusFocusedWidget(), 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.

Parameters

  widget | Widget number.

Reimplemented in VehicleViewWindow, BuyCompanyWindow, CustomCurrencyWindow, CompanyWindow, IndustryCargoesWindow, VehicleDetailsWindow, GameSettingsWindow, CompanyInfrastructureWindow, BuildSignalWindow, VehicleListWindow, StationViewWindow, NetworkLobbyWindow, BuildVehicleWindow, IndustryDirectoryWindow, BuildRailStationWindow, AIDebugWindow, OrdersWindow, QueryWindow, NetworkStartServerWindow, QueryStringWindow, CreateScenarioWindow, IndustryViewWindow, SpriteAlignerWindow, NewGRFWindow, AIConfigWindow, TownDirectoryWindow, RefitWindow, SelectCompanyLiveryWindow, ScriptTextfileWindow, NewGRFTextfileWindow, BuildRailToolbarWindow, NetworkGameWindow, CompanyStationsWindow, SignWindow, AboutWindow, StoryBookWindow, VehicleGroupWindow, DepotWindow, BuildIndustryWindow, GoalQuestionWindow, NewGRFInspectWindow, NewsWindow, TimetableWindow, GenerateLandscapeWindow, TownViewWindow, AISettingsWindow, ReplaceVehicleWindow, GameOptionsWindow, MusicTrackSelectionWindow, CompanyFinancesWindow, BuildAirportWindow, ErrmsgWindow, NewGRFParametersWindow, SignListWindow, TownAuthorityWindow, SmallMapWindow, BaseSetTextfileWindow< TBaseSet >, SetDateWindow, BuildObjectWindow, AIListWindow, OskWindow, WaypointWindow, ExtraViewportWindow, ContentTextfileWindow, and GoalListWindow.

Definition at line 586 of file window_gui.h.

Referenced by NWidgetBackground::Draw(), NWidgetLeaf::Draw(), NWidgetBackground::SetupSmallestSize(), and NWidgetLeaf::SetupSmallestSize().

void Window::SetWidgetDirty | ( | byte | widget_index | ) | const

Invalidate a widget, i.e.

mark it as being changed and in need of redraw.

Parameters

  widget_index | the widget to redraw.

Definition at line 577 of file window.cpp.

References nested_array, and NWidgetBase::SetDirty().

Referenced by IndustryDirectoryWindow::BuildSortIndustriesList(), VehicleGroupWindow::DirtyHighlightedGroupWidget(), DisableAllWidgetHighlight(), HandleButtonClick(), StationViewWindow::HandleCargoWaitingClick(), HandleEditBoxKey(), HandleZoomMessage(), InsertTextString(), TransparenciesWindow::OnClick(), SaveLoadWindow::OnClick(), MusicWindow::OnClick(), DepotWindow::OnClick(), RefitWindow::OnClick(), SavePresetWindow::OnClick(), CompanyWindow::OnClick(), IndustryCargoesWindow::OnClick(), DepotWindow::OnCTRLStateChange(), NewGRFWindow::OnDragDrop(), OrdersWindow::OnDragDrop(), OnDropdownClose(), OskWindow::OnEditboxChanged(), OskWindow::OnInvalidateData(), GoalListWindow::OnInvalidateData(), StoryBookWindow::OnInvalidateData(), IndustryCargoesWindow::OnInvalidateData(), DepotWindow::OnMouseDrag(), RefitWindow::OnMouseDrag(), NewGRFWindow::OnMouseDrag(), OrdersWindow::OnMouseDrag(), StoryBookWindow::OnPaint(), AIDebugWindow::OnPaint(), BuildRoadToolbarWindow::OnPlaceObjectAbort(), VehicleGroupWindow::OnPlaceObjectAbort(), DepotWindow::OnPlaceObjectAbort(), OrdersWindow::OnPlaceObjectAbort(), GenerateLandscapeWindow::OnQueryTextFinished(), CreateScenarioWindow::OnQueryTextFinished(), NetworkStartServerWindow::OnQueryTextFinished(), StatusBarWindow::OnTick(), MainToolbarWindow::OnTick(), ScenarioEditorLandscapeGenerationWindow::OnTimeout(), GenerateLandscapeWindow::OnTimeout(), CreateScenarioWindow::OnTimeout(), DepotWindow::OnTimeout(), NetworkStartServerWindow::OnTimeout(), MainToolbarWindow::OnTimeout(), ScenarioEditorToolbarWindow::OnTimeout(), OrdersWindow::OrderClick_Goto(), OrdersWindow::OrderClick_Nonstop(), OrdersWindow::OrderClick_Unload(), ProcessHighlightedInvalidations(), RaiseButtons(), StoryBookWindow::RefreshSelectedPage(), SetWidgetHighlight(), SetWindowWidgetDirty(), ShowDropDownList(), BuildBridgeWindow::SortBridgeList(), CompanyStationsWindow::SortStationsList(), ToggleRailButton_Remove(), ToggleRoadButton_Remove(), BuildRoadToolbarWindow::UpdateOptionWidgetStatus(), and StoryBookWindow::UpdatePrevNextDisabledState().

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.

Parameters

  widget_index | index of this widget in the window
  disab_stat | status to use ie: disabled = true, enabled = false

Definition at line 387 of file window_gui.h.

References nested_array, and nested_array_size.

Referenced by AISettingsWindow::AISettingsWindow(), NetworkContentListWindow::BuildContentList(), DisableWidget(), EnableWidget(), HandleZoomMessage(), NetworkContentListWindow::NetworkContentListWindow(), RefitWindow::OnClick(), RefitWindow::OnInit(), LinkGraphLegendWindow::OnInvalidateData(), WaypointWindow::OnInvalidateData(), MusicTrackSelectionWindow::OnInvalidateData(), GenerateLandscapeWindow::OnInvalidateData(), NewGRFParametersWindow::OnInvalidateData(), GameOptionsWindow::OnInvalidateData(), StoryBookWindow::OnInvalidateData(), SaveLoadWindow::OnInvalidateData(), AIConfigWindow::OnInvalidateData(), NetworkContentListWindow::OnInvalidateData(), NewGRFWindow::OnInvalidateData(), AIDebugWindow::OnInvalidateData(), PerformanceRatingDetailWindow::OnInvalidateData(), BuildSignalWindow::OnInvalidateData(), GameSettingsWindow::OnInvalidateData(), CompanyWindow::OnInvalidateData(), TownAuthorityWindow::OnPaint(), TimetableWindow::OnPaint(), CompanyFinancesWindow::OnPaint(), NetworkGameWindow::OnPaint(), SelectCompanyLiveryWindow::OnPaint(), CreateScenarioWindow::OnPaint(), BuildRailStationWindow::OnPaint(), StationViewWindow::OnPaint(), NetworkLobbyWindow::OnPaint(), BuildVehicleWindow::OnPaint(), VehicleListWindow::OnPaint(), MainToolbarWindow::OnPaint(), CompanyWindow::OnPaint(), VehicleDetailsWindow::OnPaint(), ScenarioEditorToolbarWindow::OnPaint(), BuildIndustryWindow::SetButtons(), TextfileWindow::SetupScrollbars(), SetWidgetsDisabledState(), SmallMapWindow::SetZoomLevel(), BuildRoadToolbarWindow::UpdateOptionWidgetStatus(), OskWindow::UpdateOskState(), and StoryBookWindow::UpdatePrevNextDisabledState().

void Window::SetWidgetHighlight | ( | byte | widget_index,
|  | TextColour | highlighted_colour
| ) |  |

Sets the highlighted status of a widget.

Parameters

  widget_index | index of this widget in the window
  highlighted_colour | Colour of highlight, or TC_INVALID to disable.

Definition at line 230 of file window.cpp.

References CLRBITS, flags, nested_array_size, SetWidgetDirty(), valid, and WF_HIGHLIGHTED.

Referenced by DispatchLeftClickEvent().

void Window::SetWidgetLoweredState | ( | byte | widget_index,
|  | bool | lowered_stat
| ) |  |
| inline

Sets the lowered/raised status of a widget.

Parameters

  widget_index | index of this widget in the window
  lowered_stat | status to use ie: lowered = true, raised = false

Definition at line 448 of file window_gui.h.

References nested_array_size.

Referenced by LowerWidget(), LinkGraphLegendWindow::OnClick(), SmallMapWindow::OnClick(), SignListWindow::OnClick(), GameOptionsWindow::OnClick(), BuildAirportWindow::OnClick(), MusicWindow::OnClick(), FoundTownWindow::OnClick(), BuildRailStationWindow::OnClick(), BuildVehicleWindow::OnClick(), SelectGameWindow::OnInvalidateData(), TransparenciesWindow::OnInvalidateData(), MusicTrackSelectionWindow::OnInvalidateData(), GenerateLandscapeWindow::OnInvalidateData(), GameOptionsWindow::OnInvalidateData(), MusicWindow::OnInvalidateData(), AIDebugWindow::OnInvalidateData(), BuildSignalWindow::OnInvalidateData(), DepotWindow::OnMouseDrag(), TimetableWindow::OnPaint(), CreateScenarioWindow::OnPaint(), OrdersWindow::OnPaint(), SelectCompanyManagerFaceWindow::OnPaint(), StationViewWindow::OnPaint(), DepotWindow::OnPlaceObjectAbort(), RaiseWidget(), LinkGraphLegendWindow::SetOverlay(), 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.

Parameters

  disab_stat | status to use ie: disabled = true, enabled = false
  widgets | list of widgets ended by WIDGET_LIST_END

Definition at line 516 of file window.cpp.

References SetWidgetDisabledState(), and WIDGET_LIST_END.

Referenced by AIDebugWindow::AIDebugWindow(), VehicleDetailsWindow::OnClick(), BuildDocksToolbarWindow::OnInvalidateData(), BuildRoadToolbarWindow::OnInvalidateData(), GenerateLandscapeWindow::OnInvalidateData(), SelectCompanyLiveryWindow::OnInvalidateData(), NewGRFWindow::OnInvalidateData(), VehicleGroupWindow::OnPaint(), DepotWindow::OnPaint(), SelectCompanyManagerFaceWindow::OnPaint(), VehicleListWindow::OnPaint(), MainToolbarWindow::OnPaint(), VehicleDetailsWindow::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.

Parameters

  lowered_stat | status to use ie: lowered = true, raised = false
  widgets | list of widgets ended by WIDGET_LIST_END

Definition at line 535 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.

Precondition
  this->IsNewGRFInspectable()

Reimplemented in VehicleViewWindow, IndustryViewWindow, and LandInfoWindow.

Definition at line 794 of file window_gui.h.

Referenced by DispatchLeftClickEvent().

int Window::SortButtonWidth | ( |  | ) |
| static

Get width of up/down arrow of sort button state.

Returns
  Width of space required by sort button arrow.

Definition at line 658 of file widget.cpp.

Referenced by BuildBridgeWindow::UpdateWidgetSize(), ReplaceVehicleWindow::UpdateWidgetSize(), CompanyStationsWindow::UpdateWidgetSize(), VehicleGroupWindow::UpdateWidgetSize(), SaveLoadWindow::UpdateWidgetSize(), NetworkGameWindow::UpdateWidgetSize(), TownDirectoryWindow::UpdateWidgetSize(), IndustryDirectoryWindow::UpdateWidgetSize(), BuildVehicleWindow::UpdateWidgetSize(), and VehicleListWindow::UpdateWidgetSize().

void Window::ToggleWidgetLoweredState | ( | byte | widget_index | ) |
| inline

Invert the lowered/raised status of a widget.

Parameters

  widget_index | index of this widget in the window

Definition at line 458 of file window_gui.h.

References nested_array_size.

Referenced by TextfileWindow::OnClick(), GraphLegendWindow::OnClick(), LinkGraphLegendWindow::OnClick(), BuildRoadToolbarWindow::OnClick(), DepotWindow::OnClick(), PaymentRatesGraphWindow::OnClick(), BuildRailStationWindow::OnClick(), NetworkCompanyPasswordWindow::OnClick(), IndustryCargoesWindow::OnClick(), MainToolbarWindow::OnTick(), ScenarioEditorToolbarWindow::OnTick(), 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 468 of file window.cpp.

References VideoDriver::EditBoxLostFocus(), VideoDriver::GetInstance(), nested_focus, NWidgetBase::SetDirty(), NWidgetBase::type, and WWT_EDITBOX.

Referenced by HandleEditBoxKey(), and SetShaded().

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.

Parameters

  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 VehicleViewWindow, BuyCompanyWindow, CustomCurrencyWindow, ScenarioEditorToolbarWindow, SelectStationWindow< T >, ScanProgressWindow, IndustryCargoesWindow, CompanyWindow, SavePresetWindow, NetworkJoinStatusWindow, VehicleDetailsWindow, NetworkClientListWindow, GameSettingsWindow, BuildRailWaypointWindow, NetworkClientListPopupWindow, BuildRailDepotWindow, CompanyInfrastructureWindow, BuildSignalWindow, VehicleListWindow, BuildVehicleWindow, NetworkLobbyWindow, StationViewWindow, IndustryDirectoryWindow, PerformanceRatingDetailWindow, GenerateProgressWindow, CompanyLeagueWindow, SelectCompanyManagerFaceWindow, QueryWindow, AIDebugWindow, NetworkStartServerWindow, BuildRailStationWindow, MessageHistoryWindow, BuildRoadStationWindow, QueryStringWindow, CreateScenarioWindow, PaymentRatesGraphWindow, IndustryViewWindow, BuildRoadDepotWindow, SpriteAlignerWindow, OrdersWindow, TownDirectoryWindow, AIConfigWindow, NewGRFWindow, TooltipsWindow, RefitWindow, DepotWindow, SelectCompanyLiveryWindow, StoryBookWindow, ScenarioEditorLandscapeGenerationWindow, MusicWindow, BuildDocksDepotWindow, NetworkGameWindow, BaseGraphWindow, SaveLoadWindow, AboutWindow, NetworkChatWindow, TownViewWindow, GenerateLandscapeWindow, GoalQuestionWindow, NewGRFInspectWindow, VehicleGroupWindow, GameOptionsWindow, AISettingsWindow, CompanyStationsWindow, BuildIndustryWindow, MusicTrackSelectionWindow, NewsWindow, CompanyFinancesWindow, BuildAirportWindow, CheatWindow, SignListWindow, ReplaceVehicleWindow, TownAuthorityWindow, NewGRFParametersWindow, TimetableWindow, ErrmsgWindow, GoalListWindow, BuildBridgeWindow, SubsidyListWindow, BuildObjectWindow, StatusBarWindow, AIListWindow, SetDateWindow, LinkGraphLegendWindow, LandInfoWindow, BuildTreesWindow, SelectGameWindow, EnginePreviewWindow, and TextfileWindow.

Definition at line 578 of file window_gui.h.

Referenced by NWidgetStacked::SetupSmallestSize(), NWidgetMatrix::SetupSmallestSize(), NWidgetBackground::SetupSmallestSize(), and NWidgetLeaf::SetupSmallestSize().

The documentation for this struct was generated from the following files:

- src/window_gui.h
- src/viewport.cpp
- src/widget.cpp
- src/window.cpp