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 OnPaint ()
 This window is currently being repainted.
virtual void OnClick (Point pt, int widget)
 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 (Point new_size, Point delta)
 Called when the window got resized.
virtual void OnInvalidateData (int data)
 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.

Protected Attributes

GUIStationList stations

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 []

Private Types

enum  StationListWidgets {
  SLW_CLOSEBOX = 0, SLW_CAPTION, SLW_STICKY, SLW_LIST,
  SLW_SCROLLBAR, SLW_RESIZE, SLW_TRAIN, SLW_TRUCK,
  SLW_BUS, SLW_AIRPLANE, SLW_SHIP, SLW_FACILALL,
  SLW_PAN_BETWEEN, SLW_NOCARGOWAITING, SLW_CARGOALL, SLW_PAN_RIGHT,
  SLW_SORTBY, SLW_SORTDROPBTN, SLW_PAN_SORT_RIGHT, SLW_CARGOSTART
}
 Enum for CompanyStations, referring to _company_stations_widgets. More...

Detailed Description

The list of stations per company.

Definition at line 84 of file station_gui.cpp.


Member Enumeration Documentation

Enum for CompanyStations, referring to _company_stations_widgets.

Enumerator:
SLW_CLOSEBOX  Close window button.
SLW_CAPTION  Window caption.
SLW_STICKY  Sticky button.
SLW_LIST  The main panel, list of stations.
SLW_SCROLLBAR  Scrollbar next to the main panel.
SLW_RESIZE  Resize button.
SLW_TRAIN  'TRAIN' button - list only facilities where is a railroad station
SLW_TRUCK  'TRUCK' button - list only facilities where is a truck stop
SLW_BUS  'BUS' button - list only facilities where is a bus stop
SLW_AIRPLANE  'AIRPLANE' button - list only facilities where is an airport
SLW_SHIP  'SHIP' button - list only facilities where is a dock
SLW_FACILALL  'ALL' button - list all facilities
SLW_PAN_BETWEEN  Small panel between list of types of ficilities and list of cargo types.
SLW_NOCARGOWAITING  'NO' button - list stations where no cargo is waiting
SLW_CARGOALL  'ALL' button - list all stations
SLW_PAN_RIGHT  Panel right of list of cargo types.
SLW_SORTBY  'Sort by' button - reverse sort direction
SLW_SORTDROPBTN  Dropdown button.
SLW_PAN_SORT_RIGHT  Panel right of sorting options.
SLW_CARGOSTART  Widget numbers used for list of cargo types (not present in _company_stations_widgets).

Definition at line 87 of file station_gui.cpp.


Member Function Documentation

void CompanyStationsWindow::BuildStationsList ( const Owner  owner  )  [inline, protected]

(Re)Build station list

Parameters:
owner company whose stations are to be in list

Definition at line 135 of file station_gui.cpp.

References Station::facilities, Station::goods, HasBit(), HasStationInUse(), PoolItem< T, Tid, Tpool >::index, Station::IsBuoy(), Station::owner, and OWNER_NONE.

Referenced by OnPaint().

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

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

References Window::SetDirty(), and SLW_SORTDROPBTN.

virtual void CompanyStationsWindow::OnResize ( Point  new_size,
Point  delta 
) [inline, virtual]

Called when the window got resized.

Parameters:
new_size the new size of the window.
delta the amount of which the window size changed.

Reimplemented from Window.

Definition at line 549 of file station_gui.cpp.

References Scrollbar::cap, Window::vscroll, and Point::y.

virtual void CompanyStationsWindow::OnInvalidateData ( int  data  )  [inline, virtual]

Some data on this window has become invalid.

Parameters:
data information about the changed data.

Reimplemented from Window.

Definition at line 554 of file station_gui.cpp.


Field Documentation

const StringID CompanyStationsWindow::sorter_names [static, protected]

Initial value:

 {
  STR_SORT_BY_DROPDOWN_NAME,
  STR_SORT_BY_FACILITY,
  STR_SORT_BY_WAITING,
  STR_SORT_BY_RATING_MAX,
  INVALID_STRING_ID
}

Definition at line 124 of file station_gui.cpp.

GUIStationList::SortFunction *const CompanyStationsWindow::sorter_funcs [static, protected]


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

Generated on Mon Jun 8 23:04:26 2009 for OpenTTD by  doxygen 1.5.6