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

Rendering/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 =========================================================================*/
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 
00050 //BTX
00051 // Forward declare internal friend functions.
00052 void vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
00053 void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00054 //ETX
00055 
00056 class VTK_RENDERING_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
00057 {
00058 public:
00059   static vtkXRenderWindowInteractor *New();
00060   vtkTypeRevisionMacro(vtkXRenderWindowInteractor,vtkRenderWindowInteractor);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00066   virtual void Initialize();
00067 
00069   void TerminateApp(void) { exit(0); }
00070 
00072 
00075   vtkSetMacro(BreakLoopFlag, int);
00076   vtkGetMacro(BreakLoopFlag, int);
00077   vtkBooleanMacro(BreakLoopFlag, int);
00079 
00081 
00082   int CreateTimer(int timertype);
00083   int DestroyTimer(void);
00085 
00087 
00089   virtual void Initialize(XtAppContext app);
00090   vtkGetMacro( App, XtAppContext );
00092   
00094 
00101   virtual void Enable();
00102   virtual void Disable();
00104 
00108   virtual void Start();
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   Display *DisplayId;
00174   Window WindowId;
00175   Widget Top;
00176   int OwnTop;
00177   XtAppContext App;
00178   int PositionBeforeStereo[2];
00179   Widget TopLevelShell;
00180 
00181   int BreakLoopFlag;
00182   XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
00183                           XtTimerCallbackProc proc, XtPointer client_data) ;
00184   void Timer(XtPointer client_data, XtIntervalId *id); 
00185   void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
00186 
00187   vtkCallbackCommand* BreakXtLoopCallback;
00188   static void BreakXtLoop(vtkObject*, unsigned long, void*, void*);
00189 private:
00190   vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&);  // Not implemented.
00191   void operator=(const vtkXRenderWindowInteractor&);  // Not implemented.
00192 };
00193 
00194 #endif
00195 
00196 
00197