diff options
Diffstat (limited to 'engines/bladerunner/ui/ui_scroll_box.cpp')
-rw-r--r-- | engines/bladerunner/ui/ui_scroll_box.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/engines/bladerunner/ui/ui_scroll_box.cpp b/engines/bladerunner/ui/ui_scroll_box.cpp index 39e4174fa3..15b0a59712 100644 --- a/engines/bladerunner/ui/ui_scroll_box.cpp +++ b/engines/bladerunner/ui/ui_scroll_box.cpp @@ -71,6 +71,7 @@ UIScrollBox::UIScrollBox(BladeRunnerEngine *vm, UIScrollBoxCallback *lineSelecte _rect = rect; _scrollBarRect = scrollBarRect; + _scrollBarRect.right += 15; // right side was not used, but it's useful for determining if the control is selected _lineCount = 0; _maxLineCount = maxLineCount; @@ -89,6 +90,8 @@ UIScrollBox::UIScrollBox(BladeRunnerEngine *vm, UIScrollBoxCallback *lineSelecte _lines[i]->flags = 0x00; _lines[i]->checkboxFrame = 5; } + + _mouseOver = false; } UIScrollBox::~UIScrollBox() { @@ -120,6 +123,8 @@ void UIScrollBox::show() { _highlightFrame = 0; _isVisible = true; + + _mouseOver = false; } void UIScrollBox::hide() { @@ -157,6 +162,8 @@ void UIScrollBox::handleMouseMove(int mouseX, int mouseY) { return; } + _mouseOver = _rect.contains(mouseX, mouseY) || _scrollBarRect.contains(mouseX, mouseY); + if (_rect.contains(mouseX, mouseY)) { int newHoveredLine = (mouseY - _rect.top) / 10 + _firstLineVisible; if (newHoveredLine >= _lineCount) { @@ -314,6 +321,16 @@ void UIScrollBox::handleMouseUp(bool alternateButton) { } } +void UIScrollBox::handleMouseScroll(int direction) { + if (_mouseOver) { + if (direction > 0) { + scrollDown(); + } else if (direction < 0) { + scrollUp(); + } + } +} + int UIScrollBox::getSelectedLineData() { if (_hoveredLine >= 0 && _selectedLineState != 1 && _hoveredLine < _lineCount) { return _lines[_hoveredLine]->lineData; |