VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/OpenGL2/vtkXOpenGLRenderWindowInteractor.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkXOpenGLRenderWindowInteractor.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00035 #ifndef vtkXOpenGLRenderWindowInteractor_h
00036 #define vtkXOpenGLRenderWindowInteractor_h
00037 
00038 //===========================================================
00039 // now we define the C++ class
00040 
00041 #include "vtkRenderingOpenGL2Module.h" // For export macro
00042 #include "vtkRenderWindowInteractor.h"
00043 #include <X11/StringDefs.h> // Needed for X types in the public interface
00044 #include <X11/Intrinsic.h> // Needed for X types in the public interface
00045 
00046 class vtkCallbackCommand;
00047 class vtkXOpenGLRenderWindowInteractorInternals;
00048 
00049 // Forward declare internal friend functions.
00050 void VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
00051 void VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00052 
00053 class VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindowInteractor : public vtkRenderWindowInteractor
00054 {
00055 public:
00056   static vtkXOpenGLRenderWindowInteractor *New();
00057   vtkTypeMacro(vtkXOpenGLRenderWindowInteractor,vtkRenderWindowInteractor);
00058   void PrintSelf(ostream& os, vtkIndent indent);
00059 
00063   virtual void Initialize();
00064 
00066   void TerminateApp();
00067 
00069 
00072   vtkGetMacro(BreakLoopFlag, int);
00073   void SetBreakLoopFlag(int);
00074   void BreakLoopFlagOff();
00075   void BreakLoopFlagOn();
00077 
00079 
00081   virtual void Initialize(XtAppContext app);
00082   vtkGetMacro( App, XtAppContext );
00084 
00086 
00093   virtual void Enable();
00094   virtual void Disable();
00096 
00099   virtual void UpdateSize(int,int);
00100 
00102 
00116   virtual void SetWidget(Widget);
00117   Widget GetWidget() {return this->Top;};
00119 
00121 
00145   virtual void SetTopLevelShell(Widget);
00146   Widget GetTopLevelShell() {return this->TopLevelShell;};
00148 
00151   virtual void GetMousePosition(int *x, int *y);
00152 
00154 
00155   friend void vtkXOpenGLRenderWindowInteractorCallback(Widget,XtPointer,
00156                                                  XEvent *,Boolean *);
00157   friend void vtkXOpenGLRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00159 
00160 protected:
00161   vtkXOpenGLRenderWindowInteractor();
00162   ~vtkXOpenGLRenderWindowInteractor();
00163 
00164   //Using static here to avoid detroying context when many apps are open:
00165   static XtAppContext App;
00166   static int NumAppInitialized;
00167 
00168   Display *DisplayId;
00169   Window WindowId;
00170   Atom KillAtom;
00171   Widget Top;
00172   int OwnTop;
00173   int OwnApp;
00174   int PositionBeforeStereo[2];
00175   Widget TopLevelShell;
00176   int TimerId;
00177   vtkXOpenGLRenderWindowInteractorInternals* Internal;
00178 
00180 
00182   virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
00183   virtual int InternalDestroyTimer(int platformTimerId);
00185 
00186   XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
00187                           XtTimerCallbackProc proc, XtPointer client_data) ;
00188   void Timer(XtPointer client_data, XtIntervalId *id);
00189   void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
00190 
00191   static int BreakLoopFlag;
00192 
00196   virtual void StartEventLoop();
00197 
00198 private:
00199   vtkXOpenGLRenderWindowInteractor(const vtkXOpenGLRenderWindowInteractor&);  // Not implemented.
00200   void operator=(const vtkXOpenGLRenderWindowInteractor&);  // Not implemented.
00201 };
00202 
00203 #endif