Sorted list of demand destinations for displaying. More...
#include <cargodest_gui.h>
Public Member Functions | |
CargoDestinationList (const CargoSourceSink *o) | |
void | InvalidateData () |
Rebuild the list, e.g. | |
void | Resort () |
Resort the list, e.g. | |
uint | GetListHeight () const |
Get the height needed to display the destination list. | |
uint | DrawList (uint left, uint right, uint y) const |
Draw the destination list. | |
void | OnClick (uint y) const |
Handle click event onto the destination list. | |
Private Member Functions | |
void | RebuildList () |
Rebuild the link list from the source object. | |
void | SortList () |
Sort the link list. | |
Private Attributes | |
const CargoSourceSink * | obj |
The object which destinations are displayed. | |
GUIList< GUICargoLink > | link_list |
Sorted list of destinations. |
Sorted list of demand destinations for displaying.
Definition at line 27 of file cargodest_gui.h.
uint CargoDestinationList::DrawList | ( | uint | left, | |
uint | right, | |||
uint | y | |||
) | const |
Draw the destination list.
left | The left most position to draw on. | |
right | The right most position to draw on. | |
y | The top position to start drawing. |
y
value below the drawn text. Definition at line 127 of file cargodest_gui.cpp.
References SmallVector< T, S >::Begin(), DrawString(), SmallVector< T, S >::End(), FONT_HEIGHT_NORMAL, SmallVector< T, S >::Length(), link_list, obj, SetDParam(), ST_TOWN, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_PAR_VSEP_WIDE.
Referenced by IndustryViewWindow::DrawInfo(), and TownViewWindow::DrawWidget().
uint CargoDestinationList::GetListHeight | ( | ) | const |
Get the height needed to display the destination list.
obj | Object to display the destinations of. |
Definition at line 114 of file cargodest_gui.cpp.
References FONT_HEIGHT_NORMAL, SmallVector< T, S >::Length(), link_list, and WD_PAR_VSEP_WIDE.
Referenced by TownViewWindow::GetDesiredInfoHeight().
void CargoDestinationList::InvalidateData | ( | ) |
Rebuild the list, e.g.
when a new cargo link was added.
Definition at line 95 of file cargodest_gui.cpp.
References GUIList< T, F >::ForceRebuild(), link_list, RebuildList(), and SortList().
Referenced by TownViewWindow::OnInvalidateData(), and IndustryViewWindow::OnInvalidateData().
void CargoDestinationList::OnClick | ( | uint | y | ) | const |
Handle click event onto the destination list.
y | Position of the click in relative to the top of the destination list. |
Definition at line 157 of file cargodest_gui.cpp.
References _ctrl_pressed, CargoLink::dest, FONT_HEIGHT_NORMAL, CargoSourceSink::GetType(), SmallVector< T, S >::Length(), link_list, ScrollMainWindowToTile(), ShowExtraViewPortWindow(), ST_TOWN, and WD_PAR_VSEP_WIDE.
Referenced by TownViewWindow::OnClick(), and IndustryViewWindow::OnClick().
void CargoDestinationList::RebuildList | ( | ) | [private] |
Rebuild the link list from the source object.
Definition at line 72 of file cargodest_gui.cpp.
References SmallVector< T, S >::Append(), SmallVector< T, S >::Begin(), CargoSourceSink::cargo_links, SmallVector< T, S >::Clear(), SmallVector< T, S >::Compact(), SmallVector< T, S >::End(), lengthof, link_list, GUIList< T, F >::NeedRebuild(), obj, and GUIList< T, F >::RebuildDone().
Referenced by InvalidateData().
void CargoDestinationList::Resort | ( | ) |
Resort the list, e.g.
when a town is renamed.
Definition at line 103 of file cargodest_gui.cpp.
References GUIList< T, F >::ForceResort(), link_list, and SortList().
Referenced by TownViewWindow::OnInvalidateData(), and IndustryViewWindow::OnInvalidateData().
void CargoDestinationList::SortList | ( | ) | [private] |
Sort the link list.
Definition at line 88 of file cargodest_gui.cpp.
References link_list, obj, and GUIList< T, F >::Sort().
Referenced by InvalidateData(), and Resort().