MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / OnPaint

Method OnPaint

src/dock_gui.cpp:434–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432 }
433
434 void OnPaint() override
435 {
436 int rad = (_settings_game.station.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
437
438 this->DrawWidgets();
439
440 if (_settings_client.gui.station_show_coverage) {
441 SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
442 } else {
443 SetTileSelectSize(1, 1);
444 }
445
446 /* strings such as 'Size' and 'Coverage Area' */
447 Rect r = this->GetWidget<NWidgetBase>(WID_BDSW_ACCEPTANCE)->GetCurrentRect();
448 const int bottom = r.bottom;
449 r.bottom = INT_MAX; // Allow overflow as we want to know the required height.
450 r.top = DrawStationCoverageAreaText(r, SCT_ALL, rad, false) + WidgetDimensions::scaled.vsep_normal;
451 r.top = DrawStationCoverageAreaText(r, SCT_ALL, rad, true);
452 /* Resize background if the window is too small.
453 * Never make the window smaller to avoid oscillating if the size change affects the acceptance.
454 * (This is the case, if making the window bigger moves the mouse into the window.) */
455 if (r.top > bottom) {
456 ResizeWindow(this, 0, r.top - bottom, false);
457 }
458 }
459
460 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
461 {

Callers

nothing calls this directly

Calls 7

SetTileSelectBigSizeFunction · 0.85
SetTileSelectSizeFunction · 0.85
ResizeWindowFunction · 0.85
DrawWidgetsMethod · 0.80
GetCurrentRectMethod · 0.80

Tested by

no test coverage detected