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 
45 #include <X11/StringDefs.h> // Needed for X types in the public interface
46 #include <X11/Intrinsic.h> // Needed for X types in the public interface
47 
48 class vtkCallbackCommand;
49 class vtkXRenderWindowInteractorInternals;
50 
51 //BTX
52 // Forward declare internal friend functions.
53 void VTK_RENDERING_EXPORT vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
54 void VTK_RENDERING_EXPORT vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
55 //ETX
56 
58 {
59 public:
62  void PrintSelf(ostream& os, vtkIndent indent);
63 
67  virtual void Initialize();
68 
70  void TerminateApp();
71 
73 
76  vtkGetMacro(BreakLoopFlag, int);
77  void SetBreakLoopFlag(int);
78  void BreakLoopFlagOff();
79  void BreakLoopFlagOn();
81 
83 
85  virtual void Initialize(XtAppContext app);
86  vtkGetMacro( App, XtAppContext );
88 
90 
97  virtual void Enable();
98  virtual void Disable();
100 
104  virtual void Start();
105 
108  virtual void UpdateSize(int,int);
109 
111 
125  virtual void SetWidget(Widget);
126  Widget GetWidget() {return this->Top;};
128 
130 
154  virtual void SetTopLevelShell(Widget);
155  Widget GetTopLevelShell() {return this->TopLevelShell;};
157 
160  virtual void GetMousePosition(int *x, int *y);
161 
163 
164  friend void vtkXRenderWindowInteractorCallback(Widget,XtPointer,
165  XEvent *,Boolean *);
166  friend void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
168 
169 protected:
172 
173  //Using static here to avoid detroying context when many apps are open:
174  static XtAppContext App;
175  static int NumAppInitialized;
176 
177  Display *DisplayId;
178  Window WindowId;
179  Atom KillAtom;
180  Widget Top;
181  int OwnTop;
182  int OwnApp;
183  int PositionBeforeStereo[2];
185  int TimerId;
186  vtkXRenderWindowInteractorInternals* Internal;
187 
189 
191  virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
192  virtual int InternalDestroyTimer(int platformTimerId);
194 
195  XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
196  XtTimerCallbackProc proc, XtPointer client_data) ;
197  void Timer(XtPointer client_data, XtIntervalId *id);
198  void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
199 
200  static int BreakLoopFlag;
201 
202 private:
203  vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&); // Not implemented.
204  void operator=(const vtkXRenderWindowInteractor&); // Not implemented.
205 };
206 
207 #endif