VTK  9.3.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 
28 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
29 #ifdef VTK_USE_TDX
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkTDxWinDevice;
32 VTK_ABI_NAMESPACE_END
33 #endif
34 
35 VTK_ABI_NAMESPACE_BEGIN
36 class VTKRENDERINGUI_EXPORT vtkWin32RenderWindowInteractor : public vtkRenderWindowInteractor
37 {
38 public:
43 
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  void Initialize() override;
51 
53 
62  void Enable() override;
63  void Disable() override;
65 
70  void ProcessEvents() override;
71 
73 
79  vtkSetMacro(InstallMessageProc, int);
80  vtkGetMacro(InstallMessageProc, int);
81  vtkBooleanMacro(InstallMessageProc, int);
83 
89  void TerminateApp() override;
90 
91  friend VTKRENDERINGUI_EXPORT LRESULT CALLBACK vtkHandleMessage(
92  HWND hwnd, UINT uMsg, WPARAM w, LPARAM l);
93  friend VTKRENDERINGUI_EXPORT LRESULT CALLBACK vtkHandleMessage2(
94  HWND hwnd, UINT uMsg, WPARAM w, LPARAM l, vtkWin32RenderWindowInteractor* me);
95 
97 
101  virtual int OnMouseMove(HWND wnd, UINT nFlags, int X, int Y);
102  virtual int OnNCMouseMove(HWND wnd, UINT nFlags, int X, int Y);
103  virtual int OnRButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat = 0);
104  virtual int OnRButtonUp(HWND wnd, UINT nFlags, int X, int Y);
105  virtual int OnMButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat = 0);
106  virtual int OnMButtonUp(HWND wnd, UINT nFlags, int X, int Y);
107  virtual int OnLButtonDown(HWND wnd, UINT nFlags, int X, int Y, int repeat = 0);
108  virtual int OnLButtonUp(HWND wnd, UINT nFlags, int X, int Y);
109  virtual int OnSize(HWND wnd, UINT nType, int X, int Y);
110  virtual int OnTimer(HWND wnd, UINT nIDEvent);
111  virtual int OnKeyDown(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
112  virtual int OnKeyUp(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
113  virtual int OnChar(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags);
114  virtual int OnMouseWheelForward(HWND wnd, UINT nFlags, int X, int Y);
115  virtual int OnMouseWheelBackward(HWND wnd, UINT nFlags, int X, int Y);
116  virtual int OnFocus(HWND wnd, UINT nFlags);
117  virtual int OnKillFocus(HWND wnd, UINT nFlags);
118  virtual int OnTouch(HWND wnd, UINT wParam, UINT lParam);
119  virtual int OnDropFiles(HWND wnd, WPARAM wParam);
121 
123 
129  static void SetClassExitMethod(void (*f)(void*), void* arg);
130  static void SetClassExitMethodArgDelete(void (*f)(void*));
132 
137  void ExitCallback() override;
138 
139 protected:
141  ~vtkWin32RenderWindowInteractor() override;
142 
143  HWND WindowId;
144  WNDPROC OldProc;
148 
150 
155  static void (*ClassExitMethod)(void*);
156  static void (*ClassExitMethodArgDelete)(void*);
157  static void* ClassExitMethodArg;
159 
161 
165  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
166  int InternalDestroyTimer(int platformTimerId) override;
168 
174  void StartEventLoop() override;
175 
176 #ifdef VTK_USE_TDX
177  vtkTDxWinDevice* Device;
178 #endif
179 
180 private:
182  void operator=(const vtkWin32RenderWindowInteractor&) = delete;
183 };
184 
185 VTK_ABI_NAMESPACE_END
186 #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...