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 =========================================================================*/
35 #ifndef vtkXRenderWindowInteractor_h
36 #define vtkXRenderWindowInteractor_h
37 
38 //===========================================================
39 // now we define the C++ class
40 
41 #include "vtkRenderingOpenGLModule.h" // For export macro
43 #include <X11/StringDefs.h> // Needed for X types in the public interface
44 #include <X11/Intrinsic.h> // Needed for X types in the public interface
45 
46 class vtkCallbackCommand;
47 class vtkXRenderWindowInteractorInternals;
48 
49 //BTX
50 // Forward declare internal friend functions.
51 void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
52 void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
53 //ETX
54 
56 {
57 public:
60  void PrintSelf(ostream& os, vtkIndent indent);
61 
65  virtual void Initialize();
66 
68  void TerminateApp();
69 
71 
74  vtkGetMacro(BreakLoopFlag, int);
75  void SetBreakLoopFlag(int);
76  void BreakLoopFlagOff();
77  void BreakLoopFlagOn();
79 
81 
83  virtual void Initialize(XtAppContext app);
84  vtkGetMacro( App, XtAppContext );
86 
88 
95  virtual void Enable();
96  virtual void Disable();
98 
101  virtual void UpdateSize(int,int);
102 
104 
118  virtual void SetWidget(Widget);
119  Widget GetWidget() {return this->Top;};
121 
123 
147  virtual void SetTopLevelShell(Widget);
148  Widget GetTopLevelShell() {return this->TopLevelShell;};
150 
153  virtual void GetMousePosition(int *x, int *y);
154 
156 
157  friend void vtkXRenderWindowInteractorCallback(Widget,XtPointer,
158  XEvent *,Boolean *);
159  friend void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
161 
162 protected:
165 
166  //Using static here to avoid detroying context when many apps are open:
167  static XtAppContext App;
168  static int NumAppInitialized;
169 
170  Display *DisplayId;
171  Window WindowId;
172  Atom KillAtom;
173  Widget Top;
174  int OwnTop;
175  int OwnApp;
176  int PositionBeforeStereo[2];
178  int TimerId;
179  vtkXRenderWindowInteractorInternals* Internal;
180 
184  virtual void StartEventLoop();
185 
187 
189  virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
190  virtual int InternalDestroyTimer(int platformTimerId);
192 
193  XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
194  XtTimerCallbackProc proc, XtPointer client_data) ;
195  void Timer(XtPointer client_data, XtIntervalId *id);
196  void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
197 
198  static int BreakLoopFlag;
199 
200 private:
201  vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&); // Not implemented.
202  void operator=(const vtkXRenderWindowInteractor&); // Not implemented.
203 };
204 
205 #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
#define VTKRENDERINGOPENGL_EXPORT
void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorCallback(Widget, XtPointer, XEvent *, Boolean *)
an X event driven interface for a RenderWindow
void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorTimer(XtPointer, XtIntervalId *)
vtkXRenderWindowInteractorInternals * Internal