00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00035 #ifndef __vtkXRenderWindowInteractor_h
00036 #define __vtkXRenderWindowInteractor_h
00037
00038
00039
00040
00041 #include "vtkRenderWindowInteractor.h"
00042 #include <X11/StringDefs.h>
00043 #include <X11/Intrinsic.h>
00044
00045 class vtkCallbackCommand;
00046 class vtkXRenderWindowInteractorInternals;
00047
00048
00049
00050 void vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
00051 void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00052
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
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&);
00202 void operator=(const vtkXRenderWindowInteractor&);
00203 };
00204
00205 #endif