Public Member Functions | Static Public Member Functions | Data Fields

# 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=0, bool gui_scope=true)
| 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, bool speed)
## 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.
Scrollbar * | vscroll
bool | query_is_speed_query
| The currently open query window is a speed query and not a time query.

## Detailed Description

Definition at line 158 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 187 of file timetable_gui.cpp.

References _date_fract, BaseConsist::cur_real_order_index, Vehicle::current_order, BaseConsist::current_order_time, FillTimetableArrivalDepartureTable(), Order::GetNonStopType(), Vehicle::GetNumOrders(), HasBit(), Order::IsType(), BaseConsist::lateness_counter, BaseConsist::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 358 of file timetable_gui.cpp.

References _current_text_dir, _settings_client, abs(), AllocaM, BuildArrivalDepartureList(), BaseConsist::cur_real_order_index, DAY_TICKS, deparr_abbr_width, deparr_time_width, DrawOrderString(), DrawString(), 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(), BaseConsist::lateness_counter, Vehicle::list, Order::max_speed, Order::next, Vehicle::orders, SetArrivalDepartParams(), SetDParam(), SetDParamMaxValue(), SetTimetableParams(), show_expected, GUISettings::timetable_in_ticks, BaseConsist::timetable_start, Order::travel_time, vehicle, BaseConsist::vehicle_flags, VF_TIMETABLE_STARTED, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WID_VT_ARRIVAL_DEPARTURE_PANEL, WID_VT_SUMMARY_PANEL, and WID_VT_TIMETABLE_PANEL.

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 510 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, ConvertKmhishSpeedToDisplaySpeed(), CS_NUMERAL, DAY_TICKS, Window::DeleteChildWindows(), DoCommandP(), Vehicle::GetNumOrders(), Vehicle::GetOrder(), ClientSettings::gui, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_ORDER, Order::max_speed, query_is_speed_query, SetBit(), Window::SetDirty(), SetDParam(), show_expected, ShowQueryString(), ShowSetDateWindow(), GUISettings::timetable_in_ticks, Order::travel_time, vehicle, BaseConsist::vehicle_flags, VF_AUTOFILL_TIMETABLE, Order::wait_time, WID_VT_AUTOFILL, WID_VT_CHANGE_SPEED, WID_VT_CHANGE_TIME, WID_VT_CLEAR_SPEED, WID_VT_CLEAR_TIME, WID_VT_EXPECTED, WID_VT_ORDER_VIEW, WID_VT_RESET_LATENESS, WID_VT_SHARED_ORDER_LIST, WID_VT_START_DATE, and WID_VT_TIMETABLE_PANEL.

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

References Window::DeleteChildWindows(), GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), Vehicle::GetNumOrders(), HasBit(), INVALID_VEH_ORDER_ID, Window::ReInit(), UpdateSelectionStates(), vehicle, VIWD_AUTOREPLACE, VIWD_MODIFY_ORDERS, VIWD_REMOVE_ALL_ORDERS, 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 _local_company, Window::DisableWidget(), Window::DrawWidgets(), Window::EnableWidget(), Order::GetNonStopType(), Vehicle::GetNumOrders(), Vehicle::GetOrder(), HasBit(), Vehicle::IsOrderListShared(), Order::IsType(), Vehicle::owner, Scrollbar::SetCount(), Window::SetWidgetDisabledState(), Window::SetWidgetLoweredState(), BaseVehicle::type, vehicle, BaseConsist::vehicle_flags, VF_AUTOFILL_TIMETABLE, WID_VT_AUTOFILL, WID_VT_CHANGE_SPEED, WID_VT_CHANGE_TIME, WID_VT_CLEAR_SPEED, WID_VT_CLEAR_TIME, WID_VT_RESET_LATENESS, WID_VT_SHARED_ORDER_LIST, and WID_VT_START_DATE.

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 611 of file timetable_gui.cpp.

References _settings_client, CMD_CHANGE_TIMETABLE, CMD_MSG, ConvertDisplaySpeedToKmhishSpeed(), DAY_TICKS, DoCommandP(), ClientSettings::gui, minu(), query_is_speed_query, 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 631 of file timetable_gui.cpp.

References Scrollbar::SetCapacityFromWidget(), WD_FRAMERECT_BOTTOM, WD_FRAMERECT_TOP, and WID_VT_TIMETABLE_PANEL.

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 350 of file timetable_gui.cpp.

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

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 199 of file timetable_gui.cpp.

References DAYS_IN_YEAR, deparr_abbr_width, deparr_time_width, FONT_HEIGHT_NORMAL, FS_SMALL, GetStringBoundingBox(), max(), MAX_YEAR, SetDParamMaxValue(), WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WID_VT_ARRIVAL_DEPARTURE_PANEL, WID_VT_ARRIVAL_DEPARTURE_SELECTION, WID_VT_SUMMARY_PANEL, WID_VT_TIMETABLE_PANEL, and Window::width.

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

- src/timetable_gui.cpp