CargoDestinationList Class Reference

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 CargoSourceSinkobj
 The object which destinations are displayed.
GUIList< GUICargoLinklink_list
 Sorted list of destinations.

Detailed Description

Sorted list of demand destinations for displaying.

Definition at line 27 of file cargodest_gui.h.


Member Function Documentation

uint CargoDestinationList::DrawList ( uint  left,
uint  right,
uint  y 
) const

Draw the destination list.

Parameters:
left The left most position to draw on.
right The right most position to draw on.
y The top position to start drawing.
Returns:
New 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.

Parameters:
obj Object to display the destinations of.
Returns:
Height needed for display.

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.

Parameters:
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]
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().


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

Generated on Fri Jun 3 05:19:45 2011 for OpenTTD by  doxygen 1.6.1