X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=kernel%2Fsrc%2FbbtkWx.cxx;h=46712c4869ad4bcc1bc15da6845677437b2df7ef;hb=7785d9f3ee33f106ad64a204d8cef883185180b0;hp=abccb5e630f0d8daf2028f4faff3bd30ba1c17d8;hpb=5ca30b861f60def2666a1c675e8b45df0a713f95;p=bbtk.git diff --git a/kernel/src/bbtkWx.cxx b/kernel/src/bbtkWx.cxx index abccb5e..46712c4 100644 --- a/kernel/src/bbtkWx.cxx +++ b/kernel/src/bbtkWx.cxx @@ -5,24 +5,172 @@ namespace bbtk { - void Wx::ResetCursor() + //========================================================================= + class WxApp; + //========================================================================= + + //========================================================================= + static WxApp* mgWxApp = 0; + static wxWindow* mgTopWindow = 0; + static wxWindow* mgTopWindowParent = 0; + static bool mgAutoDestroyTopWindow = true; + static int mgNbWindowsAlive = 0; + static int mgNbWindowsShown = 0; + //========================================================================= + + //========================================================================= + // BBTKWXSIG + static Wx::Signal_type mgWxSignal; + // \BBTKWXSIG + //========================================================================= + + + //========================================================================= + // The wxApp class which is used when no user wxApp was created + class WxApp : public wxApp { - if (!GetTopWindow()) return; - bbtkDebugMessage("Wx",9,"wx::ResetCursor()"< Creating bbtk wxApp"< Destructing bbtk WxApp"< Creating bbtk top window"<Hide(); + + Wx::SetTopWindow(top); + } + //========================================================================= + + //========================================================================= + void Wx::DestroyTopWindowIfNeeded() + { + if ( (mgNbWindowsAlive==0) && + (mgAutoDestroyTopWindow) ) + { + bbtkDebugMessage("wx",1," --> Destructing bbtk top window"<Close(); + mgTopWindow = 0; + + DestroyWxAppIfNeeded(); + } + } + //========================================================================= + + //========================================================================= + void Wx::LoopUntilAllWindowsClose() + { + int i = 0; + while (mgTopWindow != 0) + { + if (i % 100 == 0) + { + bbtkDebugMessage("wx",2,"Wx::Loop "<