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 /// Returns the global parent of all bbtk windows
48 static wxWindow* GetTopWindow();
49 /// Sets the global parent of all bbtk windows
50 static void SetTopWindow(wxWindow*);
52 static void IncNbWindowsAlive();
53 static void DecNbWindowsAlive();
54 static int GetNbWindowsAlive();
55 static bool IsSomeWindowAlive();
57 static void IncNbWindowsShown();
58 static void DecNbWindowsShown();
59 static int GetNbWindowsShown();
60 static bool IsSomeWindowShown();
64 static wxWindow* mgTopWindow;
65 static int mgNbWindowsAlive;
66 static int mgNbWindowsShown;
69 //==================================================================
73 //==================================================================
74 /// Conversion std::string to wxString
75 inline wxString std2wx(const std::string& s){
77 const char* my_string=s.c_str();
78 wxMBConvUTF8 *wxconv= new wxMBConvUTF8();
79 wx=wxString(wxconv->cMB2WC(my_string),wxConvUTF8);
81 // test if conversion works of not. In case it fails convert from Ascii
83 wx=wxString(wxString::FromAscii(s.c_str()));
86 //==================================================================
88 //==================================================================
89 /// Conversion wxString to std::string
90 inline std::string wx2std(const wxString& s){
92 if(s.wxString::IsAscii()) {
93 s2=s.wxString::ToAscii();
95 const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(s);
96 const char *tmp_str = (const char*) tmp_buf;
97 s2=std::string(tmp_str, strlen(tmp_str));
101 //==================================================================
109 #else // _USE_WXWIDGETS
115 struct BBTK_EXPORT Wx
117 static void ResetCursor() {}
118 static void BeginBusyCursor() {}
119 static void EndBusyCursor() {}
120 static wxWindow* GetTopWindow() { return 0; }
121 static void SetTopWindow(wxWindow*) {}
122 static void IncNbWindowsAlive() {}
123 static void DecNbWindowsAlive() {}
124 static int GetNbWindowsAlive() { return 0; }
125 static bool IsSomeWindowAlive() { return false; }
127 static void IncNbWindowsShown() {}
128 static void DecNbWindowsShown() {}
129 static int GetNbWindowsShown() { return 0; }
130 static bool IsSomeWindowShown() { return false; }
137 #endif // EO _USE_WXWIDGETS
138 #endif // EO __bbtkWx_h_INCLUDED__