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

Method OnTooltip

src/network/network_gui.cpp:1838–1855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1836 }
1837
1838 bool OnTooltip([[maybe_unused]] Point pt, WidgetID widget, TooltipCloseCondition close_cond) override
1839 {
1840 switch (widget) {
1841 case WID_CL_MATRIX: {
1842 auto it = this->vscroll->GetScrolledItemFromWidget(this->buttons, pt.y, this, WID_CL_MATRIX);
1843 if (it == std::end(this->buttons)) break;
1844
1845 Rect r = this->GetWidget<NWidgetBase>(WID_CL_MATRIX)->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect);
1846 auto tooltip = (*it)->GetTooltip(r, pt);
1847 if (!tooltip.has_value()) break;
1848
1849 GuiShowTooltips(this, std::move(*tooltip), close_cond);
1850 return true;
1851 };
1852 }
1853
1854 return false;
1855 }
1856
1857 void OnDropdownClose(Point pt, WidgetID widget, int index, int click_result, bool instant_close) override
1858 {

Callers

nothing calls this directly

Calls 7

GuiShowTooltipsFunction · 0.85
ShrinkMethod · 0.80
GetCurrentRectMethod · 0.80
endFunction · 0.50
GetTooltipMethod · 0.45

Tested by

no test coverage detected