VTK
dox/Rendering/OpenGL/vtkWin32RenderWindowInteractor.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkWin32RenderWindowInteractor.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00035 #ifndef __vtkWin32RenderWindowInteractor_h
00036 #define __vtkWin32RenderWindowInteractor_h
00037 
00038 #include "vtkRenderingOpenGLModule.h" // For export macro
00039 #include "vtkRenderWindowInteractor.h"
00040 #include "vtkWindows.h" // For windows API.
00041 
00042 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
00043 #ifdef VTK_USE_TDX
00044 class vtkTDxWinDevice;
00045 #endif
00046 
00047 class VTKRENDERINGOPENGL_EXPORT vtkWin32RenderWindowInteractor : public vtkRenderWindowInteractor
00048 {
00049 public:
00051   static vtkWin32RenderWindowInteractor *New();
00052 
00053   vtkTypeMacro(vtkWin32RenderWindowInteractor,vtkRenderWindowInteractor);
00054   void PrintSelf(ostream& os, vtkIndent indent);
00055 
00057   virtual void Initialize();
00058 
00060 
00067   virtual void Enable();
00068   virtual void Disable();
00070 
00074   virtual void Start();
00075 
00077 
00082   vtkSetMacro(InstallMessageProc,int);
00083   vtkGetMacro(InstallMessageProc,int);
00084   vtkBooleanMacro(InstallMessageProc,int);
00086 
00091   void TerminateApp(void);
00092 
00093   //BTX
00094   friend VTKRENDERINGOPENGL_EXPORT LRESULT CALLBACK vtkHandleMessage(HWND hwnd,UINT uMsg, WPARAM w, LPARAM l);
00095   friend VTKRENDERINGOPENGL_EXPORT LRESULT CALLBACK vtkHandleMessage2(HWND hwnd,UINT uMsg, WPARAM w, LPARAM l, vtkWin32RenderWindowInteractor *me);
00096 
00098 
00100   virtual void OnMouseMove  (HWND wnd, UINT nFlags, int X, int Y);
00101   virtual void OnNCMouseMove(HWND wnd, UINT nFlags, int X, int Y);
00102   virtual void OnRButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat=0);
00103   virtual void OnRButtonUp  (HWND wnd, UINT nFlags, int X, int Y);
00104   virtual void OnMButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat=0);
00105   virtual void OnMButtonUp  (HWND wnd, UINT nFlags, int X, int Y);
00106   virtual void OnLButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat=0);
00107   virtual void OnLButtonUp  (HWND wnd, UINT nFlags, int X, int Y);
00108   virtual void OnSize       (HWND wnd, UINT nType,  int X, int Y);
00109   virtual void OnTimer      (HWND wnd, UINT nIDEvent);
00110   virtual void OnKeyDown    (HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
00111   virtual void OnKeyUp      (HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
00112   virtual void OnChar       (HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
00113   virtual void OnMouseWheelForward (HWND wnd, UINT nFlags, int X, int Y);
00114   virtual void OnMouseWheelBackward(HWND wnd, UINT nFlags, int X, int Y);
00115   virtual void OnFocus(HWND wnd, UINT nFlags);
00116   virtual void OnKillFocus(HWND wnd, UINT nFlags);
00117   //ETX
00119 
00121 
00125   static void SetClassExitMethod(void (*f)(void *), void *arg);
00126   static void SetClassExitMethodArgDelete(void (*f)(void *));
00128 
00131   virtual void ExitCallback();
00132 
00133 protected:
00134   vtkWin32RenderWindowInteractor();
00135   ~vtkWin32RenderWindowInteractor();
00136 
00137   HWND    WindowId;
00138   WNDPROC OldProc;
00139   int     InstallMessageProc;
00140   int     MouseInWindow;
00141   int     StartedMessageLoop;
00142 
00143   //BTX
00145 
00148   static void (*ClassExitMethod)(void *);
00149   static void (*ClassExitMethodArgDelete)(void *);
00150   static void *ClassExitMethodArg;
00151   //ETX
00153 
00155 
00157   virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
00158   virtual int InternalDestroyTimer(int platformTimerId);
00160 
00161 #ifdef VTK_USE_TDX
00162   vtkTDxWinDevice *Device;
00163 #endif
00164 
00165 private:
00166   vtkWin32RenderWindowInteractor(const vtkWin32RenderWindowInteractor&);  // Not implemented.
00167   void operator=(const vtkWin32RenderWindowInteractor&);  // Not implemented.
00168 };
00169 
00170 #endif
00171