Changeset - r25322:7c46ca9b31ee
[Not reviewed]
master
0 2 0
Peter Nelson - 3 years ago 2021-04-08 08:02:38
peter1138@openttd.org
Cleanup: Call SetMinimalSize instead of setting min_y directly.
2 files changed with 9 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/widget.cpp
Show inline comments
 
@@ -2268,7 +2268,8 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, 
 
		case WWT_CAPTION:
 
			this->SetFill(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);
 
			break;
 

	
 
@@ -2310,7 +2311,7 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, 
 

	
 
		case WWT_DROPDOWN:
 
			this->SetFill(0, 0);
 
			this->min_y = WD_DROPDOWN_HEIGHT;
 
			this->SetMinimalSize(0, WD_DROPDOWN_HEIGHT);
 
			this->SetAlignment(SA_TOP | SA_LEFT);
 
			break;
 

	
src/widget_type.h
Show inline comments
 
@@ -251,7 +251,7 @@ public:
 
	void SetFill(uint fill_x, uint fill_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_y; ///< Minimal vertical size of only this widget.
 
@@ -470,8 +470,8 @@ class NWidgetHorizontal : public NWidget
 
public:
 
	NWidgetHorizontal(NWidContainerFlags flags = NC_NONE);
 

	
 
	void SetupSmallestSize(Window *w, bool init_array);
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl);
 
	void SetupSmallestSize(Window *w, bool init_array) override;
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
 
};
 

	
 
/**
 
@@ -482,7 +482,7 @@ class NWidgetHorizontalLTR : public NWid
 
public:
 
	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;
 
};
 

	
 
/**
 
@@ -493,8 +493,8 @@ class NWidgetVertical : public NWidgetPI
 
public:
 
	NWidgetVertical(NWidContainerFlags flags = NC_NONE);
 

	
 
	void SetupSmallestSize(Window *w, bool init_array);
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl);
 
	void SetupSmallestSize(Window *w, bool init_array) override;
 
	void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
 
};
 

	
 
/**
0 comments (0 inline, 0 general)