# Window Struct Reference

Data structure for an opened window. More...

`#include <window_gui.h>`

Inheritance diagram for Window:

## Public Types
enum | EventState { ES_HANDLED, ES_NOT_HANDLED }
| State whether an event is handled or not. More...
## Public Member Functions
| Window (int x, int y, int width, int height, WindowClass cls, const Widget *widget)
| Open a new window.
| Window (const WindowDesc *desc, WindowNumber number=0)
| Set the positions of a new window from a WindowDesc and open it.
virtual | ~Window ()
| Remove window and all its child windows from the window stack.
FORCEINLINE void * | operator new[] (size_t size)
| Memory allocator for an array of class instances.
FORCEINLINE void | operator delete (void *ptr, size_t size)
| Memory release for a single class instance.
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.
void | SetWidgetHiddenState (byte widget_index, bool hidden_stat)
| Sets the hidden/shown status of a widget.
void | HideWidget (byte widget_index)
| Sets a widget hidden.
void | ShowWidget (byte widget_index)
| Sets a widget visible.
bool | IsWidgetHidden (byte widget_index) const
| Gets the visibility of a widget.
void | SetFocusedWidget (byte widget_index)
| Set focus within this window to given 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 | AlignWidgetRight (byte widget_index_a, byte widget_index_b)
| Align widgets a and b next to each other.
int | GetWidgetWidth (byte widget_index) const
| Get the width of a widget.
void | HandleButtonClick (byte widget)
| Do all things to make a button look clicked and mark it to be unclicked in a few ticks.
bool | HasWidgetOfType (WidgetType widget_type) const
| Checks if the window has at least one widget of given type.
void | RaiseButtons ()
| Raise all buttons of the window.
void CDECL | SetWidgetsDisabledState (bool disab_stat, int widgets,...)
| Sets the enabled/disabled status of a list of widgets.
void CDECL | SetWidgetsHiddenState (bool hidden_stat, int widgets,...)
| Sets the hidden/shown 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 | InvalidateWidget (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 () 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).
virtual void | OnPaint ()
| This window is currently being repainted.
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)
| A click with the left mouse button has been made on the window.
virtual void | OnDoubleClick (Point pt, int widget)
| A double click with the left mouse button has been made on the window.
virtual void | OnRightClick (Point pt, int widget)
| A click with the right mouse button has been made on the window.
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 (Point new_size, Point delta)
| Called when 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 | 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.
## 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).
Scrollbar | hscroll
| Horizontal scroll bar.
Scrollbar | vscroll
| First vertical scroll bar.
Scrollbar | vscroll2
| Second vertical scroll bar.
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.
Widget * | widget
| Widgets of the window.
uint | widget_count
| Number of widgets of the window.
uint32 | desc_flags
| Window/widgets default flags setting,.
const Widget * | focused_widget
| Currently focused widget or NULL, if no widget has focus.
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 | Initialize (int x, int y, int min_width, int min_height, WindowClass cls, const Widget *widget, int window_number)
| Initializes a new Window.
void | FindWindowPlacementAndResize (int def_width, int def_height)
| Resize window towards the default size.
void | FindWindowPlacementAndResize (const WindowDesc *desc)
| Resize window towards the default size given in the window description.

## Detailed Description

Data structure for an opened window.

Definition at line 124 of file window_gui.h.

## Member Enumeration Documentation

enum Window::EventState

State whether an event is handled or not.

Enumerator:

  ES_HANDLED | The passed event is handled.
  ES_NOT_HANDLED | The passed event is not handled.

Definition at line 126 of file window_gui.h.

## Constructor & Destructor Documentation

Window::Window | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height,
|  | WindowClass | cls,
|  | const Widget * | widget |
| ) |  |  |

Open a new window.

If there is no space for a new window, close an open window. Try to avoid stickied windows, but if there is no else, close one of those as well. Then make sure all created windows are below some always-on-top ones. Finally set all variables and call the WE_CREATE event

