Index: Common/vtkCommand.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Common/vtkCommand.cxx,v
retrieving revision 1.29
diff -u -3 -p -r1.29 vtkCommand.cxx
--- Common/vtkCommand.cxx	14 Nov 2003 20:43:23 -0000	1.29
+++ Common/vtkCommand.cxx	23 Jan 2004 17:36:30 -0000
@@ -45,6 +45,8 @@ static const char *vtkCommandEventString
   "ConfigureEvent",
   "TimerEvent",
   "MouseMoveEvent",
+  "MouseWheelForwardEvent",
+  "MouseWheelBackwardEvent",
   "ResetCameraEvent",
   "ResetCameraClippingRangeEvent",
   "ModifiedEvent",
Index: Common/vtkCommand.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Common/vtkCommand.h,v
retrieving revision 1.44
diff -u -3 -p -r1.44 vtkCommand.h
--- Common/vtkCommand.h	14 Nov 2003 20:43:23 -0000	1.44
+++ Common/vtkCommand.h	23 Jan 2004 17:36:30 -0000
@@ -125,6 +125,8 @@ public:
     ConfigureEvent,
     TimerEvent,
     MouseMoveEvent,
+    MouseWheelForwardEvent,
+    MouseWheelBackwardEvent,
     ResetCameraEvent,
     ResetCameraClippingRangeEvent,
     ModifiedEvent,
Index: Rendering/vtkCarbonRenderWindowInteractor.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkCarbonRenderWindowInteractor.cxx,v
retrieving revision 1.8
diff -u -3 -p -r1.8 vtkCarbonRenderWindowInteractor.cxx
--- Rendering/vtkCarbonRenderWindowInteractor.cxx	8 Jan 2004 14:27:46 -0000	1.8
+++ Rendering/vtkCarbonRenderWindowInteractor.cxx	23 Jan 2004 17:36:31 -0000
@@ -234,6 +234,28 @@ static pascal OSStatus myWinEvtHndlr(Eve
           result = noErr;
           break;
           }
+        case kEventMouseWheelMoved:
+          {
+          EventMouseWheelAxis axis;
+          SInt32 delta;
+          GetEventParameter( event, kEventParamMouseWheelAxis, 
+                         typeMouseWheelAxis, NULL, sizeof(axis), NULL, &axis );
+          GetEventParameter( event, kEventParamMouseWheelDelta, 
+                          typeLongInteger, NULL, sizeof(delta), NULL, &delta );
+          if ( axis == kEventMouseWheelAxisY )
+            {
+             if( delta > 0)
+              {
+              me->InvokeEvent(vtkCommand::MouseWheelForwardEvent, NULL);
+              }
+            else
+              {
+              me->InvokeEvent(vtkCommand::MouseWheelBackwardEvent, NULL);
+              }
+            }
+          result = noErr;
+          break;
+          }
         default:
           {
           result = noErr;
@@ -330,6 +352,7 @@ void vtkCarbonRenderWindowInteractor::En
                             { kEventClassMouse, kEventMouseUp },
                             { kEventClassMouse, kEventMouseMoved },
                             { kEventClassMouse, kEventMouseDragged },
+                            { kEventClassMouse, kEventMouseWheelMoved },
                             { kEventClassKeyboard, kEventRawKeyDown },
                             { kEventClassKeyboard, kEventRawKeyRepeat },
                             { kEventClassKeyboard, kEventRawKeyUp }};
Index: Rendering/vtkCocoaGLView.mm
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkCocoaGLView.mm,v
retrieving revision 1.6
diff -u -3 -p -r1.6 vtkCocoaGLView.mm
--- Rendering/vtkCocoaGLView.mm	17 Apr 2003 13:13:46 -0000	1.6
+++ Rendering/vtkCocoaGLView.mm	23 Jan 2004 17:36:31 -0000
@@ -129,6 +129,24 @@
 }
 
 
