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...)
42 static void ResetCursor();
43 static void BeginBusyCursor();
44 static void EndBusyCursor();
45 static int mBeginBusyCallsCount;
47 static void CreateInvisibleTopWindow(wxWindow* parent=0);
48 /// Returns the global parent of all bbtk windows
49 static wxWindow* GetTopWindow();
50 /// Sets the global parent of all bbtk windows
51 static void SetTopWindow(wxWindow*);
53 static void IncNbWindowsAlive();
54 static void DecNbWindowsAlive();
55 static int GetNbWindowsAlive();
56 static bool IsSomeWindowAlive();
58 static void IncNbWindowsShown();
59 static void DecNbWindowsShown();
60 static int GetNbWindowsShown();
61 static bool IsSomeWindowShown();
65 static wxWindow* mgTopWindow;
66 static int mgNbWindowsAlive;
67 static int mgNbWindowsShown;
70 //==================================================================
74 //==================================================================
75 /// Conversion std::string to wxString
76 inline wxString std2wx(const std::string& s){
78 const char* my_string=s.c_str();
79 wxMBConvUTF8 *wxconv= new wxMBConvUTF8();
80 wx=wxString(wxconv->cMB2WC(my_string),wxConvUTF8);
82 // test if conversion works of not. In case it fails convert from Ascii
84 wx=wxString(wxString::FromAscii(s.c_str()));
87 //==================================================================
89 //==================================================================
90 /// Conversion wxString to std::string
91 inline std::string wx2std(const wxString& s){
93 if(s.wxString::IsAscii()) {
94 s2=s.wxString::ToAscii();
96 const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(s);
97 const char *tmp_str = (const char*) tmp_buf;
98 s2=std::string(tmp_str, strlen(tmp_str));
102 //==================================================================
110 #else // _USE_WXWIDGETS
116 struct BBTK_EXPORT Wx
118 static void ResetCursor() {}
119 static void BeginBusyCursor() {}
120 static void EndBusyCursor() {}
121 static void CreateInvisibleTopWindow() {}
122 static wxWindow* GetTopWindow() { return 0; }
123 static void SetTopWindow(wxWindow*) {}
124 static void IncNbWindowsAlive() {}
125 static void DecNbWindowsAlive() {}
126 static int GetNbWindowsAlive() { return 0; }
127 static bool IsSomeWindowAlive() { return false; }
129 static void IncNbWindowsShown() {}
130 static void DecNbWindowsShown() {}
131 static int GetNbWindowsShown() { return 0; }
132 static bool IsSomeWindowShown() { return false; }
139 #endif // EO _USE_WXWIDGETS
140 #endif // EO __bbtkWx_h_INCLUDED__