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 class vtkXRenderWindowInteractorInternals;
00050
00051
00052
00053 void vtkXRenderWindowInteractorCallback(Widget,XtPointer, XEvent *,Boolean *);
00054 void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00055
00056
00057 class VTK_RENDERING_EXPORT vtkXRenderWindowInteractor : public vtkRenderWindowInteractor
00058 {
00059 public:
00060 static vtkXRenderWindowInteractor *New();
00061 vtkTypeRevisionMacro(vtkXRenderWindowInteractor,vtkRenderWindowInteractor);
00062 void PrintSelf(ostream& os, vtkIndent indent);
00063
00067 virtual void Initialize();
00068
00070 void TerminateApp(void) { exit(0); }
00071
00073
00076 vtkSetMacro(BreakLoopFlag, int);
00077 vtkGetMacro(BreakLoopFlag, int);
00078 vtkBooleanMacro(BreakLoopFlag, int);
00080
00082
00084 virtual void Initialize(XtAppContext app);
00085 vtkGetMacro( App, XtAppContext );
00087
00089
00096 virtual void Enable();
00097 virtual void Disable();
00099
00103 virtual void Start();
00104
00107 virtual void UpdateSize(int,int);
00108
00110
00124 virtual void SetWidget(Widget);
00125 Widget GetWidget() {return this->Top;};
00127
00129
00153 virtual void SetTopLevelShell(Widget);
00154 Widget GetTopLevelShell() {return this->TopLevelShell;};
00156
00159 virtual void GetMousePosition(int *x, int *y);
00160
00162
00163 friend void vtkXRenderWindowInteractorCallback(Widget,XtPointer,
00164 XEvent *,Boolean *);
00165 friend void vtkXRenderWindowInteractorTimer(XtPointer,XtIntervalId *);
00167
00168 protected:
00169 vtkXRenderWindowInteractor();
00170 ~vtkXRenderWindowInteractor();
00171
00172
00173 static XtAppContext App;
00174 static int NumAppInitialized;
00175
00176 Display *DisplayId;
00177 Window WindowId;
00178 Atom KillAtom;
00179 Widget Top;
00180 int OwnTop;
00181 int OwnApp;
00182 int PositionBeforeStereo[2];
00183 Widget TopLevelShell;
00184 int TimerId;
00185 vtkXRenderWindowInteractorInternals* Internal;
00186
00188
00190 virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
00191 virtual int InternalDestroyTimer(int platformTimerId);
00193
00194 int BreakLoopFlag;
00195 XtIntervalId AddTimeOut(XtAppContext app_context, unsigned long interval,
00196 XtTimerCallbackProc proc, XtPointer client_data) ;
00197 void Timer(XtPointer client_data, XtIntervalId *id);
00198 void Callback(Widget w, XtPointer client_data, XEvent *event, Boolean *ctd);
00199
00200 vtkCallbackCommand* BreakXtLoopCallback;
00201 static void BreakXtLoop(vtkObject*, unsigned long, void*, void*);
00202
00203 private:
00204 vtkXRenderWindowInteractor(const vtkXRenderWindowInteractor&);
00205 void operator=(const vtkXRenderWindowInteractor&);
00206 };
00207
00208 #endif