2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
28 /*=========================================================================
30 Program: Visualization Toolkit
36 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
38 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
40 This software is distributed WITHOUT ANY WARRANTY; without even
41 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
42 PURPOSE. See the above copyright notice for more information.
44 =========================================================================*/
46 // .NAME wxVTKRenderWindowInteractor - class to enable VTK to render to
47 // and interact with wxWindow.
48 // .SECTION Description
49 // wxVTKRenderWindowInteractor provide a VTK widget for wxWindow. This class
50 // was completely rewrote to have the 'Look & Feel' of the python version:
51 // wxVTKRenderWindowInteractor.py
53 // - There is a know bug that prevent this class to works for more info see
54 // WX_USE_X_CAPTURE. This bug only affect wxGTK from 2.3.2 to wxGTK 2.4.0.
55 // - Furthermore this class is tempated over either wxWindows or wxGLCanvas,
56 // in wxWindows 2.3.1 and earlier, the wxGLCanvas had scroll bars, you can avoid
57 // this effect by playing with WX_BASE_CLASS at your risk (you might end up with
58 // lot of flickering.)
59 // - This class might not be easily readable as it tried to work with VTK 3.2
60 // and 4.x. This class doesn't support reparenting with VTK 4.2 and earlier.
62 // wxVTKRenderWindowInteractor.py wxVTKRenderWindow.py
64 #ifndef _wxVTKRenderWindowInteractor_h_
65 #define _wxVTKRenderWindowInteractor_h_
67 // For compilers that support precompilation, includes "wx/wx.h".
68 #include "wx/wxprec.h"
79 #include <wx/dcclient.h>
82 #include "vtkRenderWindowInteractor.h"
83 #include "vtkRenderWindow.h"
85 #define USE_WXGLCANVAS
87 #if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
89 # include <wx/glcanvas.h>
91 # error "problem of wxGLCanvas, you need to build wxWidgets with opengl"
92 # endif //wxUSE_GLCANVAS
95 // Motif version (renamed into wxX11 for wxWindow 2.4 and newer)
96 #if defined(__WXMOTIF__)
97 # error This GUI is not supported by wxVTKRenderWindowInteractor for now
100 // wx forward declarations
107 //=======================================================================
108 // LG : NAMESPACE IS NECESSARY TO AVOID CONFLICTING SYMBOLS IN DYN LIBS
113 #if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
114 class wxVTKRenderWindowInteractor : public wxGLCanvas, public vtkRenderWindowInteractor
116 class wxVTKRenderWindowInteractor : public wxWindow, public vtkRenderWindowInteractor
119 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
120 #if wxMAJOR_VERSION <= 2
121 DECLARE_DYNAMIC_CLASS(wxVTKRenderWindowInteractor)
123 wxDECLARE_DYNAMIC_CLASS(wxVTKRenderWindowInteractor);
128 wxVTKRenderWindowInteractor();
130 wxVTKRenderWindowInteractor(wxWindow *parent,
132 const wxPoint &pos = wxDefaultPosition,
133 const wxSize &size = wxDefaultSize,
134 long style = wxWANTS_CHARS | wxNO_FULL_REPAINT_ON_RESIZE,
135 const wxString &name = wxPanelNameStr);
136 //EED win Compilation why ??: vtkTypeRevisionMacro(wxVTKRenderWindowInteractor,vtkRenderWindowInteractor);
137 static wxVTKRenderWindowInteractor * New();
138 void PrintSelf(ostream& os, vtkIndent indent);
141 ~wxVTKRenderWindowInteractor();
143 // vtkRenderWindowInteractor overrides
146 bool Enable(bool enable);
149 void UpdateSize(int x, int y);
150 int CreateTimer(int timertype);
152 void TerminateApp() {};
155 void OnPaint(wxPaintEvent &event);
156 void OnEraseBackground (wxEraseEvent& event);
157 void OnMotion(wxMouseEvent &event);
159 void OnButtonDown(wxMouseEvent &event);
160 void OnButtonUp(wxMouseEvent &event);
161 #if !(VTK_MAJOR_VERSION == 3 && VTK_MINOR_VERSION == 1)
162 void OnEnter(wxMouseEvent &event);
163 void OnLeave(wxMouseEvent &event);
164 void OnMouseWheel(wxMouseEvent& event);
165 #if wxCHECK_VERSION(2, 8, 0)
166 void OnMouseCaptureLost(wxMouseCaptureLostEvent& event);
168 void OnKeyDown(wxKeyEvent &event);
169 void OnKeyUp(wxKeyEvent &event);
170 void OnChar(wxKeyEvent &event);
172 void OnTimer(wxTimerEvent &event);
173 void OnSize(wxSizeEvent &event);
176 void SetRenderWhenDisabled(int newValue);
179 // Prescribe that the window be created in a stereo-capable mode. This
180 // method must be called before the window is realized. Default if off.
181 vtkGetMacro(Stereo,int);
182 vtkBooleanMacro(Stereo,int);
183 virtual void SetStereo(int capable);
186 // As CaptureMouse could be a problem sometimes on a window box
187 // This method allow to set or not the CaptureMouse.
188 // This method actually will works only if WX_USE_X_CAPTURE was set to 1
189 vtkSetMacro(UseCaptureMouse,int);
190 vtkBooleanMacro(UseCaptureMouse,int);
192 #if VTK_MAJOR_VERSION > 5 || (VTK_MAJOR_VERSION == 5 && VTK_MINOR_VERSION >= 2)
194 virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
195 virtual int InternalDestroyTimer(int platformTimerId);
199 #if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
200 wxGLContext *context;
204 long GetHandleHack();
210 int RenderWhenDisabled;
213 DECLARE_EVENT_TABLE()
217 // LG : EO namespace bbwxvtk
218 //======================================================================
220 #endif //_wxVTKRenderWindowInteractor_h_