Data Structures | Public Types | Public Member Functions | Data Fields | Static Public Attributes

# StationViewWindow Struct Reference

The StationView window. More...

Inheritance diagram for StationViewWindow:

## Data Structures
struct | RowDisplay
| A row being displayed in the cargo view (as opposed to being "hidden" behind a plus sign). More...
## Public Types
enum | Invalidation { INV_FLOWS = 0x100, INV_CARGO = 0x200 }
| Type of data invalidation. More...
enum | Grouping { GR_SOURCE, GR_NEXT, GR_DESTINATION, GR_CARGO }
| Type of grouping used in each of the "columns". More...
enum | Mode { MODE_WAITING, MODE_PLANNED }
| Display mode of the cargo view. More...
enum | AcceptListHeight { ALH_RATING = 13, ALH_ACCEPTS = 3 }
| Height of the WID_SV_ACCEPT_RATING_LIST widget for different views. More...
typedef std::vector< RowDisplay > | CargoDataVector
## Public Member Functions
| StationViewWindow (WindowDesc *desc, WindowNumber window_number)
void | ShowCargo (CargoDataEntry *data, CargoID cargo, StationID source, StationID next, StationID dest, uint count)
| Show a certain cargo entry characterized by source/next/dest station, cargo ID and amount of cargo at the right place in the cargo view.
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 | OnPaint ()
| The window must be repainted.
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
void | RecalcDestinations (CargoID i)
| Rebuild the cache for estimated destinations which is used to quickly show the "destination" entries even if we actually don't know the destination of a certain packet from just looking at it.
void | EstimateDestinations (CargoID cargo, StationID source, StationID next, uint count, CargoDataEntry *dest)
| Estimate the amounts of cargo per final destination for a given cargo, source station and next hop and save the result as children of the given CargoDataEntry.
void | BuildFlowList (CargoID i, const FlowStatMap &flows, CargoDataEntry *cargo)
| Build up the cargo view for PLANNED mode and a specific cargo.
void | BuildCargoList (CargoID i, const StationCargoList &packets, CargoDataEntry *cargo)
| Build up the cargo view for WAITING mode and a specific cargo.
void | BuildCargoList (CargoDataEntry *cargo, const Station *st)
| Build up the cargo view for all cargoes.
void | SetDisplayedRow (const CargoDataEntry *data)
| Mark a specific row, characterized by its CargoDataEntry, as expanded.
StringID | GetEntryString (StationID station, StringID here, StringID other_station, StringID any)
| Select the correct string for an entry referring to the specified station.
StringID | SearchNonStop (CargoDataEntry *cd, StationID station, int column)
| Determine if we need to show the special "non-stop" string.
int | DrawEntries (CargoDataEntry *entry, Rect &r, int pos, int maxrows, int column, CargoID cargo=CT_INVALID)
| Draw the given cargo entries in the station GUI.
int | DrawAcceptedCargo (const Rect &r) const
| Draw accepted cargo in the WID_SV_ACCEPT_RATING_LIST widget.
int | DrawCargoRatings (const Rect &r) const
| Draw cargo ratings in the WID_SV_ACCEPT_RATING_LIST widget.
template<class Tid >
void | HandleCargoWaitingClick (CargoDataEntry *filter, Tid next)
| Expand or collapse a specific row.
void | HandleCargoWaitingClick (int row)
| Handle a click on a specific row in the cargo view.
virtual void | OnClick (Point pt, int widget, int click_count)
| A click with the left mouse button has been made on the window.
void | SelectSortOrder (SortOrder order)
| Select a new sort order for the cargo view.
void | SelectSortBy (int index)
| Select a new sort criterium for the cargo view.
void | SelectGroupBy (int index)
| Select a new grouping mode for the cargo view.
virtual void | OnDropdownSelect (int widget, int index)
| A dropdown option associated to this window has been selected.
virtual void | OnQueryTextFinished (char *str)
| The query window opened from this window has closed.
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.
## Data Fields
uint | expand_shrink_width
| The width allocated to the expand/shrink 'button'.
int | rating_lines
| Number of lines in the cargo ratings view.
int | accepts_lines
| Number of lines in the accepted cargo view.
Scrollbar * | vscroll
CargoSortType | sortings [NUM_COLUMNS]
| Sort types of the different 'columns'.
SortOrder | sort_orders [NUM_COLUMNS]
| Sort order (ascending/descending) for the 'columns'.
int | scroll_to_row
| If set, scroll the main viewport to the station pointed to by this row.
int | grouping_index
| Currently selected entry in the grouping drop down.
Mode | current_mode
| Currently selected display mode of cargo view.
Grouping | groupings [NUM_COLUMNS]
| Grouping modes for the different columns.
CargoDataEntry | expanded_rows
| Parent entry of currently expanded rows.
CargoDataEntry | cached_destinations
| Cache for the flows passing through this station.
CargoDataVector | displayed_rows
| Parent entry of currently displayed rows (including collapsed ones).
## Static Public Attributes
static const int | NUM_COLUMNS = 4
| Number of "columns" in the cargo view: cargo, from, via, to.
static const StringID | _sort_names []
| Names of the sorting options in the dropdown.
static const StringID | _group_names []
| Names of the grouping options in the dropdown.

