]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkWxGUIScriptingInterface.cxx
Fixed Window deletion mechanism
[bbtk.git] / kernel / src / bbtkWxGUIScriptingInterface.cxx
index 4cb10db79bff0daccd28c7af3ba31cf30e133286..c15e5996551ca429597292ddfa59b8073663f217 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/04/15 15:45:49 $
-  Version:   $Revision: 1.37 $
+  Date:      $Date: 2009/05/28 08:12:07 $
+  Version:   $Revision: 1.38 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -243,8 +243,10 @@ namespace bbtk
 #endif
 
     // parent window of all bbtk windows will be a child of this
-    Wx::SetTopWindowParent(this);
-    // Add the method OnWxSignal as a Wx::Signal observer 
+    //    Wx::SetTopWindowParent(this);
+    Wx::SetTopWindow(this);
+    // Wx::SetAutoDestroyTopWindow(false);
+  // Add the method OnWxSignal as a Wx::Signal observer 
     //bbtkAddWxSignalObserver(WxGUIPackageBrowser2Window::OnWxSignal);
 
     //.PaneBorder(false)); 
@@ -301,11 +303,29 @@ namespace bbtk
  //================================================================
   WxGUIScriptingInterface::~WxGUIScriptingInterface()
   {
+  bbtkDebugMessage("widget",9,"bbStudio::~bbStudio()"<<std::endl);
     SavePerspective();
     m_mgr.UnInit();
   }
   //================================================================
 
+  //================================================================
+  void WxGUIScriptingInterface::OnClose(wxCloseEvent& event)
+  {
+    bbtkDebugMessage("widget",9,"bbStudio::OnClose()"<<std::endl);
+    //Wx::SetWindowsHaveBeenDestroyedByParent();
+    //mInterpreter.reset();
+    wxWindowList& list = GetChildren();
+    wxWindowList::iterator iter;
+    for (iter = list.begin(); iter != list.end(); ++iter)
+      {
+       (*iter)->Close();
+      }
+    this->Destroy();
+  }
+  //================================================================
+
+
   //================================================================
   void WxGUIScriptingInterface::Open(const std::string& filename)
   {
@@ -916,6 +936,7 @@ namespace bbtk
   
   //================================================================  
   BEGIN_EVENT_TABLE(WxGUIScriptingInterface, wxFrame)
+    EVT_CLOSE(  WxGUIScriptingInterface::OnClose)
     EVT_MENU(ID_Menu_Quit, WxGUIScriptingInterface::OnMenuQuit)
     EVT_MENU(ID_Menu_About, WxGUIScriptingInterface::OnMenuAbout)
     EVT_MENU(ID_Menu_EditConfig, WxGUIScriptingInterface::OnMenuEditConfig)