]> git.saurik.com Git - wxWidgets.git/commitdiff
make File->Exit work
authorPaul Cornett <paulcor@bullseye.com>
Wed, 2 May 2007 03:18:18 +0000 (03:18 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Wed, 2 May 2007 03:18:18 +0000 (03:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/minifram/minifram.cpp
samples/minifram/minifram.h

index 4b01ac159f714dab060e353f4fad139a17937078..9cd56f413e2e02016d504c06dda01e1c30af1719 100644 (file)
@@ -164,7 +164,6 @@ bool MyApp::InitToolbar(wxToolBar* toolBar)
 // MyMiniFrame
 
 BEGIN_EVENT_TABLE(MyMiniFrame, wxMiniFrame)
-    EVT_CLOSE  (              MyMiniFrame::OnCloseWindow)
     EVT_BUTTON (ID_REPARENT,  MyMiniFrame::OnReparent)
     EVT_MENU   (wxID_PRINT,   MyMiniFrame::OnReparent)
 END_EVENT_TABLE()
@@ -175,11 +174,11 @@ MyMiniFrame::MyMiniFrame(wxFrame* parent, wxWindowID id, const wxString& title,
 {
 }
 
-void MyMiniFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
+bool MyMiniFrame::Destroy()
 {
   // make it known that the miniframe is no more
   mini_frame_exists = false;
-  Destroy();
+  return wxMiniFrame::Destroy();
 }
 
 void MyMiniFrame::OnReparent(wxCommandEvent& WXUNUSED(event))
@@ -193,7 +192,7 @@ void MyMiniFrame::OnReparent(wxCommandEvent& WXUNUSED(event))
 // MyMainFrame
 
 BEGIN_EVENT_TABLE(MyMainFrame, wxFrame)
-    EVT_CLOSE  (              MyMainFrame::OnCloseWindow)
+    EVT_MENU   (wxID_EXIT,    MyMainFrame::OnExit)
     EVT_BUTTON (ID_REPARENT,  MyMainFrame::OnReparent)
     EVT_MENU   (wxID_PRINT,   MyMainFrame::OnReparent)
 END_EVENT_TABLE()
@@ -204,9 +203,9 @@ MyMainFrame::MyMainFrame(wxFrame* parent, wxWindowID id, const wxString& title,
 {
 }
 
-void MyMainFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
+void MyMainFrame::OnExit(wxCommandEvent&)
 {
-  Destroy();
+    Close();
 }
 
 void MyMainFrame::OnReparent(wxCommandEvent& WXUNUSED(event))
index 4d2197b3e9fbd2cc09aa1baadbebb7e7acbc85d0..c3c390168ddbbfdaac90ecb1a07cd37bb39c3d84 100644 (file)
@@ -26,7 +26,7 @@ public:
     MyMiniFrame(wxFrame *parent, wxWindowID id = wxID_ANY, const wxString& title = _T("wxToolBar Sample"),
         const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize );
 
-    void OnCloseWindow(wxCloseEvent& event);
+    virtual bool Destroy();
     void OnReparent(wxCommandEvent& event);
     
 DECLARE_EVENT_TABLE()
@@ -39,7 +39,7 @@ public:
     MyMainFrame(wxFrame *parent, wxWindowID id = wxID_ANY, const wxString& title = _T("wxToolBar Sample"),
         const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize );
 
-    void OnCloseWindow(wxCloseEvent& event);
+    void OnExit(wxCommandEvent&);
     void OnReparent(wxCommandEvent& event);
     void OnSetSize_150_150(wxCommandEvent &event);
     void OnSetSize_200_200(wxCommandEvent &event);