VTK
vtkXRenderWindowInteractor.h
Go to the documentation of this file.
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=========================================================================*/
33#ifndef vtkXRenderWindowInteractor_h
34#define vtkXRenderWindowInteractor_h
35
36//===========================================================
37// now we define the C++ class
38
39#include "vtkRenderingOpenGL2Module.h" // For export macro
41#include <X11/StringDefs.h> // Needed for X types in the public interface
42#include <X11/Intrinsic.h> // Needed for X types in the public interface
43
45class vtkXRenderWindowInteractorInternals;
46
47// Forward declare internal friend functions.
48void VTKRENDERINGOPENGL2_EXPORT vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
49void VTKRENDERINGOPENGL2_EXPORT vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
50
51class VTKRENDERINGOPENGL2_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
52{
53public:
56 void PrintSelf(ostream& os, vtkIndent indent);
57
63 virtual void Initialize();
64
69
71
77 vtkGetMacro(BreakLoopFlag, int);
82
84
88 virtual void Initialize(XtAppContext app);
89 vtkGetMacro( App, XtAppContext );
91
93
102 virtual void Enable();
103 virtual void Disable();
105
110 virtual void UpdateSize(int,int);
111
113
129 virtual void SetWidget(Widget);
130 Widget GetWidget() {return this->Top;};
132
134
163 virtual void SetTopLevelShell(Widget);
164 Widget GetTopLevelShell() {return this->TopLevelShell;};
166
170 virtual void GetMousePosition(int *x, int *y);
171
173
176 friend void vtkXRenderWindowInteractorCallback(Widget,XtPointer,
177 XEvent *,Boolean *);
178 friend void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
180
181protected:
184
185 //Using static here to avoid detroying context when many apps are open:
186 static XtAppContext App;
187 static int NumAppInitialized;
188
189 Display *DisplayId;
190 Window WindowId;
191 Atom KillAtom;
192 Widget Top;
193 int OwnTop;
194 int OwnApp;
195 int PositionBeforeStereo[2];
196 Widget TopLevelShell;
197 vtkXRenderWindowInteractorInternals* Internal;
198
200
204 virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
205 virtual int InternalDestroyTimer(int platformTimerId);
207
208 XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
209 XtTimerCallbackProc proc, XtPointer client_data) ;
210 void Timer(XtPointer client_data, XtIntervalId *id);
211 void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
212
213 static int BreakLoopFlag;
214
220 virtual void StartEventLoop();
221
222private:
223 vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&) VTK_DELETE_FUNCTION;
224 void operator=(const vtkXRenderWindowInteractor&) VTK_DELETE_FUNCTION;
225};
226
227#endif
void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorTimer(XtPointer, XtIntervalId *)
void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorCallback(Widget, XtPointer, XEvent *, Boolean *)
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:40
platform-independent render window interaction including picking and frame rate control.
an X event driven interface for a RenderWindow
void TerminateApp()
Break the event loop on 'q','e' keypress.
void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd)
virtual void StartEventLoop()
This will start up the X event loop and never return.
friend void vtkXRenderWindowInteractorTimer(XtPointer, XtIntervalId *)
friend void vtkXRenderWindowInteractorCallback(Widget, XtPointer, XEvent *, Boolean *)
Functions that are used internally.
virtual void SetWidget(Widget)
Specify the Xt widget to use for interaction.
virtual void SetTopLevelShell(Widget)
This method will store the top level shell widget for the interactor.
static vtkXRenderWindowInteractor * New()
virtual void Initialize()
Initializes the event handlers without an XtAppContext.
virtual void Enable()
Enable/Disable interactions.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval, XtTimerCallbackProc proc, XtPointer client_data)
virtual void Initialize(XtAppContext app)
Initializes the event handlers using an XtAppContext that you have provided.
virtual int InternalDestroyTimer(int platformTimerId)
void Timer(XtPointer client_data, XtIntervalId *id)
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
X-specific internal timer methods.
virtual void UpdateSize(int, int)
Update the Size data member and set the associated RenderWindow's size.
virtual void GetMousePosition(int *x, int *y)
Re-defines virtual function to get mouse position by querying X-server.