Use OnTooltip instead of OnHover for some custom tooltips

pull/519/head
Jonathan G Rennison 1 year ago
parent b59f229723
commit d93a1a5804

@ -739,12 +739,14 @@ struct BuildRailToolbarWindow : Window {
if (_ctrl_pressed) RailToolbar_CtrlChanged(this);
}
virtual void OnHover(Point pt, int widget) override
virtual bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
{
if (widget == WID_RAT_CONVERT_RAIL) {
uint64 args[] = { STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL };
GuiShowTooltips(this, STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_EXTRA, lengthof(args), args, TCC_HOVER);
GuiShowTooltips(this, STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_EXTRA, lengthof(args), args, close_cond);
return true;
}
return false;
}
EventState OnHotkey(int hotkey) override

@ -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);

@ -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

Loading…
Cancel
Save