From 888a883335a982e165429308445a22c475ae62de Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 25 Dec 2016 01:28:49 +0000 Subject: [PATCH] Updated AppXestiaCalendar.cpp/.h --- source/AppXestiaCalendar.cpp | 10 +++++++++- source/AppXestiaCalendar.h | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/source/AppXestiaCalendar.cpp b/source/AppXestiaCalendar.cpp index 6ba325c..5ccf62b 100644 --- a/source/AppXestiaCalendar.cpp +++ b/source/AppXestiaCalendar.cpp @@ -30,7 +30,7 @@ frmMainADT::frmMainADT( wxWindow* parent, wxWindowID id, const wxString& title, mnuManage->AppendSeparator(); wxMenuItem* mnuManageExit; - mnuManageExit = new wxMenuItem( mnuManage, wxID_EXIT, wxString( wxT("Exit") ) + wxT('\t') + wxT("Ctrl+Q"), wxEmptyString, wxITEM_NORMAL ); + mnuManageExit = new wxMenuItem( mnuManage, wxID_EXIT, wxString( wxT("Quit") ) + wxT('\t') + wxT("Ctrl+Q"), wxEmptyString, wxITEM_NORMAL ); mnuManage->Append( mnuManageExit ); menuBar->Append( mnuManage, wxT("Manage") ); @@ -70,10 +70,18 @@ frmMainADT::frmMainADT( wxWindow* parent, wxWindowID id, const wxString& title, this->Layout(); this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( frmMainADT::QuitApp ) ); + this->Connect( mnuManageExit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::QuitApp ) ); } frmMainADT::~frmMainADT() { + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( frmMainADT::QuitApp ) ); + this->Disconnect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::QuitApp ) ); + } frmUpdateADT::frmUpdateADT( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) diff --git a/source/AppXestiaCalendar.h b/source/AppXestiaCalendar.h index faaf083..21b70ce 100644 --- a/source/AppXestiaCalendar.h +++ b/source/AppXestiaCalendar.h @@ -55,6 +55,11 @@ class frmMainADT : public wxFrame wxMenu* mnuCreate; wxMenu* mnuHelp; wxBoxSizer* szrMain; + + // Virtual event handlers, overide them in your derived class + virtual void QuitApp( wxCloseEvent& event ) { event.Skip(); } + virtual void QuitApp( wxCommandEvent& event ) { event.Skip(); } + public: -- 2.39.5