VTK
vtkWin32RenderWindowInteractor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkWin32RenderWindowInteractor.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
33 #ifndef vtkWin32RenderWindowInteractor_h
34 #define vtkWin32RenderWindowInteractor_h
35 
37 #include "vtkRenderingOpenGL2Module.h" // For export macro
38 #include "vtkWindows.h" // For windows API.
39 
40 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
41 #ifdef VTK_USE_TDX
42 class vtkTDxWinDevice;
43 #endif
44 
45 class VTKRENDERINGOPENGL2_EXPORT vtkWin32RenderWindowInteractor : public vtkRenderWindowInteractor
46 {
47 public:
52 
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
59  virtual void Initialize() override;
60 
62 
71  virtual void Enable() override;
72  virtual void Disable() override;
74 
80  void ProcessEvents() override;
81 
83 
89  vtkSetMacro(InstallMessageProc,int);
90  vtkGetMacro(InstallMessageProc,int);
91  vtkBooleanMacro(InstallMessageProc,int);
93 
99  void TerminateApp(void) override;
100 
101  friend VTKRENDERINGOPENGL2_EXPORT LRESULT CALLBACK vtkHandleMessage(HWND hwnd,UINT uMsg, WPARAM w, LPARAM l);
102  friend VTKRENDERINGOPENGL2_EXPORT LRESULT CALLBACK vtkHandleMessage2(HWND hwnd,UINT uMsg, WPARAM w, LPARAM l, vtkWin32RenderWindowInteractor *me);
103 
105 
109  virtual int OnMouseMove(HWND wnd, UINT nFlags, int X, int Y);
110  virtual int OnNCMouseMove(HWND wnd, UINT nFlags, int X, int Y);
111  virtual int OnRButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat = 0);
112  virtual int OnRButtonUp(HWND wnd, UINT nFlags, int X, int Y);
113  virtual int OnMButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat = 0);
114  virtual int OnMButtonUp(HWND wnd, UINT nFlags, int X, int Y);
115  virtual int OnLButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat = 0);
116  virtual int OnLButtonUp(HWND wnd, UINT nFlags, int X, int Y);
117  virtual int OnSize(HWND wnd, UINT nType, int X, int Y);
118  virtual int OnTimer(HWND wnd, UINT nIDEvent);
119  virtual int OnKeyDown(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
120  virtual int OnKeyUp(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
121  virtual int OnChar(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
122  virtual int OnMouseWheelForward(HWND wnd, UINT nFlags, int X, int Y);
123  virtual int OnMouseWheelBackward(HWND wnd, UINT nFlags, int X, int Y);
124  virtual int OnFocus(HWND wnd, UINT nFlags);
125  virtual int OnKillFocus(HWND wnd, UINT nFlags);
126  virtual int OnTouch(HWND wnd, UINT wParam, UINT lParam);
128 
130 
136  static void SetClassExitMethod(void (*f)(void *), void *arg);
137  static void SetClassExitMethodArgDelete(void (*f)(void *));
139 
144  void ExitCallback() override;
145 
146 protected:
149 
150  HWND WindowId;
151  WNDPROC OldProc;
155 
157 
162  static void (*ClassExitMethod)(void *);
163  static void (*ClassExitMethodArgDelete)(void *);
164  static void *ClassExitMethodArg;
166 
168 
172  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
173  int InternalDestroyTimer(int platformTimerId) override;
175 
181  void StartEventLoop() override;
182 
183 #ifdef VTK_USE_TDX
184  vtkTDxWinDevice *Device;
185 #endif
186 
187 private:
189  void operator=(const vtkWin32RenderWindowInteractor&) = delete;
190 };
191 
192 #endif
vtkRenderWindowInteractor::New
static vtkRenderWindowInteractor * New()
vtkRenderWindowInteractor::InternalCreateTimer
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
vtkRenderWindowInteractor::StartEventLoop
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
Definition: vtkRenderWindowInteractor.h:913
vtkRenderWindowInteractor::InternalDestroyTimer
virtual int InternalDestroyTimer(int platformTimerId)
vtkWin32RenderWindowInteractor::StartedMessageLoop
int StartedMessageLoop
Definition: vtkWin32RenderWindowInteractor.h:154
vtkWin32RenderWindowInteractor
implements Win32 specific functions required by vtkRenderWindowInteractor.
Definition: vtkWin32RenderWindowInteractor.h:45
vtkRenderWindowInteractor::Disable
virtual void Disable()
Definition: vtkRenderWindowInteractor.h:137
vtkWin32RenderWindowInteractor::OldProc
WNDPROC OldProc
Definition: vtkWin32RenderWindowInteractor.h:151
vtkRenderWindowInteractor::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkWin32RenderWindowInteractor::MouseInWindow
int MouseInWindow
Definition: vtkWin32RenderWindowInteractor.h:153
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:78
vtkRenderWindowInteractor::ExitCallback
virtual void ExitCallback()
These methods correspond to the Exit, User and Pick callbacks.
vtkRenderWindowInteractor::TerminateApp
virtual void TerminateApp(void)
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
Definition: vtkRenderWindowInteractor.h:271
vtkRenderWindowInteractor::Enable
virtual void Enable()
Enable/Disable interactions.
Definition: vtkRenderWindowInteractor.h:136
vtkWin32RenderWindowInteractor::InstallMessageProc
int InstallMessageProc
Definition: vtkWin32RenderWindowInteractor.h:152
vtkRenderWindowInteractor.h
vtkRenderWindowInteractor::Initialize
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
vtkRenderWindowInteractor::ProcessEvents
virtual void ProcessEvents()
Run the event loop and return.
Definition: vtkRenderWindowInteractor.h:119
vtkWin32RenderWindowInteractor::ClassExitMethodArg
static void * ClassExitMethodArg
Definition: vtkWin32RenderWindowInteractor.h:164
vtkWin32RenderWindowInteractor::WindowId
HWND WindowId
Definition: vtkWin32RenderWindowInteractor.h:150