The list of stations per company. More...
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 | 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 |
Scrollbar * | vscroll |
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 Station * | last_station = NULL |
static const StringID | sorter_names [] |
static GUIStationList::SortFunction *const | sorter_funcs [] |
The list of stations per company.
Definition at line 148 of file station_gui.cpp.
void CompanyStationsWindow::BuildStationsList | ( | const Owner | owner | ) | [inline, protected] |
(Re)Build station list
owner | company whose stations are to be in list |
Definition at line 171 of file station_gui.cpp.
References SmallVector< T, S >::Append(), SmallVector< T, S >::Clear(), SmallVector< T, S >::Compact(), DEBUG, BaseStation::facilities, Station::goods, HasBit(), GoodsEntry::HasRating(), HasStationInUse(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, SmallVector< T, S >::Length(), GUIList< T, F >::NeedRebuild(), BaseStation::owner, OWNER_NONE, GUIList< T, F >::RebuildDone(), and Scrollbar::SetCount().
virtual void CompanyStationsWindow::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [inline, virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
Reimplemented from Window.
Definition at line 386 of file station_gui.cpp.
References _current_text_dir, _sorted_cargo_specs, _sorted_standard_cargo_specs_size, CargoSpec::abbrev, GoodsEntry::cargo, DrawString(), BaseStation::facilities, GetContrastColour(), GfxFillRect(), Station::goods, HasBit(), CargoSpec::Index(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_TILE, max(), min(), BaseStation::owner, OWNER_NONE, GoodsEntry::rating, SA_HOR_CENTER, SBS_DOWN, SetDParam(), StationsWndShowStationRating(), StationCargoList::TotalCount(), WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WID_STL_CARGOALL, WID_STL_CARGOSTART, WID_STL_FACILALL, WID_STL_LIST, WID_STL_NOCARGOWAITING, WID_STL_SORTBY, and BaseStation::xy.
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.
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 478 of file station_gui.cpp.
References _cargo_mask, _ctrl_pressed, _sorted_cargo_specs, _sorted_standard_cargo_specs_size, FACIL_AIRPORT, FACIL_BUS_STOP, FACIL_TRAIN, FACIL_TRUCK_STOP, FONT_HEIGHT_NORMAL, FOR_EACH_SET_BIT, CargoSpec::Index(), 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.
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 594 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.
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 625 of file station_gui.cpp.
virtual void CompanyStationsWindow::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented from Window.
Definition at line 378 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 615 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.
widget | Widget number. |
Reimplemented from Window.
Definition at line 470 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.
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 322 of file station_gui.cpp.
References _sorted_cargo_specs, GetStringBoundingBox(), INVALID_STRING_ID, 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.
GUIStationList::SortFunction *const CompanyStationsWindow::sorter_funcs [static, protected] |
{ &StationNameSorter, &StationTypeSorter, &StationWaitingSorter, &StationRatingMaxSorter, &StationRatingMinSorter }
Definition at line 161 of file station_gui.cpp.
const StringID CompanyStationsWindow::sorter_names [static, protected] |
{ 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 160 of file station_gui.cpp.