Public Member Functions | Data Fields

# CompanyInfrastructureWindow Struct Reference

Window with detailed information about the company's infrastructure. More...

Inheritance diagram for CompanyInfrastructureWindow:

## Public Member Functions
| CompanyInfrastructureWindow (const WindowDesc *desc, WindowNumber window_number)
void | UpdateRailRoadTypes ()
Money | GetTotalMaintenanceCost () const
| Get total infrastructure maintenance cost.
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
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.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | OnInvalidateData (int data=0, bool gui_scope=true)
| Some data on this window has become invalid.
## Data Fields
RailTypes | railtypes
| Valid railtypes.
RoadTypes | roadtypes
| Valid roadtypes.
uint | total_width
| String width of the total cost line.

## Detailed Description

Window with detailed information about the company's infrastructure.

Definition at line 1541 of file company_gui.cpp.

## Member Function Documentation

virtual void CompanyInfrastructureWindow::DrawWidget | ( | const Rect & | r,
|  | int | widget |
| ) |  |  | const`[inline, virtual]`

Draw the contents of a nested widget.

Parameters:

  | r | Rectangle occupied by the widget.
  | widget | Number of the widget to draw.

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

Reimplemented from Window.

Definition at line 1713 of file company_gui.cpp.

References _current_text_dir, _settings_game, CompanyInfrastructure::airport, AirportMaintenanceCost(), CanalMaintenanceCost(), DrawString(), GameSettings::economy, EXP_LINESPACE, FONT_HEIGHT_NORMAL, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), CompanyInfrastructure::GetRailTotal(), GetRailTypeInfo(), GetTotalMaintenanceCost(), GfxFillRect(), HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Company::infrastructure, EconomySettings::infrastructure_maintenance, PC_WHITE, CompanyInfrastructure::rail, RailMaintenanceCost(), RAILTYPE_BEGIN, railtypes, RAILTYPES_NONE, CompanyInfrastructure::road, RoadMaintenanceCost(), ROADTYPE_ROAD, ROADTYPE_TRAM, roadtypes, ROADTYPES_NONE, SetDParam(), CompanyInfrastructure::signal, SignalMaintenanceCost(), CompanyInfrastructure::station, StationMaintenanceCost(), TD_LTR, CompanyInfrastructure::water, WD_FRAMERECT_LEFT, WID_CI_RAIL_COUNT, WID_CI_RAIL_DESC, WID_CI_ROAD_COUNT, WID_CI_ROAD_DESC, WID_CI_STATION_COUNT, WID_CI_STATION_DESC, WID_CI_TOTAL, WID_CI_WATER_COUNT, WID_CI_WATER_DESC, and Window::window_number.

Money CompanyInfrastructureWindow::GetTotalMaintenanceCost | ( |  | ) | const`[inline]`

Get total infrastructure maintenance cost.

Definition at line 1583 of file company_gui.cpp.

References AirportMaintenanceCost(), CanalMaintenanceCost(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), CompanyInfrastructure::GetRailTotal(), HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Company::infrastructure, CompanyInfrastructure::rail, RailMaintenanceCost(), RAILTYPE_BEGIN, railtypes, CompanyInfrastructure::road, RoadMaintenanceCost(), ROADTYPE_ROAD, ROADTYPE_TRAM, roadtypes, CompanyInfrastructure::signal, SignalMaintenanceCost(), CompanyInfrastructure::station, StationMaintenanceCost(), CompanyInfrastructure::water, and Window::window_number.

Referenced by DrawWidget(), and UpdateWidgetSize().

virtual void CompanyInfrastructureWindow::OnInvalidateData | ( | int | data = `0`,
|  | bool | gui_scope = `true` |
| ) |  |  | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | 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 1827 of file company_gui.cpp.

References Window::ReInit().

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

Parameters:

  | widget | Widget number.

Reimplemented from Window.

Definition at line 1604 of file company_gui.cpp.

References SetDParam(), WID_CI_CAPTION, and Window::window_number.

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

Parameters:

  | 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 1613 of file company_gui.cpp.

References _settings_game, CompanyInfrastructure::airport, AirportMaintenanceCost(), CanalMaintenanceCost(), GameSettings::economy, EXP_LINESPACE, FONT_HEIGHT_NORMAL, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), CompanyInfrastructure::GetRailTotal(), GetRailTypeInfo(), GetStringBoundingBox(), GetTotalMaintenanceCost(), HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Company::infrastructure, EconomySettings::infrastructure_maintenance, max(), CompanyInfrastructure::rail, RailMaintenanceCost(), RAILTYPE_BEGIN, railtypes, RAILTYPES_NONE, CompanyInfrastructure::road, RoadMaintenanceCost(), ROADTYPE_BEGIN, ROADTYPE_ROAD, ROADTYPE_TRAM, roadtypes, SetDParam(), SetDParamMaxValue(), CompanyInfrastructure::signal, SignalMaintenanceCost(), CompanyInfrastructure::station, StationMaintenanceCost(), total_width, CompanyInfrastructure::water, WD_FRAMERECT_LEFT, WID_CI_RAIL_COUNT, WID_CI_RAIL_DESC, WID_CI_ROAD_COUNT, WID_CI_ROAD_DESC, WID_CI_STATION_COUNT, WID_CI_STATION_DESC, WID_CI_TOTAL, WID_CI_WATER_COUNT, WID_CI_WATER_DESC, Window::width, and Window::window_number.

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

- src/company_gui.cpp