Point Cloud Library (PCL)  1.14.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 namespace pcl {
40 class vtkCallbackCommand;
41 class vtkXRenderWindowInteractorInternals;
42 
43 class VTKRENDERINGUI_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
44 {
45 public:
47  void operator=(const vtkXRenderWindowInteractor&) = delete;
48 
50  vtkTypeMacro(vtkXRenderWindowInteractor, vtkRenderWindowInteractor);
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
53  /**
54  * Initializes the event handlers without an XtAppContext. This is
55  * good for when you don't have a user interface, but you still
56  * want to have mouse interaction.
57  */
58  void Initialize() override;
59 
60  /**
61  * Break the event loop on 'q','e' keypress. Want more ???
62  */
63  void TerminateApp() override;
64 
65  /**
66  * Run the event loop and return. This is provided so that you can
67  * implement your own event loop but yet use the vtk event handling as
68  * well.
69  */
70  void ProcessEvents() override;
71 
72  ///@{
73  /**
74  * Enable/Disable interactions. By default interactors are enabled when
75  * initialized. Initialize() must be called prior to enabling/disabling
76  * interaction. These methods are used when a window/widget is being
77  * shared by multiple renderers and interactors. This allows a "modal"
78  * display where one interactor is active when its data is to be displayed
79  * and all other interactors associated with the widget are disabled
80  * when their data is not displayed.
81  */
82  void Enable() override;
83  void Disable() override;
84  ///@}
85 
86  /**
87  * Update the Size data member and set the associated RenderWindow's
88  * size.
89  */
90  void UpdateSize(int, int) override;
91 
92  /**
93  * Re-defines virtual function to get mouse position by querying X-server.
94  */
95  void GetMousePosition(int* x, int* y) override;
96 
97  void DispatchEvent(XEvent*);
98 
99 protected:
102 
103  /**
104  * Update the Size data member and set the associated RenderWindow's
105  * size but do not resize the XWindow.
106  */
107  void UpdateSizeNoXResize(int, int);
108 
109  // Using static here to avoid destroying context when many apps are open:
110  static int NumAppInitialized;
111 
112  Display* DisplayId;
113  bool OwnDisplay = false;
114  Window WindowId;
115  Atom KillAtom;
116  int PositionBeforeStereo[2];
117  vtkXRenderWindowInteractorInternals* Internal;
118 
119  // Drag and drop related
121  Window XdndSource;
131 
132  ///@{
133  /**
134  * X-specific internal timer methods. See the superclass for detailed
135  * documentation.
136  */
137  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
138  int InternalDestroyTimer(int platformTimerId) override;
139  ///@}
140 
141  void FireTimers();
142 
143  /**
144  * This will start up the X event loop and never return. If you
145  * call this method it will loop processing X events until the
146  * application is exited.
147  */
148  void StartEventLoop() override;
149 
150  /**
151  * Deallocate X resource that may have been allocated
152  * Also calls finalize on the render window if available
153  */
154  void Finalize();
155 
156 };
157 } // namespace pcl
158 
159 #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.