| 643 | }}; |
| 644 | |
| 645 | void UpdateMatrixSize(WidgetID widget, Dimension &size, Dimension &resize, auto labels) |
| 646 | { |
| 647 | size = {}; |
| 648 | for (const StringID &str : labels) { |
| 649 | size = maxdim(size, GetStringBoundingBox(str, FS_SMALL)); |
| 650 | } |
| 651 | |
| 652 | size.width += WidgetDimensions::scaled.framerect.Horizontal(); |
| 653 | size.height += WidgetDimensions::scaled.framerect.Vertical(); |
| 654 | |
| 655 | /* Set fixed height for number of ranges. */ |
| 656 | size.height *= static_cast<uint>(std::size(labels)); |
| 657 | |
| 658 | resize.width = 0; |
| 659 | resize.height = 0; |
| 660 | this->GetWidget<NWidgetCore>(widget)->SetMatrixDimension(1, ClampTo<uint32_t>(std::size(labels))); |
| 661 | } |
| 662 | |
| 663 | public: |
| 664 | void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override |
no test coverage detected