]> git.saurik.com Git - wxWidgets.git/blobdiff - src/stc/ScintillaWX.cpp
Up-ported code to make tree item visible when programmatically
[wxWidgets.git] / src / stc / ScintillaWX.cpp
index e652082bb95b0e2060cffdfa146bf50562ed8d36..30a896b9038e23101c679210c62bbc41d09b5269 100644 (file)
@@ -95,6 +95,7 @@ ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) {
     wMain = win;
     wDraw = win;
     stc   = win;
+    wheelRotation = 0;
     Initialise();
 }
 
@@ -363,6 +364,22 @@ void ScintillaWX::DoVScroll(int type, int pos) {
     ScrollTo(topLineNew);
 }
 
+
+void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction) {
+    int topLineNew = topLine;
+    int lines;
+
+    wheelRotation += rotation;
+    lines = wheelRotation / delta;
+    wheelRotation -= lines * delta;
+    if (lines != 0) {
+        lines *= linesPerAction;
+        topLineNew -= lines;
+        ScrollTo(topLineNew);
+    }
+}
+
+
 void ScintillaWX::DoSize(int width, int height) {
     PRectangle rcClient(0,0,width,height);
     SetScrollBarsTo(rcClient);