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 =========================================================================*/
36 #ifndef vtkXRenderWindowInteractor_h
37 #define vtkXRenderWindowInteractor_h
38 
39 //===========================================================
40 // now we define the C++ class
41 
42 #include "vtkRenderingOpenGLModule.h" // For export macro
44 #include <X11/StringDefs.h> // Needed for X types in the public interface
45 #include <X11/Intrinsic.h> // Needed for X types in the public interface
46 
47 class vtkCallbackCommand;
48 class vtkXRenderWindowInteractorInternals;
49 
50 // Forward declare internal friend functions.
51 void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
52 void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
53 
54 class VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
55 {
56 public:
59  void PrintSelf(ostream& os, vtkIndent indent);
60 
66  virtual void Initialize();
67 
71  void TerminateApp();
72 
74 
80  vtkGetMacro(BreakLoopFlag, int);
81  void SetBreakLoopFlag(int);
82  void BreakLoopFlagOff();
83  void BreakLoopFlagOn();
85 
87 
91  virtual void Initialize(XtAppContext app);
92  vtkGetMacro( App, XtAppContext );
94 
96 
105  virtual void Enable();
106  virtual void Disable();
108 
113  virtual void UpdateSize(int,int);
114 
116 
132  virtual void SetWidget(Widget);
133  Widget GetWidget() {return this->Top;};
135 
137 
166  virtual void SetTopLevelShell(Widget);
167  Widget GetTopLevelShell() {return this->TopLevelShell;};
169 
173  virtual void GetMousePosition(int *x, int *y);
174 
176 
179  friend void vtkXRenderWindowInteractorCallback(Widget,XtPointer,
180  XEvent *,Boolean *);
181  friend void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
183 
184 protected:
187 
188  //Using static here to avoid detroying context when many apps are open:
189  static XtAppContext App;
190  static int NumAppInitialized;
191 
192  Display *DisplayId;
193  Window WindowId;
194  Atom KillAtom;
195  Widget Top;
196  int OwnTop;
197  int OwnApp;
198  int PositionBeforeStereo[2];
200  int TimerId;
201  vtkXRenderWindowInteractorInternals* Internal;
202 
208  virtual void StartEventLoop();
209 
211 
215  virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
216  virtual int InternalDestroyTimer(int platformTimerId);
218 
219  XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
220  XtTimerCallbackProc proc, XtPointer client_data) ;
221  void Timer(XtPointer client_data, XtIntervalId *id);
222  void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
223 
224  static int BreakLoopFlag;
225 
226 private:
227  vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&) VTK_DELETE_FUNCTION;
228  void operator=(const vtkXRenderWindowInteractor&) VTK_DELETE_FUNCTION;
229 };
230 
231 #endif
vtkRenderWindowInteractor::New
static vtkRenderWindowInteractor * New()
vtkRenderWindowInteractor::InternalCreateTimer
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
vtkRenderWindowInteractor::StartEventLoop
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
Definition: vtkRenderWindowInteractor.h:891
vtkXRenderWindowInteractor::GetTopLevelShell
Widget GetTopLevelShell()
Definition: vtkXRenderWindowInteractor.h:167
vtkRenderWindowInteractor::InternalDestroyTimer
virtual int InternalDestroyTimer(int platformTimerId)
vtkXRenderWindowInteractorTimer
void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorTimer(XtPointer, XtIntervalId *)
vtkRenderWindowInteractor::UpdateSize
virtual void UpdateSize(int x, int y)
Event loop notification member for window size change.
vtkXRenderWindowInteractor::OwnApp
int OwnApp
Definition: vtkXRenderWindowInteractor.h:197
vtkXRenderWindowInteractor
an X event driven interface for a RenderWindow
Definition: vtkXRenderWindowInteractor.h:54
vtkRenderWindowInteractor::Disable
virtual void Disable()
Definition: vtkRenderWindowInteractor.h:124
vtkXRenderWindowInteractor::KillAtom
Atom KillAtom
Definition: vtkXRenderWindowInteractor.h:194
vtkXRenderWindowInteractor::OwnTop
int OwnTop
Definition: vtkXRenderWindowInteractor.h:196
vtkXRenderWindowInteractor::Internal
vtkXRenderWindowInteractorInternals * Internal
Definition: vtkXRenderWindowInteractor.h:201
vtkXRenderWindowInteractor::BreakLoopFlag
static int BreakLoopFlag
Definition: vtkXRenderWindowInteractor.h:224
vtkRenderWindowInteractor::GetMousePosition
virtual void GetMousePosition(int *x, int *y)
Get the current position of the mouse.
Definition: vtkRenderWindowInteractor.h:347
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkXRenderWindowInteractor::TopLevelShell
Widget TopLevelShell
Definition: vtkXRenderWindowInteractor.h:199
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:78
vtkXRenderWindowInteractor::GetWidget
Widget GetWidget()
Definition: vtkXRenderWindowInteractor.h:133
vtkXRenderWindowInteractor::Top
Widget Top
Definition: vtkXRenderWindowInteractor.h:195
vtkRenderWindowInteractor::TerminateApp
virtual void TerminateApp(void)
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
Definition: vtkRenderWindowInteractor.h:255
vtkRenderWindowInteractor::Enable
virtual void Enable()
Enable/Disable interactions.
Definition: vtkRenderWindowInteractor.h:123
vtkRenderWindowInteractor::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:50
vtkRenderWindowInteractor.h
vtkXRenderWindowInteractor::App
static XtAppContext App
Definition: vtkXRenderWindowInteractor.h:189
vtkRenderWindowInteractor::Initialize
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
vtkXRenderWindowInteractor::NumAppInitialized
static int NumAppInitialized
Definition: vtkXRenderWindowInteractor.h:190
vtkXRenderWindowInteractor::DisplayId
Display * DisplayId
Definition: vtkXRenderWindowInteractor.h:192
vtkXRenderWindowInteractorCallback
void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorCallback(Widget, XtPointer, XEvent *, Boolean *)
vtkXRenderWindowInteractor::TimerId
int TimerId
Definition: vtkXRenderWindowInteractor.h:200
vtkXRenderWindowInteractor::WindowId
Window WindowId
Definition: vtkXRenderWindowInteractor.h:193