TimetableWindow Struct Reference

Inheritance diagram for TimetableWindow:
Window ZeroedMemoryAllocator

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 Vehiclevehicle
 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]
virtual void TimetableWindow::OnClick ( Point  pt,
int  widget,
int  click_count 
) [inline, virtual]
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]
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:

Generated on Sat Jul 17 18:44:24 2010 for OpenTTD by  doxygen 1.6.1