Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkXRenderWindowInteractor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkXRenderWindowInteractor.h,v $
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 =========================================================================*/
00051 #ifndef __vtkXRenderWindowInteractor_h
00052 #define __vtkXRenderWindowInteractor_h
00053 
00054 //===========================================================
00055 // now we define the C++ class
00056 
00057 #include "vtkRenderWindowInteractor.h"
00058 #include <X11/StringDefs.h> // Needed for X types in the public interface
00059 #include <X11/Intrinsic.h> // Needed for X types in the public interface
00060 
00061 class vtkCallbackCommand;
00062 
00063 //BTX
00064 // Forward declare internal friend functions.
00065 void vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
00066 void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00067 //ETX
00068 
00069 class VTK_RENDERING_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
00070 {
00071 public:
00072   static vtkXRenderWindowInteractor *New();
00073   vtkTypeRevisionMacro(vtkXRenderWindowInteractor,vtkRenderWindowInteractor);
00074   void PrintSelf(ostream& os, vtkIndent indent);
00075 
00079   virtual void Initialize();
00080 
00082   void TerminateApp(void) { exit(0); }
00083 
00085 
00088   vtkSetMacro(BreakLoopFlag, int);
00089   vtkGetMacro(BreakLoopFlag, int);
00090   vtkBooleanMacro(BreakLoopFlag, int);
00092 
00094 
00095   int CreateTimer(int timertype);
00096   int DestroyTimer(void);
00098 
00100 
00102   virtual void Initialize(XtAppContext app);
00103   vtkGetMacro( App, XtAppContext );
00105   
00107 
00114   virtual void Enable();
00115   virtual void Disable();
00117 
00121   virtual void Start();
00122 
00124 
00138   virtual void SetWidget(Widget);
00139   Widget GetWidget() {return this->Top;};
00141   
00143 
00167   virtual void SetTopLevelShell(Widget);
00168   Widget GetTopLevelShell() {return this->TopLevelShell;};
00170   
00173   virtual void GetMousePosition(int *x, int *y); 
00174 
00176 
00177   friend void vtkXRenderWindowInteractorCallback(Widget,XtPointer,
00178                                                  XEvent *,Boolean *);
00179   friend void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00181 
00182 protected:
00183   vtkXRenderWindowInteractor();
00184   ~vtkXRenderWindowInteractor();
00185 
00186   //Using static here to avoid detroying context when many apps are open:
00187   static XtAppContext App;
00188   static int NumAppInitialized;
00189 
00190   Display *DisplayId;
00191   Window WindowId;
00192   Widget Top;
00193   int OwnTop;
00194   int OwnApp;
00195   int PositionBeforeStereo[2];
00196   Widget TopLevelShell;
00197 
00198   int BreakLoopFlag;
00199   XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
00200                           XtTimerCallbackProc proc, XtPointer client_data) ;
00201   void Timer(XtPointer client_data, XtIntervalId *id); 
00202   void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
00203 
00204   vtkCallbackCommand* BreakXtLoopCallback;
00205   static void BreakXtLoop(vtkObject*, unsigned long, void*, void*);
00206 private:
00207   vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&);  // Not implemented.
00208   void operator=(const vtkXRenderWindowInteractor&);  // Not implemented.
00209 };
00210 
00211 #endif
00212 
00213 
00214