## Detailed Description

The StationView window.

Definition at line 1196 of file station_gui.cpp.

## Member Enumeration Documentation

enum StationViewWindow::AcceptListHeight

Height of the WID_SV_ACCEPT_RATING_LIST widget for different views.

Enumerator:

  ALH_RATING | Height of the cargo ratings view.
  ALH_ACCEPTS | Height of the accepted cargo view.

Definition at line 1257 of file station_gui.cpp.

enum StationViewWindow::Grouping

Type of grouping used in each of the "columns".

Enumerator:

  GR_SOURCE | Group by source of cargo ("from").
  GR_NEXT | Group by next station ("via").
  GR_DESTINATION | Group by estimated final destination ("to").
  GR_CARGO | Group by cargo type.

Definition at line 1236 of file station_gui.cpp.

enum StationViewWindow::Invalidation

Type of data invalidation.

Enumerator:

  INV_FLOWS | The planned flows have been recalculated and everything has to be updated.
  INV_CARGO | Some cargo has been added or removed.

Definition at line 1228 of file station_gui.cpp.

enum StationViewWindow::Mode

Display mode of the cargo view.

Enumerator:

  MODE_WAITING | Show cargo waiting at the station.
  MODE_PLANNED | Show cargo planned to pass through the station.

Definition at line 1246 of file station_gui.cpp.

## Member Function Documentation

void StationViewWindow::BuildCargoList | ( | CargoID | i,
|  | const StationCargoList & | packets,
|  | CargoDataEntry * | cargo |
| ) |  |  | `[inline]`

Build up the cargo view for WAITING mode and a specific cargo.

Parameters:

  | i | Cargo to show.
  | packets | The current station's cargo list for that cargo.
  | cargo | The CargoDataEntry to save the result in.

Definition at line 1563 of file station_gui.cpp.

References CargoDataEntry::Begin(), cached_destinations, CargoPacket::Count(), DivideApprox(), CargoDataEntry::End(), CargoDataEntry::GetCount(), CargoDataEntry::GetStation(), CargoList< Tinst, Tcont >::Packets(), StationCargoList::ReservedCount(), CargoDataEntry::Retrieve(), ShowCargo(), and CargoPacket::SourceStation().

Referenced by BuildCargoList(), and OnPaint().

void StationViewWindow::BuildCargoList | ( | CargoDataEntry * | cargo,
|  | const Station * | st |
| ) |  |  | `[inline]`

Build up the cargo view for all cargoes.

Parameters:

  | cargo | The root cargo entry to save all results in.
  | st | The station to calculate the cargo view from.

Definition at line 1596 of file station_gui.cpp.

References BuildCargoList(), BuildFlowList(), cached_destinations, GoodsEntry::cargo, current_mode, GoodsEntry::flows, Station::goods, MODE_WAITING, RecalcDestinations(), and CargoDataEntry::Retrieve().

void StationViewWindow::BuildFlowList | ( | CargoID | i,
|  | const FlowStatMap & | flows,
|  | CargoDataEntry * | cargo |
| ) |  |  | `[inline]`

Build up the cargo view for PLANNED mode and a specific cargo.

Parameters:

  | i | Cargo to show.
  | flows | The current station's flows for that cargo.
  | cargo | The CargoDataEntry to save the results in.

Definition at line 1540 of file station_gui.cpp.

References CargoDataEntry::Begin(), cached_destinations, CargoDataEntry::End(), CargoDataEntry::GetCount(), CargoDataEntry::GetStation(), CargoDataEntry::Retrieve(), and ShowCargo().

