MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / WindowTooltipOpen

Function WindowTooltipOpen

src/openrct2-ui/windows/Tooltip.cpp:181–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179 }
180
181 void WindowTooltipOpen(WindowBase* widgetWindow, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
182 {
183 if (widgetWindow == nullptr || widgetIndex == kWidgetIndexNull)
184 return;
185
186 auto widget = &widgetWindow->widgets[widgetIndex];
187 widgetWindow->onPrepareDraw();
188
189 StringWithArgs result;
190 if (widget->flags.has(WidgetFlag::tooltipIsString))
191 {
192 auto tooltipString = widget->sztooltip;
193 if (*tooltipString == 0)
194 return;
195
196 result.str = STR_STRING_TOOLTIP;
197 result.args = Formatter();
198 result.args.Add<const char*>(tooltipString);
199
200 gTooltipWidget.windowClassification = widgetWindow->classification;
201 gTooltipWidget.windowNumber = widgetWindow->number;
202 gTooltipWidget.widgetIndex = widgetIndex;
203 }
204 else
205 {
206 auto stringId = widget->tooltip;
207 gTooltipWidget.windowClassification = widgetWindow->classification;
208 gTooltipWidget.windowNumber = widgetWindow->number;
209 gTooltipWidget.widgetIndex = widgetIndex;
210 result = widgetWindow->onTooltip(widgetIndex, stringId);
211 if (result.str == kStringIdNone)
212 return;
213 }
214
215 WindowTooltipShow(result, screenCoords);
216 }
217
218 void WindowTooltipClose()
219 {

Callers 1

InputUpdateTooltipFunction · 0.85

Calls 5

WindowTooltipShowFunction · 0.85
FormatterClass · 0.70
hasMethod · 0.65
onPrepareDrawMethod · 0.45
onTooltipMethod · 0.45

Tested by

no test coverage detected