Changeset - r28163:b65cb15e804c
[Not reviewed]
master
0 2 0
Peter Nelson - 11 months ago 2023-11-20 22:24:34
peter1138@openttd.org
Codechange: Add method to resize both width and height of a widget.
2 files changed with 17 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/widget.cpp
Show inline comments
 
@@ -1158,6 +1158,22 @@ void NWidgetResizeBase::SetResize(uint r
 

	
 
/**
 
 * Set absolute (post-scaling) minimal size of the widget.
 
 * The window will need to be reinited if the size is changed.
 
 * @param min_x Horizontal 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::UpdateSize(uint min_x, uint min_y)
 
{
 
	if (min_x == this->min_x && min_y == this->min_y) return false;
 
	this->min_x = min_x;
 
	this->min_y = min_y;
 
	return true;
 
}
 

	
 
/**
 
 * Set absolute (post-scaling) minimal size of the widget.
 
 * The window will need to be reinited if the size is changed.
 
 * @param min_y Vertical minimal size of the widget.
 
 * @return true iff the widget minimum size has changed.
 
 */
src/widget_type.h
Show inline comments
 
@@ -262,6 +262,7 @@ public:
 
	void SetFill(uint fill_x, uint fill_y);
 
	void SetResize(uint resize_x, uint resize_y);
 

	
 
	bool UpdateSize(uint min_x, uint min_y);
 
	bool UpdateVerticalSize(uint min_y);
 

	
 
	void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
0 comments (0 inline, 0 general)