VTK  9.1.0
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 =========================================================================*/
36 #ifndef vtkWin32RenderWindowInteractor_h
37 #define vtkWin32RenderWindowInteractor_h
38 
40 #include "vtkRenderingUIModule.h" // For export macro
41 #include "vtkWindows.h" // For windows API.
42 
43 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
44 #ifdef VTK_USE_TDX
45 class vtkTDxWinDevice;
46 #endif
47 
48 class VTKRENDERINGUI_EXPORT vtkWin32RenderWindowInteractor : public vtkRenderWindowInteractor
49 {
50 public:
55 
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
62  void Initialize() override;
63 
65 
74  void Enable() override;
75  void Disable() override;
77 
83  void ProcessEvents() override;
84 
86 
92  vtkSetMacro(InstallMessageProc, int);
93  vtkGetMacro(InstallMessageProc, int);
94  vtkBooleanMacro(InstallMessageProc, int);
96 
102  void TerminateApp(void) override;
103 
104  friend VTKRENDERINGUI_EXPORT LRESULT CALLBACK vtkHandleMessage(
105  HWND hwnd, UINT uMsg, WPARAM w, LPARAM l);
106  friend VTKRENDERINGUI_EXPORT LRESULT CALLBACK vtkHandleMessage2(
107  HWND hwnd, UINT uMsg, WPARAM w, LPARAM l, vtkWin32RenderWindowInteractor* me);
108 
110 
114  virtual int OnMouseMove(HWND wnd, UINT nFlags, int X, int Y);
115  virtual int OnNCMouseMove(HWND wnd, UINT nFlags, int X, int Y);
116  virtual int OnRButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat = 0);
117  virtual int OnRButtonUp(HWND wnd, UINT nFlags, int X, int Y);
118  virtual int OnMButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat = 0);
119  virtual int OnMButtonUp(HWND wnd, UINT nFlags, int X, int Y);
120  virtual int OnLButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat = 0);
121  virtual int OnLButtonUp(HWND wnd, UINT nFlags, int X, int Y);
122  virtual int OnSize(HWND wnd, UINT nType, int X, int Y);
123  virtual int OnTimer(HWND wnd, UINT nIDEvent);
124  virtual int OnKeyDown(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
125  virtual int OnKeyUp(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
126  virtual int OnChar(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
127  virtual int OnMouseWheelForward(HWND wnd, UINT nFlags, int X, int Y);
128  virtual int OnMouseWheelBackward(HWND wnd, UINT nFlags, int X, int Y);
129  virtual int OnFocus(HWND wnd, UINT nFlags);
130  virtual int OnKillFocus(HWND wnd, UINT nFlags);
131  virtual int OnTouch(HWND wnd, UINT wParam, UINT lParam);
132  virtual int OnDropFiles(HWND wnd, WPARAM wParam);
134 
136 
142  static void SetClassExitMethod(void (*f)(void*), void* arg);
143  static void SetClassExitMethodArgDelete(void (*f)(void*));
145 
150  void ExitCallback() override;
151 
152 protected:
155 
156  HWND WindowId;
157  WNDPROC OldProc;
161 
163 
168  static void (*ClassExitMethod)(void*);
169  static void (*ClassExitMethodArgDelete)(void*);
170  static void* ClassExitMethodArg;
172 
174 
178  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
179  int InternalDestroyTimer(int platformTimerId) override;
181 
187  void StartEventLoop() override;
188 
189 #ifdef VTK_USE_TDX
190  vtkTDxWinDevice* Device;
191 #endif
192 
193 private:
195  void operator=(const vtkWin32RenderWindowInteractor&) = delete;
196 };
197 
198 #endif
vtkWin32RenderWindowInteractor::OnDropFiles
virtual int OnDropFiles(HWND wnd, WPARAM wParam)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::OnSize
virtual int OnSize(HWND wnd, UINT nType, int X, int Y)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::StartedMessageLoop
int StartedMessageLoop
Definition: vtkWin32RenderWindowInteractor.h:160
vtkWin32RenderWindowInteractor::vtkWin32RenderWindowInteractor
vtkWin32RenderWindowInteractor()
vtkWin32RenderWindowInteractor::Enable
void Enable() override
Enable/Disable interactions.
vtkWin32RenderWindowInteractor::InternalDestroyTimer
int InternalDestroyTimer(int platformTimerId) override
Win32-specific internal timer methods.
vtkWin32RenderWindowInteractor::OnKillFocus
virtual int OnKillFocus(HWND wnd, UINT nFlags)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor
implements Win32 specific functions required by vtkRenderWindowInteractor.
Definition: vtkWin32RenderWindowInteractor.h:49
vtkWin32RenderWindowInteractor::ProcessEvents
void ProcessEvents() override
Run the event loop and return.
vtkWin32RenderWindowInteractor::OnNCMouseMove
virtual int OnNCMouseMove(HWND wnd, UINT nFlags, int X, int Y)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::OnTimer
virtual int OnTimer(HWND wnd, UINT nIDEvent)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::OnChar
virtual int OnChar(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::OnMouseMove
virtual int OnMouseMove(HWND wnd, UINT nFlags, int X, int Y)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::SetClassExitMethod
static void SetClassExitMethod(void(*f)(void *), void *arg)
Methods to set the default exit method for the class.
vtkWin32RenderWindowInteractor::OldProc
WNDPROC OldProc
Definition: vtkWin32RenderWindowInteractor.h:157
vtkWin32RenderWindowInteractor::OnKeyUp
virtual int OnKeyUp(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::TerminateApp
void TerminateApp(void) override
Win32 specific application terminate, calls ClassExitMethod then calls PostQuitMessage(0) to terminat...
vtkWin32RenderWindowInteractor::OnMButtonDown
virtual int OnMButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat=0)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::vtkHandleMessage
friend VTKRENDERINGUI_EXPORT LRESULT CALLBACK vtkHandleMessage(HWND hwnd, UINT uMsg, WPARAM w, LPARAM l)
vtkWin32RenderWindowInteractor::MouseInWindow
int MouseInWindow
Definition: vtkWin32RenderWindowInteractor.h:159
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkWin32RenderWindowInteractor::OnLButtonDown
virtual int OnLButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat=0)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::SetClassExitMethodArgDelete
static void SetClassExitMethodArgDelete(void(*f)(void *))
Methods to set the default exit method for the class.
vtkWin32RenderWindowInteractor::ExitCallback
void ExitCallback() override
These methods correspond to the Exit, User and Pick callbacks.
vtkWin32RenderWindowInteractor::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:192
vtkWin32RenderWindowInteractor::~vtkWin32RenderWindowInteractor
~vtkWin32RenderWindowInteractor() override
vtkWin32RenderWindowInteractor::InternalCreateTimer
int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override
Win32-specific internal timer methods.
vtkWin32RenderWindowInteractor::OnKeyDown
virtual int OnKeyDown(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::Disable
void Disable() override
Enable/Disable interactions.
vtkWin32RenderWindowInteractor::OnFocus
virtual int OnFocus(HWND wnd, UINT nFlags)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::OnMouseWheelBackward
virtual int OnMouseWheelBackward(HWND wnd, UINT nFlags, int X, int Y)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::OnMouseWheelForward
virtual int OnMouseWheelForward(HWND wnd, UINT nFlags, int X, int Y)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::OnRButtonUp
virtual int OnRButtonUp(HWND wnd, UINT nFlags, int X, int Y)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::OnMButtonUp
virtual int OnMButtonUp(HWND wnd, UINT nFlags, int X, int Y)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::InstallMessageProc
int InstallMessageProc
Definition: vtkWin32RenderWindowInteractor.h:158
vtkRenderWindowInteractor.h
vtkWin32RenderWindowInteractor::ClassExitMethodArg
static void * ClassExitMethodArg
Class variables so an exit method can be defined for this class (used to set different exit methods f...
Definition: vtkWin32RenderWindowInteractor.h:170
vtkWin32RenderWindowInteractor::OnRButtonDown
virtual int OnRButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat=0)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::OnLButtonUp
virtual int OnLButtonUp(HWND wnd, UINT nFlags, int X, int Y)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::vtkHandleMessage2
friend VTKRENDERINGUI_EXPORT LRESULT CALLBACK vtkHandleMessage2(HWND hwnd, UINT uMsg, WPARAM w, LPARAM l, vtkWin32RenderWindowInteractor *me)
vtkWin32RenderWindowInteractor::Initialize
void Initialize() override
Initialize the event handler.
vtkWin32RenderWindowInteractor::New
static vtkWin32RenderWindowInteractor * New()
Construct object so that light follows camera motion.
vtkWin32RenderWindowInteractor::OnTouch
virtual int OnTouch(HWND wnd, UINT wParam, UINT lParam)
Various methods that a Win32 window can redirect to this class to be handled.
vtkWin32RenderWindowInteractor::StartEventLoop
void StartEventLoop() override
This will start up the event loop and never return.
vtkWin32RenderWindowInteractor::WindowId
HWND WindowId
Definition: vtkWin32RenderWindowInteractor.h:156