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

Method OnResize

src/news_gui.cpp:609–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607 }
608
609 void OnResize() override
610 {
611 if (this->viewport != nullptr) {
612 NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_N_VIEWPORT);
613 nvp->UpdateViewportCoordinates(this);
614
615 if (!std::holds_alternative<VehicleID>(ni->ref1)) {
616 ScrollWindowToTile(GetReferenceTile(ni->ref1), this, true); // Re-center viewport.
617 }
618 }
619
620 NWidgetResizeBase *wid = this->GetWidget<NWidgetResizeBase>(WID_N_MGR_NAME);
621 if (wid != nullptr) {
622 int y = GetStringHeight(GetString(STR_JUST_RAW_STRING, static_cast<const CompanyNewsInformation *>(this->ni->data.get())->president_name), wid->current_x);
623 if (wid->UpdateVerticalSize(y)) this->ReInit(0, 0);
624 }
625 }
626
627 /**
628 * Some data on this window has become invalid.

Callers

nothing calls this directly

Calls 8

ScrollWindowToTileFunction · 0.85
GetReferenceTileFunction · 0.85
GetStringHeightFunction · 0.85
UpdateVerticalSizeMethod · 0.80
ReInitMethod · 0.80
GetStringFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected