* * rct2: 0x006EB535 */
| 476 | * rct2: 0x006EB535 |
| 477 | */ |
| 478 | static void WidgetGroupboxDraw(RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex) |
| 479 | { |
| 480 | // Get the widget |
| 481 | const auto& widget = w.widgets[widgetIndex]; |
| 482 | |
| 483 | // Resolve the absolute ltrb |
| 484 | auto l = w.windowPos.x + widget.left + 5; |
| 485 | auto t = w.windowPos.y + widget.top; |
| 486 | auto textRight = l; |
| 487 | |
| 488 | // Text |
| 489 | u8string groupCaption{}; |
| 490 | if (widget.flags.has(WidgetFlag::textIsString) && widget.string != nullptr) |
| 491 | groupCaption = widget.string; |
| 492 | else |
| 493 | groupCaption = LanguageGetString(widget.text); |
| 494 | |
| 495 | if (!groupCaption.empty()) |
| 496 | { |
| 497 | auto colour = w.colours[widget.colour].withFlag(ColourFlag::translucent, false); |
| 498 | if (widgetIsDisabled(w, widgetIndex)) |
| 499 | colour.flags.set(ColourFlag::inset, true); |
| 500 | |
| 501 | drawText(rt, { l, t }, groupCaption, { colour }); |
| 502 | textRight = l + getStringWidth(groupCaption, FontStyle::medium) + 1; |
| 503 | } |
| 504 | |
| 505 | // Border |
| 506 | // Resolve the absolute ltrb |
| 507 | l = w.windowPos.x + widget.left; |
| 508 | t = w.windowPos.y + widget.top + 4; |
| 509 | const auto r = w.windowPos.x + widget.right; |
| 510 | const auto b = w.windowPos.y + widget.bottom; |
| 511 | |
| 512 | auto colour = w.colours[widget.colour].colour; |
| 513 | |
| 514 | // Border left of text |
| 515 | Rectangle::fill(rt, { { l, t }, { l + 4, t } }, getColourMap(colour).midDark); |
| 516 | Rectangle::fill(rt, { { l + 1, t + 1 }, { l + 4, t + 1 } }, getColourMap(colour).lighter); |
| 517 | |
| 518 | // Border right of text |
| 519 | Rectangle::fill(rt, { { textRight, t }, { r - 1, t } }, getColourMap(colour).midDark); |
| 520 | Rectangle::fill(rt, { { textRight, t + 1 }, { r - 2, t + 1 } }, getColourMap(colour).lighter); |
| 521 | |
| 522 | // Border right |
| 523 | Rectangle::fill(rt, { { r - 1, t + 1 }, { r - 1, b - 1 } }, getColourMap(colour).midDark); |
| 524 | Rectangle::fill(rt, { { r, t }, { r, b } }, getColourMap(colour).lighter); |
| 525 | |
| 526 | // Border bottom |
| 527 | Rectangle::fill(rt, { { l, b - 1 }, { r - 2, b - 1 } }, getColourMap(colour).midDark); |
| 528 | Rectangle::fill(rt, { { l, b }, { r - 1, b } }, getColourMap(colour).lighter); |
| 529 | |
| 530 | // Border left |
| 531 | Rectangle::fill(rt, { { l, t + 1 }, { l, b - 2 } }, getColourMap(colour).midDark); |
| 532 | Rectangle::fill(rt, { { l + 1, t + 2 }, { l + 1, b - 2 } }, getColourMap(colour).lighter); |
| 533 | } |
| 534 | |
| 535 | /** |
no test coverage detected