+- (void)scrollWheel:(NSEvent *)theEvent {
+    NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
+    int shiftDown = ([theEvent modifierFlags] & NSShiftKeyMask);
+    int controlDown = ([theEvent modifierFlags] & NSControlKeyMask);
+
+    myVTKRenderWindowInteractor->SetEventInformation((int)mouseLoc.x, (int)mouseLoc.y, 
+					             controlDown, shiftDown);
+    if( [theEvent deltaY] > 0)
+      {
+      myVTKRenderWindowInteractor->InvokeEvent(vtkCommand::MouseWheelForwardEvent, NULL);
+      }
+    else
+      {
+      myVTKRenderWindowInteractor->InvokeEvent(vtkCommand::MouseWheelBackwardEvent, NULL);
+      }
+}
+
+
 - (void)mouseDown:(NSEvent *)theEvent {
     BOOL keepOn = YES;
     NSPoint mouseLoc;
Index: Rendering/vtkGenericRenderWindowInteractor.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkGenericRenderWindowInteractor.cxx,v
retrieving revision 1.5
diff -u -3 -p -r1.5 vtkGenericRenderWindowInteractor.cxx
--- Rendering/vtkGenericRenderWindowInteractor.cxx	14 Nov 2003 20:43:37 -0000	1.5
+++ Rendering/vtkGenericRenderWindowInteractor.cxx	23 Jan 2004 17:36:31 -0000
@@ -87,6 +87,24 @@ void vtkGenericRenderWindowInteractor::M
   this->InvokeEvent(vtkCommand::MiddleButtonReleaseEvent, NULL);
 }
 
+void vtkGenericRenderWindowInteractor::MouseWheelForwardEvent()
+{
+  if (!this->Enabled) 
+    {
+    return;
+    }
+  this->InvokeEvent(vtkCommand::MouseWheelForwardEvent, NULL);
+}
+
+void vtkGenericRenderWindowInteractor::MouseWheelBackwardEvent()
+{
+  if (!this->Enabled) 
+    {
+    return;
+    }
+  this->InvokeEvent(vtkCommand::MouseWheelBackwardEvent, NULL);
+}
+
 void vtkGenericRenderWindowInteractor::ExposeEvent()
 {
   if (!this->Enabled) 
Index: Rendering/vtkGenericRenderWindowInteractor.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkGenericRenderWindowInteractor.h,v
retrieving revision 1.4
diff -u -3 -p -r1.4 vtkGenericRenderWindowInteractor.h
--- Rendering/vtkGenericRenderWindowInteractor.h	14 Nov 2003 20:43:37 -0000	1.4
+++ Rendering/vtkGenericRenderWindowInteractor.h	23 Jan 2004 17:36:31 -0000
@@ -45,6 +45,8 @@ public:
   virtual void LeftButtonReleaseEvent();
   virtual void MiddleButtonPressEvent();
   virtual void MiddleButtonReleaseEvent();
+  virtual void MouseWheelForwardEvent();
+  virtual void MouseWheelBackwardEvent();
   virtual void ExposeEvent();
   virtual void ConfigureEvent();
   virtual void EnterEvent();
Index: Rendering/vtkWin32RenderWindowInteractor.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkWin32RenderWindowInteractor.cxx,v
retrieving revision 1.85
diff -u -3 -p -r1.85 vtkWin32RenderWindowInteractor.cxx
--- Rendering/vtkWin32RenderWindowInteractor.cxx	14 Nov 2003 20:43:38 -0000	1.85
+++ Rendering/vtkWin32RenderWindowInteractor.cxx	23 Jan 2004 17:36:31 -0000
@@ -19,6 +19,16 @@
 
 #include "vtkWin32OpenGLRenderWindow.h"
 
+// Mouse wheel support
+// In an ideal world we would just have to include <zmouse.h>, but it is not
+// always available with all compilers/headers
+#ifndef WM_MOUSEWHEEL
+#  define WM_MOUSEWHEEL                   0x020A
+#endif  //WM_MOUSEWHEEL
+#ifndef GET_WHEEL_DELTA_WPARAM
+#  define GET_WHEEL_DELTA_WPARAM(wparam) ((short)HIWORD (wparam))
+#endif  //GET_WHEEL_DELTA_WPARAM
+
 // MSVC does the right thing without the forward declaration when it 
 // sees it in the friend decl in vtkWin32RenderWindowInteractor, but
 // GCC needs to see the declaration beforehand. It has to do with the
@@ -350,6 +360,34 @@ void vtkWin32RenderWindowInteractor::OnN
     }
 }
 
