]> Creatis software - crea.git/commitdiff
#3125 crea Feature New Normal - branch changeWx28to30 compilation with wxWidgets3
authorEduardo DAVILA <davila@localhost.localdomain>
Tue, 19 Sep 2017 14:41:20 +0000 (16:41 +0200)
committerEduardo DAVILA <davila@localhost.localdomain>
Tue, 19 Sep 2017 14:41:20 +0000 (16:41 +0200)
cmake/CREAMacro_FindAndUseWxWidgets.cmake
lib/creaDevManagerLib/wxCDMMainFrame.cpp
samples/creaSample_preprocessor/CMakeLists.txt
samples/creaSample_preprocessor/main.cxx
src/creawxVTKRenderWindowInteractor.cxx

index 969300c73478ef2338d415e949462b8c1612da53..1ef548c81ef9d6475b6b849473dde1f60e4ba62c 100644 (file)
@@ -58,8 +58,12 @@ MACRO(CREA_FIND_WXWIDGETS)
     # CMake 2.6:
     # technically those packages are not required 
     # since one can still use the Motif/X11 version and not the gtk one:
-    FIND_PACKAGE(PkgConfig)
-    pkg_check_modules (GTK2 gtk+-2.0)
+    FIND_PACKAGE(PkgConfig REQUIRED)
+
+##    pkg_check_modules (GTK2 gtk+-2.0)
+##    pkg_check_modules (GTK322 gtk+-3.0)
+    pkg_check_modules (GTK3 REQUIRED gtk+-3.0)
+
     #MESSAGE("${GTK2_INCLUDE_DIRS}")
     # Can I require all my user to have the gl lib on linux, even if they do not really need it...
 #EED  SET(WXGLCANVASLIBS "gl")
@@ -108,10 +112,14 @@ MACRO(CREA_USE_WXWIDGETS)
       optimized msvcprt
       )
   ELSE(WIN32)
-    # GTK2
-    INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
-    LINK_DIRECTORIES(${GTK2_LIBRARY_DIRS})
-    LINK_LIBRARIES(${GTK2_LIBRARIES})
+##    # GTK2
+##    INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
+##    LINK_DIRECTORIES(${GTK2_LIBRARY_DIRS})
+##    LINK_LIBRARIES(${GTK2_LIBRARIES})
+    # GTK3
+    INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
+    LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})
+    LINK_LIBRARIES(${GTK3_LIBRARIES})
     # WX
 
 
index 41052d4014f611fd1fb851511810008d63390ec8..5664c50d3aed65200f0afae5de487d376870d5bc 100755 (executable)
@@ -271,14 +271,25 @@ void wxCDMMainFrame::CreateControls()
   auiManager.SetManagedWindow(this);
 
 
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
   tree_Projects = new wxCDMProjectsTreeCtrl(
       this,
       ID_TREE_PROJECTS,
       wxDefaultPosition,
       wxSize(200,400),
-         wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
-  );
+      wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS );
+  this->actualTreeItem.Unset();
+#else
+  tree_Projects = new wxCDMProjectsTreeCtrl(
+      this,
+      ID_TREE_PROJECTS,
+      wxDefaultPosition,
+      wxSize(200,400),
+      wxTR_HAS_BUTTONS  );
   this->actualTreeItem.Unset();
+#endif
+
 
   panel_Properties = new wxCDMMainDescriptionPanel(
       this,
index 61e80bc4222a806ec325a96bf201ad9fd691fa7d..835705bb9bd127e7d9391ba767e0f8703b7f57bd 100644 (file)
@@ -25,7 +25,7 @@
 # ------------------------------------------------------------------------ */ 
 
 crea_DEFINE(DEF1)
-crea_DEFINE_WITH_VAL(DEF2 "This is the value of DEF2")
+#crea_DEFINE_WITH_VAL(DEF2 "This is the value of DEF2")
 crea_DEFINE_WITH_VAL(DEF3 10)
 
 ADD_EXECUTABLE(creaSample_preprocessor main)
index 5da1eda6ea5900776fb20db452de5b2ef6082bcf..6496c7e52840b05001de79d6e62dc238cd3fdd83 100644 (file)
@@ -28,7 +28,7 @@
 #include <creaSystem.h>
 
 int main(int argc, char* argv[])
-{      
+{
  std::cout << "** creaSample_preprocessor : begin of main "<<std::endl;
 
 #if defined (DEF1)
@@ -49,4 +49,5 @@ int main(int argc, char* argv[])
 
        
  std::cout << "** creaSample_preprocessor : end of main "<<std::endl;
+
 }
index b83bcce5c6147a0d217b64ef10809de31249c411..3c421e5f29e68a3e2b65282df94fc89408e00e87 100644 (file)
@@ -88,23 +88,34 @@ wxWindow* wxGetTopLevelParent(wxWindow *win)
 #endif //VTK_USE_COCOA
 #endif //__WXCOCOA__
 
-#ifdef __WXGTK__
-#    include <gdk/gdkx.h> // GDK_WINDOW_XWINDOW is found here in wxWidgets 2.8.0
-#    include "gdk/gdkprivate.h"
-#if wxCHECK_VERSION(2, 8, 0)
-#ifdef __WXGTK20__
-#include <wx/gtk/win_gtk.h>
-#else
-#include <wx/gtk1/win_gtk.h>
-#endif
+
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+       #ifdef __WXGTK__
+               #include <gdk/gdkx.h> // GDK_WINDOW_XWINDOW is found here in wxWidgets 2.8.0
+               #include "gdk/gdkprivate.h"
+               #if wxCHECK_VERSION(2, 8, 0)
+                       #ifdef __WXGTK20__
+                               #include <wx/gtk/win_gtk.h>
+                       #else
+                               #include <wx/gtk1/win_gtk.h>
+                       #endif
+               #else
+                       #include <wx/gtk/win_gtk.h>
+               #endif
+               #define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \
+                                 GDK_WINDOW_XWINDOW(GTK_PIZZA((wxwin)->m_wxwindow)->bin_window) : \
+                                 GDK_WINDOW_XWINDOW((wxwin)->m_widget->window)
+       #endif
 #else
-#include <wx/gtk/win_gtk.h>
-#endif
-#define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \
-                          GDK_WINDOW_XWINDOW(GTK_PIZZA((wxwin)->m_wxwindow)->bin_window) : \
-                          GDK_WINDOW_XWINDOW((wxwin)->m_widget->window)
+       #ifdef __WXGTK__
+           #include <gdk/gdkx.h>
+           #include <gtk/gtk.h>
+       #endif
 #endif
 
+
+
 #ifdef __WXX11__
 #include "wx/x11/privx.h"
 #define GetXWindow(wxwin)   ((Window)(wxwin)->GetHandle())
@@ -376,7 +387,15 @@ long creawxVTKRenderWindowInteractor::GetHandleHack()
 
     // Find and return the actual X-Window.
 #if defined(__WXGTK__) || defined(__WXX11__)
-    return (long)GetXWindow(this);
+
+       //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+       #if wxMAJOR_VERSION <= 2
+               return (long)GetXWindow(this);
+       #else
+               GdkWindow* Win = gtk_widget_get_window( (GtkWidget *) GetHandle() );
+               return (long int)GDK_WINDOW_XDISPLAY(Win);
+       #endif
+
 #endif
 
 //#ifdef __WXMOTIF__