Use OnTooltip instead of OnHover for some custom tooltips

This commit is contained in:
Jonathan G Rennison
2023-05-07 19:58:07 +01:00
parent b59f229723
commit d93a1a5804
3 changed files with 17 additions and 14 deletions

View File

@@ -1494,6 +1494,12 @@ struct StationViewWindow : public Window {
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
{
if (widget == WID_SV_RENAME) {
uint64 args[] = { STR_STATION_VIEW_RENAME_TOOLTIP, STR_BUTTON_DEFAULT };
GuiShowTooltips(this, STR_STATION_VIEW_RENAME_TOOLTIP_EXTRA, lengthof(args), args, close_cond);
return true;
}
if (widget != WID_SV_ACCEPT_RATING_LIST || this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON ||
_settings_client.gui.station_rating_tooltip_mode == SRTM_OFF) {
return false;
@@ -1582,14 +1588,6 @@ struct StationViewWindow : public Window {
}
}
virtual void OnHover(Point pt, int widget) override
{
if (widget == WID_SV_RENAME) {
uint64 args[] = { STR_STATION_VIEW_RENAME_TOOLTIP, STR_BUTTON_DEFAULT };
GuiShowTooltips(this, STR_STATION_VIEW_RENAME_TOOLTIP_EXTRA, lengthof(args), args, TCC_HOVER);
}
}
void SetStringParameters(int widget) const override
{
const Station *st = Station::Get(this->window_number);