Public Types | Public Member Functions | Data Fields

# StationViewWindow Struct Reference

The StationView window. More...

Inheritance diagram for StationViewWindow:

## Public Types
enum | AcceptListHeight { ALH_RATING = 13, ALH_ACCEPTS = 3 }
| Height of the WID_SV_ACCEPT_RATING_LIST widget for different views. More...
## Public Member Functions
| StationViewWindow (const WindowDesc *desc, WindowNumber window_number)
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 | OrderWaitingCargo (CargoDataList *cargolist, uint32 *transfers)
| Order waiting cargo by type and destination.
void | DrawWaitingCargo (const Rect &r, const CargoDataList &cargolist, uint32 transfers) const
| Draw waiting cargo.
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.
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.
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
uint32 | cargo
| Bitmask of cargo types to expand.
uint16 | cargo_rows [NUM_CARGO]
| Header row for each cargo type.
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

## Detailed Description

The StationView window.

Definition at line 804 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 813 of file station_gui.cpp.

## Member Function Documentation

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

References GoodsEntry::acceptance_pickup, CeilDiv(), DrawStringMultiLine(), FONT_HEIGHT_NORMAL, GoodsEntry::GES_ACCEPTANCE, SpecializedStation< Station, false >::Get(), Station::goods, HasBit(), SetBit(), SetDParam(), 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 1057 of file station_gui.cpp.

References GoodsEntry::acceptance_pickup, CeilDiv(), DrawString(), DrawStringMultiLine(), Town::exclusive_counter, Town::exclusivity, FONT_HEIGHT_NORMAL, FOR_ALL_SORTED_STANDARD_CARGOSPECS, GoodsEntry::GES_PICKUP, SpecializedStation< Station, false >::Get(), Station::goods, HasBit(), CargoSpec::Index(), CargoSpec::name, BaseStation::owner, GoodsEntry::rating, SetDParam(), ToPercent8(), BaseStation::town, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.

Referenced by OnPaint().

void StationViewWindow::DrawWaitingCargo | ( | const Rect & | r,
|  | const CargoDataList & | cargolist,
|  | uint32 | transfers |
| ) |  |  | const`[inline]`

Draw waiting cargo.

Parameters:

  | r | Rectangle of the widget.
  | cargolist | Cargo, ordered by type and destination.
  | transfers | Bitmask for cargoes that are transfered.

Definition at line 982 of file station_gui.cpp.

References _current_text_dir, cargo, GoodsEntry::cargo, DrawCargoIcons(), DrawString(), CargoList< Tinst >::Empty(), expand_shrink_width, SpecializedStation< Station, false >::Get(), Scrollbar::GetCapacity(), Scrollbar::GetPosition(), Station::goods, HasBit(), SA_RIGHT, SetDParam(), WD_FRAMERECT_LEFT, and WD_FRAMERECT_RIGHT.

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

References _ctrl_pressed, accepts_lines, CMD_OPEN_CLOSE_AIRPORT, CS_ALPHANUMERAL, DoCommandP(), FONT_HEIGHT_NORMAL, SpecializedStation< Station, false >::Get(), Scrollbar::GetScrolledRowFromWidget(), MAX_LENGTH_STATION_NAME_CHARS, BaseStation::owner, QSF_ENABLE_DEFAULT, QSF_LEN_IN_CHARS, rating_lines, Window::ReInit(), ScrollMainWindowToTile(), NWidgetCore::SetDataTip(), SetDParam(), ShowExtraViewPortWindow(), ShowQueryString(), WD_FRAMERECT_TOP, WID_SV_ACCEPTS_RATINGS, WID_SV_CLOSE_AIRPORT, WID_SV_LOCATION, WID_SV_PLANES, WID_SV_RENAME, WID_SV_ROADVEHS, WID_SV_SHIPS, WID_SV_TRAINS, and WID_SV_WAITING.

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

References Window::ReInit().

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

References _local_company, accepts_lines, Station::airport, AIRPORT_CLOSED_block, NWidgetBase::current_x, NWidgetBase::current_y, DrawAcceptedCargo(), DrawCargoRatings(), DrawWaitingCargo(), Window::DrawWidgets(), FACIL_AIRPORT, FACIL_BUS_STOP, FACIL_DOCK, FACIL_TRAIN, FACIL_TRUCK_STOP, BaseStation::facilities, Airport::flags, SpecializedStation< Station, false >::Get(), Window::IsShaded(), OrderWaitingCargo(), BaseStation::owner, OWNER_NONE, NWidgetBase::pos_x, NWidgetBase::pos_y, rating_lines, Window::ReInit(), Scrollbar::SetCount(), Window::SetWidgetDisabledState(), Window::SetWidgetLoweredState(), WID_SV_ACCEPTS_RATINGS, WID_SV_CLOSE_AIRPORT, WID_SV_PLANES, WID_SV_RENAME, WID_SV_ROADVEHS, WID_SV_SHIPS, 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 1149 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 1156 of file station_gui.cpp.

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

void StationViewWindow::OrderWaitingCargo | ( | CargoDataList * | cargolist,
|  | uint32 * | transfers |
| ) |  |  | `[inline]`

Order waiting cargo by type and destination.

Parameters:

  | cargolist | [out] Ordered cargo.
  | transfers | [out] Bitmask for cargoes being transfered.

Precondition:
  `*cargolist` must be empty.

Definition at line 927 of file station_gui.cpp.

References cargo, GoodsEntry::cargo, cargo_rows, CargoPacket::Count(), CargoList< Tinst >::Count(), CargoList< Tinst >::Empty(), SpecializedStation< Station, false >::Get(), Station::goods, HasBit(), CargoList< Tinst >::Packets(), SetBit(), and CargoPacket::SourceStation().

Referenced by OnPaint().

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 912 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 WID_SV_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 841 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.

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

- src/station_gui.cpp