# MainWindow Struct Reference

Inheritance diagram for MainWindow:

## Public Member Functions
virtual void | OnPaint ()
| The window must be repainted.
virtual EventState | OnKeyPress (uint16 key, uint16 keycode)
| A key has been pressed.
virtual void | OnScroll (Point delta)
| Handle the request for (viewport) scrolling.
virtual void | OnMouseWheel (int wheel)
| The mouse wheel has been turned.
virtual void | OnResize ()
| Called after the window got resized.
virtual void | OnInvalidateData (int data)
| Some data on this window has become invalid.
## Static Public Attributes
static Hotkey< MainWindow > | global_hotkeys []

## Detailed Description

Definition at line 242 of file main_gui.cpp.

## Member Function Documentation

virtual void MainWindow::OnInvalidateData | ( | int | data | ) | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | data | information about the changed data.

Reimplemented from Window.

Definition at line 435 of file main_gui.cpp.

References InvalidateWindowData().

virtual EventState MainWindow::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 from Window.

Definition at line 273 of file main_gui.cpp.

References _network_server, _networking, _settings_client, _switch_mode, GUISettings::autosave_on_exit, CheckHotkeyMatch(), CLIENT_ID_SERVER, NetworkClientInfo::client_playas, CMD_MONEY_CHEAT, DeleteAllNonVitalWindows(), DeleteNonVitalWindows(), DESTTYPE_BROADCAST, DESTTYPE_CLIENT, DESTTYPE_TEAM, DoCommandP(), DoExitSave(), ES_HANDLED, ES_NOT_HANDLED, ClientSettings::gui, IConsoleSwitch(), IsGeneratingWorld(), MarkWholeScreenDirty(), MaxZoomInOut(), NetworkClientPreferTeamChat(), NetworkFindClientInfoFromClientID(), ResetRestoreAllTransparency(), ScrollMainWindowTo(), ToggleInvisibilityWithTransparency(), ToggleTransparency(), UpdateAllVirtCoords(), Window::viewport, and ZOOM_IN.

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

The mouse wheel has been turned.

Parameters:

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

Reimplemented from Window.

Definition at line 420 of file main_gui.cpp.

References _settings_client, ClientSettings::gui, and GUISettings::scrollwheel_scrolling.

virtual void MainWindow::OnPaint | ( |  | ) | `[inline, virtual]`

The window must be repainted.

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

Reimplemented from Window.

Definition at line 253 of file main_gui.cpp.

References DrawSprite(), Window::DrawWidgets(), GetSpriteSize(), lengthof, and Window::width.

virtual void MainWindow::OnResize | ( |  | ) | `[inline, virtual]`

Called after the window got resized.

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

Reimplemented from Window.

Definition at line 427 of file main_gui.cpp.

References MW_VIEWPORT, NWidgetViewport::UpdateViewportCoordinates(), and Window::viewport.

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

Handle the request for (viewport) scrolling.

Parameters:

  | delta | the amount the viewport must be scrolled.

Reimplemented from Window.

Definition at line 412 of file main_gui.cpp.

References ViewportData::dest_scrollpos_x, ViewportData::dest_scrollpos_y, ScaleByZoom(), ViewportData::scrollpos_x, ViewportData::scrollpos_y, and Window::viewport.

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

- src/main_gui.cpp