DepotWindow Struct Reference

Inheritance diagram for DepotWindow:
Window ZeroedMemoryAllocator

Data Structures

struct  GetDepotVehiclePtData

Public Types

enum  DepotGUIAction { MODE_ERROR, MODE_DRAG_VEHICLE, MODE_SHOW_VEHICLE, MODE_START_STOP }

Public Member Functions

 DepotWindow (const WindowDesc *desc, TileIndex tile, VehicleType type)
void DrawVehicleInDepot (const Vehicle *v, int left, int right, int y) const
 Draw a vehicle in the depot window in the box with the top left corner at x,y.
void DrawWidget (const Rect &r, int widget) const
 Draw the contents of a nested widget.
void SetStringParameters (int widget) const
 Initialize string parameters for a widget.
DepotGUIAction GetVehicleFromDepotWndPt (int x, int y, const Vehicle **veh, GetDepotVehiclePtData *d) const
void DepotClick (int x, int y)
 Handle click in the depot matrix.
void HandleCloneVehClick (const Vehicle *v)
 Clones a vehicle.
void SetupWidgetData (VehicleType type)
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 OnInvalidateData (int data)
 Some data on this window has become invalid.
virtual void OnPaint ()
 The window must be repainted.
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 OnRightClick (Point pt, int widget)
 A click with the right mouse button has been made on the window.
virtual void OnPlaceObject (Point pt, TileIndex tile)
 The user clicked some place on the map when a tile highlight mode has been set.
virtual void OnPlaceObjectAbort ()
 The user cancelled a tile highlight mode that has been set.
virtual void OnMouseLoop ()
 Called for every mouse loop run, which is at least once per (game) tick.
virtual void OnDragDrop (Point pt, int widget)
 A dragged 'object' has been released.
virtual void OnTimeout ()
 Called when this window's timeout has been reached.
virtual void OnResize ()
 Called after the window got resized.
virtual EventState OnCTRLStateChange ()
 The state of the control key has changed.

Data Fields

VehicleID sel
VehicleType type
bool generate_list
VehicleList vehicle_list
VehicleList wagon_list
uint count_width
uint header_width
uint flag_width
uint flag_height

Detailed Description

Definition at line 209 of file depot_gui.cpp.


Member Function Documentation

void DepotWindow::DepotClick ( int  x,
int  y 
) [inline]
void DepotWindow::DrawVehicleInDepot ( const Vehicle v,
int  left,
int  right,
int  y 
) const [inline]
void DepotWindow::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 301 of file depot_gui.cpp.

References _dynlang, DrawVehicleInDepot(), GB(), Scrollbar::GetPosition(), SmallVector< T, S >::Length(), MAT_COL_BITS, MAT_COL_START, MAT_ROW_BITS, MAT_ROW_START, min(), Window::resize, ResizeInfo::step_height, ResizeInfo::step_width, TD_RTL, DynamicLanguages::text_dir, and Window::vscroll.

void DepotWindow::HandleCloneVehClick ( const Vehicle v  )  [inline]
virtual void DepotWindow::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 714 of file depot_gui.cpp.

References _ctrl_pressed, CMD_DEPOT_MASS_AUTOREPLACE, CMD_MASS_START_STOP, DepotClick(), DoCommandP(), GetStationIndex(), GetTileOwner(), HT_RECT, Window::IsWidgetLowered(), SmallVector< T, S >::Length(), NWidgetBase::pos_x, NWidgetBase::pos_y, SetDParam(), Window::SetWidgetDirty(), ShowQuery(), Window::ToggleWidgetLoweredState(), VEH_AIRCRAFT, and Window::window_number.

virtual EventState DepotWindow::OnCTRLStateChange (  )  [inline, virtual]

The state of the control key has changed.

Returns:
ES_HANDLED if the change has been handled and no other window should receive the event.

Reimplemented from Window.

Definition at line 956 of file depot_gui.cpp.

References _ctrl_pressed, Window::ES_HANDLED, Window::ES_NOT_HANDLED, INVALID_VEHICLE, Window::SetWidgetDirty(), and CursorVars::vehchain.

virtual void DepotWindow::OnDragDrop ( Point  pt,
int  widget 
) [inline, virtual]
virtual void DepotWindow::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 666 of file depot_gui.cpp.

virtual void DepotWindow::OnPaint (  )  [inline, virtual]
virtual void DepotWindow::OnPlaceObject ( Point  pt,
TileIndex  tile 
) [inline, virtual]

The user clicked some place on the map when a tile highlight mode has been set.

Parameters:
pt the exact point on the map that has been clicked.
tile the tile on the map that has been clicked.

Reimplemented from Window.

Definition at line 843 of file depot_gui.cpp.

References HandleCloneVehClick().

virtual void DepotWindow::OnResize (  )  [inline, virtual]
virtual void DepotWindow::OnRightClick ( Point  pt,
int  widget 
) [inline, virtual]

A click with the right mouse button has been made on the window.

Parameters:
pt the point inside the window that has been clicked.
widget the clicked widget.

Reimplemented from Window.

Definition at line 785 of file depot_gui.cpp.

References _ctrl_pressed, SpecializedVehicle< Train, VEH_TRAIN >::From(), GuiShowTooltips(), Train::HasArticulatedPart(), lastof, Vehicle::Next(), NUM_CARGO, NWidgetBase::pos_x, NWidgetBase::pos_y, SetDParam(), and VEH_TRAIN.

void DepotWindow::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 337 of file depot_gui.cpp.

References GetStationIndex(), SetDParam(), VEH_AIRCRAFT, and Window::window_number.

virtual void DepotWindow::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 614 of file depot_gui.cpp.

References DEPOT_WIDGET_H_SCROLL, FONT_HEIGHT_NORMAL, GetDigitWidth(), GetStringBoundingBox(), Window::height, Sprite::height, max(), SetDParam(), ST_NORMAL, VEH_ROAD, VEH_TRAIN, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_MATRIX_BOTTOM, WD_MATRIX_TOP, WD_PAR_VSEP_NORMAL, and Sprite::width.


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

Generated on Sat Apr 17 23:25:26 2010 for OpenTTD by  doxygen 1.6.1