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 "vtkRenderingOpenGL2Module.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 // Forward declare internal friend functions.
53 void VTKRENDERINGOPENGL2_EXPORT vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
54 void VTKRENDERINGOPENGL2_EXPORT vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
55 
56 class VTKRENDERINGOPENGL2_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
57 {
58 public:
61  void PrintSelf(ostream& os, vtkIndent indent);
62 
66  virtual void Initialize();
67 
69  void TerminateApp();
70 
72 
75  vtkGetMacro(BreakLoopFlag, int);
76  void SetBreakLoopFlag(int);
77  void BreakLoopFlagOff();
78  void BreakLoopFlagOn();
80 
82 
84  virtual void Initialize(XtAppContext app);
85  vtkGetMacro( App, XtAppContext );
87 
89 
96  virtual void Enable();
97  virtual void Disable();
99 
102  virtual void UpdateSize(int,int);
103 
105 
119  virtual void SetWidget(Widget);
120  Widget GetWidget() {return this->Top;};
122 
124 
148  virtual void SetTopLevelShell(Widget);
149  Widget GetTopLevelShell() {return this->TopLevelShell;};
151 
154  virtual void GetMousePosition(int *x, int *y);
155 
157 
158  friend void vtkXRenderWindowInteractorCallback(Widget,XtPointer,
159  XEvent *,Boolean *);
160  friend void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
162 
163 protected:
166 
167  //Using static here to avoid detroying context when many apps are open:
168  static XtAppContext App;
169  static int NumAppInitialized;
170 
171  Display *DisplayId;
172  Window WindowId;
173  Atom KillAtom;
174  Widget Top;
175  int OwnTop;
176  int OwnApp;
177  int PositionBeforeStereo[2];
178  Widget TopLevelShell;
179  int TimerId;
180  vtkXRenderWindowInteractorInternals* Internal;
181 
183 
185  virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
186  virtual int InternalDestroyTimer(int platformTimerId);
188 
189  XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
190  XtTimerCallbackProc proc, XtPointer client_data) ;
191  void Timer(XtPointer client_data, XtIntervalId *id);
192  void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
193 
194  static int BreakLoopFlag;
195 
199  virtual void StartEventLoop();
200 
201 private:
202  vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&); // Not implemented.
203  void operator=(const vtkXRenderWindowInteractor&); // Not implemented.
204 };
205 
206 #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 *)