Referenced by BuildCargoList().

int StationViewWindow::DrawAcceptedCargo | ( | const Rect & | r | ) | const`[inline]`

Draw accepted cargo in the WID_SV_ACCEPT_RATING_LIST widget.

Parameters:

  | r | Rectangle of the widget.

Returns:
  Number of lines needed for drawing the accepted cargo.

Definition at line 1793 of file station_gui.cpp.

References CeilDiv(), DrawStringMultiLine(), FONT_HEIGHT_NORMAL, GoodsEntry::GES_ACCEPTANCE, SpecializedStation< Station, false >::Get(), Station::goods, HasBit(), SetBit(), SetDParam(), GoodsEntry::status, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.

Referenced by OnPaint().

int StationViewWindow::DrawCargoRatings | ( | const Rect & | r | ) | const`[inline]`

Draw cargo ratings in the WID_SV_ACCEPT_RATING_LIST widget.

Parameters:

  | r | Rectangle of the widget.

Returns:
  Number of lines needed for drawing the cargo ratings.

Definition at line 1811 of file station_gui.cpp.

References CeilDiv(), DrawString(), DrawStringMultiLine(), Town::exclusive_counter, Town::exclusivity, FONT_HEIGHT_NORMAL, FOR_ALL_SORTED_STANDARD_CARGOSPECS, SpecializedStation< Station, false >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_pool >::GetIfValid(), Station::goods, GoodsEntry::HasRating(), CargoSpec::Index(), GoodsEntry::link_graph, LinkGraph::Monthly(), CargoSpec::name, GoodsEntry::node, BaseStation::owner, GoodsEntry::rating, SetDParam(), ToPercent8(), BaseStation::town, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.

Referenced by OnPaint().

int StationViewWindow::DrawEntries | ( | CargoDataEntry * | entry,
|  | Rect & | r,
|  | int | pos,
|  | int | maxrows,
|  | int | column,
|  | CargoID | cargo = `CT_INVALID` |
| ) |  |  | `[inline]`

Draw the given cargo entries in the station GUI.

Parameters:

  | entry | Root entry for all cargo to be drawn.
  | r | Screen rectangle to draw into.
  | pos | Current row to be drawn to (counted down from 0 to -maxrows, same as vscroll->GetPosition()).
  | maxrows | Maximum row to be drawn.
  | column | Current "column" being drawn.
  | cargo | Current cargo being drawn (if cargo column has been passed).

Returns:
  row (in "pos" counting) after the one we have last drawn to.

Definition at line 1707 of file station_gui.cpp.

References _current_text_dir, _settings_game, CargoDataEntry::Begin(), GoodsEntry::cargo, DrawCargoIcons(), DrawString(), CargoDataEntry::End(), expand_shrink_width, SpecializedStation< Station, false >::Get(), CargoDataEntry::GetCargo(), CargoDataEntry::GetCount(), GetEntryString(), CargoDataEntry::GetNumChildren(), CargoDataEntry::GetStation(), Station::goods, GR_CARGO, GR_DESTINATION, GR_NEXT, GR_SOURCE, groupings, CargoDataEntry::HasTransfers(), SpecializedStation< Station, false >::IsValidID(), GameSettings::linkgraph, NUM_COLUMNS, StationCargoList::ReservedCount(), scroll_to_row, ScrollMainWindowToTile(), SearchNonStop(), SetDisplayedRow(), SetDParam(), sort_orders, sortings, ST_AS_GROUPING, ST_COUNT, ST_STATION_STRING, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.

Referenced by OnPaint().

void StationViewWindow::EstimateDestinations | ( | CargoID | cargo,
|  | StationID | source,
|  | StationID | next,
|  | uint | count,
|  | CargoDataEntry * | dest |
| ) |  |  | `[inline]`

Estimate the amounts of cargo per final destination for a given cargo, source station and next hop and save the result as children of the given CargoDataEntry.

Parameters:

  | cargo | ID of the cargo to estimate destinations for.
  | source | Source station of the given batch of cargo.
  | next | Intermediate hop to start the calculation at ("next hop").
  | count | Size of the batch of cargo.
  | dest | CargoDataEntry to save the results in.

Definition at line 1487 of file station_gui.cpp.

