MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / WidgetTextButton

Function WidgetTextButton

src/openrct2-ui/interface/Widget.cpp:325–350  ·  view source on GitHub ↗

* * rct2: 0x006EBBEB */

Source from the content-addressed store, hash-verified

323 * rct2: 0x006EBBEB
324 */
325 static void WidgetTextButton(RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex)
326 {
327 // Get the widget
328 const auto& widget = w.widgets[widgetIndex];
329
330 // Resolve the absolute ltrb
331 ScreenRect rect{ w.windowPos + ScreenCoordsXY{ widget.left, widget.top },
332 w.windowPos + ScreenCoordsXY{ widget.right, widget.bottom } };
333
334 auto colour = w.colours[widget.colour];
335
336 // Border
337 auto borderStyle = widgetIsPressed(w, widgetIndex) || isToolActive(w, widgetIndex) ? Rectangle::BorderStyle::inset
338 : Rectangle::BorderStyle::outset;
339 Rectangle::fillInset(rt, rect, colour, borderStyle);
340
341 // Button caption
342 if (widget.type != WidgetType::tableHeader)
343 {
344 WidgetTextCentred(rt, w, widgetIndex);
345 }
346 else
347 {
348 WidgetText(rt, w, widgetIndex);
349 }
350 }
351
352 /**
353 *

Callers 1

widgetDrawFunction · 0.85

Calls 5

widgetIsPressedFunction · 0.85
isToolActiveFunction · 0.85
fillInsetFunction · 0.85
WidgetTextCentredFunction · 0.85
WidgetTextFunction · 0.85

Tested by

no test coverage detected