1 #ifndef __bbtkWx_h_INCLUDED__
2 #define __bbtkWx_h_INCLUDED__
6 #ifdef wxUSE_STD_IOSTREAM
7 #undef wxUSE_STD_IOSTREAM
9 #define wxUSE_STD_IOSTREAM 0
13 #ifdef _USE_WXWIDGETS_
14 // For compilers that support precompilation, includes "wx/wx.h".
15 #include "wx/wxprec.h"
16 #include <wx/datetime.h>
32 #include "bbtkSystem.h"
36 //==================================================================
37 /// Global wx handlers (cursor...)
41 static void ResetCursor();
42 static void BeginBusyCursor();
43 static void EndBusyCursor();
44 static int mBeginBusyCallsCount;
46 //==================================================================
49 //==================================================================
50 /// Conversion std::string to wxString
51 inline wxString std2wx(const std::string& s){
53 const char* my_string=s.c_str();
54 wxMBConvUTF8 *wxconv= new wxMBConvUTF8();
55 wx=wxString(wxconv->cMB2WC(my_string),wxConvUTF8);
57 // test if conversion works of not. In case it fails convert from Ascii
59 wx=wxString(wxString::FromAscii(s.c_str()));
62 //==================================================================
64 //==================================================================
65 /// Conversion wxString to std::string
66 inline std::string wx2std(const wxString& s){
68 if(s.wxString::IsAscii()) {
69 s2=s.wxString::ToAscii();
71 const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(s);
72 const char *tmp_str = (const char*) tmp_buf;
73 s2=std::string(tmp_str, strlen(tmp_str));
77 //==================================================================
85 #else // _USE_WXWIDGETS
93 static void ResetCursor() {}
94 static void BeginBusyCursor() {}
95 static void EndBusyCursor() {}
102 #endif // EO _USE_WXWIDGETS
103 #endif // EO __bbtkWx_h_INCLUDED__