Public Member Functions | |
BuildBridgeWindow (const WindowDesc *desc, TileIndex start, TileIndex end, uint32 br_type, GUIBridgeList *bl) | |
virtual void | OnPaint () |
The window must be repainted. | |
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 | DrawWidget (const Rect &r, int widget) const |
Draw the contents of a nested widget. | |
virtual EventState | OnKeyPress (uint16 key, uint16 keycode) |
A key has been pressed. | |
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 | OnDropdownSelect (int widget, int index) |
A dropdown option associated to this window has been selected. | |
virtual void | OnResize () |
Called after 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 |
GUIBridgeList * | bridges |
int | bridgetext_offset |
Horizontal offset of the text describing the bridge properties in BBSW_BRIDGE_LIST relative to the left edge. | |
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 [] |
Definition at line 66 of file bridge_gui.cpp.
virtual void BuildBridgeWindow::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [inline, virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
Reimplemented from Window.
Definition at line 209 of file bridge_gui.cpp.
References Window::DrawSortButtonState(), DrawSprite(), DrawStringMultiLine(), SmallVector< T, S >::Get(), Scrollbar::GetPosition(), GetSpriteSize(), GUIList< T, F >::IsDescSortOrder(), Scrollbar::IsVisible(), SmallVector< T, S >::Length(), BridgeSpec::material, BridgeSpec::pal, Window::resize, SBS_DOWN, SBS_UP, SetDParam(), BridgeSpec::speed, BridgeSpec::sprite, ResizeInfo::step_height, Window::vscroll, and WD_MATRIX_LEFT.
virtual void BuildBridgeWindow::OnClick | ( | Point | pt, | |
int | widget, | |||
int | click_count | |||
) | [inline, virtual] |
A click with the left mouse button has been made on the window.
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 246 of file bridge_gui.cpp.
References Scrollbar::GetCapacity(), Scrollbar::GetPosition(), SmallVector< T, S >::Length(), Window::resize, Window::SetDirty(), ShowDropDownMenu(), GUIList< T, F >::SortType(), ResizeInfo::step_height, GUIList< T, F >::ToggleSortOrder(), and Window::vscroll.
virtual void BuildBridgeWindow::OnDropdownSelect | ( | int | widget, | |
int | index | |||
) | [inline, virtual] |
A dropdown option associated to this window has been selected.
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 272 of file bridge_gui.cpp.
References GUIList< T, F >::SetSortType(), SortBridgeList(), and GUIList< T, F >::SortType().
virtual EventState BuildBridgeWindow::OnKeyPress | ( | uint16 | key, | |
uint16 | keycode | |||
) | [inline, virtual] |
A key has been pressed.
key | the Unicode value of the key. | |
keycode | the untranslated key code including shift state. |
Reimplemented from Window.
Definition at line 234 of file bridge_gui.cpp.
References Window::ES_HANDLED, Window::ES_NOT_HANDLED, and SmallVector< T, S >::Length().
virtual void BuildBridgeWindow::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented from Window.
Definition at line 160 of file bridge_gui.cpp.
References Window::DrawWidgets().
virtual void BuildBridgeWindow::OnResize | ( | ) | [inline, virtual] |
Called after the window got resized.
For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.
Reimplemented from Window.
Definition at line 281 of file bridge_gui.cpp.
References Scrollbar::GetCapacity(), MAT_COL_START, MAT_ROW_START, max(), Scrollbar::SetCapacityFromWidget(), and Window::vscroll.
virtual void BuildBridgeWindow::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.
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 165 of file bridge_gui.cpp.
References bridgetext_offset, SmallVector< T, S >::Get(), GetSpriteSize(), GetStringBoundingBox(), INVALID_STRING_ID, SmallVector< T, S >::Length(), BridgeSpec::material, max(), maxdim(), SetDParam(), BridgeSpec::speed, BridgeSpec::sprite, WD_MATRIX_LEFT, WD_MATRIX_RIGHT, and WD_SORTBUTTON_ARROW_WIDTH.
GUIBridgeList::SortFunction *const BuildBridgeWindow::sorter_funcs [static, private] |
Definition at line 74 of file bridge_gui.cpp.
const StringID BuildBridgeWindow::sorter_names [static, private] |
{ STR_SORT_BY_NUMBER, STR_SORT_BY_COST, STR_SORT_BY_MAX_SPEED, INVALID_STRING_ID }
Definition at line 73 of file bridge_gui.cpp.