Add support for exiting after loading

This commit is contained in:
Andy Cedilnik 2002-09-19 17:23:59 -04:00
parent 8f3d8e7470
commit b7fa92c9e1
2 changed files with 21 additions and 2 deletions

View File

@ -216,12 +216,17 @@ cmMainFrame::cmMainFrame(const wxString& title, const wxSize& size)
this->ConnectEvent( this->m_GeneratorMenu, wxEVT_COMMAND_TEXT_UPDATED, this->ConnectEvent( this->m_GeneratorMenu, wxEVT_COMMAND_TEXT_UPDATED,
(wxObjectEventFunction) &cmMainFrame::OnGeneratorSelected ); (wxObjectEventFunction) &cmMainFrame::OnGeneratorSelected );
this->ConnectEvent( this, wxEVT_TIMER,
(wxObjectEventFunction) &cmMainFrame::OnExitTimer );
this->Connect(cmCacheProperty::Menu_Popup_Ignore, wxEVT_COMMAND_MENU_SELECTED, this->Connect(cmCacheProperty::Menu_Popup_Ignore, wxEVT_COMMAND_MENU_SELECTED,
(wxObjectEventFunction) &cmMainFrame::OnPopupMenuIgnore); (wxObjectEventFunction) &cmMainFrame::OnPopupMenuIgnore);
this->Connect(cmCacheProperty::Menu_Popup_Delete, wxEVT_COMMAND_MENU_SELECTED, this->Connect(cmCacheProperty::Menu_Popup_Delete, wxEVT_COMMAND_MENU_SELECTED,
(wxObjectEventFunction) &cmMainFrame::OnPopupMenuDelete); (wxObjectEventFunction) &cmMainFrame::OnPopupMenuDelete);
this->Connect(cmCacheProperty::Menu_Popup_Help, wxEVT_COMMAND_MENU_SELECTED, this->Connect(cmCacheProperty::Menu_Popup_Help, wxEVT_COMMAND_MENU_SELECTED,
(wxObjectEventFunction) &cmMainFrame::OnPopupMenuHelp); (wxObjectEventFunction) &cmMainFrame::OnPopupMenuHelp);
} }
cmMainFrame::~cmMainFrame() cmMainFrame::~cmMainFrame()
@ -493,8 +498,14 @@ void cmMainFrame::OnResize(wxSizeEvent& event)
this->wxFrame::OnSize(event); this->wxFrame::OnSize(event);
// Expand inner pannel when window resizes // Expand inner pannel when window resizes
this->ResizeInternal(); this->ResizeInternal();
} }
void cmMainFrame::OnExitTimer(wxEvent& event)
{
this->Close();
this->Refresh();
}
void cmMainFrame::ResizeInternal() void cmMainFrame::ResizeInternal()
{ {
// Expand inner pannel when window resizes // Expand inner pannel when window resizes
@ -588,6 +599,12 @@ void cmMainFrame::Initialize(cmCommandLineInfo* cmdInfo)
*/ */
this->LoadCacheFromDiskToGUI(); this->LoadCacheFromDiskToGUI();
if ( cmdInfo->m_ExitAfterLoad )
{
std::cout << "Set timer" << std::endl;
this->m_ExitTimer = new wxTimer(this, this->GetId());
this->m_ExitTimer->Start(3000);
}
} }
//! Set the current generator //! Set the current generator

View File

@ -66,6 +66,7 @@ public:
void OnPopupMenu(wxMouseEvent& event); void OnPopupMenu(wxMouseEvent& event);
void OnCacheStatusBar(wxEvent& event); void OnCacheStatusBar(wxEvent& event);
void OnStatusBar(wxEvent& event); void OnStatusBar(wxEvent& event);
void OnExitTimer(wxEvent& event);
//! Callbacks for menu events //! Callbacks for menu events
void OnPopupMenuIgnore(wxEvent& event); void OnPopupMenuIgnore(wxEvent& event);
@ -214,6 +215,7 @@ private:
CacheMapType* m_CacheEntries; CacheMapType* m_CacheEntries;
cmake* m_CMakeInstance; cmake* m_CMakeInstance;
wxTimer* m_ExitTimer;
enum Events { enum Events {
ID_MainFrame, ID_MainFrame,