diff options
-rw-r--r-- | gui/widgets/scrollbar.cpp | 13 | ||||
-rw-r--r-- | gui/widgets/scrollbar.h | 1 | ||||
-rw-r--r-- | gui/widgets/scrollcontainer.cpp | 1 |
3 files changed, 9 insertions, 6 deletions
diff --git a/gui/widgets/scrollbar.cpp b/gui/widgets/scrollbar.cpp index 38cdc6fda6..c45b4e0ec5 100644 --- a/gui/widgets/scrollbar.cpp +++ b/gui/widgets/scrollbar.cpp @@ -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); diff --git a/gui/widgets/scrollbar.h b/gui/widgets/scrollbar.h index a1181b9e6c..9fdc94c396 100644 --- a/gui/widgets/scrollbar.h +++ b/gui/widgets/scrollbar.h @@ -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); diff --git a/gui/widgets/scrollcontainer.cpp b/gui/widgets/scrollcontainer.cpp index 33f7e7f754..3c2e7aae32 100644 --- a/gui/widgets/scrollcontainer.cpp +++ b/gui/widgets/scrollcontainer.cpp @@ -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); } |