Cleanup: Call SetMinimalSize instead of setting min_y directly.

(cherry picked from commit 03a43b8247)
This commit is contained in:
Peter Nelson 2021-04-08 09:02:38 +01:00 committed by Jonathan G Rennison
parent 23938cb583
commit 1a4a6f579e
2 changed files with 9 additions and 8 deletions

View File

@ -2337,7 +2337,8 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, Colours colour, int index, uint32 data,
case WWT_CAPTION: case WWT_CAPTION:
this->SetFill(1, 0); this->SetFill(1, 0);
this->SetResize(1, 0); this->SetResize(1, 0);
this->min_y = WD_CAPTION_HEIGHT; this->SetMinimalSize(0, WD_CAPTION_HEIGHT);
this->SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM, FS_NORMAL);
this->SetDataTip(data, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS); this->SetDataTip(data, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS);
break; break;
@ -2379,7 +2380,7 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, Colours colour, int index, uint32 data,
case WWT_DROPDOWN: case WWT_DROPDOWN:
this->SetFill(0, 0); this->SetFill(0, 0);
this->min_y = WD_DROPDOWN_HEIGHT; this->SetMinimalSize(0, WD_DROPDOWN_HEIGHT);
this->SetAlignment(SA_TOP | SA_LEFT); this->SetAlignment(SA_TOP | SA_LEFT);
break; break;

View File

@ -271,7 +271,7 @@ public:
void SetFill(uint fill_x, uint fill_y); void SetFill(uint fill_x, uint fill_y);
void SetResize(uint resize_x, uint resize_y); void SetResize(uint resize_x, uint resize_y);
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl); void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
uint min_x; ///< Minimal horizontal size of only this widget. uint min_x; ///< Minimal horizontal size of only this widget.
uint min_y; ///< Minimal vertical size of only this widget. uint min_y; ///< Minimal vertical size of only this widget.
@ -493,8 +493,8 @@ class NWidgetHorizontal : public NWidgetPIPContainer {
public: public:
NWidgetHorizontal(NWidContainerFlags flags = NC_NONE); NWidgetHorizontal(NWidContainerFlags flags = NC_NONE);
void SetupSmallestSize(Window *w, bool init_array); void SetupSmallestSize(Window *w, bool init_array) override;
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl); void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
}; };
/** /**
@ -505,7 +505,7 @@ class NWidgetHorizontalLTR : public NWidgetHorizontal {
public: public:
NWidgetHorizontalLTR(NWidContainerFlags flags = NC_NONE); NWidgetHorizontalLTR(NWidContainerFlags flags = NC_NONE);
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl); void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
}; };
/** /**
@ -516,8 +516,8 @@ class NWidgetVertical : public NWidgetPIPContainer {
public: public:
NWidgetVertical(NWidContainerFlags flags = NC_NONE); NWidgetVertical(NWidContainerFlags flags = NC_NONE);
void SetupSmallestSize(Window *w, bool init_array); void SetupSmallestSize(Window *w, bool init_array) override;
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl); void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
}; };
/** /**