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 "vtkRenderingOpenGLModule.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 
44 class vtkCallbackCommand;
45 class vtkXRenderWindowInteractorInternals;
46 
47 // Forward declare internal friend functions.
48 void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
49 void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
50 
51 class VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
52 {
53 public:
56  void PrintSelf(ostream& os, vtkIndent indent);
57 
63  virtual void Initialize();
64 
68  void TerminateApp();
69 
71 
77  vtkGetMacro(BreakLoopFlag, int);
78  void SetBreakLoopFlag(int);
79  void BreakLoopFlagOff();
80  void BreakLoopFlagOn();
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 
181 protected:
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];
197  int TimerId;
198  vtkXRenderWindowInteractorInternals* Internal;
199 
205  virtual void StartEventLoop();
206 
208 
212  virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
213  virtual int InternalDestroyTimer(int platformTimerId);
215 
216  XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
217  XtTimerCallbackProc proc, XtPointer client_data) ;
218  void Timer(XtPointer client_data, XtIntervalId *id);
219  void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
220 
221  static int BreakLoopFlag;
222 
223 private:
224  vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&) VTK_DELETE_FUNCTION;
225  void operator=(const vtkXRenderWindowInteractor&) VTK_DELETE_FUNCTION;
226 };
227 
228 #endif
vtkRenderWindowInteractor::New
static vtkRenderWindowInteractor * New()
vtkRenderWindowInteractor::InternalCreateTimer
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
vtkRenderWindowInteractor::StartEventLoop
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
Definition: vtkRenderWindowInteractor.h:891
vtkXRenderWindowInteractor::GetTopLevelShell
Widget GetTopLevelShell()
Definition: vtkXRenderWindowInteractor.h:164
vtkRenderWindowInteractor::InternalDestroyTimer
virtual int InternalDestroyTimer(int platformTimerId)
vtkXRenderWindowInteractorTimer
void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorTimer(XtPointer, XtIntervalId *)
vtkRenderWindowInteractor::UpdateSize
virtual void UpdateSize(int x, int y)
Event loop notification member for window size change.
vtkXRenderWindowInteractor::OwnApp
int OwnApp
Definition: vtkXRenderWindowInteractor.h:194
vtkXRenderWindowInteractor
an X event driven interface for a RenderWindow
Definition: vtkXRenderWindowInteractor.h:51
vtkRenderWindowInteractor::Disable
virtual void Disable()
Definition: vtkRenderWindowInteractor.h:124
vtkXRenderWindowInteractor::KillAtom
Atom KillAtom
Definition: vtkXRenderWindowInteractor.h:191
vtkXRenderWindowInteractor::OwnTop
int OwnTop
Definition: vtkXRenderWindowInteractor.h:193
vtkXRenderWindowInteractor::Internal
vtkXRenderWindowInteractorInternals * Internal
Definition: vtkXRenderWindowInteractor.h:198
vtkXRenderWindowInteractor::BreakLoopFlag
static int BreakLoopFlag
Definition: vtkXRenderWindowInteractor.h:221
vtkRenderWindowInteractor::GetMousePosition
virtual void GetMousePosition(int *x, int *y)
Get the current position of the mouse.
Definition: vtkRenderWindowInteractor.h:347
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkXRenderWindowInteractor::TopLevelShell
Widget TopLevelShell
Definition: vtkXRenderWindowInteractor.h:196
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:78
vtkXRenderWindowInteractor::GetWidget
Widget GetWidget()
Definition: vtkXRenderWindowInteractor.h:130
vtkXRenderWindowInteractor::Top
Widget Top
Definition: vtkXRenderWindowInteractor.h:192
vtkRenderWindowInteractor::TerminateApp
virtual void TerminateApp(void)
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
Definition: vtkRenderWindowInteractor.h:255
vtkRenderWindowInteractor::Enable
virtual void Enable()
Enable/Disable interactions.
Definition: vtkRenderWindowInteractor.h:123
vtkRenderWindowInteractor::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:50
vtkRenderWindowInteractor.h
vtkXRenderWindowInteractor::App
static XtAppContext App
Definition: vtkXRenderWindowInteractor.h:186
vtkRenderWindowInteractor::Initialize
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
vtkXRenderWindowInteractor::NumAppInitialized
static int NumAppInitialized
Definition: vtkXRenderWindowInteractor.h:187
vtkXRenderWindowInteractor::DisplayId
Display * DisplayId
Definition: vtkXRenderWindowInteractor.h:189
vtkXRenderWindowInteractorCallback
void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorCallback(Widget, XtPointer, XEvent *, Boolean *)
vtkXRenderWindowInteractor::TimerId
int TimerId
Definition: vtkXRenderWindowInteractor.h:197
vtkXRenderWindowInteractor::WindowId
Window WindowId
Definition: vtkXRenderWindowInteractor.h:190