summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2011-01-09 15:36:02 +0000
committeralberth <alberth@openttd.org>2011-01-09 15:36:02 +0000
commit352fd000eaae16e79b5d9f4ca6081e778d9ec4e8 (patch)
treedc9135b1d992e51275fad4a9fe556ef59b236eda
parentf5364269b550c59b7d1a80999f2d4bb862327ca2 (diff)
downloadopenttd-352fd000eaae16e79b5d9f4ca6081e778d9ec4e8.tar.xz
(svn r21760) -Fix (r20452): Restore wheeling of vertical scrollbars.
-rw-r--r--src/window.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 4dca8403a..568b1814b 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -442,7 +442,7 @@ static void DispatchHoverEvent(Window *w, int x, int y)
* @param nwid the widget where the scrollwheel was used
* @param wheel scroll up or down
*/
-static void DispatchMouseWheelEvent(Window *w, const NWidgetCore *nwid, int wheel)
+static void DispatchMouseWheelEvent(Window *w, NWidgetCore *nwid, int wheel)
{
if (nwid == NULL) return;
@@ -452,6 +452,16 @@ static void DispatchMouseWheelEvent(Window *w, const NWidgetCore *nwid, int whee
return;
}
+ /* Wheeling a vertical scrollbar. */
+ if (nwid->type == NWID_VSCROLLBAR) {
+ NWidgetScrollbar *sb = static_cast<NWidgetScrollbar *>(nwid);
+ if (sb->GetCount() > sb->GetCapacity()) {
+ sb->UpdatePosition(wheel);
+ w->SetDirty();
+ }
+ return;
+ }
+
/* Scroll the widget attached to the scrollbar. */
Scrollbar *sb = (nwid->scrollbar_index >= 0 ? w->GetScrollbar(nwid->scrollbar_index) : NULL);
if (sb != NULL && sb->GetCount() > sb->GetCapacity()) {