VTK  9.3.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 <X11/Xlib.h> // Needed for X types in the public interface
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkCallbackCommand;
32 class vtkXRenderWindowInteractorInternals;
33 
34 class VTKRENDERINGUI_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
35 {
36 public:
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
46  void Initialize() override;
47 
51  void TerminateApp() override;
52 
57  void ProcessEvents() override;
58 
60 
69  void Enable() override;
70  void Disable() override;
72 
77  void UpdateSize(int, int) override;
78 
82  void GetMousePosition(int* x, int* y) override;
83 
84  void DispatchEvent(XEvent*);
85 
86 protected:
88  ~vtkXRenderWindowInteractor() override;
89 
94  void UpdateSizeNoXResize(int, int);
95 
96  // Using static here to avoid destroying context when many apps are open:
97  static int NumAppInitialized;
98 
99  Display* DisplayId;
100  bool OwnDisplay = false;
101  Window WindowId;
102  Atom KillAtom;
103  int PositionBeforeStereo[2];
104  vtkXRenderWindowInteractorInternals* Internal;
105 
106  // Drag and drop related
108  Window XdndSource;
118 
120 
124  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
125  int InternalDestroyTimer(int platformTimerId) override;
127 
128  void FireTimers();
129 
135  void StartEventLoop() override;
136 
140  void WaitForEvents();
141 
146  void Finalize();
147 
148 private:
150  void operator=(const vtkXRenderWindowInteractor&) = delete;
151 };
152 
153 VTK_ABI_NAMESPACE_END
154 #endif
virtual void GetMousePosition(int *x, int *y)
Get the current position of the mouse.
virtual void UpdateSize(int x, int y)
Event loop notification member for window size change.
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...
an X event driven interface for a RenderWindow