00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00038 #ifndef __vtkXRenderWindowInteractor_h
00039 #define __vtkXRenderWindowInteractor_h
00040
00041
00042
00043
00044 #include "vtkRenderWindowInteractor.h"
00045 #include <X11/StringDefs.h>
00046 #include <X11/Intrinsic.h>
00047
00048 class vtkCallbackCommand;
00049
00050
00051
00052 void vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
00053 void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00054
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
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
00186 int BreakLoopFlag;
00187 XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
00188 XtTimerCallbackProc proc, XtPointer client_data) ;
00189 void Timer(XtPointer client_data, XtIntervalId *id);
00190 void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
00191
00192 vtkCallbackCommand* BreakXtLoopCallback;
00193 static void BreakXtLoop(vtkObject*, unsigned long, void*, void*);
00194 private:
00195 vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&);
00196 void operator=(const vtkXRenderWindowInteractor&);
00197 };
00198
00199 #endif
00200
00201
00202