MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DrawSortButtonState

Method DrawSortButtonState

src/widget.cpp:816–827  ·  view source on GitHub ↗

* Draw a sort button's up or down arrow symbol. * @param widget Sort button widget * @param state State of sort button */

Source from the content-addressed store, hash-verified

814 * @param state State of sort button
815 */
816void Window::DrawSortButtonState(WidgetID widget, SortButtonState state) const
817{
818 if (state == SBS_OFF) return;
819
820 assert(!this->widget_lookup.empty());
821 Rect r = this->GetWidget<NWidgetBase>(widget)->GetCurrentRect();
822
823 /* Sort button uses the same sprites as vertical scrollbar */
824 Dimension dim = NWidgetScrollbar::GetVerticalDimension();
825
826 DrawSpriteIgnorePadding(state == SBS_DOWN ? SPR_ARROW_DOWN : SPR_ARROW_UP, PAL_NONE, r.WithWidth(dim.width, _current_text_dir == TD_LTR), SA_CENTER);
827}
828
829/**
830 * Get width of up/down arrow of sort button state.

Callers 12

DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
OnPaintMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
DrawWidgetMethod · 0.80
OnPaintMethod · 0.80
DrawWidgetMethod · 0.80

Calls 5

DrawSpriteIgnorePaddingFunction · 0.85
GetCurrentRectMethod · 0.80
WithWidthMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected