| 213 | } |
| 214 | |
| 215 | void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override |
| 216 | { |
| 217 | /* We cache the button size. This is safe as no reinit can happen here. */ |
| 218 | if (this->button_size.width == 0) { |
| 219 | this->button_size = maxdim(GetStringBoundingBox(STR_MISSING_GRAPHICS_YES_DOWNLOAD), GetStringBoundingBox(STR_MISSING_GRAPHICS_NO_QUIT)); |
| 220 | this->button_size.width += WidgetDimensions::scaled.frametext.Horizontal(); |
| 221 | this->button_size.height += WidgetDimensions::scaled.frametext.Vertical(); |
| 222 | } |
| 223 | |
| 224 | switch (widget) { |
| 225 | case WID_BAFD_QUESTION: |
| 226 | /* The question is twice as wide as the buttons, and determine the height based on the width. */ |
| 227 | size.width = this->button_size.width * 2; |
| 228 | size.height = GetStringHeight(STR_MISSING_GRAPHICS_SET_MESSAGE, size.width - WidgetDimensions::scaled.frametext.Horizontal()) + WidgetDimensions::scaled.frametext.Vertical(); |
| 229 | break; |
| 230 | |
| 231 | case WID_BAFD_YES: |
| 232 | case WID_BAFD_NO: |
| 233 | size = this->button_size; |
| 234 | break; |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | void DrawWidget(const Rect &r, WidgetID widget) const override |
| 239 | { |
nothing calls this directly
no test coverage detected