From 135b6e1eb83ceb47b1436edede57115696193f0d Mon Sep 17 00:00:00 2001 From: "fires.gc" Date: Wed, 5 Nov 2008 22:58:26 +0000 Subject: [PATCH] added close event so application got shutdown correctly git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1083 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/Frame.cpp | 13 ++++++++++--- Source/Core/DolphinWX/Src/Frame.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index c82b3199f0..1a452446af 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -80,6 +80,7 @@ static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT; const wxEventType wxEVT_HOST_COMMAND = wxNewEventType(); BEGIN_EVENT_TABLE(CFrame, wxFrame) +EVT_CLOSE(CFrame::OnClose) EVT_MENU(wxID_OPEN, CFrame::OnOpen) EVT_MENU(wxID_EXIT, CFrame::OnQuit) EVT_MENU(IDM_HELPWEBSITE, CFrame::OnHelp) @@ -367,16 +368,22 @@ void CFrame::OnOpen(wxCommandEvent& WXUNUSED (event)) void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event)) { + Close(true); +} + + +void CFrame::OnClose(wxCloseEvent& event) +{ + // Don't forget the skip of the window won't be destroyed + event.Skip(); + if (Core::GetState() != Core::CORE_UNINITIALIZED) { Core::Stop(); UpdateGUI(); } - - Close(true); } - void CFrame::OnHelp(wxCommandEvent& event) { switch (event.GetId()) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index d2d300ede2..868feba5dc 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -80,6 +80,7 @@ class CFrame : public wxFrame void OnHostMessage(wxCommandEvent& event); void OnLoadState(wxCommandEvent& event); void OnSaveState(wxCommandEvent& event); + void OnClose(wxCloseEvent &event); wxStatusBar* m_pStatusBar;