StationViewWindow Struct Reference

The StationView window. More...

Inheritance diagram for StationViewWindow:

Window ZeroedMemoryAllocator

Public Types

enum  AcceptListHeight { ALH_RATING = 13, ALH_ACCEPTS = 3 }
 Height of the SVW_ACCEPTLIST 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 DrawWidget (const Rect &r, int widget) const
 Draw the contents of a nested widget.
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.
void DrawAcceptedCargo (const Rect &r) const
 Draw accepted cargo in the SVW_ACCEPTLIST widget.
void DrawCargoRatings (const Rect &r) const
 Draw cargo ratings in the SVW_ACCEPTLIST widget.
void HandleCargoWaitingClick (int row)
virtual void OnClick (Point pt, int widget)
 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.

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'.

Detailed Description

The StationView window.

Definition at line 796 of file station_gui.cpp.


Member Enumeration Documentation

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


Member Function Documentation

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

References ALH_ACCEPTS, ALH_RATING, expand_shrink_width, FONT_HEIGHT_NORMAL, GetStringBoundingBox(), Dimension::height, max(), SVW_ACCEPTLIST, SVW_ACCEPTS, SVW_WAITING, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, and Window::width.

virtual void StationViewWindow::OnPaint (  )  [inline, virtual]

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

References DrawAcceptedCargo(), DrawCargoRatings(), SVW_ACCEPTLIST, and SVW_ACCEPTS.

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

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

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

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

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

References _dynlang, cargo, DrawCargoIcons(), DrawString(), expand_shrink_width, FONT_HEIGHT_NORMAL, SpecializedStation< Station, false >::Get(), Scrollbar::GetCapacity(), Scrollbar::GetPosition(), Station::goods, HasBit(), Rect::left, Rect::right, SA_RIGHT, SetDParam(), TD_RTL, DynamicLanguages::text_dir, Rect::top, Window::vscroll, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.

Referenced by OnPaint().

void StationViewWindow::DrawAcceptedCargo ( const Rect r  )  const [inline]

void StationViewWindow::DrawCargoRatings ( const Rect r  )  const [inline]

virtual void StationViewWindow::OnClick ( Point  pt,
int  widget 
) [inline, virtual]

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 or NULL if the window was cancelled.

Reimplemented from Window.

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

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


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

Generated on Wed Dec 30 20:40:43 2009 for OpenTTD by  doxygen 1.5.6