BuildVehicleWindow Struct Reference

Inheritance diagram for BuildVehicleWindow:
Window ZeroedMemoryAllocator

Public Member Functions

 BuildVehicleWindow (const WindowDesc *desc, TileIndex tile, VehicleType type)
void FilterEngineList ()
 Filter the engine list against the currently selected cargo filter.
bool FilterSingleEngine (EngineID eid)
 Filter a single engine.
void GenerateBuildTrainList ()
void GenerateBuildRoadVehList ()
void GenerateBuildShipList ()
void GenerateBuildAircraftList ()
void GenerateBuildList ()
void OnClick (Point pt, int widget, int click_count)
 A click with the left mouse button has been made on the window.
virtual void OnInvalidateData (int data)
 Some data on this window has become invalid.
virtual void SetStringParameters (int widget) const
 Initialize string parameters for a widget.
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 DrawWidget (const Rect &r, int widget) const
 Draw the contents of a nested widget.
virtual void OnPaint ()
 The window must be repainted.
virtual void OnQueryTextFinished (char *str)
 The query window opened from this window has closed.
virtual void OnDropdownSelect (int widget, int index)
 A dropdown option associated to this window has been selected.
virtual void OnResize ()
 Called after the window got resized.

Data Fields

VehicleType vehicle_type
union {
   RailTypeByte   railtype
   AirportFTAClass::Flags   flags
   RoadTypes   roadtypes
filter
bool descending_sort_order
byte sort_criteria
bool listview_mode
EngineID sel_engine
EngineID rename_engine
GUIEngineList eng_list
CargoID cargo_filter [NUM_CARGO+2]
 Available cargo filters; CargoID or CF_ANY or CF_NONE.
StringID cargo_filter_texts [NUM_CARGO+3]
 Texts for filter_cargo, terminated by INVALID_STRING_ID.
byte cargo_filter_criteria
 Selected cargo filter.
int details_height
 Minimal needed height of the details panels (found so far).

Detailed Description

Definition at line 736 of file build_vehicle_gui.cpp.


Member Function Documentation

virtual void BuildVehicleWindow::DrawWidget ( const Rect r,
int  widget 
) const [inline, virtual]

Draw the contents of a nested widget.

Parameters:
r Rectangle occupied by the widget.
widget Number of the widget to draw.
Note:
This method may not change any state, it may only use drawing functions.

Reimplemented from Window.

Definition at line 1093 of file build_vehicle_gui.cpp.

References DEFAULT_GROUP, DrawEngineList(), Window::DrawSortButtonState(), Scrollbar::GetCapacity(), Scrollbar::GetPosition(), SmallVector< T, S >::Length(), min(), SBS_DOWN, SBS_UP, Window::vscroll, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.

void BuildVehicleWindow::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 1005 of file build_vehicle_gui.cpp.

References cargo_filter_criteria, cargo_filter_texts, CcBuildPrimaryVehicle(), CS_ALPHANUMERAL, DoCommandP(), GUIList< T, F >::ForceRebuild(), Scrollbar::GetPosition(), SmallVector< T, S >::Length(), MAX_LENGTH_ENGINE_NAME_BYTES, MAX_LENGTH_ENGINE_NAME_PIXELS, QSF_ENABLE_DEFAULT, RAILVEH_WAGON, Window::resize, Window::SetDirty(), SetDParam(), ShowDropDownMenu(), ShowQueryString(), ResizeInfo::step_height, VEH_TRAIN, Window::vscroll, and Window::window_number.

virtual void BuildVehicleWindow::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 1140 of file build_vehicle_gui.cpp.

References cargo_filter, cargo_filter_criteria, CF_ANY, GUIList< T, F >::ForceRebuild(), Window::SetDirty(), and GUIList< T, F >::SetFilterState().

virtual void BuildVehicleWindow::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 1053 of file build_vehicle_gui.cpp.

References GUIList< T, F >::ForceRebuild().

virtual void BuildVehicleWindow::OnPaint (  )  [inline, virtual]
virtual void BuildVehicleWindow::OnQueryTextFinished ( char *  str  )  [inline, virtual]

The query window opened from this window has closed.

Parameters:
str the new value of the string, NULL if the window was cancelled or an empty string when the default button was pressed, i.e. StrEmpty(str).

Reimplemented from Window.

Definition at line 1133 of file build_vehicle_gui.cpp.

References CMD_MSG, CMD_RENAME_ENGINE, and DoCommandP().

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

Called after the window got resized.

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

Reimplemented from Window.

Definition at line 1164 of file build_vehicle_gui.cpp.

References Scrollbar::GetCapacity(), MAT_COL_START, MAT_ROW_START, Scrollbar::SetCapacityFromWidget(), and Window::vscroll.

virtual void BuildVehicleWindow::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 1058 of file build_vehicle_gui.cpp.

References cargo_filter_criteria, cargo_filter_texts, GetRailTypeInfo(), SetDParam(), and VEH_TRAIN.

virtual void BuildVehicleWindow::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 1079 of file build_vehicle_gui.cpp.

References details_height, and GetEngineListHeight().


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

Generated on Wed Apr 21 20:32:22 2010 for OpenTTD by  doxygen 1.6.1