Parameters:

  | x | offset in pixels from the left of the screen
  | y | offset in pixels from the top of the screen
  | width | width in pixels of the window
  | height | height in pixels of the window
  | cls | see WindowClass class of the window, used for identification and grouping
  | *widget | see Widget pointer to the window layout and various elements

Returns:
  Window pointer of the newly created window

Definition at line 933 of file window.cpp.

References Initialize().

Window::Window | ( | const WindowDesc * | desc,
|  | WindowNumber | window_number = `0` |
| ) |  |  |

Set the positions of a new window from a WindowDesc and open it.

Parameters:

  | *desc | The pointer to the WindowDesc to be created
  | window_number | the window number of the new window

Returns:
  Window pointer of the newly created window

Definition at line 1157 of file window.cpp.

References WindowDesc::cls, desc_flags, WindowDesc::flags, Initialize(), LocalGetWindowPlacement(), WindowDesc::minimum_height, WindowDesc::minimum_width, WindowDesc::widgets, Point::x, and Point::y.

## Member Function Documentation

void Window::Initialize | ( | int | x,
|  | int | y,
|  | int | min_width,
|  | int | min_height,
|  | WindowClass | cls,
|  | const Widget * | widget,
|  | int | window_number |
| ) |  |  | `[protected]`

Initializes a new Window.

This function is called the constructors. See descriptions for those functions for usage Only addition here is window_number, which is the window_number being assigned to the new window

Parameters:

  | x | offset in pixels from the left of the screen
  | y | offset in pixels from the top of the screen
  | min_width | minimum width in pixels of the window
  | min_height | minimum height in pixels of the window
  | cls | see WindowClass class of the window, used for identification and grouping
  | *widget | see Widget pointer to the window layout and various elements
  | window_number | number being assigned to the new window

Returns:
  Window pointer of the newly created window

Definition at line 782 of file window.cpp.

References AssignWidgetToWindow(), EditBoxInGlobalFocus(), FindWindowById(), flags4, focused_widget, HasWidgetOfType(), ResizeInfo::height, height, INVALID_OWNER, left, owner, resize, SetFocusedWindow(), ResizeInfo::step_height, ResizeInfo::step_width, top, ResizeInfo::width, width, window_class, WWT_EDITBOX, z_back, and z_front.

Referenced by Window().

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.

Parameters:

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

See also:
  Window::Window(), Window::Initialize()

Definition at line 857 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, width, Point::x, and Point::y.

Referenced by FindWindowPlacementAndResize().

void Window::FindWindowPlacementAndResize | ( | const WindowDesc * | desc | ) | `[protected]`

Resize window towards the default size given in the window description.

Parameters:

  | desc | the description to get the default size from.

Definition at line 915 of file window.cpp.

References WindowDesc::default_height, WindowDesc::default_width, and FindWindowPlacementAndResize().

FORCEINLINE void* Window::operator new[] | ( | size_t | size | ) | `[inline]`

Memory allocator for an array of class instances.

Parameters:

  | size | the amount of bytes to allocate.

Returns:
  the given amounts of bytes zeroed.

Reimplemented from ZeroedMemoryAllocator.

Definition at line 144 of file window_gui.h.

FORCEINLINE void Window::operator delete | ( | void * | ptr,
|  | size_t | size |
| ) |  |  | `[inline]`

Memory release for a single class instance.

Parameters:

  | ptr | the memory to free.
  | size | the amount of allocated memory (unused).

Warning:
  The value of the size parameter can only be trusted for classes that have their own (virtual) destructor method.

Reimplemented from ZeroedMemoryAllocator.

Definition at line 146 of file window_gui.h.

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 181 of file window_gui.h.

References SB(), WIDG_DISABLED, widget, and widget_count.

Referenced by DisableWidget(), EnableWidget(), HandleZoomMessage(), VehicleListWindow::OnPaint(), StationViewWindow::OnPaint(), NewGRFWindow::OnPaint(), NewGRFAddWindow::OnPaint(), CompanyWindow::OnPaint(), ReplaceVehicleWindow::OnPaint(), AIConfigWindow::OnPaint(), and SetWidgetsDisabledState().

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 191 of file window_gui.h.

