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
## Public Types
enum | Invalidation { INV_FLOWS = 0x100, INV_CARGO = 0x200 }
enum | Grouping { GR_SOURCE, GR_NEXT, GR_DESTINATION, GR_CARGO }
enum | Mode { MODE_WAITING, MODE_PLANNED }
enum | AcceptListHeight { ALH_RATING = 13, ALH_ACCEPTS = 3 }
| Height of the SVW_ACCEPTLIST widget for different views. More...
typedef std::vector< RowDisplay > | CargoDataVector
## Public Member Functions
| StationViewWindow (const WindowDesc *desc, WindowNumber window_number)
void | ShowCargo (CargoDataEntry *data, CargoID cargo, StationID source, StationID next, StationID dest, uint count)
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)
void | EstimateDestinations (CargoID cargo, StationID source, StationID next, uint count, CargoDataEntry *dest)
void | BuildFlowList (CargoID i, const FlowStatMap &flows, CargoDataEntry *cargo)
void | BuildCargoList (CargoID i, const StationCargoList &packets, CargoDataEntry *cargo)
void | BuildCargoList (CargoDataEntry *cargo, const Station *st)
void | SetDisplayedRow (const CargoDataEntry *data)
StringID | GetEntryString (StationID station, StringID here, StringID other_station, StringID any)
StringID | SearchNonStop (CargoDataEntry *cd, StationID station, int column)
int | DrawEntries (CargoDataEntry *entry, Rect &r, int pos, int maxrows, int column, CargoID cargo=CT_INVALID)
virtual void | OnInvalidateData (int data=0, bool gui_scope=true)
| Invalidate the cache for the given cargo.
int | DrawAcceptedCargo (const Rect &r) const
| Draw accepted cargo in the SVW_ACCEPTLIST widget.
int | DrawCargoRatings (const Rect &r) const
| Draw cargo ratings in the SVW_ACCEPTLIST widget.
template<class ID >
void | HandleCargoWaitingClick (CargoDataEntry *filter, ID next)
void | HandleCargoWaitingClick (int row)
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)
void | SelectSortBy (int index)
void | SelectGroupBy (int index)
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.
## 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]
SortOrder | sort_orders [NUM_COLUMNS]
int | scroll_to_row
int | grouping_index
Mode | current_mode
Grouping | groupings [NUM_COLUMNS]
CargoDataEntry | expanded_rows
CargoDataEntry | cached_destinations
CargoDataVector | displayed_rows
## Static Public Attributes
static const int | NUM_COLUMNS = 4
static const StringID | _sort_names []
static const StringID | _group_names []

## Detailed Description

The StationView window.

Definition at line 1082 of file station_gui.cpp.

## Member Enumeration Documentation

enum StationViewWindow::AcceptListHeight

Height of the SVW_ACCEPTLIST widget for different views.

Enumerator:

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

Definition at line 1120 of file station_gui.cpp.

## Member Function Documentation

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

Draw accepted cargo in the SVW_ACCEPTLIST widget.

Parameters:

  | r | Rectangle of the widget.

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

Definition at line 1552 of file station_gui.cpp.

References GoodsEntry::acceptance_pickup, CeilDiv(), DrawCargoListText(), GoodsEntry::GES_ACCEPTANCE, SpecializedStation< Station, false >::Get(), Station::goods, HasBit(), SetBit(), and WD_FRAMERECT_TOP.

Referenced by OnPaint().

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

Draw cargo ratings in the SVW_ACCEPTLIST widget.

Parameters:

  | r | Rectangle of the widget.

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

Definition at line 1570 of file station_gui.cpp.

References GoodsEntry::acceptance_pickup, CeilDiv(), DrawString(), GoodsEntry::GES_PICKUP, SpecializedStation< Station, false >::Get(), Station::goods, HasBit(), CargoSpec::Index(), CargoSpec::name, GoodsEntry::rating, SetDParam(), GoodsEntry::supply, ToPercent8(), WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.

Referenced by OnPaint().

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

References _ctrl_pressed, accepts_lines, CS_ALPHANUMERAL, Window::flags4, SpecializedStation< Station, false >::Get(), Scrollbar::GetPosition(), Scrollbar::GetScrolledRowFromWidget(), Window::LowerWidget(), MAX_LENGTH_STATION_NAME_CHARS, QSF_ENABLE_DEFAULT, QSF_LEN_IN_CHARS, rating_lines, Window::ReInit(), ScrollMainWindowToTile(), NWidgetCore::SetDataTip(), SetDParam(), ShowDropDownMenu(), ShowExtraViewPortWindow(), ShowQueryString(), ShowStationDepartures(), SVW_DEPARTURES, SVW_GROUP_BY, SVW_LOCATION, SVW_PLANES, SVW_RATINGS, SVW_RENAME, SVW_ROADVEHS, SVW_SHIPS, SVW_SORT_BY, SVW_SORT_ORDER, SVW_TRAINS, SVW_WAITING, and WD_FRAMERECT_TOP.

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

References SVW_SORT_BY.

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

Invalidate the cache for the given cargo.

Parameters:

  | cargo | ID of the cargo.
  | 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 1541 of file station_gui.cpp.

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

References _local_company, accepts_lines, NWidgetBase::current_x, NWidgetBase::current_y, DrawAcceptedCargo(), DrawCargoRatings(), Window::DrawSortButtonState(), Window::DrawWidgets(), FACIL_AIRPORT, FACIL_BUS_STOP, FACIL_DOCK, FACIL_TRAIN, FACIL_TRUCK_STOP, BaseStation::facilities, SpecializedStation< Station, false >::Get(), Scrollbar::GetCapacity(), CargoDataEntry::GetNumChildren(), Scrollbar::GetPosition(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Window::IsShaded(), BaseStation::owner, NWidgetBase::pos_x, NWidgetBase::pos_y, rating_lines, Window::ReInit(), SBS_DOWN, SBS_UP, Scrollbar::SetCount(), SetDParam(), Window::SetWidgetDisabledState(), SVW_ACCEPTS, SVW_PLANES, SVW_RENAME, SVW_ROADVEHS, SVW_SHIPS, SVW_SORT_ORDER, and SVW_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 1769 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 1776 of file station_gui.cpp.

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

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 1271 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, SetDParam(), and SVW_CAPTION.

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

References accepts_lines, expand_shrink_width, FONT_HEIGHT_NORMAL, GetStringBoundingBox(), max(), rating_lines, SVW_ACCEPTLIST, SVW_WAITING, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, 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
    }

Definition at line 1126 of file station_gui.cpp.

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
    }

Definition at line 1125 of file station_gui.cpp.

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

- src/station_gui.cpp