# FoundTownWindow Struct Reference

Found a town window class. More...

Inheritance diagram for FoundTownWindow:

## Public Member Functions
| FoundTownWindow (const WindowDesc *desc, WindowNumber window_number)
void | RandomTownName ()
void | UpdateButtons (bool check_availability)
void | ExecuteFoundTownCommand (TileIndex tile, bool random, StringID errstr, CommandCallback cc)
virtual void | OnPaint ()
| The window must be repainted.
virtual void | OnClick (Point pt, int widget, int click_count)
| A click with the left mouse button has been made on the window.
virtual void | OnTimeout ()
| Called when this window's timeout has been reached.
virtual void | OnMouseLoop ()
| Called for every mouse loop run, which is at least once per (game) tick.
virtual EventState | OnKeyPress (uint16 key, uint16 keycode)
| A key has been pressed.
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 | OnInvalidateData (int)
| Some data on this window has become invalid.
## Private Attributes
TownSize | town_size
| Selected town size.
TownLayout | town_layout
| Selected town layout.
bool | city
| Are we building a city?
bool | townnamevalid
| Is generated town name valid?
uint32 | townnameparts
| Generated town name.
TownNameParams | params
| Town name parameters.

## Detailed Description

Found a town window class.

Definition at line 996 of file town_gui.cpp.

## Member Function Documentation

virtual void FoundTownWindow::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 from Window.

Definition at line 1080 of file town_gui.cpp.

References _generating_world, city, GenerateTowns(), Window::HandleButtonClick(), HandlePlacePushButton(), HT_RECT, Window::SetDirty(), Window::SetFocusedWidget(), Window::SetWidgetLoweredState(), ShowErrorMessage(), town_layout, town_size, UpdateNearestTownForRoadTiles(), and WL_INFO.

virtual void FoundTownWindow::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 1160 of file town_gui.cpp.

virtual EventState FoundTownWindow::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 1140 of file town_gui.cpp.

References ES_NOT_HANDLED, and Window::UnfocusFocusedWidget().

virtual void FoundTownWindow::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 1074 of file town_gui.cpp.

References Window::DrawWidgets(), and Window::IsShaded().

virtual void FoundTownWindow::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 from Window.

Definition at line 1149 of file town_gui.cpp.

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

- src/town_gui.cpp