References CargoDataEntry::Begin(), DivideApprox(), CargoDataEntry::End(), GoodsEntry::flows, SpecializedStation< Station, false >::Get(), CargoDataEntry::GetCount(), CargoDataEntry::GetStation(), Station::goods, CargoDataEntry::InsertOrRetrieve(), SpecializedStation< Station, false >::IsValidID(), and CargoDataEntry::Update().

Referenced by RecalcDestinations().

StringID StationViewWindow::GetEntryString | ( | StationID | station,
|  | StringID | here,
|  | StringID | other_station,
|  | StringID | any |
| ) |  |  | `[inline]`

Select the correct string for an entry referring to the specified station.

Parameters:

  | station | Station the entry is showing cargo for.
  | here | String to be shown if the entry refers to the same station as this station GUI belongs to.
  | other_station | String to be shown if the entry refers to a specific other station.
  | any | String to be shown if the entry refers to "any station".

Returns:
  One of the three given strings or STR_STATION_VIEW_RESERVED, depending on what station the entry refers to.

Definition at line 1649 of file station_gui.cpp.

References SetDParam().

Referenced by DrawEntries().

template<class Tid >

void StationViewWindow::HandleCargoWaitingClick | ( | CargoDataEntry * | filter,
|  | Tid | next |
| ) |  |  | `[inline]`

Expand or collapse a specific row.

Parameters:

  | filter | Parent of the row.
  | next | ID pointing to the row.

Definition at line 1847 of file station_gui.cpp.

References CargoDataEntry::InsertOrRetrieve(), CargoDataEntry::Remove(), and CargoDataEntry::Retrieve().

Referenced by OnClick().

void StationViewWindow::HandleCargoWaitingClick | ( | int | row | ) | `[inline]`

Handle a click on a specific row in the cargo view.

Parameters:

  | row | Row being clicked.

Definition at line 1860 of file station_gui.cpp.

References _ctrl_pressed, displayed_rows, StationViewWindow::RowDisplay::filter, StationViewWindow::RowDisplay::next_cargo, StationViewWindow::RowDisplay::next_station, scroll_to_row, Window::SetWidgetDirty(), and WID_SV_WAITING.

virtual void StationViewWindow::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 1876 of file station_gui.cpp.

References _ctrl_pressed, _group_names, _sort_names, accepts_lines, CMD_OPEN_CLOSE_AIRPORT, CS_ALPHANUMERAL, current_mode, DoCommandP(), FONT_HEIGHT_NORMAL, SpecializedStation< Station, false >::Get(), Scrollbar::GetPosition(), Scrollbar::GetScrolledRowFromWidget(), grouping_index, HandleCargoWaitingClick(), Window::LowerWidget(), MAX_LENGTH_STATION_NAME_CHARS, BaseStation::owner, QSF_ENABLE_DEFAULT, QSF_LEN_IN_CHARS, rating_lines, Window::ReInit(), ScrollMainWindowToTile(), SelectSortOrder(), NWidgetCore::SetDataTip(), SetDParam(), Window::SetTimeout(), ShowDropDownMenu(), ShowExtraViewPortWindow(), ShowQueryString(), sort_orders, sortings, ST_COUNT, WD_FRAMERECT_TOP, WID_SV_ACCEPTS_RATINGS, WID_SV_CLOSE_AIRPORT, WID_SV_GROUP_BY, WID_SV_LOCATION, WID_SV_PLANES, WID_SV_RENAME, WID_SV_ROADVEHS, WID_SV_SHIPS, WID_SV_SORT_BY, WID_SV_SORT_ORDER, WID_SV_TRAINS, and WID_SV_WAITING.

virtual void StationViewWindow::OnDropdownSelect | ( | int | widget,
|  | int | index |
| ) |  |  | `[inline, virtual]`

A dropdown option associated to this window has been selected.

Parameters:

  | widget | the widget (button) that the dropdown is associated with.
  | index | the element in the dropdown that is selected.

Reimplemented from Window.

Definition at line 2037 of file station_gui.cpp.

References SelectGroupBy(), SelectSortBy(), and WID_SV_SORT_BY.

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

Some data on this window has become invalid.

Invalidate the cache for the given cargo if necessary.

Parameters:

  | data | Information about the changed data. If it's a valid cargo ID, invalidate the cargo 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 2063 of file station_gui.cpp.

References cached_destinations, NUM_CARGO, Window::ReInit(), and CargoDataEntry::Remove().

virtual void StationViewWindow::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 1385 of file station_gui.cpp.

