diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 1810e11fbb..f07c37a54f 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1222,10 +1222,10 @@ struct BuildVehicleWindow : Window { if (this->listview_mode) this->GetWidget(WID_BV_BUILD_SEL)->SetDisplayedPlane(SZSP_NONE); NWidgetCore *widget = this->GetWidget(WID_BV_LIST); - widget->tool_tip = STR_BUY_VEHICLE_TRAIN_LIST_TOOLTIP + type; + widget->SetToolTip(STR_BUY_VEHICLE_TRAIN_LIST_TOOLTIP + type); widget = this->GetWidget(WID_BV_SHOW_HIDE); - widget->tool_tip = STR_BUY_VEHICLE_TRAIN_HIDE_SHOW_TOGGLE_TOOLTIP + type; + widget->SetToolTip(STR_BUY_VEHICLE_TRAIN_HIDE_SHOW_TOGGLE_TOOLTIP + type); widget = this->GetWidget(WID_BV_RENAME); widget->SetStringTip(STR_BUY_VEHICLE_TRAIN_RENAME_BUTTON + type, STR_BUY_VEHICLE_TRAIN_RENAME_TOOLTIP + type); diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index eff689d48c..3a197686b0 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -592,18 +592,18 @@ struct DepotWindow : Window { */ void SetupWidgetData(VehicleType type) { - this->GetWidget(WID_D_STOP_ALL)->tool_tip = STR_DEPOT_MASS_STOP_DEPOT_TRAIN_TOOLTIP + type; - this->GetWidget(WID_D_START_ALL)->tool_tip = STR_DEPOT_MASS_START_DEPOT_TRAIN_TOOLTIP + type; - this->GetWidget(WID_D_SELL)->tool_tip = STR_DEPOT_TRAIN_SELL_TOOLTIP + type; - this->GetWidget(WID_D_SELL_ALL)->tool_tip = STR_DEPOT_SELL_ALL_BUTTON_TRAIN_TOOLTIP + type; + this->GetWidget(WID_D_STOP_ALL)->SetToolTip(STR_DEPOT_MASS_STOP_DEPOT_TRAIN_TOOLTIP + type); + this->GetWidget(WID_D_START_ALL)->SetToolTip(STR_DEPOT_MASS_START_DEPOT_TRAIN_TOOLTIP + type); + this->GetWidget(WID_D_SELL)->SetToolTip(STR_DEPOT_TRAIN_SELL_TOOLTIP + type); + this->GetWidget(WID_D_SELL_ALL)->SetToolTip(STR_DEPOT_SELL_ALL_BUTTON_TRAIN_TOOLTIP + type); this->GetWidget(WID_D_BUILD)->SetStringTip(STR_DEPOT_TRAIN_NEW_VEHICLES_BUTTON + type, STR_DEPOT_TRAIN_NEW_VEHICLES_TOOLTIP + type); this->GetWidget(WID_D_CLONE)->SetStringTip(STR_DEPOT_CLONE_TRAIN + type, STR_DEPOT_CLONE_TRAIN_DEPOT_TOOLTIP + type); - this->GetWidget(WID_D_LOCATION)->tool_tip = STR_DEPOT_TRAIN_LOCATION_TOOLTIP + type; - this->GetWidget(WID_D_VEHICLE_LIST)->tool_tip = STR_DEPOT_VEHICLE_ORDER_LIST_TRAIN_TOOLTIP + type; - this->GetWidget(WID_D_AUTOREPLACE)->tool_tip = STR_DEPOT_AUTOREPLACE_TRAIN_TOOLTIP + type; - this->GetWidget(WID_D_MATRIX)->tool_tip = STR_DEPOT_TRAIN_LIST_TOOLTIP + this->type; + this->GetWidget(WID_D_LOCATION)->SetToolTip(STR_DEPOT_TRAIN_LOCATION_TOOLTIP + type); + this->GetWidget(WID_D_VEHICLE_LIST)->SetToolTip(STR_DEPOT_VEHICLE_ORDER_LIST_TRAIN_TOOLTIP + type); + this->GetWidget(WID_D_AUTOREPLACE)->SetToolTip(STR_DEPOT_AUTOREPLACE_TRAIN_TOOLTIP + type); + this->GetWidget(WID_D_MATRIX)->SetToolTip(STR_DEPOT_TRAIN_LIST_TOOLTIP + this->type); switch (type) { default: NOT_REACHED(); diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 54ab181e9d..43ed4c63de 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -812,7 +812,7 @@ public: this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_O_SCROLLBAR); if (NWidgetCore *nwid = this->GetWidget(WID_O_DEPOT_ACTION); nwid != nullptr) { - nwid->tool_tip = STR_ORDER_TRAIN_DEPOT_ACTION_TOOLTIP + v->type; + nwid->SetToolTip(STR_ORDER_TRAIN_DEPOT_ACTION_TOOLTIP + v->type); } this->FinishInitNested(v->index); diff --git a/src/picker_gui.cpp b/src/picker_gui.cpp index 2d0de2f27d..2831003958 100644 --- a/src/picker_gui.cpp +++ b/src/picker_gui.cpp @@ -177,7 +177,7 @@ void PickerWindow::ConstructWindow() this->has_type_picker = isActive && this->GetWidget(WID_PW_TYPE_MATRIX) != nullptr; if (this->has_class_picker) { - this->GetWidget(WID_PW_CLASS_LIST)->tool_tip = this->callbacks.GetClassTooltip(); + this->GetWidget(WID_PW_CLASS_LIST)->SetToolTip(this->callbacks.GetClassTooltip()); this->querystrings[WID_PW_CLASS_FILTER] = &this->class_editbox; } else { @@ -209,7 +209,7 @@ void PickerWindow::ConstructWindow() SetWidgetDisabledState(WID_PW_MODE_ALL, !this->callbacks.HasClassChoice()); - this->GetWidget(WID_PW_TYPE_ITEM)->tool_tip = this->callbacks.GetTypeTooltip(); + this->GetWidget(WID_PW_TYPE_ITEM)->SetToolTip(this->callbacks.GetTypeTooltip()); auto *matrix = this->GetWidget(WID_PW_TYPE_MATRIX); matrix->SetScrollbar(this->GetScrollbar(WID_PW_TYPE_SCROLL)); diff --git a/src/road_gui.cpp b/src/road_gui.cpp index be5bff7633..1f8c916248 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -1095,7 +1095,7 @@ struct BuildRoadDepotWindow : public PickerWindowBase { if (RoadTypeIsTram(_cur_roadtype)) { this->GetWidget(WID_BROD_CAPTION)->widget_data = STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION; for (WidgetID i = WID_BROD_DEPOT_NE; i <= WID_BROD_DEPOT_NW; i++) { - this->GetWidget(i)->tool_tip = STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP; + this->GetWidget(i)->SetToolTip(STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP); } } @@ -1317,7 +1317,7 @@ public: this->GetWidget(WID_BROS_CAPTION)->widget_data = rti->strings.picker_title[rs]; for (WidgetID i = RoadTypeIsTram(_cur_roadtype) ? WID_BROS_STATION_X : WID_BROS_STATION_NE; i < WID_BROS_LT_OFF; i++) { - this->GetWidget(i)->tool_tip = rti->strings.picker_tooltip[rs]; + this->GetWidget(i)->SetToolTip(rti->strings.picker_tooltip[rs]); } this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui.orientation); diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 47a4c184e2..35e011334a 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -946,12 +946,12 @@ struct RefitWindow : public Window { this->vscroll = this->GetScrollbar(WID_VR_SCROLLBAR); this->hscroll = (v->IsGroundVehicle() ? this->GetScrollbar(WID_VR_HSCROLLBAR) : nullptr); - this->GetWidget(WID_VR_SELECT_HEADER)->tool_tip = STR_REFIT_TRAIN_LIST_TOOLTIP + v->type; - this->GetWidget(WID_VR_MATRIX)->tool_tip = STR_REFIT_TRAIN_LIST_TOOLTIP + v->type; + this->GetWidget(WID_VR_SELECT_HEADER)->SetToolTip(STR_REFIT_TRAIN_LIST_TOOLTIP + v->type); + this->GetWidget(WID_VR_MATRIX)->SetToolTip(STR_REFIT_TRAIN_LIST_TOOLTIP + v->type); NWidgetCore *nwi = this->GetWidget(WID_VR_REFIT); nwi->SetStringTip(STR_REFIT_TRAIN_REFIT_BUTTON + v->type, STR_REFIT_TRAIN_REFIT_TOOLTIP + v->type); this->GetWidget(WID_VR_SHOW_HSCROLLBAR)->SetDisplayedPlane(v->IsGroundVehicle() ? 0 : SZSP_HORIZONTAL); - this->GetWidget(WID_VR_VEHICLE_PANEL_DISPLAY)->tool_tip = (v->type == VEH_TRAIN) ? STR_REFIT_SELECT_VEHICLES_TOOLTIP : STR_NULL; + this->GetWidget(WID_VR_VEHICLE_PANEL_DISPLAY)->SetToolTip((v->type == VEH_TRAIN) ? STR_REFIT_SELECT_VEHICLES_TOOLTIP : STR_NULL); this->FinishInitNested(v->index); this->owner = v->owner; @@ -1955,7 +1955,7 @@ public: this->vscroll = this->GetScrollbar(WID_VL_SCROLLBAR); /* Set up the window widgets */ - this->GetWidget(WID_VL_LIST)->tool_tip = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vli.vtype; + this->GetWidget(WID_VL_LIST)->SetToolTip(STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vli.vtype); NWidgetStacked *nwi = this->GetWidget(WID_VL_CAPTION_SELECTION); if (this->vli.type == VL_SHARED_ORDERS) { @@ -3082,7 +3082,7 @@ public: switch (v->type) { case VEH_TRAIN: - this->GetWidget(WID_VV_TURN_AROUND)->tool_tip = STR_VEHICLE_VIEW_TRAIN_REVERSE_TOOLTIP; + this->GetWidget(WID_VV_TURN_AROUND)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_REVERSE_TOOLTIP); break; case VEH_ROAD: @@ -3099,14 +3099,14 @@ public: this->owner = v->owner; this->GetWidget(WID_VV_VIEWPORT)->InitializeViewport(this, static_cast(this->window_number), ScaleZoomGUI(_vehicle_view_zoom_levels[v->type])); - this->GetWidget(WID_VV_START_STOP)->tool_tip = STR_VEHICLE_VIEW_TRAIN_STATUS_START_STOP_TOOLTIP + v->type; - this->GetWidget(WID_VV_RENAME)->tool_tip = STR_VEHICLE_DETAILS_TRAIN_RENAME + v->type; - this->GetWidget(WID_VV_LOCATION)->tool_tip = STR_VEHICLE_VIEW_TRAIN_CENTER_TOOLTIP + v->type; - this->GetWidget(WID_VV_REFIT)->tool_tip = STR_VEHICLE_VIEW_TRAIN_REFIT_TOOLTIP + v->type; - this->GetWidget(WID_VV_GOTO_DEPOT)->tool_tip = STR_VEHICLE_VIEW_TRAIN_SEND_TO_DEPOT_TOOLTIP + v->type; - this->GetWidget(WID_VV_SHOW_ORDERS)->tool_tip = STR_VEHICLE_VIEW_TRAIN_ORDERS_TOOLTIP + v->type; - this->GetWidget(WID_VV_SHOW_DETAILS)->tool_tip = STR_VEHICLE_VIEW_TRAIN_SHOW_DETAILS_TOOLTIP + v->type; - this->GetWidget(WID_VV_CLONE)->tool_tip = STR_VEHICLE_VIEW_CLONE_TRAIN_INFO + v->type; + this->GetWidget(WID_VV_START_STOP)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_STATUS_START_STOP_TOOLTIP + v->type); + this->GetWidget(WID_VV_RENAME)->SetToolTip(STR_VEHICLE_DETAILS_TRAIN_RENAME + v->type); + this->GetWidget(WID_VV_LOCATION)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_CENTER_TOOLTIP + v->type); + this->GetWidget(WID_VV_REFIT)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_REFIT_TOOLTIP + v->type); + this->GetWidget(WID_VV_GOTO_DEPOT)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_SEND_TO_DEPOT_TOOLTIP + v->type); + this->GetWidget(WID_VV_SHOW_ORDERS)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_ORDERS_TOOLTIP + v->type); + this->GetWidget(WID_VV_SHOW_DETAILS)->SetToolTip(STR_VEHICLE_VIEW_TRAIN_SHOW_DETAILS_TOOLTIP + v->type); + this->GetWidget(WID_VV_CLONE)->SetToolTip(STR_VEHICLE_VIEW_CLONE_TRAIN_INFO + v->type); this->UpdateButtonStatus(); } diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index ec75e9d8ce..7910d0634b 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -88,8 +88,8 @@ public: this->GetWidget(WID_W_SHOW_VEHICLES)->SetStringTip(STR_LORRY, STR_STATION_VIEW_SCHEDULED_ROAD_VEHICLES_TOOLTIP); } if (this->vt != VEH_SHIP) { - this->GetWidget(WID_W_CENTER_VIEW)->tool_tip = STR_WAYPOINT_VIEW_CENTER_TOOLTIP; - this->GetWidget(WID_W_RENAME)->tool_tip = STR_WAYPOINT_VIEW_CHANGE_WAYPOINT_NAME; + this->GetWidget(WID_W_CENTER_VIEW)->SetToolTip(STR_WAYPOINT_VIEW_CENTER_TOOLTIP); + this->GetWidget(WID_W_RENAME)->SetToolTip(STR_WAYPOINT_VIEW_CHANGE_WAYPOINT_NAME); } this->FinishInitNested(window_number); diff --git a/src/widget.cpp b/src/widget.cpp index f14d12dbc3..8ddd77ed6d 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -1116,7 +1116,7 @@ NWidgetCore::NWidgetCore(WidgetType tp, Colours colour, WidgetID index, uint fil { this->colour = colour; this->widget_data = widget_data; - this->tool_tip = tool_tip; + this->SetToolTip(tool_tip); this->scrollbar_index = -1; this->text_colour = tp == WWT_CAPTION ? TC_WHITE : TC_BLACK; this->text_size = FS_NORMAL; @@ -3115,7 +3115,7 @@ static void ApplyNWidgetPartAttribute(const NWidgetPart &nwid, NWidgetBase *dest NWidgetCore *nwc = dynamic_cast(dest); if (nwc == nullptr) [[unlikely]] throw std::runtime_error("WPT_DATATIP requires NWidgetCore"); nwc->widget_data = nwid.u.data_tip.data; - nwc->tool_tip = nwid.u.data_tip.tooltip; + nwc->SetToolTip(nwid.u.data_tip.tooltip); break; }