00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 #ifndef _wxVTKRenderWindowInteractor_h_
00034 #define _wxVTKRenderWindowInteractor_h_
00035 
00036 
00037 #include "wx/wxprec.h"
00038 
00039 #ifdef __BORLANDC__
00040 #  pragma hdrstop
00041 #endif
00042 
00043 #ifndef WX_PRECOMP
00044 #include <wx/wx.h>
00045 #endif
00046 
00047 #include <wx/timer.h>
00048 #include <wx/dcclient.h>
00049 
00050 
00051 #include "vtkRenderWindowInteractor.h"
00052 #include "vtkRenderWindow.h"
00053 
00054 #ifdef __WXGTK__
00055 #  if wxUSE_GLCANVAS
00056 #    include <wx/glcanvas.h>
00057 #  else
00058 #    error "problem of wxGLCanvas, you need to build wxWidgets with opengl"
00059 #  endif //wxUSE_GLCANVAS
00060 #endif //__WXGTK__
00061 
00062 
00063 #if defined(__WXMOTIF__) 
00064 # error This GUI is not supported by wxVTKRenderWindowInteractor for now
00065 #endif
00066 
00067 
00068 class wxPaintEvent;
00069 class wxMouseEvent;
00070 class wxTimerEvent;
00071 class wxKeyEvent;
00072 class wxSizeEvent;
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 #ifdef __WXGTK__
00091 class VTK_RENDERING_EXPORT wxVTKRenderWindowInteractor : public wxGLCanvas, virtual public vtkRenderWindowInteractor
00092 #else
00093 
00094 class wxVTKRenderWindowInteractor : public wxWindow, virtual public vtkRenderWindowInteractor
00095 #endif 
00096 {
00097   DECLARE_DYNAMIC_CLASS(wxVTKRenderWindowInteractor)
00098   
00099   public:
00100     
00101     wxVTKRenderWindowInteractor();
00102 
00103     wxVTKRenderWindowInteractor(wxWindow *parent,
00104                                 wxWindowID id,
00105                                 const wxPoint &pos = wxDefaultPosition,
00106                                 const wxSize &size = wxDefaultSize,
00107                                 long style = wxWANTS_CHARS | wxNO_FULL_REPAINT_ON_RESIZE,
00108                                 const wxString &name = wxPanelNameStr);
00109     
00110     static wxVTKRenderWindowInteractor * New();
00111     void PrintSelf(ostream& os, vtkIndent indent);
00112 
00113       
00114     ~wxVTKRenderWindowInteractor();
00115 
00116     
00117     void Initialize();
00118     void Enable();
00119     bool Enable(bool enable);
00120     void Disable();
00121     void Start();
00122     void UpdateSize(int x, int y);
00123     int CreateTimer(int timertype);
00124     int DestroyTimer();
00125     void TerminateApp() {};
00126 
00127     
00128     void OnPaint(wxPaintEvent &event);
00129     void OnEraseBackground (wxEraseEvent& event);
00130     void OnMotion(wxMouseEvent &event);
00131 
00132     void OnButtonDown(wxMouseEvent &event);
00133     void OnButtonUp(wxMouseEvent &event);
00134 #if !(VTK_MAJOR_VERSION == 3 && VTK_MINOR_VERSION == 1)
00135     void OnEnter(wxMouseEvent &event);
00136     void OnLeave(wxMouseEvent &event);
00137     void OnKeyDown(wxKeyEvent &event);
00138     void OnKeyUp(wxKeyEvent &event);
00139 #endif
00140     void OnTimer(wxTimerEvent &event);
00141     void OnSize(wxSizeEvent &event);
00142 
00143     void Render();
00144     void SetRenderWhenDisabled(int newValue);
00145 
00146     
00147     
00148     
00149     vtkGetMacro(Stereo,int);
00150     vtkBooleanMacro(Stereo,int);
00151     virtual void SetStereo(int capable);
00152 
00153     
00154     
00155     
00156     
00157     vtkSetMacro(UseCaptureMouse,int);
00158     vtkBooleanMacro(UseCaptureMouse,int);
00159 
00160   protected:
00161     wxTimer timer;
00162     int ActiveButton;
00163     int RenderAllowed;
00164     long GetHandleHack();
00165     int Stereo;
00166     
00167   private:
00168     long Handle;
00169     bool Created;
00170     int RenderWhenDisabled;
00171     int UseCaptureMouse;
00172 
00173     DECLARE_EVENT_TABLE()
00174 };
00175 
00176 #endif //_wxVTKRenderWindowInteractor_h_