Program: bbtk
Module: $RCSfile: bbtkWxGUIConsole.cxx,v $
Language: C++
- Date: $Date: 2008/04/23 14:49:28 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2008/04/24 10:11:28 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
cmdsizer->Add (mWxGUICommand, 0, wxALL | wxGROW, 5);
- // Creates and sets the parent window of all bbtk windows
- /*
- wxWindow* top = new wxPanel(this,-1);//,_T("top"));
- top->Hide();
- Wx::SetTopWindow(top);
- */
- Wx::CreateInvisibleTopWindow(this);
+ // Creates the parent window of all bbtk windows as a child of this
+ Wx::CreateTopWindow(this,true);
+ // Add the method OnWxSignal as a Wx::Signal observer
+ bbtkAddWxSignalObserver(WxGUIConsole::OnWxSignal);
+
// Layout
//EED SetSizer(sizer);
}
//================================================================
+ //================================================================
+ void WxGUIConsole::OnWxSignal()
+ {
+ if ((!Wx::TopWindowExists())&&(!IsShown()))
+ {
+ bbtkDebugMessage("wx",2," --> bbtk top window destroyed and WxGUIConsole not shown => destructing"<<std::endl);
+ Close();
+ }
+ }
+ //================================================================
//================================================================
void WxGUIConsole::WxGUICommandEnter(const std::string& command)
}
//================================================================
-
+ //================================================================
+ // Overloaded Show method to handle bbtk::Wx::TopWindow auto-destruction
+ bool WxGUIConsole::Show(bool show)
+ {
+ Wx::AutoDestroyTopWindow(!show);
+ wxFrame::Show(show);
+ }
+ //================================================================
+
//================================================================
BEGIN_EVENT_TABLE(WxGUIConsole, wxFrame)
EVT_MENU(ID_Menu_Quit, WxGUIConsole::OnMenuQuit)