BuildBridgeWindow Class Reference

Inheritance diagram for BuildBridgeWindow:

Window ZeroedMemoryAllocator

Public Member Functions

 BuildBridgeWindow (const WindowDesc *desc, TileIndex start, TileIndex end, uint32 br_type, GUIBridgeList *bl)
 ~BuildBridgeWindow ()
virtual void OnPaint ()
 This window is currently being repainted.
virtual EventState OnKeyPress (uint16 key, uint16 keycode)
 A key has been pressed.
virtual void OnClick (Point pt, int widget)
 A click with the left mouse button has been made on the window.
virtual void OnDropdownSelect (int widget, int index)
 A dropdown option associated to this window has been selected.
virtual void OnResize (Point new_size, Point delta)
 Called when the window got resized.

Private Member Functions

void BuildBridge (uint8 i)
void SortBridgeList ()
 Sort the builable bridges.

Static Private Member Functions

static int CDECL BridgeIndexSorter (const BuildBridgeData *a, const BuildBridgeData *b)
 Sort the bridges by their index.
static int CDECL BridgePriceSorter (const BuildBridgeData *a, const BuildBridgeData *b)
 Sort the bridges by their price.
static int CDECL BridgeSpeedSorter (const BuildBridgeData *a, const BuildBridgeData *b)
 Sort the bridges by their maximum speed.

Private Attributes

TileIndex start_tile
TileIndex end_tile
uint32 type
GUIBridgeListbridges

Static Private Attributes

static uint16 last_size = 4
static Listing last_sorting = {false, 0}
static const StringID sorter_names []
static GUIBridgeList::SortFunction
*const 
sorter_funcs []

Detailed Description

Definition at line 60 of file bridge_gui.cpp.


Member Function Documentation

virtual void BuildBridgeWindow::OnClick ( Point  pt,
int  widget 
) [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.

Reimplemented from Window.

Definition at line 183 of file bridge_gui.cpp.

References bridges, Scrollbar::cap, int, SmallVector< T, S >::Length(), Scrollbar::pos, Window::resize, Window::SetDirty(), ShowDropDownMenu(), ResizeInfo::step_height, GUIList< T >::ToggleSortOrder(), Window::vscroll, and Point::y.

virtual void BuildBridgeWindow::OnDropdownSelect ( int  widget,
int  index 
) [inline, virtual]

A dropdown option associated to this window has been selected.

Parameters:
widget the widget (button) that the dropdown is associated with.
index the element in the dropdown that is selected.

Reimplemented from Window.

Definition at line 209 of file bridge_gui.cpp.

References SortBridgeList().

virtual EventState BuildBridgeWindow::OnKeyPress ( uint16  key,
uint16  keycode 
) [inline, virtual]

A key has been pressed.

Parameters:
key the Unicode value of the key.
keycode the untranslated key code including shift state.
Returns:
ES_HANDLED if the key press has been handled and no other window should receive the event.

Reimplemented from Window.

Definition at line 171 of file bridge_gui.cpp.

References bridges, and SmallVector< T, S >::Length().

virtual void BuildBridgeWindow::OnResize ( Point  new_size,
Point  delta 
) [inline, virtual]

Called when the window got resized.

Parameters:
new_size the new size of the window.
delta the amount of which the window size changed.

Reimplemented from Window.

Definition at line 218 of file bridge_gui.cpp.

References Scrollbar::cap, int, last_size, max, SetVScrollCount(), Window::vscroll, and Point::y.


Field Documentation

GUIBridgeList::SortFunction *const BuildBridgeWindow::sorter_funcs [static, private]

Initial value:

Definition at line 68 of file bridge_gui.cpp.

const StringID BuildBridgeWindow::sorter_names [static, private]

Initial value:

 {
  STR_SORT_BY_NUMBER,
  STR_ENGINE_SORT_COST,
  STR_SORT_BY_MAX_SPEED,
  INVALID_STRING_ID
}

Definition at line 67 of file bridge_gui.cpp.

Referenced by SortBridgeList().


The documentation for this class was generated from the following file:
Generated on Sat Sep 6 20:15:59 2008 for openttd by  doxygen 1.4.7