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

@@ -4119,22 +4119,25 @@ public:
return false;
}
virtual void OnHover(Point pt, int widget) override
virtual bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
{
if (widget == WID_VV_GOTO_DEPOT) {
const Vehicle *v = Vehicle::Get(this->window_number);
if (_settings_client.gui.show_depot_sell_gui && v->current_order.IsType(OT_GOTO_DEPOT)) {
GuiShowTooltips(this, STR_VEHICLE_VIEW_SEND_TO_DEPOT_MENU, 0, nullptr, TCC_HOVER);
GuiShowTooltips(this, STR_VEHICLE_VIEW_SEND_TO_DEPOT_MENU, 0, nullptr, close_cond);
} else {
uint64 arg = STR_VEHICLE_VIEW_TRAIN_SEND_TO_DEPOT_TOOLTIP + v->type;
GuiShowTooltips(this, STR_VEHICLE_VIEW_SEND_TO_DEPOT_TOOLTIP_SHIFT, 1, &arg, TCC_HOVER);
GuiShowTooltips(this, STR_VEHICLE_VIEW_SEND_TO_DEPOT_TOOLTIP_SHIFT, 1, &arg, close_cond);
}
return true;
}
if (widget == WID_VV_LOCATION) {
const Vehicle *v = Vehicle::Get(this->window_number);
uint64 args[] = { STR_VEHICLE_VIEW_TRAIN_CENTER_TOOLTIP + v->type };
GuiShowTooltips(this, STR_VEHICLE_VIEW_TRAIN_CENTER_TOOLTIP_EXTRA, lengthof(args), args, TCC_HOVER);
GuiShowTooltips(this, STR_VEHICLE_VIEW_TRAIN_CENTER_TOOLTIP_EXTRA, lengthof(args), args, close_cond);
return true;
}
return false;
}
void OnMouseOver(Point pt, int widget) override