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