From 3196e0709de3508f9db01ba4113f816f8cdb1c67 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Thu, 2 Jan 2025 11:49:59 +0100 Subject: [PATCH] Codechange: replace internal SetDataTips with appropriate variants --- src/framerate_gui.cpp | 2 +- src/graph_gui.cpp | 6 +++--- src/misc_gui.cpp | 2 +- src/newgrf_gui.cpp | 2 +- src/widget.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index 5da15f742f..d54550a3ca 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -462,7 +462,7 @@ struct FramerateWindow : Window { /* Check if the shaded state has changed, switch caption text if it has */ if (this->small != this->IsShaded()) { this->small = this->IsShaded(); - this->GetWidget(WID_FRW_CAPTION)->SetDataTip(this->small ? STR_FRAMERATE_CAPTION_SMALL : STR_FRAMERATE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS); + this->GetWidget(WID_FRW_CAPTION)->SetStringTip(this->small ? STR_FRAMERATE_CAPTION_SMALL : STR_FRAMERATE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS); this->UpdateData(); this->SetDirty(); } diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 33b2378fc2..06cdba6463 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -555,7 +555,7 @@ public: resize.width = 0; resize.height = 0; - this->GetWidget(WID_GRAPH_RANGE_MATRIX)->SetDataTip((1 << MAT_COL_START) | (static_cast(std::size(this->ranges)) << MAT_ROW_START), 0); + this->GetWidget(WID_GRAPH_RANGE_MATRIX)->SetMatrixDataTip(1, ClampTo(std::size(this->ranges)), STR_NULL); break; case WID_GRAPH_GRAPH: { @@ -1045,7 +1045,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { this->vscroll->SetCount(_sorted_standard_cargo_specs.size()); auto *wid = this->GetWidget(WID_GRAPH_FOOTER); - wid->SetDataTip(TimerGameEconomy::UsingWallclockUnits() ? STR_GRAPH_CARGO_PAYMENT_RATES_SECONDS: STR_GRAPH_CARGO_PAYMENT_RATES_DAYS, STR_NULL); + wid->SetStringTip(TimerGameEconomy::UsingWallclockUnits() ? STR_GRAPH_CARGO_PAYMENT_RATES_SECONDS: STR_GRAPH_CARGO_PAYMENT_RATES_DAYS, STR_NULL); /* Initialise the dataset */ this->UpdatePaymentRates(); @@ -1524,7 +1524,7 @@ struct IndustryProductionGraphWindow : BaseGraphWindow { this->vscroll->SetCount(count); auto *wid = this->GetWidget(WID_GRAPH_FOOTER); - wid->SetDataTip(TimerGameEconomy::UsingWallclockUnits() ? STR_GRAPH_LAST_24_MINUTES_TIME_LABEL : STR_EMPTY, STR_NULL); + wid->SetStringTip(TimerGameEconomy::UsingWallclockUnits() ? STR_GRAPH_LAST_24_MINUTES_TIME_LABEL : STR_EMPTY, STR_NULL); this->FinishInitNested(window_number); diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index e1f1864ae1..09fa15cc83 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -1082,7 +1082,7 @@ struct QueryWindow : public Window { this->parent = parent; this->CreateNestedTree(); - this->GetWidget(WID_Q_CAPTION)->SetDataTip(caption, STR_NULL); + this->GetWidget(WID_Q_CAPTION)->SetStringTip(caption, STR_NULL); this->FinishInitNested(WN_CONFIRM_POPUP_QUERY); } diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 109669fc4a..a73eb6d207 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -167,7 +167,7 @@ struct NewGRFParametersWindow : public Window { this->action14present = (c->num_valid_params != c->param.size() || !c->param_info.empty()); this->CreateNestedTree(); - this->GetWidget(WID_NP_CAPTION)->SetDataTip(is_baseset ? STR_BASEGRF_PARAMETERS_CAPTION : STR_NEWGRF_PARAMETERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS); + this->GetWidget(WID_NP_CAPTION)->SetStringTip(is_baseset ? STR_BASEGRF_PARAMETERS_CAPTION : STR_NEWGRF_PARAMETERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS); this->vscroll = this->GetScrollbar(WID_NP_SCROLLBAR); this->GetWidget(WID_NP_SHOW_NUMPAR)->SetDisplayedPlane(this->action14present ? SZSP_HORIZONTAL : 0); this->GetWidget(WID_NP_SHOW_DESCRIPTION)->SetDisplayedPlane(this->action14present ? 0 : SZSP_HORIZONTAL); diff --git a/src/widget.cpp b/src/widget.cpp index 5976339ceb..f14d12dbc3 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -2668,7 +2668,7 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, Colours colour, WidgetID index, uint32_t this->SetResize(1, 0); this->SetMinimalSize(0, WidgetDimensions::WD_CAPTION_HEIGHT); this->SetMinimalTextLines(1, WidgetDimensions::unscaled.captiontext.Vertical(), FS_NORMAL); - this->SetDataTip(data, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS); + this->SetToolTip(STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS); break; case WWT_STICKYBOX: