VTK  9.7.1
vtkWin32RenderWindowInteractor.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
21 #ifndef vtkWin32RenderWindowInteractor_h
22 #define vtkWin32RenderWindowInteractor_h
23 
25 #include "vtkRenderingUIModule.h" // For export macro
26 #include "vtkWindows.h" // For windows API.
27 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
28 
29 #include <memory> // for std::unique_ptr
30 
31 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
32 #ifdef VTK_USE_TDX
33 VTK_ABI_NAMESPACE_BEGIN
34 class vtkTDxWinDevice;
35 VTK_ABI_NAMESPACE_END
36 #endif
37 
38 VTK_ABI_NAMESPACE_BEGIN
41 {
42 public:
47 
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
54  void Initialize() override;
55 
57 
66  void Enable() override;
67  void Disable() override;
69 
74  void ProcessEvents() override;
75 
77 
83  vtkSetMacro(InstallMessageProc, int);
84  vtkGetMacro(InstallMessageProc, int);
85  vtkBooleanMacro(InstallMessageProc, int);
87 
93  void TerminateApp() override;
94 
95  friend VTKRENDERINGUI_EXPORT LRESULT CALLBACK vtkHandleMessage(
96  HWND hwnd, UINT uMsg, WPARAM w, LPARAM l);
97  friend VTKRENDERINGUI_EXPORT LRESULT CALLBACK vtkHandleMessage2(
98  HWND hwnd, UINT uMsg, WPARAM w, LPARAM l, vtkWin32RenderWindowInteractor* me);
99 
101 
105  virtual int OnMouseMove(HWND wnd, UINT nFlags, int X, int Y);
106  virtual int OnNCMouseMove(HWND wnd, UINT nFlags, int X, int Y);
107  virtual int OnRButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat = 0);
108  virtual int OnRButtonUp(HWND wnd, UINT nFlags, int X, int Y);
109  virtual int OnMButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat = 0);
110  virtual int OnMButtonUp(HWND wnd, UINT nFlags, int X, int Y);
111  virtual int OnLButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat = 0);
112  virtual int OnLButtonUp(HWND wnd, UINT nFlags, int X, int Y);
113  virtual int OnSize(HWND wnd, UINT nType, int X, int Y);
114  virtual int OnTimer(HWND wnd, UINT nIDEvent);
115  virtual int OnKeyDown(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
116  virtual int OnKeyUp(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
117  virtual int OnChar(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
118  virtual int OnMouseWheelForward(HWND wnd, UINT nFlags, int X, int Y);
119  virtual int OnMouseWheelBackward(HWND wnd, UINT nFlags, int X, int Y);
120  virtual int OnFocus(HWND wnd, UINT nFlags);
121  virtual int OnKillFocus(HWND wnd, UINT nFlags);
122  virtual int OnTouch(HWND wnd, UINT wParam, UINT lParam);
123  virtual int OnDropFiles(HWND wnd, WPARAM wParam);
125 
127 
133  static void SetClassExitMethod(void (*f)(void*), void* arg);
134  static void SetClassExitMethodArgDelete(void (*f)(void*));
136 
141  void ExitCallback() override;
142 
143 protected:
145  ~vtkWin32RenderWindowInteractor() override;
146 
147  HWND WindowId;
148  WNDPROC OldProc;
152 
154 
159  static void (*ClassExitMethod)(void*);
160  static void (*ClassExitMethodArgDelete)(void*);
161  static void* ClassExitMethodArg;
163 
165 
169  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
170  int InternalDestroyTimer(int platformTimerId) override;
172 
178  void StartEventLoop() override;
179 
180 #ifdef VTK_USE_TDX
181  vtkTDxWinDevice* Device;
182 #endif
183 
184 private:
186  void operator=(const vtkWin32RenderWindowInteractor&) = delete;
187 
188  class vtkInternals;
189  std::unique_ptr<vtkInternals> Internals;
190 };
191 
192 VTK_ABI_NAMESPACE_END
193 #endif
static void * ClassExitMethodArg
Class variables so an exit method can be defined for this class (used to set different exit methods f...
virtual void Enable()
Enable/Disable interactions.
virtual int InternalDestroyTimer(int platformTimerId)
Internal methods for creating and destroying timers that must be implemented by subclasses.
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
implements Win32 specific functions required by vtkRenderWindowInteractor.
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
static vtkRenderWindowInteractor * New()
platform-independent render window interaction including picking and frame rate control.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void ExitCallback()
These methods correspond to the Exit, User and Pick callbacks.
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
virtual void ProcessEvents()
Process all user-interaction, timer events and return.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void TerminateApp()
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
#define VTK_MARSHALAUTO