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