Changeset - r25323:dc80da3cdc0a
[Not reviewed]
master
0 1 0
Peter Nelson - 3 years ago 2021-04-22 01:13:55
peter1138@openttd.org
Cleanup: Set unchanging scrollbar properties in constructor.
1 file changed with 16 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/widget.cpp
Show inline comments
 
@@ -2108,6 +2108,22 @@ NWidgetScrollbar::NWidgetScrollbar(Widge
 
{
 
	assert(tp == NWID_HSCROLLBAR || tp == NWID_VSCROLLBAR);
 
	this->SetIndex(index);
 

	
 
	switch (this->type) {
 
		case NWID_HSCROLLBAR:
 
			this->SetResize(1, 0);
 
			this->SetFill(1, 0);
 
			this->SetDataTip(0x0, STR_TOOLTIP_HSCROLL_BAR_SCROLLS_LIST);
 
			break;
 

	
 
		case NWID_VSCROLLBAR:
 
			this->SetResize(0, 1);
 
			this->SetFill(0, 1);
 
			this->SetDataTip(0x0, STR_TOOLTIP_VSCROLL_BAR_SCROLLS_LIST);
 
			break;
 

	
 
		default: NOT_REACHED();
 
	}
 
}
 

	
 
void NWidgetScrollbar::SetupSmallestSize(Window *w, bool init_array)
 
@@ -2122,16 +2138,10 @@ void NWidgetScrollbar::SetupSmallestSize
 
	switch (this->type) {
 
		case NWID_HSCROLLBAR:
 
			this->SetMinimalSize(NWidgetScrollbar::GetHorizontalDimension().width * 3, NWidgetScrollbar::GetHorizontalDimension().height);
 
			this->SetResize(1, 0);
 
			this->SetFill(1, 0);
 
			this->SetDataTip(0x0, STR_TOOLTIP_HSCROLL_BAR_SCROLLS_LIST);
 
			break;
 

	
 
		case NWID_VSCROLLBAR:
 
			this->SetMinimalSize(NWidgetScrollbar::GetVerticalDimension().width, NWidgetScrollbar::GetVerticalDimension().height * 3);
 
			this->SetResize(0, 1);
 
			this->SetFill(0, 1);
 
			this->SetDataTip(0x0, STR_TOOLTIP_VSCROLL_BAR_SCROLLS_LIST);
 
			break;
 

	
 
		default: NOT_REACHED();
0 comments (0 inline, 0 general)