]> Creatis software - crea.git/blobdiff - src/creaWx.h
Pass std::string as reference
[crea.git] / src / creaWx.h
index 3a7d6bbd3edccfdbc0da4516c41deac232c8fc70..84a0390c0015180ea0475a24a003a7d71b70eece 100644 (file)
@@ -9,7 +9,6 @@
 #include "wx/wxprec.h"
 #include <wx/datetime.h>
 
-
 #ifdef __BORLANDC__
 #pragma hdrstop
 #endif
@@ -29,19 +28,37 @@ typedef void wxWindow;
 #endif // EO USE_WXWIDGETS
 //===========================================================================
 
+//===========================================================================
+#ifdef USE_WXWIDGETS
 
+#if defined(_WIN32) 
 
+//  How to have a Console and wxWidgets
+//  http://www.wxwidgets.org/wiki/index.php/MSVC_Setup_Guide
+//   In Visual C++ 6 (7 should be similar), to create an application that is both a console application 
+//  (cout's to the console are visible) and has a wxWidgets GUI, 
+//  you need to use the linker option "/subsystem:console" and the following code:
 
+#define CREA_WXMAIN_WITH_CONSOLE                                       \
+  int main(int argc, char* argv[])                                     \
+  {                                                                    \
+    return WinMain(::GetModuleHandle(NULL), NULL,                      \
+                  ::GetCommandLine(), SW_SHOWNORMAL);                  \
+  }                                                                    
 
+#else // defined(_WIN32) 
 
-//===========================================================================
-#ifdef USE_WXWIDGETS
+#define CREA_WXMAIN_WITH_CONSOLE
+
+#endif // defined(_WIN32) 
+
+#include <string>
 
 namespace crea
 {
   //==================================================================
   /// Conversion std::string to wxString 
-  inline wxString std2wx(const std::string& s){
+  inline wxString std2wx(const std::string& s) {
     wxString wx;
     const char* my_string=s.c_str();
     wxMBConvUTF8 *wxconv= new wxMBConvUTF8();
@@ -53,7 +70,7 @@ namespace crea
     return wx;
   }
   //==================================================================
-  
+
   //==================================================================
   /// Conversion wxString to std::string
   inline std::string wx2std(const wxString& s){
@@ -68,8 +85,6 @@ namespace crea
     return s2;
   }
   //==================================================================
-  
-
 }
 
 #endif // EO USE_WXWIDGETS