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 =========================================================================*/
38 #ifndef vtkXRenderWindowInteractor_h
39 #define vtkXRenderWindowInteractor_h
40 
41 //===========================================================
42 // now we define the C++ class
43 
44 #include "vtkRenderingOpenGLModule.h" // For export macro
46 #include <X11/StringDefs.h> // Needed for X types in the public interface
47 #include <X11/Intrinsic.h> // Needed for X types in the public interface
48 
49 class vtkCallbackCommand;
50 class vtkXRenderWindowInteractorInternals;
51 
52 //BTX
53 // Forward declare internal friend functions.
54 void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
55 void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
56 //ETX
57 
58 class VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
59 {
60 public:
63  void PrintSelf(ostream& os, vtkIndent indent);
64 
68  virtual void Initialize();
69 
71  void TerminateApp();
72 
74 
77  vtkGetMacro(BreakLoopFlag, int);
78  void SetBreakLoopFlag(int);
79  void BreakLoopFlagOff();
80  void BreakLoopFlagOn();
82 
84 
86  virtual void Initialize(XtAppContext app);
87  vtkGetMacro( App, XtAppContext );
89 
91 
98  virtual void Enable();
99  virtual void Disable();
101 
104  virtual void UpdateSize(int,int);
105 
107 
121  virtual void SetWidget(Widget);
122  Widget GetWidget() {return this->Top;};
124 
126 
150  virtual void SetTopLevelShell(Widget);
151  Widget GetTopLevelShell() {return this->TopLevelShell;};
153 
156  virtual void GetMousePosition(int *x, int *y);
157 
159 
160  friend void vtkXRenderWindowInteractorCallback(Widget,XtPointer,
161  XEvent *,Boolean *);
162  friend void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
164 
165 protected:
168 
169  //Using static here to avoid detroying context when many apps are open:
170  static XtAppContext App;
171  static int NumAppInitialized;
172 
173  Display *DisplayId;
174  Window WindowId;
175  Atom KillAtom;
176  Widget Top;
177  int OwnTop;
178  int OwnApp;
179  int PositionBeforeStereo[2];
181  int TimerId;
182  vtkXRenderWindowInteractorInternals* Internal;
183 
187  virtual void StartEventLoop();
188 
190 
192  virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
193  virtual int InternalDestroyTimer(int platformTimerId);
195 
196  XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
197  XtTimerCallbackProc proc, XtPointer client_data) ;
198  void Timer(XtPointer client_data, XtIntervalId *id);
199  void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
200 
201  static int BreakLoopFlag;
202 
203 private:
204  vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&); // Not implemented.
205  void operator=(const vtkXRenderWindowInteractor&); // Not implemented.
206 };
207 
208 #endif
virtual void GetMousePosition(int *x, int *y)
virtual void UpdateSize(int x, int y)
virtual int InternalDestroyTimer(int platformTimerId)
void PrintSelf(ostream &os, vtkIndent indent)
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
virtual void Initialize()
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:38
void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorCallback(Widget, XtPointer, XEvent *, Boolean *)
an X event driven interface for a RenderWindow
void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorTimer(XtPointer, XtIntervalId *)
vtkXRenderWindowInteractorInternals * Internal