VTK  9.7.1
vtkXRenderWindowInteractor.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
20 #ifndef vtkXRenderWindowInteractor_h
21 #define vtkXRenderWindowInteractor_h
22 
23 //===========================================================
24 // now we define the C++ class
25 
27 #include "vtkRenderingUIModule.h" // For export macro
28 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
29 #include "vtkX11Functions.h" // Needed for X types in the public interface
30 
31 VTK_ABI_NAMESPACE_BEGIN
32 class vtkCallbackCommand;
33 class vtkXRenderWindowInteractorInternals;
34 
35 class VTKRENDERINGUI_EXPORT VTK_MARSHALAUTO vtkXRenderWindowInteractor
37 {
38 public:
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
48  void Initialize() override;
49 
53  void TerminateApp() override;
54 
59  void ProcessEvents() override;
60 
62 
71  void Enable() override;
72  void Disable() override;
74 
79  void UpdateSize(int, int) override;
80 
84  void GetMousePosition(int* x, int* y) override;
85 
90  void GetMousePositionAndModifierKeysState(int* x, int* y, unsigned int* keys);
91 
92  void DispatchEvent(XEvent*);
93 
94 protected:
96  ~vtkXRenderWindowInteractor() override;
97 
102  void UpdateSizeNoXResize(int, int);
103 
104  // Using static here to avoid destroying context when many apps are open:
105  static int NumAppInitialized;
106 
107  Display* DisplayId;
108  Window WindowId;
109  Atom KillAtom;
110  int PositionBeforeStereo[2];
111  vtkXRenderWindowInteractorInternals* Internal;
112 
113  // Drag and drop related
115  Window XdndSource;
125 
127 
131  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
132  int InternalDestroyTimer(int platformTimerId) override;
134 
135  void FireTimers();
136 
142  void StartEventLoop() override;
143 
147  void WaitForEvents();
148 
152  bool CheckDisplayId(Display* dpy);
153 
158  void Finalize();
159 
160 private:
162  void operator=(const vtkXRenderWindowInteractor&) = delete;
163 };
164 
165 VTK_ABI_NAMESPACE_END
166 #endif
virtual void GetMousePosition(int *x, int *y)
Get the current position of the mouse.
virtual void UpdateSize(int x, int y)
When the event loop notifies the interactor that the window size has changed, this method is called t...
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.
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.
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
vtkXRenderWindowInteractorInternals * Internal
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
an X event driven interface for a RenderWindow