VTK
|
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 =========================================================================*/ 00035 #ifndef __vtkXRenderWindowInteractor_h 00036 #define __vtkXRenderWindowInteractor_h 00037 00038 //=========================================================== 00039 // now we define the C++ class 00040 00041 #include "vtkRenderWindowInteractor.h" 00042 #include <X11/StringDefs.h> // Needed for X types in the public interface 00043 #include <X11/Intrinsic.h> // Needed for X types in the public interface 00044 00045 class vtkCallbackCommand; 00046 class vtkXRenderWindowInteractorInternals; 00047 00048 //BTX 00049 // Forward declare internal friend functions. 00050 void vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *); 00051 void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *); 00052 //ETX 00053 00054 class VTK_RENDERING_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor 00055 { 00056 public: 00057 static vtkXRenderWindowInteractor *New(); 00058 vtkTypeRevisionMacro(vtkXRenderWindowInteractor,vtkRenderWindowInteractor); 00059 void PrintSelf(ostream& os, vtkIndent indent); 00060 00064 virtual void Initialize(); 00065 00067 void TerminateApp(void) { exit(0); } 00068 00070 00073 vtkSetMacro(BreakLoopFlag, int); 00074 vtkGetMacro(BreakLoopFlag, int); 00075 vtkBooleanMacro(BreakLoopFlag, int); 00077 00079 00081 virtual void Initialize(XtAppContext app); 00082 vtkGetMacro( App, XtAppContext ); 00084 00086 00093 virtual void Enable(); 00094 virtual void Disable(); 00096 00100 virtual void Start(); 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 00185 00187 virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration); 00188 virtual int InternalDestroyTimer(int platformTimerId); 00190 00191 int BreakLoopFlag; 00192 XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval, 00193 XtTimerCallbackProc proc, XtPointer client_data) ; 00194 void Timer(XtPointer client_data, XtIntervalId *id); 00195 void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd); 00196 00197 vtkCallbackCommand* BreakXtLoopCallback; 00198 static void BreakXtLoop(vtkObject*, unsigned long, void*, void*); 00199 00200 private: 00201 vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&); // Not implemented. 00202 void operator=(const vtkXRenderWindowInteractor&); // Not implemented. 00203 }; 00204 00205 #endif