* * rct2: 0x006EBD52 */
| 407 | * rct2: 0x006EBD52 |
| 408 | */ |
| 409 | static void WidgetText(RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex) |
| 410 | { |
| 411 | // Get the widget |
| 412 | const auto& widget = w.widgets[widgetIndex]; |
| 413 | |
| 414 | if (widget.text == kStringIdNone || widget.content == kWidgetContentEmpty) |
| 415 | return; |
| 416 | |
| 417 | auto colour = w.colours[widget.colour]; |
| 418 | if (widgetIsDisabled(w, widgetIndex)) |
| 419 | colour.flags.set(ColourFlag::inset, true); |
| 420 | |
| 421 | // Resolve the absolute ltrb |
| 422 | int32_t l = w.windowPos.x + widget.left; |
| 423 | int32_t r = w.windowPos.x + widget.right; |
| 424 | int32_t t; |
| 425 | |
| 426 | if (widget.type == WidgetType::button || widget.type == WidgetType::dropdownMenu || widget.type == WidgetType::spinner |
| 427 | || widget.type == WidgetType::tableHeader) |
| 428 | { |
| 429 | t = w.windowPos.y + widget.textTop(); |
| 430 | } |
| 431 | else |
| 432 | t = w.windowPos.y + widget.top; |
| 433 | |
| 434 | auto stringId = widget.text; |
| 435 | auto ft = Formatter(); |
| 436 | if (widget.flags.has(WidgetFlag::textIsString)) |
| 437 | { |
| 438 | stringId = STR_STRING; |
| 439 | ft.Add<utf8*>(widget.string); |
| 440 | } |
| 441 | |
| 442 | ScreenCoordsXY coords = { l + 1, t }; |
| 443 | if (widget.type == WidgetType::labelCentred) |
| 444 | { |
| 445 | drawTextWrapped(rt, coords, r - l, stringId, ft, { colour, TextAlignment::centre }); |
| 446 | } |
| 447 | else |
| 448 | { |
| 449 | drawTextEllipsised(rt, coords, r - l, stringId, ft, colour); |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | /** |
| 454 | * |
no test coverage detected