mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-05 00:36:57 +00:00
GUI: Set ScrollContainer single step to kLineHeight instead of 1 pixel
The single step is the amount of scroll done when clicking once on the scrollbar up or down arrow. It used to be 1 entry, but for the ScrollContainer 1 entry is 1 pixel, which was too litle. Now the single step can be set to a multiple entries.
This commit is contained in:
parent
f7a4b74130
commit
211ef61fdf
@ -47,6 +47,7 @@ ScrollBarWidget::ScrollBarWidget(GuiObject *boss, int x, int y, int w, int h)
|
||||
_numEntries = 0;
|
||||
_entriesPerPage = 0;
|
||||
_currentPos = 0;
|
||||
_singleStep = 1;
|
||||
|
||||
_repeatTimer = 0;
|
||||
}
|
||||
@ -60,12 +61,12 @@ void ScrollBarWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||
|
||||
if (y <= UP_DOWN_BOX_HEIGHT) {
|
||||
// Up arrow
|
||||
_currentPos--;
|
||||
_currentPos -= _singleStep;
|
||||
_repeatTimer = g_system->getMillis() + kRepeatInitialDelay;
|
||||
_draggingPart = kUpArrowPart;
|
||||
} else if (y >= _h - UP_DOWN_BOX_HEIGHT) {
|
||||
// Down arrow
|
||||
_currentPos++;
|
||||
_currentPos += _singleStep;
|
||||
_repeatTimer = g_system->getMillis() + kRepeatInitialDelay;
|
||||
_draggingPart = kDownArrowPart;
|
||||
} else if (y < _sliderPos) {
|
||||
@ -93,9 +94,9 @@ void ScrollBarWidget::handleMouseWheel(int x, int y, int direction) {
|
||||
return;
|
||||
|
||||
if (direction < 0) {
|
||||
_currentPos--;
|
||||
_currentPos -= _singleStep;
|
||||
} else {
|
||||
_currentPos++;
|
||||
_currentPos += _singleStep;
|
||||
}
|
||||
|
||||
// Make sure that _currentPos is still inside the bounds
|
||||
@ -146,9 +147,9 @@ void ScrollBarWidget::handleTickle() {
|
||||
const int old_pos = _currentPos;
|
||||
|
||||
if (_part == kUpArrowPart)
|
||||
_currentPos -= 3;
|
||||
_currentPos -= 3 * _singleStep;
|
||||
else if (_part == kDownArrowPart)
|
||||
_currentPos += 3;
|
||||
_currentPos += 3 * _singleStep;
|
||||
|
||||
checkBounds(old_pos);
|
||||
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
int _numEntries;
|
||||
int _entriesPerPage;
|
||||
int _currentPos;
|
||||
int _singleStep;
|
||||
|
||||
public:
|
||||
ScrollBarWidget(GuiObject *boss, int x, int y, int w, int h);
|
||||
|
@ -73,6 +73,7 @@ void ScrollContainerWidget::recalc() {
|
||||
_verticalScroll->_numEntries = h;
|
||||
_verticalScroll->_currentPos = _scrolledY;
|
||||
_verticalScroll->_entriesPerPage = _limitH;
|
||||
_verticalScroll->_singleStep = kLineHeight;
|
||||
_verticalScroll->setPos(_w - scrollbarWidth, _scrolledY+1);
|
||||
_verticalScroll->setSize(scrollbarWidth, _limitH -2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user