References _local_company, accepts_lines, Station::airport, AIRPORT_CLOSED_block, BuildCargoList(), NWidgetBase::current_x, NWidgetBase::current_y, displayed_rows, DrawAcceptedCargo(), DrawCargoRatings(), DrawEntries(), Window::DrawSortButtonState(), Window::DrawWidgets(), FACIL_AIRPORT, FACIL_BUS_STOP, FACIL_DOCK, FACIL_TRAIN, FACIL_TRUCK_STOP, BaseStation::facilities, Airport::flags, SpecializedStation< Station, false >::Get(), Scrollbar::GetCapacity(), CargoDataEntry::GetNumChildren(), Scrollbar::GetPosition(), Window::IsShaded(), BaseStation::owner, OWNER_NONE, NWidgetBase::pos_x, NWidgetBase::pos_y, rating_lines, Window::ReInit(), SBS_DOWN, SBS_UP, scroll_to_row, Scrollbar::SetCount(), Window::SetWidgetDisabledState(), Window::SetWidgetLoweredState(), sort_orders, WID_SV_ACCEPTS_RATINGS, WID_SV_CLOSE_AIRPORT, WID_SV_PLANES, WID_SV_RENAME, WID_SV_ROADVEHS, WID_SV_SHIPS, WID_SV_SORT_ORDER, and WID_SV_TRAINS.

virtual void StationViewWindow::OnQueryTextFinished | ( | char * | str | ) | `[inline, virtual]`

The query window opened from this window has closed.

Parameters:

  | 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 2046 of file station_gui.cpp.

References CMD_MSG, CMD_RENAME_STATION, and DoCommandP().

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

Called after the window got resized.

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

Reimplemented from Window.

Definition at line 2053 of file station_gui.cpp.

References Scrollbar::SetCapacityFromWidget(), WD_FRAMERECT_BOTTOM, WD_FRAMERECT_TOP, and WID_SV_WAITING.

void StationViewWindow::RecalcDestinations | ( | CargoID | i | ) | `[inline]`

Rebuild the cache for estimated destinations which is used to quickly show the "destination" entries even if we actually don't know the destination of a certain packet from just looking at it.

Parameters:

  | i | Cargo to recalculate the cache for.

Definition at line 1453 of file station_gui.cpp.

References cached_destinations, CargoDataEntry::Clear(), EstimateDestinations(), GoodsEntry::flows, SpecializedStation< Station, false >::Get(), Station::goods, CargoDataEntry::InsertOrRetrieve(), and CargoDataEntry::Update().

Referenced by BuildCargoList().

StringID StationViewWindow::SearchNonStop | ( | CargoDataEntry * | cd,
|  | StationID | station,
|  | int | column |
| ) |  |  | `[inline]`

Determine if we need to show the special "non-stop" string.

Parameters:

  | cd | Entry we are going to show.
  | station | Station the entry refers to.
  | column | The "column" the entry will be shown in.

Returns:
  either STR_STATION_VIEW_VIA or STR_STATION_VIEW_NONSTOP.

Definition at line 1670 of file station_gui.cpp.

References CargoDataEntry::Begin(), CargoDataEntry::End(), CargoDataEntry::GetParent(), CargoDataEntry::GetStation(), GR_DESTINATION, groupings, and Window::parent.

Referenced by DrawEntries().

void StationViewWindow::SelectGroupBy | ( | int | index | ) | `[inline]`

Select a new grouping mode for the cargo view.

Parameters:

  | index | Row being selected in the grouping drop down.

Definition at line 1997 of file station_gui.cpp.

References _group_names, _settings_client, grouping_index, groupings, ClientSettings::gui, Window::SetDirty(), and GUISettings::station_gui_group_order.

Referenced by OnDropdownSelect().

void StationViewWindow::SelectSortBy | ( | int | index | ) | `[inline]`

Select a new sort criterium for the cargo view.

Parameters:

  | index | Row being selected in the sort criteria drop down.

Definition at line 1965 of file station_gui.cpp.

References _settings_client, _sort_names, current_mode, ClientSettings::gui, Window::SetDirty(), sortings, and GUISettings::station_gui_sort_by.

Referenced by OnDropdownSelect().

void StationViewWindow::SelectSortOrder | ( | SortOrder | order | ) | `[inline]`

Select a new sort order for the cargo view.

Parameters:

  | order | New sort order.

