VTK
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 
00105   virtual void Start();
00106 
00109   virtual void UpdateSize(int,int);
00110 
00112 
00126   virtual void SetWidget(Widget);
00127   Widget GetWidget() {return this->Top;};
00129 
00131 
00155   virtual void SetTopLevelShell(Widget);
00156   Widget GetTopLevelShell() {return this->TopLevelShell;};
00158 
00161   virtual void GetMousePosition(int *x, int *y);
00162 
00164 
00165   friend void vtkXRenderWindowInteractorCallback(Widget,XtPointer,
00166                                                  XEvent *,Boolean *);
00167   friend void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00169 
00170 protected:
00171   vtkXRenderWindowInteractor();
00172   ~vtkXRenderWindowInteractor();
00173 
00174   //Using static here to avoid detroying context when many apps are open:
00175   static XtAppContext App;
00176   static int NumAppInitialized;
00177 
00178   Display *DisplayId;
00179   Window WindowId;
00180   Atom KillAtom;
00181   Widget Top;
00182   int OwnTop;
00183   int OwnApp;
00184   int PositionBeforeStereo[2];
00185   Widget TopLevelShell;
00186   int TimerId;
00187   vtkXRenderWindowInteractorInternals* Internal;
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