forked from mirror/OpenTTD
(svn r17365) -Codechange: introduce wrapper functions to update the position, capacity and count of scroll bars. This to (eventually) prevent the scrollbar overflowing outside of the window
This commit is contained in:
@@ -2635,10 +2635,7 @@ int PositionMainToolbar(Window *w)
|
||||
*/
|
||||
void SetVScrollCount(Window *w, int num)
|
||||
{
|
||||
w->vscroll.count = num;
|
||||
num -= w->vscroll.cap;
|
||||
if (num < 0) num = 0;
|
||||
if (num < w->vscroll.pos) w->vscroll.pos = num;
|
||||
w->vscroll.SetCount(num);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2650,10 +2647,7 @@ void SetVScrollCount(Window *w, int num)
|
||||
*/
|
||||
void SetVScroll2Count(Window *w, int num)
|
||||
{
|
||||
w->vscroll2.count = num;
|
||||
num -= w->vscroll2.cap;
|
||||
if (num < 0) num = 0;
|
||||
if (num < w->vscroll2.pos) w->vscroll2.pos = num;
|
||||
w->vscroll2.SetCount(num);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2665,10 +2659,7 @@ void SetVScroll2Count(Window *w, int num)
|
||||
*/
|
||||
void SetHScrollCount(Window *w, int num)
|
||||
{
|
||||
w->hscroll.count = num;
|
||||
num -= w->hscroll.cap;
|
||||
if (num < 0) num = 0;
|
||||
if (num < w->hscroll.pos) w->hscroll.pos = num;
|
||||
w->hscroll.SetCount(num);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user