BuildVehicleWindow Struct Reference

Inheritance diagram for BuildVehicleWindow:
Window ZeroedMemoryAllocator

Public Member Functions

 BuildVehicleWindow (const WindowDesc *desc, TileIndex tile, VehicleType type)
void SetCargoFilterArray ()
 Populate the filter list and set the cargo filter criteria.
void OnInit ()
 Notification that the nested widget tree gets initialized.
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=0, bool gui_scope=true)
 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
   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).
Scrollbarvscroll

Detailed Description

Definition at line 874 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 1282 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, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.

void BuildVehicleWindow::OnClick ( Point  pt,
int  widget,
int  click_count 
) [inline, virtual]
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 1327 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().

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

Notification that the nested widget tree gets initialized.

The event can be used to perform general computations.

Note:
nested_root and/or nested_array (normally accessed via GetWidget()) may not exist during this call.

Reimplemented from Window.

Definition at line 991 of file build_vehicle_gui.cpp.

References SetCargoFilterArray().

virtual void BuildVehicleWindow::OnInvalidateData ( int  data = 0,
bool  gui_scope = true 
) [inline, virtual]

Some data on this window has become invalid.

Parameters:
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 1226 of file build_vehicle_gui.cpp.

References _settings_game, GUIList< T, F >::ForceRebuild(), VehicleSettings::roadveh_acceleration_model, VEH_ROAD, and GameSettings::vehicle.

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 1320 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 1351 of file build_vehicle_gui.cpp.

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

void BuildVehicleWindow::SetCargoFilterArray (  )  [inline]
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 1239 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 1260 of file build_vehicle_gui.cpp.

References details_height, GetEngineListHeight(), GetStringBoundingBox(), maxdim(), and WD_SORTBUTTON_ARROW_WIDTH.


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

Generated on Wed Apr 13 00:48:29 2011 for OpenTTD by  doxygen 1.6.1