Cleanup: Set unchanging scrollbar properties in constructor.
(cherry picked from commit 6fe5353da2
)
This commit is contained in:

committed by
Jonathan G Rennison

parent
1a4a6f579e
commit
43a3a233df
@@ -2174,6 +2174,22 @@ NWidgetScrollbar::NWidgetScrollbar(WidgetType tp, Colours colour, int index) : N
|
|||||||
{
|
{
|
||||||
assert(tp == NWID_HSCROLLBAR || tp == NWID_VSCROLLBAR);
|
assert(tp == NWID_HSCROLLBAR || tp == NWID_VSCROLLBAR);
|
||||||
this->SetIndex(index);
|
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)
|
void NWidgetScrollbar::SetupSmallestSize(Window *w, bool init_array)
|
||||||
@@ -2188,16 +2204,10 @@ void NWidgetScrollbar::SetupSmallestSize(Window *w, bool init_array)
|
|||||||
switch (this->type) {
|
switch (this->type) {
|
||||||
case NWID_HSCROLLBAR:
|
case NWID_HSCROLLBAR:
|
||||||
this->SetMinimalSize(NWidgetScrollbar::GetHorizontalDimension().width * 3, NWidgetScrollbar::GetHorizontalDimension().height);
|
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;
|
break;
|
||||||
|
|
||||||
case NWID_VSCROLLBAR:
|
case NWID_VSCROLLBAR:
|
||||||
this->SetMinimalSize(NWidgetScrollbar::GetVerticalDimension().width, NWidgetScrollbar::GetVerticalDimension().height * 3);
|
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;
|
break;
|
||||||
|
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
|
Reference in New Issue
Block a user