Definition at line 1954 of file station_gui.cpp.

References _settings_client, ClientSettings::gui, Window::SetDirty(), sort_orders, and GUISettings::station_gui_sort_order.

Referenced by OnClick().

void StationViewWindow::SetDisplayedRow | ( | const CargoDataEntry * | data | ) | `[inline]`

Mark a specific row, characterized by its CargoDataEntry, as expanded.

Parameters:

  | data | The row to be marked as expanded.

Definition at line 1616 of file station_gui.cpp.

References displayed_rows, expanded_rows, CargoDataEntry::GetCargo(), CargoDataEntry::GetParent(), CargoDataEntry::GetStation(), Window::parent, and CargoDataEntry::Retrieve().

Referenced by DrawEntries().

virtual void StationViewWindow::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 1441 of file station_gui.cpp.

References BaseStation::facilities, SpecializedStation< Station, false >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, and SetDParam().

void StationViewWindow::ShowCargo | ( | CargoDataEntry * | data,
|  | CargoID | cargo,
|  | StationID | source,
|  | StationID | next,
|  | StationID | dest,
|  | uint | count |
| ) |  |  | `[inline]`

Show a certain cargo entry characterized by source/next/dest station, cargo ID and amount of cargo at the right place in the cargo view.

I.e. update as many rows as are expanded following that characterization.

Parameters:

  | data | Root entry of the tree.
  | cargo | Cargo ID of the entry to be shown.
  | source | Source station of the entry to be shown.
  | next | Next station the cargo to be shown will visit.
  | dest | Final destination of the cargo to be shown.
  | count | Amount of cargo to be shown.

Definition at line 1325 of file station_gui.cpp.

References _settings_game, expanded_rows, GR_CARGO, GR_DESTINATION, GR_NEXT, GR_SOURCE, groupings, CargoDataEntry::InsertOrRetrieve(), GameSettings::linkgraph, NUM_COLUMNS, CargoDataEntry::Retrieve(), CargoDataEntry::SetTransfers(), and CargoDataEntry::Update().

Referenced by BuildCargoList(), and BuildFlowList().

virtual void StationViewWindow::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 1361 of file station_gui.cpp.

References accepts_lines, expand_shrink_width, BaseStation::facilities, FONT_HEIGHT_NORMAL, SpecializedStation< Station, false >::Get(), GetStringBoundingBox(), max(), rating_lines, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WID_SV_ACCEPT_RATING_LIST, WID_SV_CLOSE_AIRPORT, WID_SV_WAITING, and Window::width.

## Field Documentation

const StringID StationViewWindow::_group_names`[static]`

Initial value:

     {
      STR_STATION_VIEW_GROUP_S_V_D,
      STR_STATION_VIEW_GROUP_S_D_V,
      STR_STATION_VIEW_GROUP_V_S_D,
      STR_STATION_VIEW_GROUP_V_D_S,
      STR_STATION_VIEW_GROUP_D_S_V,
      STR_STATION_VIEW_GROUP_D_V_S,
      INVALID_STRING_ID
    }

Names of the grouping options in the dropdown.

Definition at line 1263 of file station_gui.cpp.

Referenced by OnClick(), and SelectGroupBy().

const StringID StationViewWindow::_sort_names`[static]`

Initial value:

     {
      STR_STATION_VIEW_WAITING_STATION,
      STR_STATION_VIEW_WAITING_AMOUNT,
      STR_STATION_VIEW_PLANNED_STATION,
      STR_STATION_VIEW_PLANNED_AMOUNT,
      INVALID_STRING_ID
    }

Names of the sorting options in the dropdown.

Definition at line 1262 of file station_gui.cpp.

Referenced by OnClick(), and SelectSortBy().

SortOrder StationViewWindow::sort_orders[NUM_COLUMNS]

Sort order (ascending/descending) for the 'columns'.

Definition at line 1274 of file station_gui.cpp.

Referenced by DrawEntries(), OnClick(), OnPaint(), and SelectSortOrder().

CargoSortType StationViewWindow::sortings[NUM_COLUMNS]

Sort types of the different 'columns'.

In fact only ST_COUNT and ST_AS_GROUPING are active and you can only sort all the columns in the same way. The other options haven't been included in the GUI due to lack of space.

Definition at line 1271 of file station_gui.cpp.

Referenced by DrawEntries(), OnClick(), and SelectSortBy().

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

- src/station_gui.cpp