Use OnTooltip instead of OnHover for some custom tooltips
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user