mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-31 11:23:21 +00:00
Add: Helper to update widget vertical size.
This avoids directly setting min_y outside widget code.
This commit is contained in:
parent
6830e5f5f7
commit
55d981aec3
@ -1134,6 +1134,18 @@ void NWidgetResizeBase::SetResize(uint resize_x, uint resize_y)
|
||||
this->resize_y = resize_y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set absolute (post-scaling) minimal size of the widget.
|
||||
* @param min_y Vertical minimal size of the widget.
|
||||
* @return true iff the widget minimum size has changed.
|
||||
*/
|
||||
bool NWidgetResizeBase::UpdateVerticalSize(uint min_y)
|
||||
{
|
||||
if (min_y == this->min_y) return false;
|
||||
this->min_y = min_y;
|
||||
return true;
|
||||
}
|
||||
|
||||
void NWidgetResizeBase::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
|
||||
{
|
||||
this->StoreSizePosition(sizing, x, y, given_width, given_height);
|
||||
|
@ -263,6 +263,8 @@ public:
|
||||
void SetFill(uint fill_x, uint fill_y);
|
||||
void SetResize(uint resize_x, uint resize_y);
|
||||
|
||||
bool UpdateVerticalSize(uint min_y);
|
||||
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user