Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes

# DeparturesWindow< Twaypoint > Struct Template Reference

Inheritance diagram for DeparturesWindow< Twaypoint >:

## Public Member Functions
| DeparturesWindow (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.
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a 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 | OnTick ()
| Called once per (game) tick.
virtual void | OnPaint ()
| The window must be repainted.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | OnResize ()
| Called after the window got resized.
## Protected Member Functions
virtual uint | GetMinWidth () const
virtual void | DrawDeparturesListItems (const Rect &r) const
| Draws a list of departures.
void | DeleteDeparturesList (DepartureList *list)
| Deletes this window's departure list.
## Static Protected Member Functions
static void | RecomputeDateWidth ()
## Protected Attributes
StationID | station
| The station whose departures we're showing.
DepartureList * | departures
| The current list of departures from this station.
DepartureList * | arrivals
| The current list of arrivals from this station.
uint | entry_height
| The height of an entry in the departures list.
uint | tick_count
| The number of ticks that have elapsed since the window was created. Used for scrolling text.
int | calc_tick_countdown
| The number of ticks to wait until recomputing the departure list. Signed in case it goes below zero.
bool | show_types [4]
| The vehicle types to show in the departure list.
bool | departure_types [3]
| The types of departure to show in the departure list.
uint | min_width
| The minimum width of this window.
Scrollbar * | vscroll

## Detailed Description

### template<bool Twaypoint = false>
struct DeparturesWindow< Twaypoint >

Definition at line 81 of file departures_gui.cpp.

## Member Function Documentation

template<bool Twaypoint = false>

virtual void DeparturesWindow< Twaypoint >::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 318 of file departures_gui.cpp.

References DeparturesWindow< Twaypoint >::DrawDeparturesListItems(), and DW_WIDGET_LIST.

template<bool Twaypoint = false>

virtual void DeparturesWindow< Twaypoint >::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 167 of file departures_gui.cpp.

References _settings_client, DeparturesWindow< Twaypoint >::arrivals, DeparturesWindow< Twaypoint >::calc_tick_countdown, GUISettings::departure_show_both, DeparturesWindow< Twaypoint >::departure_types, DeparturesWindow< Twaypoint >::departures, Window::DisableWidget(), DW_SHOW_ARRS, DW_SHOW_DEPS, DW_SHOW_PLANES, DW_SHOW_ROADVEHS, DW_SHOW_SHIPS, DW_SHOW_TRAINS, DW_SHOW_VIA, DW_WIDGET_LIST, Window::EnableWidget(), DeparturesWindow< Twaypoint >::entry_height, Scrollbar::GetCapacity(), Scrollbar::GetPosition(), ClientSettings::gui, SmallVector< T, S >::Length(), Window::LowerWidget(), Window::RaiseWidget(), Departure::scheduled_date, Window::SetWidgetDirty(), DeparturesWindow< Twaypoint >::show_types, ShowVehicleViewWindow(), and Departure::vehicle.

template<bool Twaypoint = false>

virtual void DeparturesWindow< Twaypoint >::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 304 of file departures_gui.cpp.

References _settings_client, DeparturesWindow< Twaypoint >::arrivals, GUISettings::departure_show_both, Window::DisableWidget(), Window::DrawWidgets(), DW_SHOW_ARRS, DW_SHOW_DEPS, Window::EnableWidget(), ClientSettings::gui, SmallVector< T, S >::Length(), GUISettings::max_departures, min(), and Scrollbar::SetCount().

template<bool Twaypoint = false>

virtual void DeparturesWindow< Twaypoint >::OnResize | ( |  | ) | `[inline, virtual]`

Called after the window got resized.

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

Reimplemented from Window.

Definition at line 327 of file departures_gui.cpp.

References DW_WIDGET_LIST, Scrollbar::GetCapacity(), MAT_COL_START, and Scrollbar::SetCapacityFromWidget().

template<bool Twaypoint = false>

virtual void DeparturesWindow< Twaypoint >::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 159 of file departures_gui.cpp.

References DW_WIDGET_CAPTION, SpecializedStation< Station, false >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, SetDParam(), and DeparturesWindow< Twaypoint >::station.

template<bool Twaypoint = false>

virtual void DeparturesWindow< Twaypoint >::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 149 of file departures_gui.cpp.

References DW_WIDGET_LIST, and DeparturesWindow< Twaypoint >::entry_height.

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

- src/departures_gui.cpp