4 #include "bbtkMessageManager.h"
5 #include <boost/signal.hpp>
6 //#include <boost/bind.hpp>
11 static wxWindow* mgTopWindow = 0;
12 static int mgNbWindowsAlive = 0;
13 static int mgNbWindowsShown = 0;
14 static bool mgAutoDestroyTopWindow = true;
17 static Wx::Signal_type mgWxSignal;
21 //=========================================================================
22 void Wx::CreateTopWindow(wxWindow* parent, bool autodestroy)
27 _T("TOP BBTK FRAME (YOU SHOULD NOT SEE ME !!)"));
29 Wx::SetTopWindow(top);
30 mgAutoDestroyTopWindow = autodestroy;
32 //=========================================================================
34 //=========================================================================
35 wxWindow* Wx::GetTopWindow()
37 if (mgTopWindow==0) Wx::CreateTopWindow(0);
40 //=========================================================================
42 //=========================================================================
43 bool Wx::TopWindowExists()
45 return (mgTopWindow!=0);
47 //=========================================================================
50 //=========================================================================
51 void Wx::AddSignalObserver(Slot_function_type f)
53 mgWxSignal.connect(f);
55 //=========================================================================
58 //=========================================================================
59 void Wx::AutoDestroyTopWindow(bool b)
61 mgAutoDestroyTopWindow = b;
63 //=========================================================================
65 //=========================================================================
66 void Wx::SetTopWindow(wxWindow* w)
70 bbtkGlobalError("wx::SetTopWindow : top window already set !");
74 //=========================================================================
77 //=========================================================================
78 void Wx::IncNbWindowsAlive()
81 bbtkDebugMessage("wx",2,"* Number of windows alive = "<<mgNbWindowsAlive
87 //=========================================================================
89 //=========================================================================
90 void Wx::DecNbWindowsAlive()
93 bbtkDebugMessage("wx",2,"* Number of windows alive = "<<mgNbWindowsAlive
95 if ( (mgNbWindowsAlive==0) &&
96 (mgAutoDestroyTopWindow) )
98 bbtkDebugMessage("wx",2," --> Destructing top window"<<std::endl);
106 //=========================================================================
108 //=========================================================================
109 void Wx::IncNbWindowsShown()
112 bbtkDebugMessage("wx",2,"* Number of windows shown = "<<mgNbWindowsShown
118 //=========================================================================
120 //=========================================================================
121 void Wx::DecNbWindowsShown()
124 bbtkDebugMessage("wx",2,"* Number of windows shown = "<<mgNbWindowsShown
126 if ( (mgNbWindowsAlive==0) &&
127 (mgAutoDestroyTopWindow) )
129 bbtkDebugMessage("wx",2," --> Destructing top window"<<std::endl);
130 mgTopWindow->Close();
137 //=========================================================================
140 //=========================================================================
141 int Wx::GetNbWindowsAlive()
143 return mgNbWindowsAlive;
145 //=========================================================================
147 //=========================================================================
148 bool Wx::IsSomeWindowAlive()
150 return (mgNbWindowsAlive>0);
152 //=========================================================================
155 //=========================================================================
156 int Wx::GetNbWindowsShown()
158 return mgNbWindowsShown;
160 //=========================================================================
162 //=========================================================================
163 bool Wx::IsSomeWindowShown()
165 return (mgNbWindowsShown>0);
167 //=========================================================================
169 //=========================================================================
170 void Wx::ResetCursor()
172 if (!TopWindowExists()) return;
173 bbtkDebugMessage("wx",9,"Wx::ResetCursor()"<<std::endl);
174 while (wxIsBusy()) ::wxEndBusyCursor();
176 //=========================================================================
177 //=========================================================================
178 void Wx::BeginBusyCursor()
180 if (!TopWindowExists()) return;
181 bbtkDebugMessage("wx",9,"Wx::BeginBusyCursor()"<<std::endl);
182 ::wxBeginBusyCursor();
184 //=========================================================================
185 //=========================================================================
186 void Wx::EndBusyCursor()
188 if (!TopWindowExists()) return;
189 bbtkDebugMessage("wx",9,"Wx::EndBusyCursor()"<<std::endl);
192 //=========================================================================