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 |
Definition at line 209 of file depot_gui.cpp.
void DepotWindow::DepotClick | ( | int | x, | |
int | y | |||
) | [inline] |
Handle click in the depot matrix.
x | Horizontal position in the matrix widget in pixels. | |
y | Vertical position in the matrix widget in pixels. |
Definition at line 459 of file depot_gui.cpp.
References _ctrl_pressed, RoadVehicleCache::cached_veh_length, TrainCache::cached_veh_length, CMD_MSG, CMD_START_STOP_VEHICLE, DIR_W, DoCommandP(), SpecializedVehicle< RoadVehicle, VEH_ROAD >::From(), SpecializedVehicle< Train, VEH_TRAIN >::From(), Vehicle::GetImage(), GetVehiclePalette(), HT_DRAG, HT_NONE, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_VEHICLE, RoadVehicle::rcache, Window::SetDirty(), CursorVars::short_vehicle_offset, ShowVehicleViewWindow(), Vehicle::tile, BaseVehicle::type, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, and CursorVars::vehchain.
Referenced by OnClick().
void DepotWindow::DrawVehicleInDepot | ( | const Vehicle * | v, | |
int | left, | |||
int | right, | |||
int | y | |||
) | const [inline] |
Draw a vehicle in the depot window in the box with the top left corner at x,y.
v | Vehicle to draw. | |
left | Left side of the box to draw in. | |
right | Right side of the box to draw in. | |
y | Top of the box to draw in. |
Definition at line 244 of file depot_gui.cpp.
References _dynlang, TrainCache::cached_total_length, DAYS_IN_LEAP_YEAR, DIR_W, DrawAircraftImage(), DrawRoadVehImage(), DrawShipImage(), DrawSprite(), DrawString(), DrawTrainImage(), FONT_HEIGHT_NORMAL, FONT_HEIGHT_SMALL, SpecializedVehicle< Train, VEH_TRAIN >::From(), Vehicle::GetImage(), Scrollbar::GetPosition(), GetVehicleHeight(), Sprite::height, Window::hscroll, Train::IsFreeWagon(), max(), Window::resize, SA_RIGHT, SetDParam(), ST_NORMAL, ResizeInfo::step_height, TD_RTL, DynamicLanguages::text_dir, BaseVehicle::type, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, Vehicle::vehstatus, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_PAR_VSEP_NORMAL, and Sprite::y_offs.
Referenced by DrawWidget().
void DepotWindow::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [inline, virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
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] |
Clones a vehicle.
*v | is the original vehicle to clone |
Definition at line 532 of file depot_gui.cpp.
References _ctrl_pressed, CcCloneVehicle(), CMD_CLONE_VEHICLE, CMD_MSG, DoCommandP(), Vehicle::First(), SpecializedVehicle< Train, VEH_TRAIN >::From(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, Train::IsFrontEngine(), Vehicle::IsPrimaryVehicle(), BaseVehicle::type, VEH_TRAIN, and Window::window_number.
Referenced by OnMouseLoop(), and OnPlaceObject().
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.
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.
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] |
A dragged 'object' has been released.
pt | the point inside the window where the release took place. | |
widget | the widget where the release took place. |
Reimplemented from Window.
Definition at line 873 of file depot_gui.cpp.
References _ctrl_pressed, BackupVehicleOrders(), CMD_MSG, CMD_REVERSE_TRAIN_DIRECTION, DoCommandP(), SpecializedVehicle< Train, VEH_TRAIN >::From(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), Window::HandleButtonClick(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_VEHICLE, Train::IsFrontEngine(), Window::IsWidgetDisabled(), NWidgetBase::pos_x, NWidgetBase::pos_y, Window::SetDirty(), ShowVehicleViewWindow(), Vehicle::tile, BaseVehicle::type, VEH_TRAIN, and CursorVars::vehchain.
virtual void DepotWindow::OnInvalidateData | ( | int | data | ) | [inline, virtual] |
Some data on this window has become invalid.
data | information about the changed data. |
Reimplemented from Window.
Definition at line 666 of file depot_gui.cpp.
virtual void DepotWindow::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented from Window.
Definition at line 671 of file depot_gui.cpp.
References BuildDepotVehicleList(), Window::DrawWidgets(), SpecializedVehicle< Train, VEH_TRAIN >::From(), Scrollbar::GetCapacity(), Train::GetDisplayImageWidth(), Window::hscroll, IsTileOwner(), SmallVector< T, S >::Length(), max(), SpecializedVehicle< T, Type >::Next(), Scrollbar::SetCount(), Window::SetWidgetsDisabledState(), VEH_TRAIN, Window::vscroll, WIDGET_LIST_END, Window::width, and Window::window_number.
The user clicked some place on the map when a tile highlight mode has been set.
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] |
Called after the window got resized.
For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.
Reimplemented from Window.
Definition at line 943 of file depot_gui.cpp.
References NWidgetBase::current_x, Scrollbar::GetCapacity(), Window::hscroll, MAT_COL_START, MAT_ROW_START, Scrollbar::SetCapacity(), Scrollbar::SetCapacityFromWidget(), VEH_TRAIN, Window::vscroll, and NWidgetCore::widget_data.
virtual void DepotWindow::OnRightClick | ( | Point | pt, | |
int | widget | |||
) | [inline, virtual] |
A click with the right mouse button has been made on the window.
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.
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.
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.