+void vtkWin32RenderWindowInteractor::OnMouseWheelForward(HWND wnd,UINT nFlags, 
+                                                   int X, int Y) 
+{
+  if (!this->Enabled) 
+    {
+    return;
+    }
+  this->SetEventInformationFlipY(X, 
+                                 Y, 
+                                 nFlags & MK_CONTROL, 
+                                 nFlags & MK_SHIFT);
+  this->InvokeEvent(vtkCommand::MouseWheelForwardEvent,NULL);
+}
+
+void vtkWin32RenderWindowInteractor::OnMouseWheelBackward(HWND wnd,UINT nFlags, 
+                                                   int X, int Y) 
+{
+  if (!this->Enabled) 
+    {
+    return;
+    }
+  this->SetEventInformationFlipY(X, 
+                                 Y, 
+                                 nFlags & MK_CONTROL, 
+                                 nFlags & MK_SHIFT);
+  this->InvokeEvent(vtkCommand::MouseWheelBackwardEvent,NULL);
+}
+
 void vtkWin32RenderWindowInteractor::OnLButtonDown(HWND wnd,UINT nFlags, 
                                                    int X, int Y) 
 {
@@ -622,6 +660,13 @@ LRESULT CALLBACK vtkHandleMessage2(HWND 
       me->OnMouseMove(hWnd,wParam,MAKEPOINTS(lParam).x,MAKEPOINTS(lParam).y);
       break;
 
+    case WM_MOUSEWHEEL:
+      if( GET_WHEEL_DELTA_WPARAM(wParam) > 0)
+        me->OnMouseWheelForward(hWnd,wParam,MAKEPOINTS(lParam).x,MAKEPOINTS(lParam).y);
+      else
+        me->OnMouseWheelBackward(hWnd,wParam,MAKEPOINTS(lParam).x,MAKEPOINTS(lParam).y);
+      break;
+      
 #ifdef WM_MCVMOUSEMOVE
     case WM_NCMOUSEMOVE:
       me->OnNCMouseMove(hWnd,wParam,MAKEPOINTS(lParam).x,MAKEPOINTS(lParam).y);
Index: Rendering/vtkWin32RenderWindowInteractor.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkWin32RenderWindowInteractor.h,v
retrieving revision 1.44
diff -u -3 -p -r1.44 vtkWin32RenderWindowInteractor.h
--- Rendering/vtkWin32RenderWindowInteractor.h	14 Nov 2003 20:43:38 -0000	1.44
+++ Rendering/vtkWin32RenderWindowInteractor.h	23 Jan 2004 17:36:31 -0000
@@ -99,6 +99,8 @@ public:
   virtual void OnKeyDown    (HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
   virtual void OnKeyUp      (HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
   virtual void OnChar       (HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
+  virtual void OnMouseWheelForward (HWND wnd, UINT nFlags, int X, int Y);
+  virtual void OnMouseWheelBackward(HWND wnd, UINT nFlags, int X, int Y);
   //ETX
 
   // Description:
Index: Rendering/vtkXRenderWindowInteractor.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkXRenderWindowInteractor.cxx,v
retrieving revision 1.111
diff -u -3 -p -r1.111 vtkXRenderWindowInteractor.cxx
--- Rendering/vtkXRenderWindowInteractor.cxx	14 Nov 2003 20:43:38 -0000	1.111
+++ Rendering/vtkXRenderWindowInteractor.cxx	23 Jan 2004 17:36:31 -0000
@@ -512,6 +512,12 @@ void vtkXRenderWindowInteractorCallback(
         case Button3: 
           me->InvokeEvent(vtkCommand::RightButtonPressEvent,NULL);
           break;
+        case Button4: 
+          me->InvokeEvent(vtkCommand::MouseWheelForwardEvent,NULL);
+          break;
+        case Button5: 
+          me->InvokeEvent(vtkCommand::MouseWheelBackwardEvent,NULL);
+          break;
         }
       }
       break;
Index: Rendering/vtkXRenderWindowTclInteractor.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkXRenderWindowTclInteractor.cxx,v
retrieving revision 1.46
diff -u -3 -p -r1.46 vtkXRenderWindowTclInteractor.cxx
--- Rendering/vtkXRenderWindowTclInteractor.cxx	7 Jan 2004 19:11:44 -0000	1.46
+++ Rendering/vtkXRenderWindowTclInteractor.cxx	23 Jan 2004 17:36:31 -0000
@@ -384,6 +384,12 @@ void vtkXRenderWindowTclInteractorCallba
         case Button3: 
           me->InvokeEvent(vtkCommand::RightButtonPressEvent, NULL);
           break;
+        case Button4: 
+          me->InvokeEvent(vtkCommand::MouseWheelForwardEvent, NULL);
+          break;
+        case Button5: 
+          me->InvokeEvent(vtkCommand::MouseWheelBackwardEvent, NULL);
+          break;
         }
       }
       break;

