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

Method OnClick

src/news_gui.cpp:1256–1268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1254 }
1255
1256 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
1257 {
1258 if (widget == WID_MH_BACKGROUND) {
1259 /* Scheduled window invalidations currently occur after the input loop, which means the scrollbar count
1260 * could be invalid, so ensure it's correct now. Potentially this means that item clicked on might be
1261 * different as well. */
1262 this->vscroll->SetCount(std::size(_news));
1263 auto ni = this->vscroll->GetScrolledItemFromWidget(_news, pt.y, this, widget, WidgetDimensions::scaled.framerect.top);
1264 if (ni == std::end(_news)) return;
1265
1266 ShowNewsMessage(ni);
1267 }
1268 }
1269
1270 void OnResize() override
1271 {

Callers

nothing calls this directly

Calls 5

ShowNewsMessageFunction · 0.85
sizeFunction · 0.50
endFunction · 0.50
SetCountMethod · 0.45

Tested by

no test coverage detected