| 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 | { |
no test coverage detected