References SetWidgetDisabledState().

Referenced by NewGRFWindow::OnPaint(), CompanyWindow::OnPaint(), and BuildRailToolbarWindow::OnPlaceObjectAbort().

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 200 of file window_gui.h.

References SetWidgetDisabledState().

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 210 of file window_gui.h.

References HasBit(), WIDG_DISABLED, widget, and widget_count.

Referenced by BuildRailClick_Remove(), BuildRoadClick_OneWay(), DispatchLeftClickEvent(), DrawWidgets(), HandlePlacePushButton(), RailToolbar_CtrlChanged(), and RoadToolbar_CtrlChanged().

void Window::SetWidgetHiddenState | ( | byte | widget_index,
|  | bool | hidden_stat |
| ) |  |  | `[inline]`

Sets the hidden/shown status of a widget.

By default, widgets are visible. On certain conditions, they have to be hidden.

Parameters:

  | widget_index | index of this widget in the window
  | hidden_stat | status to use ie. hidden = true, visible = false

Definition at line 223 of file window_gui.h.

References SB(), WIDG_HIDDEN, widget, and widget_count.

Referenced by HideWidget(), VehicleListWindow::OnPaint(), CompanyWindow::OnPaint(), SetWidgetsHiddenState(), and ShowWidget().

void Window::HideWidget | ( | byte | widget_index | ) | `[inline]`

Sets a widget hidden.

Parameters:

  | widget_index | index of this widget in the window

Definition at line 233 of file window_gui.h.

References SetWidgetHiddenState().

void Window::ShowWidget | ( | byte | widget_index | ) | `[inline]`

Sets a widget visible.

Parameters:

  | widget_index | index of this widget in the window

Definition at line 242 of file window_gui.h.

References SetWidgetHiddenState().

bool Window::IsWidgetHidden | ( | byte | widget_index | ) | const`[inline]`

Gets the visibility of a widget.

Parameters:

  | widget_index | index of this widget in the window

Returns:
  status of the widget ie: hidden = true, visible = false

Definition at line 252 of file window_gui.h.

References HasBit(), WIDG_HIDDEN, widget, and widget_count.

Referenced by GetWidgetFromPos(), and InvalidateWidget().

void Window::SetFocusedWidget | ( | byte | widget_index | ) | `[inline]`

Set focus within this window to given widget.

The function however don't change which window that has focus.

Parameters:

  | widget_index | : index of the widget in the window to set focus to

Definition at line 263 of file window_gui.h.

References focused_widget, InvalidateWidget(), widget, and widget_count.

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 279 of file window_gui.h.

References focused_widget, and widget.

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 290 of file window_gui.h.

References IsWidgetFocused().

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 300 of file window_gui.h.

References SB(), WIDG_LOWERED, widget, and widget_count.

Referenced by LowerWidget(), CompanyStationsWindow::OnClick(), RaiseWidget(), and SetWidgetsLoweredState().

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 310 of file window_gui.h.

References ToggleBit(), WIDG_LOWERED, widget, and widget_count.

Referenced by BuildRoadClick_OneWay(), CompanyStationsWindow::OnClick(), ToggleRailButton_Remove(), and ToggleRoadButton_Remove().

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 320 of file window_gui.h.

References SetWidgetLoweredState().

Referenced by HandleButtonClick(), HandlePlacePushButton(), CompanyStationsWindow::OnClick(), CompanyWindow::OnClick(), and ShowDropDownList().

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 329 of file window_gui.h.

References SetWidgetLoweredState().

Referenced by CompanyStationsWindow::OnClick(), CompanyStationsWindow::OnTimeout(), RaiseButtons(), and ResetSignalVariant().

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 339 of file window_gui.h.

References HasBit(), WIDG_LOWERED, widget, and widget_count.

