Public Member Functions | |
TownViewWindow (const WindowDesc *desc, WindowNumber window_number) | |
virtual void | SetStringParameters (int widget) const |
Initialize string parameters for a widget. | |
virtual void | DrawWidget (const Rect &r, int widget) const |
Draw the contents of a nested widget. | |
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 | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
Update size and resize step of a widget in the window. | |
uint | GetDesiredInfoHeight (int width) const |
Gets the desired height for the information panel. | |
void | ResizeWindowAsNeeded () |
virtual void | OnResize () |
Called after the window got resized. | |
virtual void | OnInvalidateData (int data=0, bool gui_scope=true) |
Some data on this window has become invalid. | |
virtual void | OnQueryTextFinished (char *str) |
The query window opened from this window has closed. | |
Static Public Attributes | |
static const int | WID_TV_HEIGHT_NORMAL = 150 |
Private Attributes | |
Town * | town |
Town displayed by the window. |
Definition at line 296 of file town_gui.cpp.
virtual void TownViewWindow::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [inline, virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
Reimplemented from Window.
Definition at line 325 of file town_gui.cpp.
References _current_text_dir, _settings_game, DAY_TICKS, DrawString(), DrawStringMultiLine(), GameSettings::economy, FindFirstCargoWithTownEffect(), FONT_HEIGHT_NORMAL, GetSnowLine(), GetTropicZone(), Town::goal, Town::growth_rate, HasBit(), LowestSnowLine(), Town::MaxTownNoise(), Town::noise_reached, Town::num_houses, TransportedCargoStat< Tstorage >::old_act, TransportedCargoStat< Tstorage >::old_max, Town::population, Town::received, SetDParam(), SetDParamStr(), EconomySettings::station_noise_level, Town::supplied, Town::text, TileHeight(), town, TOWN_GROW_RATE_CUSTOM, TOWN_GROWTH_DESERT, TOWN_GROWTH_TICKS, TOWN_GROWTH_WINTER, TOWN_IS_FUNDED, TROPICZONE_DESERT, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WID_TV_INFO, and Town::xy.
uint TownViewWindow::GetDesiredInfoHeight | ( | int | width | ) | const [inline] |
Gets the desired height for the information panel.
Definition at line 461 of file town_gui.cpp.
References _settings_game, GameSettings::economy, FONT_HEIGHT_NORMAL, GetStringHeight(), GetTropicZone(), Town::goal, LowestSnowLine(), Town::population, SetDParamStr(), EconomySettings::station_noise_level, Town::text, TileHeight(), town, TOWN_GROWTH_DESERT, TOWN_GROWTH_WINTER, TROPICZONE_DESERT, WD_FRAMERECT_TOP, and Town::xy.
Referenced by UpdateWidgetSize().
virtual void TownViewWindow::OnClick | ( | Point | pt, | |
int | widget, | |||
int | click_count | |||
) | [inline, virtual] |
A click with the left mouse button has been made on the window.
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 409 of file town_gui.cpp.
References _ctrl_pressed, _settings_game, EconomySettings::allow_town_roads, CMD_DELETE_TOWN, CMD_EXPAND_TOWN, CMD_MSG, CS_ALPHANUMERAL, DoCommandP(), GameSettings::economy, INVALID_STRING_ID, MAX_LENGTH_TOWN_NAME_CHARS, QSF_ENABLE_DEFAULT, QSF_LEN_IN_CHARS, ScrollMainWindowToTile(), SetDParam(), ShowErrorMessage(), ShowExtraViewPortWindow(), ShowQueryString(), town, WID_TV_CENTER_VIEW, WID_TV_CHANGE_NAME, WID_TV_DELETE, WID_TV_EXPAND, WID_TV_SHOW_AUTHORITY, WL_WARNING, and Town::xy.
virtual void TownViewWindow::OnInvalidateData | ( | int | data = 0 , |
|
bool | gui_scope = true | |||
) | [inline, virtual] |
Some data on this window has become invalid.
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 from Window.
Definition at line 513 of file town_gui.cpp.
References Window::SetDirty().
virtual void TownViewWindow::OnQueryTextFinished | ( | char * | str | ) | [inline, virtual] |
The query window opened from this window has closed.
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 from Window.
Definition at line 521 of file town_gui.cpp.
References CMD_MSG, CMD_RENAME_TOWN, and DoCommandP().
virtual void TownViewWindow::OnResize | ( | ) | [inline, virtual] |
Called after the window got resized.
For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.
Reimplemented from Window.
Definition at line 498 of file town_gui.cpp.
References ScrollWindowToTile(), town, NWidgetViewport::UpdateViewportCoordinates(), Window::viewport, and Town::xy.
virtual void TownViewWindow::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.
widget | Widget number. |
Reimplemented from Window.
Definition at line 320 of file town_gui.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, SetDParam(), town, and WID_TV_CAPTION.
virtual void TownViewWindow::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.
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 from Window.
Definition at line 448 of file town_gui.cpp.
References GetDesiredInfoHeight(), and WID_TV_INFO.