aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Crozat2018-07-23 23:36:37 +0100
committerThierry Crozat2018-07-24 00:27:11 +0100
commit211ef61fdf1f833267788511d5bcb354db78ee45 (patch)
tree6f55979a3e3f53c3e1f772e2d6602dda61296bcd
parentf7a4b74130fa1f02c64811dd4d14f257512e861b (diff)
downloadscummvm-rg350-211ef61fdf1f833267788511d5bcb354db78ee45.tar.gz
scummvm-rg350-211ef61fdf1f833267788511d5bcb354db78ee45.tar.bz2
scummvm-rg350-211ef61fdf1f833267788511d5bcb354db78ee45.zip
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.
-rw-r--r--gui/widgets/scrollbar.cpp13
-rw-r--r--gui/widgets/scrollbar.h1
-rw-r--r--gui/widgets/scrollcontainer.cpp1
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);
}