Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes

CompanyStationsWindow Class Reference

The list of stations per company. More...

Inheritance diagram for CompanyStationsWindow:
Window ZeroedMemoryAllocator

Public Member Functions

 CompanyStationsWindow (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.
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 OnDropdownSelect (int widget, int index)
 A dropdown option associated to this window has been selected.
virtual void OnTick ()
 Called once per (game) tick.
virtual void OnTimeout ()
 Called when this window's timeout has been reached.
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.

Protected Member Functions

void BuildStationsList (const Owner owner)
 (Re)Build station list
void SortStationsList ()
 Sort the stations list.

Static Protected Member Functions

static int CDECL StationNameSorter (const Station *const *a, const Station *const *b)
 Sort stations by their name.
static int CDECL StationTypeSorter (const Station *const *a, const Station *const *b)
 Sort stations by their type.
static int CDECL StationWaitingSorter (const Station *const *a, const Station *const *b)
 Sort stations by their waiting cargo.
static int CDECL StationRatingMaxSorter (const Station *const *a, const Station *const *b)
 Sort stations by their rating.
static int CDECL StationRatingMinSorter (const Station *const *a, const Station *const *b)
 Sort stations by their rating.

Protected Attributes

GUIStationList stations
Scrollbarvscroll

Static Protected Attributes

static Listing last_sorting = {false, 0}
static byte facilities = FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK
static bool include_empty = true
static const uint32 cargo_filter_max = UINT32_MAX
static uint32 cargo_filter = UINT32_MAX
static const Stationlast_station = NULL
static const StringID sorter_names []
static
GUIStationList::SortFunction
*const 
sorter_funcs []

Detailed Description

The list of stations per company.

Definition at line 145 of file station_gui.cpp.


Member Function Documentation

virtual void CompanyStationsWindow::DrawWidget ( const Rect r,
int  widget 
) const [inline, virtual]
virtual void CompanyStationsWindow::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 477 of file station_gui.cpp.

References _cargo_mask, _ctrl_pressed, FACIL_AIRPORT, FACIL_BUS_STOP, FACIL_TRAIN, FACIL_TRUCK_STOP, FONT_HEIGHT_NORMAL, FOR_EACH_SET_BIT, CargoSpec::Get(), CargoSpec::Index(), CargoSpec::IsValid(), BaseStation::owner, OWNER_NONE, ScrollMainWindowToTile(), SetBit(), ShowDropDownMenu(), ShowExtraViewPortWindow(), ToggleBit(), WID_STL_AIRPLANE, WID_STL_BUS, WID_STL_CARGOALL, WID_STL_CARGOSTART, WID_STL_FACILALL, WID_STL_LIST, WID_STL_NOCARGOWAITING, WID_STL_SHIP, WID_STL_SORTBY, WID_STL_SORTDROPBTN, WID_STL_TRAIN, WID_STL_TRUCK, and BaseStation::xy.

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

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

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

virtual void CompanyStationsWindow::OnResize (  )  [inline, virtual]

Called after the window got resized.

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

Reimplemented from Window.

Definition at line 626 of file station_gui.cpp.

References WD_FRAMERECT_BOTTOM, WD_FRAMERECT_TOP, and WID_STL_LIST.

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

References SetDParam(), and WID_STL_CAPTION.

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

References CargoSpec::abbrev, CargoSpec::Get(), GetStringBoundingBox(), INVALID_STRING_ID, CargoSpec::IsValid(), maxdim(), WD_FRAMERECT_TOP, WD_SORTBUTTON_ARROW_WIDTH, WID_STL_AIRPLANE, WID_STL_BUS, WID_STL_CARGOALL, WID_STL_CARGOSTART, WID_STL_FACILALL, WID_STL_LIST, WID_STL_NOCARGOWAITING, WID_STL_SHIP, WID_STL_SORTBY, WID_STL_SORTDROPBTN, WID_STL_TRAIN, and WID_STL_TRUCK.


Field Documentation

GUIStationList::SortFunction *const CompanyStationsWindow::sorter_funcs [static, protected]
Initial value:
 {
  &StationNameSorter,
  &StationTypeSorter,
  &StationWaitingSorter,
  &StationRatingMaxSorter,
  &StationRatingMinSorter
}

Definition at line 158 of file station_gui.cpp.

const StringID CompanyStationsWindow::sorter_names [static, protected]
Initial value:
 {
  STR_SORT_BY_NAME,
  STR_SORT_BY_FACILITY,
  STR_SORT_BY_WAITING,
  STR_SORT_BY_RATING_MAX,
  STR_SORT_BY_RATING_MIN,
  INVALID_STRING_ID
}

Definition at line 157 of file station_gui.cpp.


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