# main_gui.cpp File Reference

Handling of the main viewport. More...

`#include "stdafx.h"`
`#include "openttd.h"`
`#include "currency.h"`
`#include "spritecache.h"`
`#include "window_gui.h"`
`#include "window_func.h"`
`#include "textbuf_gui.h"`
`#include "viewport_func.h"`
`#include "command_func.h"`
`#include "console_gui.h"`
`#include "map_func.h"`
`#include "genworld.h"`
`#include "transparency_gui.h"`
`#include "functions.h"`
`#include "sound_func.h"`
`#include "transparency.h"`
`#include "strings_func.h"`
`#include "zoom_func.h"`
`#include "company_base.h"`
`#include "company_func.h"`
`#include "settings_type.h"`
`#include "toolbar_gui.h"`
`#include "statusbar_gui.h"`
`#include "tilehighlight_func.h"`
`#include "network/network.h"`
`#include "network/network_func.h"`
`#include "network/network_gui.h"`
`#include "network/network_base.h"`
`#include "table/sprites.h"`
`#include "table/strings.h"`

Go to the source code of this file.

## Data Structures
struct | MainWindow
## Functions
void | CcGiveMoney (bool success, TileIndex tile, uint32 p1, uint32 p2)
void | HandleOnEditText (const char *str)
bool | HandlePlacePushButton (Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc)
| This code is shared for the majority of the pushbuttons.
void | CcPlaySound10 (bool success, TileIndex tile, uint32 p1, uint32 p2)
bool | DoZoomInOutWindow (int how, Window *w)
void | ZoomInOrOutToCursorWindow (bool in, Window *w)
void | UpdateAllStationVirtCoord ()
| Update the virtual coords needed to draw the station sign for all stations.
void | ShowSelectGameWindow ()
void | SetupColoursAndInitialWindow ()
void | ShowVitalWindows ()
void | GameSizeChanged ()
| Size of the application screen changed.
## Variables
static int | _rename_id = 1
static int | _rename_what = -1

## Detailed Description

Handling of the main viewport.

Definition in file main_gui.cpp.

## Function Documentation

void GameSizeChanged | ( |  | ) |

Size of the application screen changed.

Adapt the game screen-size, re-allocate the open windows, and repaint everything

Definition at line 408 of file main_gui.cpp.

References Dimension::height, MarkWholeScreenDirty(), RelocateAllWindows(), and Dimension::width.

bool HandlePlacePushButton | ( | Window * | w,
|  | int | widget,
|  | CursorID | cursor,
|  | ViewportHighlightMode | mode,
|  | PlaceProc * | placeproc |
| ) |  |  |

This code is shared for the majority of the pushbuttons.

Handles e.g. the pressing of a button (to build things), playing of click sound and sets certain parameters

Parameters:

  | w | Window which called the function
  | widget | ID of the widget (=button) that called this function
  | cursor | How should the cursor image change? E.g. cursor with depot image in it
  | mode | Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground
  | placeproc | Procedure which will be called when someone clicks on the map

Returns:
  true if the button is clicked, false if it's unclicked

Definition at line 90 of file main_gui.cpp.

References Window::IsWidgetDisabled(), Window::IsWidgetLowered(), Window::LowerWidget(), Window::SetDirty(), Window::window_class, and Window::window_number.

Referenced by BuildRailClick_AutoRail(), BuildRailClick_AutoSignals(), BuildRailClick_Bridge(), BuildRailClick_Convert(), BuildRailClick_Demolish(), BuildRailClick_Depot(), BuildRailClick_E(), BuildRailClick_N(), BuildRailClick_NE(), BuildRailClick_NW(), BuildRailClick_Station(), BuildRailClick_Tunnel(), BuildRailClick_Waypoint(), BuildRoadClick_AutoRoad(), BuildRoadClick_X_Dir(), BuildRoadClick_Y_Dir(), and EditorTerraformClick_Dynamite().

void UpdateAllStationVirtCoord | ( |  | ) |

Update the virtual coords needed to draw the station sign for all stations.

Definition at line 394 of file station_cmd.cpp.

Referenced by CmdRenameTown(), and InitializeWindowsAndCaches().