changeset 17023:c0f6f17bb6d7 draft

(svn r21760) -Fix (r20452): Restore wheeling of vertical scrollbars.
author alberth <alberth@openttd.org>
date Sun, 09 Jan 2011 15:36:02 +0000
parents 9ffd66619632
children c4fbdc0bb51d
files src/window.cpp
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -442,7 +442,7 @@
  * @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 @@
 		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()) {