X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FcreawxVTKRenderWindowInteractor.h;h=82b463a681d8bca11044b7cf46705c33e88a79c2;hb=f19db1f9b569fa0b965cb79728b153510ad6f92b;hp=ebc2030656342849c158858140e32cf9bdf3368b;hpb=ffbaf4177cae0647c558f89daf6783b91373930d;p=crea.git diff --git a/src/creawxVTKRenderWindowInteractor.h b/src/creawxVTKRenderWindowInteractor.h index ebc2030..82b463a 100644 --- a/src/creawxVTKRenderWindowInteractor.h +++ b/src/creawxVTKRenderWindowInteractor.h @@ -1,10 +1,37 @@ +/* + # --------------------------------------------------------------------- + # + # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image + # pour la SantÈ) + # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton + # Previous Authors : Laurent Guigues, Jean-Pierre Roux + # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil + # + # This software is governed by the CeCILL-B license under French law and + # abiding by the rules of distribution of free software. You can use, + # modify and/ or redistribute the software under the terms of the CeCILL-B + # license as circulated by CEA, CNRS and INRIA at the following URL + # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html + # or in the file LICENSE.txt. + # + # As a counterpart to the access to the source code and rights to copy, + # modify and redistribute granted by the license, users are provided only + # with a limited warranty and the software's author, the holder of the + # economic rights, and the successive licensors have only limited + # liability. + # + # The fact that you are presently reading this means that you have had + # knowledge of the CeCILL-B license and that you accept its terms. + # ------------------------------------------------------------------------ */ + + /*========================================================================= Program: Visualization Toolkit - Module: $RCSfile: creawxVTKRenderWindowInteractor.h,v $ + Module: $RCSfile$ Language: C++ - Date: $Date: 2008/10/15 11:19:18 $ - Version: $Revision: 1.1 $ + Date: $Date$ + Version: $Revision$ Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. @@ -16,12 +43,12 @@ =========================================================================*/ -// .NAME creawxVTKRenderWindowInteractor - class to enable VTK to render to +// .NAME wxVTKRenderWindowInteractor - class to enable VTK to render to // and interact with wxWindow. // .SECTION Description -// creawxVTKRenderWindowInteractor provide a VTK widget for wxWindow. This class +// wxVTKRenderWindowInteractor provide a VTK widget for wxWindow. This class // was completely rewrote to have the 'Look & Feel' of the python version: -// creawxVTKRenderWindowInteractor.py +// wxVTKRenderWindowInteractor.py // .SECTION Caveats // - There is a know bug that prevent this class to works for more info see // WX_USE_X_CAPTURE. This bug only affect wxGTK from 2.3.2 to wxGTK 2.4.0. @@ -32,15 +59,11 @@ // - This class might not be easily readable as it tried to work with VTK 3.2 // and 4.x. This class doesn't support reparenting with VTK 4.2 and earlier. // .SECTION see also -// creawxVTKRenderWindowInteractor.py creawxVTKRenderWindow.py - -#ifndef _creawxVTKRenderWindowInteractor_h_ -#define _creawxVTKRenderWindowInteractor_h_ +// wxVTKRenderWindowInteractor.py wxVTKRenderWindow.py -#include -#include +#ifndef _wxVTKRenderWindowInteractor_h_ +#define _wxVTKRenderWindowInteractor_h_ -/* // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" @@ -51,35 +74,39 @@ #ifndef WX_PRECOMP #include #endif -*/ + #include #include // vtk includes +#include #include "vtkRenderWindowInteractor.h" #include "vtkRenderWindow.h" -// Apparently since wxGTK 2.8.0 one can finally use wxWindow (just as in any -// other port): -#if (!wxCHECK_VERSION(2, 8, 0)) #define USE_WXGLCANVAS -#endif - #if defined(__WXGTK__) && defined(USE_WXGLCANVAS) -# if wxUSE_GLCANVAS +# if wxUSE_GLCANVAS # include -# else +# else # error "problem of wxGLCanvas, you need to build wxWidgets with opengl" -# endif //wxUSE_GLCANVAS +# endif //wxUSE_GLCANVAS #endif //__WXGTK__ // Motif version (renamed into wxX11 for wxWindow 2.4 and newer) #if defined(__WXMOTIF__) -# error This GUI is not supported by creawxVTKRenderWindowInteractor for now +# error This GUI is not supported by wxVTKRenderWindowInteractor for now +#endif + +#include "creaSystem.h" + +#include "vtkTDxConfigure.h" // defines VTK_USE_TDX +#ifdef VTK_USE_TDX +class vtkTDxMacDevice; #endif + // wx forward declarations class wxPaintEvent; class wxMouseEvent; @@ -94,34 +121,34 @@ namespace crea #if defined(__WXGTK__) && defined(USE_WXGLCANVAS) -class CREA_EXPORT creawxVTKRenderWindowInteractor : public wxGLCanvas, virtual public vtkRenderWindowInteractor +class wxVTKRenderWindowInteractor : public wxGLCanvas, public vtkRenderWindowInteractor #else -class CREA_EXPORT creawxVTKRenderWindowInteractor : public wxWindow, virtual public vtkRenderWindowInteractor +class CREA_EXPORT wxVTKRenderWindowInteractor : public wxWindow, public vtkRenderWindowInteractor #endif //__WXGTK__ { - DECLARE_DYNAMIC_CLASS(creawxVTKRenderWindowInteractor) +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 + DECLARE_DYNAMIC_CLASS(wxVTKRenderWindowInteractor) +#else + wxDECLARE_DYNAMIC_CLASS(wxVTKRenderWindowInteractor); +#endif public: //constructors - creawxVTKRenderWindowInteractor(); + wxVTKRenderWindowInteractor(); - creawxVTKRenderWindowInteractor(wxWindow *parent, + wxVTKRenderWindowInteractor(wxWindow *parent, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxWANTS_CHARS | wxNO_FULL_REPAINT_ON_RESIZE, const wxString &name = wxPanelNameStr); - //vtk ::New() - static creawxVTKRenderWindowInteractor * New(); + //EED win Compilation why ??: vtkTypeRevisionMacro(wxVTKRenderWindowInteractor,vtkRenderWindowInteractor); + static wxVTKRenderWindowInteractor * New(); void PrintSelf(ostream& os, vtkIndent indent); //destructor - ~creawxVTKRenderWindowInteractor(); - -#if defined(_WIN32) - const char * creawxVTKRenderWindowInteractor::GetClassName() const; -#endif //_WIN32 - + ~wxVTKRenderWindowInteractor(); // vtkRenderWindowInteractor overrides void Initialize(); @@ -144,12 +171,16 @@ class CREA_EXPORT creawxVTKRenderWindowInteractor : public wxWindow, virtual pub #if !(VTK_MAJOR_VERSION == 3 && VTK_MINOR_VERSION == 1) void OnEnter(wxMouseEvent &event); void OnLeave(wxMouseEvent &event); + void OnMouseWheel(wxMouseEvent& event); +#if wxCHECK_VERSION(2, 8, 0) + void OnMouseCaptureLost(wxMouseCaptureLostEvent& event); +#endif void OnKeyDown(wxKeyEvent &event); void OnKeyUp(wxKeyEvent &event); + void OnChar(wxKeyEvent &event); #endif void OnTimer(wxTimerEvent &event); void OnSize(wxSizeEvent &event); - void OnMouseWheel(wxMouseEvent& event); void Render(); void SetRenderWhenDisabled(int newValue); @@ -168,13 +199,26 @@ class CREA_EXPORT creawxVTKRenderWindowInteractor : public wxWindow, virtual pub vtkSetMacro(UseCaptureMouse,int); vtkBooleanMacro(UseCaptureMouse,int); +#if VTK_MAJOR_VERSION > 5 || (VTK_MAJOR_VERSION == 5 && VTK_MINOR_VERSION >= 2) protected: + virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration); + virtual int InternalDestroyTimer(int platformTimerId); +#endif + + protected: +#if defined(__WXGTK__) && defined(USE_WXGLCANVAS) + wxGLContext *context; +#endif wxTimer timer; int ActiveButton; - int RenderAllowed; long GetHandleHack(); int Stereo; +#ifdef VTK_USE_TDX + vtkTDxMacDevice *Device; +#endif + + private: long Handle; bool Created; @@ -185,7 +229,7 @@ class CREA_EXPORT creawxVTKRenderWindowInteractor : public wxWindow, virtual pub }; } -// LG : EO namespace crea +// LG : EO namespace bbwxvtk //====================================================================== -#endif //_creawxVTKRenderWindowInteractor_h_ +#endif //_wxVTKRenderWindowInteractor_h_