VTK
dox/Rendering/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 "vtkRenderWindowInteractor.h"
00045 #include <X11/StringDefs.h> // Needed for X types in the public interface
00046 #include <X11/Intrinsic.h> // Needed for X types in the public interface
00047 
00048 class vtkCallbackCommand;
00049 class vtkXRenderWindowInteractorInternals;
00050 
00051 //BTX
00052 // Forward declare internal friend functions.
00053 void VTK_RENDERING_EXPORT vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
00054 void VTK_RENDERING_EXPORT vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00055 //ETX
00056 
00057 class VTK_RENDERING_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
00058 {
00059 public:
00060   static vtkXRenderWindowInteractor *New();
00061   vtkTypeMacro(vtkXRenderWindowInteractor,vtkRenderWindowInteractor);
00062   void PrintSelf(ostream& os, vtkIndent indent);
00063 
00067   virtual void Initialize();
00068 
00070   void TerminateApp();
00071 
00073 
00076   vtkGetMacro(BreakLoopFlag, int);
00077   void SetBreakLoopFlag(int);
00078   void BreakLoopFlagOff();
00079   void BreakLoopFlagOn();
00081 
00083 
00085   virtual void Initialize(XtAppContext app);
00086   vtkGetMacro( App, XtAppContext );
00088 
00090 
00097   virtual void Enable();
00098   virtual void Disable();
00100 
00104   virtual void Start();
00105 
00108   virtual void UpdateSize(int,int);
00109 
00111 
00125   virtual void SetWidget(Widget);
00126   Widget GetWidget() {return this->Top;};
00128 
00130 
00154   virtual void SetTopLevelShell(Widget);
00155   Widget GetTopLevelShell() {return this->TopLevelShell;};
00157 
00160   virtual void GetMousePosition(int *x, int *y);
00161 
00163 
00164   friend void vtkXRenderWindowInteractorCallback(Widget,XtPointer,
00165                                                  XEvent *,Boolean *);
00166   friend void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00168 
00169 protected:
00170   vtkXRenderWindowInteractor();
00171   ~vtkXRenderWindowInteractor();
00172 
00173   //Using static here to avoid detroying context when many apps are open:
00174   static XtAppContext App;
00175   static int NumAppInitialized;
00176 
00177   Display *DisplayId;
00178   Window WindowId;
00179   Atom KillAtom;
00180   Widget Top;
00181   int OwnTop;
00182   int OwnApp;
00183   int PositionBeforeStereo[2];
00184   Widget TopLevelShell;
00185   int TimerId;
00186   vtkXRenderWindowInteractorInternals* Internal;
00187 
00189 
00191   virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
00192   virtual int InternalDestroyTimer(int platformTimerId);
00194 
00195   XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
00196                           XtTimerCallbackProc proc, XtPointer client_data) ;
00197   void Timer(XtPointer client_data, XtIntervalId *id);
00198   void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
00199 
00200   static int BreakLoopFlag;
00201 
00202 private:
00203   vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&);  // Not implemented.
00204   void operator=(const vtkXRenderWindowInteractor&);  // Not implemented.
00205 };
00206 
00207 #endif