1
0
Fork 0

Codechange: remove (unused) tooltip from function to set matrix dimensions

pull/13254/head
Rubidium 2025-01-03 11:50:04 +01:00 committed by rubidium42
parent 3ecd1187ba
commit c972a9ae1f
4 changed files with 13 additions and 3 deletions

View File

@ -286,7 +286,7 @@ struct DepotWindow : Window {
/* Don't show 'rename button' of aircraft hangar */
this->GetWidget<NWidgetStacked>(WID_D_SHOW_RENAME)->SetDisplayedPlane(type == VEH_AIRCRAFT ? SZSP_NONE : 0);
/* Only train depots have a horizontal scrollbar and a 'sell chain' button */
if (type == VEH_TRAIN) this->GetWidget<NWidgetCore>(WID_D_MATRIX)->widget_data = 1 << MAT_COL_START;
if (type == VEH_TRAIN) this->GetWidget<NWidgetCore>(WID_D_MATRIX)->SetMatrixDimension(1, 0 /* auto-scale */);
this->GetWidget<NWidgetStacked>(WID_D_SHOW_H_SCROLL)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_HORIZONTAL);
this->GetWidget<NWidgetStacked>(WID_D_SHOW_SELL_CHAIN)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_NONE);
this->SetupWidgetData(type);

View File

@ -555,7 +555,7 @@ public:
resize.width = 0;
resize.height = 0;
this->GetWidget<NWidgetCore>(WID_GRAPH_RANGE_MATRIX)->SetMatrixDataTip(1, ClampTo<uint8_t>(std::size(this->ranges)), STR_NULL);
this->GetWidget<NWidgetCore>(WID_GRAPH_RANGE_MATRIX)->SetMatrixDimension(1, ClampTo<uint8_t>(std::size(this->ranges)));
break;
case WID_GRAPH_GRAPH: {

View File

@ -1174,6 +1174,16 @@ void NWidgetCore::SetSpriteTip(SpriteID sprite, StringID tool_tip)
this->SetToolTip(tool_tip);
}
/**
* Set the matrix dimension.
* @param columns The number of columns in the matrix (0 for autoscaling).
* @param rows The number of rows in the matrix (0 for autoscaling).
*/
void NWidgetCore::SetMatrixDimension(uint8_t columns, uint8_t rows)
{
this->widget_data = static_cast<uint32_t>((rows << MAT_ROW_START) | (columns << MAT_COL_START));
}
/**
* Set the text style of the nested widget.
* @param colour TextColour to use.

View File

@ -377,7 +377,7 @@ public:
void SetStringTip(StringID string, StringID tool_tip);
void SetSprite(SpriteID sprite);
void SetSpriteTip(SpriteID sprite, StringID tool_tip);
void SetMatrixDataTip(uint8_t cols, uint8_t rows, StringID tip) { this->SetDataTip(static_cast<uint32_t>((rows << MAT_ROW_START) | (cols << MAT_COL_START)), tip); }
void SetMatrixDimension(uint8_t columns, uint8_t rows);
void SetToolTip(StringID tool_tip);
StringID GetToolTip() const;
void SetTextStyle(TextColour colour, FontSize size);