Referenced by BuildRailClick_Remove(), DrawSortButtonState(), DrawWidgets(), HandlePlacePushButton(), BuildRailToolbarWindow::OnCTRLStateChange(), CompanyStationsWindow::OnPaint(), BuildRailToolbarWindow::OnPlaceDrag(), RailToolbar_CtrlChanged(), RaiseButtons(), RoadToolbar_CtrlChanged(), ToggleRailButton_Remove(), and ToggleRoadButton_Remove().

void Window::AlignWidgetRight | ( | byte | widget_index_a,
|  | byte | widget_index_b |
| ) |  |  | `[inline]`

Align widgets a and b next to each other.

Parameters:

  | widget_index_a | the left widget
  | widget_index_b | the right widget (fixed)

Definition at line 350 of file window_gui.h.

References Widget::left, Widget::right, widget, and widget_count.

int Window::GetWidgetWidth | ( | byte | widget_index | ) | const`[inline]`

Get the width of a widget.

Parameters:

  | widget_index | the widget

Returns:
  width of the widget

Definition at line 364 of file window_gui.h.

References Widget::left, Widget::right, widget, and widget_count.

Referenced by ReplaceVehicleWindow::OnPaint().

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

References flags4, InvalidateWidget(), LowerWidget(), and WF_TIMEOUT_BEGIN.

Referenced by DispatchLeftClickEvent().

bool Window::HasWidgetOfType | ( | WidgetType | widget_type | ) | const

Checks if the window has at least one widget of given type.

Parameters:

  | widget_type | the widget type to look for

Definition at line 222 of file window.cpp.

References widget, and widget_count.

Referenced by Initialize().

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

References SetWidgetDisabledState(), and WIDGET_LIST_END.

Referenced by VehicleListWindow::OnPaint(), and NewGRFWindow::OnPaint().

void CDECL Window::SetWidgetsHiddenState | ( | bool | hidden_stat,
|  | int | widgets,
|  |  | ... |
| ) |  |  |

Sets the hidden/shown status of a list of widgets.

By default, widgets are visible. On certain conditions, they have to be hidden.

Parameters:

  | hidden_stat | status to use ie. hidden = true, visible = false
  | widgets | list of widgets ended by WIDGET_LIST_END

Definition at line 146 of file window.cpp.

References SetWidgetHiddenState(), and WIDGET_LIST_END.

Referenced by VehicleListWindow::OnPaint().

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

References SetWidgetLoweredState(), and WIDGET_LIST_END.

void Window::InvalidateWidget | ( | 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 196 of file window.cpp.

References Widget::bottom, IsWidgetHidden(), Widget::left, left, Widget::right, SetDirtyBlocks(), Widget::top, Widget::type, widget, and WWT_EMPTY.

Referenced by DispatchLeftClickEvent(), HandleButtonClick(), HandleZoomMessage(), InvalidateWindowWidget(), CompanyWindow::OnClick(), IndustryDirectoryWindow::OnInvalidateData(), BuildRailToolbarWindow::OnPlaceObjectAbort(), RaiseButtons(), SetFocusedWidget(), SetFocusedWindow(), ShowDropDownList(), IndustryDirectoryWindow::SortIndustriesList(), CompanyStationsWindow::SortStationsList(), ToggleRailButton_Remove(), and ToggleRoadButton_Remove().

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 619 of file widget.cpp.

References DoDrawString(), IsWidgetLowered(), and top.

Referenced by VehicleListWindow::OnPaint(), CompanyStationsWindow::OnPaint(), and IndustryDirectoryWindow::OnPaint().

virtual EventState Window::OnKeyPress | ( | uint16 | 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 QueryWindow, and BuildRailToolbarWindow.

Definition at line 411 of file window_gui.h.

References ES_NOT_HANDLED.

Referenced by HandleKeypress().

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

Definition at line 418 of file window_gui.h.

References ES_NOT_HANDLED.

Referenced by HandleCtrlChanged().

virtual void Window::OnClick | ( | Point | pt,
|  | int | widget |
| ) |  |  | `[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.

Reimplemented in AIListWindow, AISettingsWindow, AIConfigWindow, ReplaceVehicleWindow, CompanyWindow, IndustryDirectoryWindow, QueryWindow, NewGRFAddWindow, NewGRFWindow, BuildRailToolbarWindow, CompanyStationsWindow, StationViewWindow, and VehicleListWindow.

Definition at line 426 of file window_gui.h.

Referenced by DispatchLeftClickEvent().

virtual void Window::OnDoubleClick | ( | Point | pt,
|  | int | widget |
| ) |  |  | `[inline, virtual]`

A double 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.

Reimplemented in AIListWindow, AIConfigWindow, and NewGRFAddWindow.

Definition at line 433 of file window_gui.h.

Referenced by DispatchLeftClickEvent().

virtual void 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.

Definition at line 440 of file window_gui.h.

Referenced by DispatchRightClickEvent().

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.

Definition at line 447 of file window_gui.h.

virtual void Window::OnScroll | ( | Point | delta | ) | `[inline, virtual]`

Handle the request for (viewport) scrolling.

Parameters:

  | delta | the amount the viewport must be scrolled.

Definition at line 453 of file window_gui.h.

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.

Definition at line 461 of file window_gui.h.

virtual void Window::OnMouseWheel | ( | int | wheel | ) | `[inline, virtual]`

The mouse wheel has been turned.

Parameters:

  | wheel | the amount of movement of the mouse wheel.

Definition at line 467 of file window_gui.h.

virtual void Window::OnResize | ( | Point | new_size,
|  | Point | delta |
| ) |  |  | `[inline, virtual]`

Called when the window got resized.

Parameters:

  | new_size | the new size of the window.
  | delta | the amount of which the window size changed.

Reimplemented in AIListWindow, AISettingsWindow, AIConfigWindow, ReplaceVehicleWindow, IndustryDirectoryWindow, NewGRFWindow, CompanyStationsWindow, StationViewWindow, and VehicleListWindow.

Definition at line 496 of file window_gui.h.

Referenced by FindWindowPlacementAndResize(), and RelocateAllWindows().

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 ReplaceVehicleWindow, IndustryDirectoryWindow, NewGRFWindow, CompanyStationsWindow, and VehicleListWindow.

Definition at line 503 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 or NULL if the window was cancelled.

Reimplemented in AISettingsWindow, CompanyWindow, NewGRFWindow, and StationViewWindow.

Definition at line 510 of file window_gui.h.

virtual void Window::OnInvalidateData | ( | int | data = `0` | ) | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | data | information about the changed data.

Reimplemented in ReplaceVehicleWindow, IndustryDirectoryWindow, NewGRFWindow, CompanyStationsWindow, and VehicleListWindow.

Definition at line 516 of file window_gui.h.

Referenced by InvalidateThisWindowData().

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 CompanyWindow, and BuildRailToolbarWindow.

Definition at line 525 of file window_gui.h.

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.

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

Definition at line 551 of file window_gui.h.

Referenced by VpHandlePlaceSizingDrag().

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.

Definition at line 560 of file window_gui.h.

## Field Documentation

uint16 Window::flags4

Window flags,.

See also:
  WindowFlags

Definition at line 148 of file window_gui.h.

Referenced by BringWindowToFrontById(), CheckSoftLimit(), DeleteAllNonVitalWindows(), DeleteNonVitalWindows(), DeleteWindowById(), DispatchLeftClickEvent(), DrawWidgets(), HandleAutoscroll(), HandleButtonClick(), Initialize(), MaybeBringWindowToFront(), CompanyStationsWindow::OnClick(), ScrollbarClickHandler(), StartWindowDrag(), StartWindowSizing(), and UpdateWindows().

uint32 Window::desc_flags

Window/widgets default flags setting,.

See also:
  WindowDefaultFlag

Definition at line 167 of file window_gui.h.

Referenced by DeleteConstructionWindows(), DeleteWindowById(), DispatchLeftClickEvent(), DispatchRightClickEvent(), MaybeBringWindowToFront(), and Window().

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

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