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 SetupWidgetData (VehicleType type)
 Function to set up vehicle specific widgets (mainly sprites and strings).
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 OnQueryTextFinished (char *str)
 The query window opened from this window has closed.
virtual bool OnRightClick (Point pt, int widget)
 A click with the right mouse button has been made on the window.
virtual void OnVehicleSelect (const Vehicle *v)
 Clones a vehicle.
virtual void OnPlaceObjectAbort ()
 The user cancelled a tile highlight mode that has been set.
virtual void OnMouseDrag (Point pt, int widget)
 An 'object' is being dragged at the provided position, highlight the target if possible.
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
VehicleID vehicle_over
 Rail vehicle over which another one is dragged, INVALID_VEHICLE if none.
VehicleType type
bool generate_list
VehicleList vehicle_list
VehicleList wagon_list
uint num_columns
 Number of columns.
Scrollbarhscroll
 Only for trains.
Scrollbarvscroll
uint count_width
uint header_width
uint flag_width
uint flag_height

Detailed Description

Definition at line 221 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 329 of file depot_gui.cpp.

References _current_text_dir, 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, and TD_RTL.

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

References _ctrl_pressed, ES_HANDLED, 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 638 of file depot_gui.cpp.

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

An 'object' is being dragged at the provided position, highlight the target if possible.

Parameters:
pt The point inside the window that the mouse hovers over.
widget The widget the mouse hovers over.

Reimplemented from Window.

Definition at line 853 of file depot_gui.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_VEHICLE, Vehicle::Last(), NWidgetBase::pos_x, NWidgetBase::pos_y, Vehicle::Previous(), Window::SetWidgetDirty(), VEH_TRAIN, and vehicle_over.

virtual void DepotWindow::OnPaint (  )  [inline, virtual]
virtual void DepotWindow::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 766 of file depot_gui.cpp.

References CMD_MSG, CMD_RENAME_DEPOT, DoCommandP(), GetDepotIndex(), and Window::window_number.

virtual void DepotWindow::OnResize (  )  [inline, virtual]
virtual bool 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.
Returns:
true if the click was actually handled, i.e. do not show a tooltip if tooltip-on-right-click is enabled.

Reimplemented from Window.

Definition at line 774 of file depot_gui.cpp.

References _ctrl_pressed, Vehicle::engine_type, GuiShowTooltips(), lastof, Vehicle::Next(), NUM_CARGO, NWidgetBase::pos_x, NWidgetBase::pos_y, SetDParam(), and VEH_TRAIN.

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

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

void DepotWindow::SetupWidgetData ( VehicleType  type  )  [inline]

Function to set up vehicle specific widgets (mainly sprites and strings).

Only use this function to if the widget is used for several vehicle types and each has different text/sprites. If the widget is only used for a single vehicle type, or the same text/sprites are used every time, use the nested widget array to initialize the widget.

Definition at line 533 of file depot_gui.cpp.

References SetDataTip(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

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 594 of file depot_gui.cpp.

References 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 Fri Feb 4 20:54:28 2011 for OpenTTD by  doxygen 1.6.1