X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d62144c98d1625172918fc66fa77cb5d788a74ee..7fa4dc1cfcc55b0fe425a3ebe5e992ff8255481b:/src/common/docmdi.cpp diff --git a/src/common/docmdi.cpp b/src/common/docmdi.cpp index fa69061271..281953afa2 100644 --- a/src/common/docmdi.cpp +++ b/src/common/docmdi.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "docmdi.h" #endif @@ -20,7 +20,7 @@ #pragma hdrstop #endif -#if wxUSE_MDI_ARCHITECTURE && wxUSE_DOC_VIEW_ARCHITECTURE +#if wxUSE_MDI_ARCHITECTURE #include "wx/docmdi.h" @@ -87,14 +87,36 @@ BEGIN_EVENT_TABLE(wxDocMDIChildFrame, wxMDIChildFrame) EVT_CLOSE(wxDocMDIChildFrame::OnCloseWindow) END_EVENT_TABLE() +void wxDocMDIChildFrame::Init() +{ + m_childDocument = (wxDocument*) NULL; + m_childView = (wxView*) NULL; +} + +wxDocMDIChildFrame::wxDocMDIChildFrame() +{ + Init(); +} + wxDocMDIChildFrame::wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id, - const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name): - wxMDIChildFrame(frame, id, title, pos, size, style, name) + const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) +{ + Init(); + Create(doc, view, frame, id, title, pos, size, style, name); +} + +bool wxDocMDIChildFrame::Create(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id, + const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { m_childDocument = doc; m_childView = view; + if (wxMDIChildFrame::Create(frame, id, title, pos, size, style, name)) { if (view) view->SetFrame(this); + return TRUE; + } + + return FALSE; } wxDocMDIChildFrame::~wxDocMDIChildFrame(void) @@ -143,11 +165,9 @@ void wxDocMDIChildFrame::OnCloseWindow(wxCloseEvent& event) // ...since it will be deleted by wxWindows if we return TRUE. if (m_childView) { - bool ans = FALSE; - if (!event.CanVeto()) - ans = TRUE; // Must delete. - else - ans = m_childView->Close(FALSE); // FALSE means don't delete associated window + bool ans = event.CanVeto() + ? m_childView->Close(FALSE) // FALSE means don't delete associated window + : TRUE; // Must delete. if (ans) {