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 "vtkRenderingOpenGL2Module.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 // Forward declare internal friend functions.
50 void VTKRENDERINGOPENGL2_EXPORT vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
51 void VTKRENDERINGOPENGL2_EXPORT vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
52 
54 {
55 public:
58  void PrintSelf(ostream& os, vtkIndent indent);
59 
63  virtual void Initialize();
64 
66  void TerminateApp();
67 
69 
72  vtkGetMacro(BreakLoopFlag, int);
73  void SetBreakLoopFlag(int);
74  void BreakLoopFlagOff();
75  void BreakLoopFlagOn();
77 
79 
81  virtual void Initialize(XtAppContext app);
82  vtkGetMacro( App, XtAppContext );
84 
86 
93  virtual void Enable();
94  virtual void Disable();
96 
99  virtual void UpdateSize(int,int);
100 
102 
116  virtual void SetWidget(Widget);
117  Widget GetWidget() {return this->Top;};
119 
121 
145  virtual void SetTopLevelShell(Widget);
146  Widget GetTopLevelShell() {return this->TopLevelShell;};
148 
151  virtual void GetMousePosition(int *x, int *y);
152 
154 
155  friend void vtkXRenderWindowInteractorCallback(Widget,XtPointer,
156  XEvent *,Boolean *);
157  friend void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
159 
160 protected:
163 
164  //Using static here to avoid detroying context when many apps are open:
165  static XtAppContext App;
166  static int NumAppInitialized;
167 
168  Display *DisplayId;
169  Window WindowId;
170  Atom KillAtom;
171  Widget Top;
172  int OwnTop;
173  int OwnApp;
174  int PositionBeforeStereo[2];
175  Widget TopLevelShell;
176  int TimerId;
177  vtkXRenderWindowInteractorInternals* Internal;
178 
180 
182  virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
183  virtual int InternalDestroyTimer(int platformTimerId);
185 
186  XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
187  XtTimerCallbackProc proc, XtPointer client_data) ;
188  void Timer(XtPointer client_data, XtIntervalId *id);
189  void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
190 
191  static int BreakLoopFlag;
192 
196  virtual void StartEventLoop();
197 
198 private:
199  vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&); // Not implemented.
200  void operator=(const vtkXRenderWindowInteractor&); // Not implemented.
201 };
202 
203 #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)
#define VTKRENDERINGOPENGL2_EXPORT
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 *)