# TimetableWindow Struct Reference

Inheritance diagram for TimetableWindow:

## Public Member Functions

| TimetableWindow (const WindowDesc *desc, WindowNumber window_number)
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.
int | GetOrderFromTimetableWndPt (int y, const Vehicle *v)
virtual void | OnInvalidateData (int data)
| Some data on this window has become invalid.
virtual void | OnPaint ()
| The window must be repainted.
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
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 void | OnResize ()
| Called after the window got resized.
void | UpdateSelectionStates ()
| Update the selection state of the arrival/departure data.

## Static Public Member Functions

static bool | BuildArrivalDepartureList (const Vehicle *v, TimetableArrivalDeparture *table)
| Build the arrival-departure list for a given vehicle.
static uint32 | PackTimetableArgs (const Vehicle *v, uint selected)

## Data Fields

int | sel_index
const Vehicle * | vehicle
| Vehicle monitored by the window.
bool | show_expected
| Whether we show expected arrival or scheduled.
uint | deparr_time_width
| The width of the departure/arrival time.
uint | deparr_abbr_width
| The width of the departure/arrival abbreviation.

## Detailed Description

Definition at line 170 of file timetable_gui.cpp.

## Member Function Documentation

static bool TimetableWindow::BuildArrivalDepartureList | ( | const Vehicle * | v,
|  | TimetableArrivalDeparture * | table |
| ) |  |  | `[inline, static]`

Build the arrival-departure list for a given vehicle.

Parameters:

  | v | the vehicle to make the list for
  | table | the table to fill

Returns:
  if next arrival will be early

Definition at line 196 of file timetable_gui.cpp.

References Vehicle::cur_order_index, Vehicle::current_order, Vehicle::current_order_time, FillTimetableArrivalDepartureTable(), Order::GetNonStopType(), Vehicle::GetNumOrders(), HasBit(), Order::IsType(), Vehicle::lateness_counter, ONSF_STOP_EVERYWHERE, Vehicle::vehicle_flags, and VF_TIMETABLE_STARTED.

Referenced by DrawWidget().

virtual void TimetableWindow::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 353 of file timetable_gui.cpp.

References _dynlang, _settings_client, abs(), AllocaM, BuildArrivalDepartureList(), Vehicle::cur_order_index, DAY_TICKS, deparr_abbr_width, deparr_time_width, DrawOrderString(), DrawString(), FONT_HEIGHT_NORMAL, Vehicle::GetNumOrders(), Vehicle::GetOrder(), Scrollbar::GetPosition(), GetSpriteSize(), GetStringBoundingBox(), OrderList::GetTimetableDurationIncomplete(), ClientSettings::gui, HasBit(), INVALID_TICKS, INVALID_VEH_ORDER_ID, OrderList::IsCompleteTimetable(), Order::IsType(), Scrollbar::IsVisible(), Vehicle::lateness_counter, Vehicle::list, Order::next, SetArrivalDepartParams(), SetDParam(), SetTimetableParams(), show_expected, TD_RTL, DynamicLanguages::text_dir, GUISettings::timetable_in_ticks, Vehicle::timetable_start, Order::travel_time, TTV_ARRIVAL_DEPARTURE_PANEL, vehicle, Vehicle::vehicle_flags, VF_TIMETABLE_STARTED, Window::vscroll, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.

virtual void TimetableWindow::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 500 of file timetable_gui.cpp.

References _ctrl_pressed, _cur_year, _date, _settings_client, ChangeTimetableStartCallback(), CMD_AUTOFILL_TIMETABLE, CMD_CHANGE_TIMETABLE, CMD_MSG, CMD_SET_VEHICLE_ON_TIME, CS_NUMERAL, DAY_TICKS, Window::DeleteChildWindows(), DoCommandP(), Vehicle::GetNumOrders(), Vehicle::GetOrder(), ClientSettings::gui, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_ORDER, SetBit(), Window::SetDirty(), SetDParam(), show_expected, ShowQueryString(), ShowSetDateWindow(), GUISettings::timetable_in_ticks, Order::travel_time, TTV_EXPECTED, TTV_SHARED_ORDER_LIST, vehicle, Vehicle::vehicle_flags, VF_AUTOFILL_TIMETABLE, and Order::wait_time.

virtual void TimetableWindow::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 240 of file timetable_gui.cpp.

References Window::DeleteChildWindows(), GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), Vehicle::GetNumOrders(), HasBit(), INVALID_VEH_ORDER_ID, Window::ReInit(), UpdateSelectionStates(), vehicle, and Window::window_number.

virtual void TimetableWindow::OnPaint | ( |  | ) | `[inline, virtual]`

The window must be repainted.

Note:
  This method should not change any state, it should only use drawing functions.

Reimplemented from Window.

Definition at line 306 of file timetable_gui.cpp.

References Window::DisableWidget(), Window::DrawWidgets(), Window::EnableWidget(), Order::GetNonStopType(), Vehicle::GetNumOrders(), Vehicle::GetOrder(), HasBit(), Vehicle::IsOrderListShared(), Order::IsType(), ONSF_NO_STOP_AT_DESTINATION_STATION, Scrollbar::SetCount(), Window::SetWidgetDisabledState(), Window::SetWidgetLoweredState(), TTV_SHARED_ORDER_LIST, vehicle, Vehicle::vehicle_flags, VF_AUTOFILL_TIMETABLE, and Window::vscroll.

virtual void TimetableWindow::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 570 of file timetable_gui.cpp.

References _settings_client, CMD_CHANGE_TIMETABLE, CMD_MSG, DAY_TICKS, DoCommandP(), ClientSettings::gui, minu(), StrEmpty(), GUISettings::timetable_in_ticks, and vehicle.

virtual void TimetableWindow::OnResize | ( |  | ) | `[inline, virtual]`

Called after the window got resized.

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

Reimplemented from Window.

Definition at line 586 of file timetable_gui.cpp.

References Scrollbar::SetCapacityFromWidget(), Window::vscroll, WD_FRAMERECT_BOTTOM, and WD_FRAMERECT_TOP.

virtual void TimetableWindow::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 345 of file timetable_gui.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, SetDParam(), show_expected, TTV_EXPECTED, and vehicle.

virtual void TimetableWindow::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 208 of file timetable_gui.cpp.

References DAYS_IN_YEAR, deparr_abbr_width, deparr_time_width, FONT_HEIGHT_NORMAL, GetStringBoundingBox(), max(), MAX_YEAR, SetDParam(), TTV_ARRIVAL_DEPARTURE_PANEL, TTV_ARRIVAL_DEPARTURE_SELECTION, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, and Window::width.

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

- src/timetable_gui.cpp