VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/OpenGL/vtkXRenderWindowInteractor.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkXRenderWindowInteractor.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 =========================================================================*/
00038 #ifndef vtkXRenderWindowInteractor_h
00039 #define vtkXRenderWindowInteractor_h
00040 
00041 //===========================================================
00042 // now we define the C++ class
00043 
00044 #include "vtkRenderingOpenGLModule.h" // For export macro
00045 #include "vtkRenderWindowInteractor.h"
00046 #include <X11/StringDefs.h> // Needed for X types in the public interface
00047 #include <X11/Intrinsic.h> // Needed for X types in the public interface
00048 
00049 class vtkCallbackCommand;
00050 class vtkXRenderWindowInteractorInternals;
00051 
00052 //BTX
00053 // Forward declare internal friend functions.
00054 void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
00055 void VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00056 //ETX
00057 
00058 class VTKRENDERINGOPENGL_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
00059 {
00060 public:
00061   static vtkXRenderWindowInteractor *New();
00062   vtkTypeMacro(vtkXRenderWindowInteractor,vtkRenderWindowInteractor);
00063   void PrintSelf(ostream& os, vtkIndent indent);
00064 
00068   virtual void Initialize();
00069 
00071   void TerminateApp();
00072 
00074 
00077   vtkGetMacro(BreakLoopFlag, int);
00078   void SetBreakLoopFlag(int);
00079   void BreakLoopFlagOff();
00080   void BreakLoopFlagOn();
00082 
00084 
00086   virtual void Initialize(XtAppContext app);
00087   vtkGetMacro( App, XtAppContext );
00089 
00091 
00098   virtual void Enable();
00099   virtual void Disable();
00101 
00104   virtual void UpdateSize(int,int);
00105 
00107 
00121   virtual void SetWidget(Widget);
00122   Widget GetWidget() {return this->Top;};
00124 
00126 
00150   virtual void SetTopLevelShell(Widget);
00151   Widget GetTopLevelShell() {return this->TopLevelShell;};
00153 
00156   virtual void GetMousePosition(int *x, int *y);
00157 
00159 
00160   friend void vtkXRenderWindowInteractorCallback(Widget,XtPointer,
00161                                                  XEvent *,Boolean *);
00162   friend void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00164 
00165 protected:
00166   vtkXRenderWindowInteractor();
00167   ~vtkXRenderWindowInteractor();
00168 
00169   //Using static here to avoid detroying context when many apps are open:
00170   static XtAppContext App;
00171   static int NumAppInitialized;
00172 
00173   Display *DisplayId;
00174   Window WindowId;
00175   Atom KillAtom;
00176   Widget Top;
00177   int OwnTop;
00178   int OwnApp;
00179   int PositionBeforeStereo[2];
00180   Widget TopLevelShell;
00181   int TimerId;
00182   vtkXRenderWindowInteractorInternals* Internal;
00183 
00187   virtual void StartEventLoop();
00188 
00190 
00192   virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
00193   virtual int InternalDestroyTimer(int platformTimerId);
00195 
00196   XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
00197                           XtTimerCallbackProc proc, XtPointer client_data) ;
00198   void Timer(XtPointer client_data, XtIntervalId *id);
00199   void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
00200 
00201   static int BreakLoopFlag;
00202 
00203 private:
00204   vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&);  // Not implemented.
00205   void operator=(const vtkXRenderWindowInteractor&);  // Not implemented.
00206 };
00207 
00208 #endif