Point Cloud Library (PCL)  1.15.1-dev
vtkFixedXRenderWindowInteractor.h
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkXRenderWindowInteractor.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 =========================================================================*/
15 /**
16  * @class vtkXRenderWindowInteractor
17  * @brief an X event driven interface for a RenderWindow
18  *
19  * vtkXRenderWindowInteractor is a convenience object that provides event
20  * bindings to common graphics functions. For example, camera and actor
21  * functions such as zoom-in/zoom-out, azimuth, roll, and pan. IT is one of
22  * the window system specific subclasses of vtkRenderWindowInteractor. Please
23  * see vtkRenderWindowInteractor documentation for event bindings.
24  *
25  * @sa
26  * vtkRenderWindowInteractor
27  */
28 
29 #ifndef vtkXRenderWindowInteractor_h
30 #define vtkXRenderWindowInteractor_h
31 
32 //===========================================================
33 // now we define the C++ class
34 
35 #include "vtkRenderWindowInteractor.h"
36 #include "vtkRenderingUIModule.h" // For export macro
37 #include <X11/Xlib.h> // Needed for X types in the public interface
38 
39 class vtkCallbackCommand;
40 
41 namespace pcl {
42 class vtkXRenderWindowInteractorInternals;
43 
44 class VTKRENDERINGUI_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
45 {
46 public:
48  void operator=(const vtkXRenderWindowInteractor&) = delete;
49 
51  vtkTypeMacro(vtkXRenderWindowInteractor, vtkRenderWindowInteractor);
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
54  /**
55  * Initializes the event handlers without an XtAppContext. This is
56  * good for when you don't have a user interface, but you still
57  * want to have mouse interaction.
58  */
59  void Initialize() override;
60 
61  /**
62  * Break the event loop on 'q','e' keypress. Want more ???
63  */
64  void TerminateApp() override;
65 
66  /**
67  * Run the event loop and return. This is provided so that you can
68  * implement your own event loop but yet use the vtk event handling as
69  * well.
70  */
71  void ProcessEvents() override;
72 
73  ///@{
74  /**
75  * Enable/Disable interactions. By default interactors are enabled when
76  * initialized. Initialize() must be called prior to enabling/disabling
77  * interaction. These methods are used when a window/widget is being
78  * shared by multiple renderers and interactors. This allows a "modal"
79  * display where one interactor is active when its data is to be displayed
80  * and all other interactors associated with the widget are disabled
81  * when their data is not displayed.
82  */
83  void Enable() override;
84  void Disable() override;
85  ///@}
86 
87  /**
88  * Update the Size data member and set the associated RenderWindow's
89  * size.
90  */
91  void UpdateSize(int, int) override;
92 
93  /**
94  * Re-defines virtual function to get mouse position by querying X-server.
95  */
96  void GetMousePosition(int* x, int* y) override;
97 
98  void DispatchEvent(XEvent*);
99 
100 protected:
103 
104  /**
105  * Update the Size data member and set the associated RenderWindow's
106  * size but do not resize the XWindow.
107  */
108  void UpdateSizeNoXResize(int, int);
109 
110  // Using static here to avoid destroying context when many apps are open:
111  static int NumAppInitialized;
112 
113  Display* DisplayId;
114  bool OwnDisplay = false;
115  Window WindowId;
116  Atom KillAtom;
117  int PositionBeforeStereo[2];
118  vtkXRenderWindowInteractorInternals* Internal;
119 
120  // Drag and drop related
122  Window XdndSource;
132 
133  ///@{
134  /**
135  * X-specific internal timer methods. See the superclass for detailed
136  * documentation.
137  */
138  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
139  int InternalDestroyTimer(int platformTimerId) override;
140  ///@}
141 
142  void FireTimers();
143 
144  /**
145  * This will start up the X event loop and never return. If you
146  * call this method it will loop processing X events until the
147  * application is exited.
148  */
149  void StartEventLoop() override;
150 
151  /**
152  * Deallocate X resource that may have been allocated
153  * Also calls finalize on the render window if available
154  */
155  void Finalize();
156 
157 };
158 } // namespace pcl
159 
160 #endif
static vtkXRenderWindowInteractor * New()
vtkXRenderWindowInteractorInternals * Internal
void StartEventLoop() override
This will start up the X event loop and never return.
void ProcessEvents() override
Run the event loop and return.
vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor &)=delete
int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override
X-specific internal timer methods.
void PrintSelf(ostream &os, vtkIndent indent) override
void Finalize()
Deallocate X resource that may have been allocated Also calls finalize on the render window if availa...
void TerminateApp() override
Break the event loop on 'q','e' keypress.
void Enable() override
Enable/Disable interactions.
void UpdateSize(int, int) override
Update the Size data member and set the associated RenderWindow's size.
int InternalDestroyTimer(int platformTimerId) override
void operator=(const vtkXRenderWindowInteractor &)=delete
void UpdateSizeNoXResize(int, int)
Update the Size data member and set the associated RenderWindow's size but do not resize the XWindow.
vtkTypeMacro(vtkXRenderWindowInteractor, vtkRenderWindowInteractor)
void GetMousePosition(int *x, int *y) override
Re-defines virtual function to get mouse position by querying X-server.
void Initialize() override
Initializes the event handlers without an XtAppContext.