Refactor wxDocParentFrame and wxDocMDIParentFrame to share common base class.
Use the same approach as for the child frames: add a base template class which allows wxDocParentFrame to inherit from wxFrame and wxDocMDIParentFrame from wxMDIParentFrame while still allowing to reuse the common code. This reduces code duplication and should make implementing parent AUI document frame easier as well, see #8945. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64295 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: docmdi.h
|
// Name: wx/docmdi.h
|
||||||
// Purpose: Frame classes for MDI document/view applications
|
// Purpose: Frame classes for MDI document/view applications
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) 1997 Julian Smart
|
||||||
|
// (c) 2010 Vadim Zeitlin
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -19,61 +19,60 @@
|
|||||||
#include "wx/docview.h"
|
#include "wx/docview.h"
|
||||||
#include "wx/mdi.h"
|
#include "wx/mdi.h"
|
||||||
|
|
||||||
/*
|
#ifdef __VISUALC6__
|
||||||
* Use this instead of wxMDIParentFrame
|
// "non dll-interface class 'wxDocXXXFrameAny<>' used as base interface for
|
||||||
*/
|
// dll-interface class 'wxDocMDIXXXFrame'" -- this is bogus as the template
|
||||||
|
// will be DLL-exported but only once it is used as base class here!
|
||||||
|
#pragma warning (push)
|
||||||
|
#pragma warning (disable:4275)
|
||||||
|
#endif
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxDocMDIParentFrame: public wxMDIParentFrame
|
// Define MDI versions of the doc-view frame classes. Note that we need to
|
||||||
|
// define them as classes for wxRTTI, otherwise we could simply define them as
|
||||||
|
// typedefs.
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// An MDI document parent frame
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
typedef
|
||||||
|
wxDocParentFrameAny<wxMDIParentFrame> wxDocMDIParentFrameBase;
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_CORE wxDocMDIParentFrame : public wxDocMDIParentFrameBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxDocMDIParentFrame();
|
wxDocMDIParentFrame() : wxDocMDIParentFrameBase() { }
|
||||||
wxDocMDIParentFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id,
|
|
||||||
const wxString& title, const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr);
|
|
||||||
|
|
||||||
bool Create(wxDocManager *manager, wxFrame *parent, wxWindowID id,
|
wxDocMDIParentFrame(wxDocManager *manager,
|
||||||
const wxString& title, const wxPoint& pos = wxDefaultPosition,
|
wxFrame *parent,
|
||||||
const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr);
|
wxWindowID id,
|
||||||
|
const wxString& title,
|
||||||
wxDocManager *GetDocumentManager(void) const { return m_docManager; }
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
void OnExit(wxCommandEvent& event);
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
void OnMRUFile(wxCommandEvent& event);
|
const wxString& name = wxFrameNameStr)
|
||||||
void OnCloseWindow(wxCloseEvent& event);
|
: wxDocMDIParentFrameBase(manager,
|
||||||
|
parent, id, title, pos, size, style, name)
|
||||||
protected:
|
{
|
||||||
void Init();
|
}
|
||||||
|
|
||||||
virtual bool TryBefore(wxEvent& event);
|
|
||||||
|
|
||||||
wxDocManager *m_docManager;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_CLASS(wxDocMDIParentFrame)
|
DECLARE_CLASS(wxDocMDIParentFrame)
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
wxDECLARE_NO_COPY_CLASS(wxDocMDIParentFrame);
|
wxDECLARE_NO_COPY_CLASS(wxDocMDIParentFrame);
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// An MDI document child frame: we need to define it as a class just for wxRTTI,
|
// An MDI document child frame
|
||||||
// otherwise we could simply typedef it
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __VISUALC6__
|
|
||||||
// "non dll-interface class 'wxDocChildFrameAny<>' used as base interface
|
|
||||||
// for dll-interface class 'wxDocMDIChildFrame'" -- this is bogus as the
|
|
||||||
// template will be DLL-exported but only once it is used as base class
|
|
||||||
// here!
|
|
||||||
#pragma warning (push)
|
|
||||||
#pragma warning (disable:4275)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
wxDocChildFrameAny<wxMDIChildFrame, wxMDIParentFrame> wxDocMDIChildFrameBase;
|
wxDocChildFrameAny<wxMDIChildFrame, wxMDIParentFrame> wxDocMDIChildFrameBase;
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxDocMDIChildFrame : public wxDocMDIChildFrameBase
|
class WXDLLIMPEXP_CORE wxDocMDIChildFrame : public wxDocMDIChildFrameBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
wxDocMDIChildFrame() { }
|
||||||
|
|
||||||
wxDocMDIChildFrame(wxDocument *doc,
|
wxDocMDIChildFrame(wxDocument *doc,
|
||||||
wxView *view,
|
wxView *view,
|
||||||
wxMDIParentFrame *parent,
|
wxMDIParentFrame *parent,
|
||||||
|
@@ -751,26 +751,55 @@ private:
|
|||||||
wxDECLARE_NO_COPY_CLASS(wxDocChildFrame);
|
wxDECLARE_NO_COPY_CLASS(wxDocChildFrame);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __VISUALC6__
|
|
||||||
#pragma warning (pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// A default parent frame
|
// wxDocParentFrame and related classes.
|
||||||
|
//
|
||||||
|
// As with wxDocChildFrame we define a template base class used by both normal
|
||||||
|
// and MDI versions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxDocParentFrame : public wxFrame
|
// Base class containing type-independent code of wxDocParentFrameAny
|
||||||
|
//
|
||||||
|
// Similarly to wxDocChildFrameAnyBase, this class is a mix-in and doesn't
|
||||||
|
// derive from wxWindow.
|
||||||
|
class WXDLLIMPEXP_CORE wxDocParentFrameAnyBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxDocParentFrame();
|
wxDocParentFrameAnyBase() { m_docManager = NULL; }
|
||||||
wxDocParentFrame(wxDocManager *manager,
|
|
||||||
wxFrame *frame,
|
wxDocManager *GetDocumentManager() const { return m_docManager; }
|
||||||
wxWindowID id,
|
|
||||||
const wxString& title,
|
protected:
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
// Open the MRU file with the given index in our associated file history.
|
||||||
const wxSize& size = wxDefaultSize,
|
//
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
// This is called from the derived class event handler for the MRU menu
|
||||||
const wxString& name = wxFrameNameStr);
|
// items.
|
||||||
|
void DoOpenMRUFile(unsigned n);
|
||||||
|
|
||||||
|
wxDocManager *m_docManager;
|
||||||
|
|
||||||
|
wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAnyBase);
|
||||||
|
};
|
||||||
|
|
||||||
|
// This is similar to wxDocChildFrameAny and is used to provide common
|
||||||
|
// implementation for both wxDocParentFrame and wxDocMDIParentFrame
|
||||||
|
template <class BaseFrame>
|
||||||
|
class WXDLLIMPEXP_CORE wxDocParentFrameAny : public BaseFrame,
|
||||||
|
public wxDocParentFrameAnyBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxDocParentFrameAny() { }
|
||||||
|
wxDocParentFrameAny(wxDocManager *manager,
|
||||||
|
wxFrame *frame,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString& title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
|
const wxString& name = wxFrameNameStr)
|
||||||
|
{
|
||||||
|
Create(manager, frame, id, title, pos, size, style, name);
|
||||||
|
}
|
||||||
|
|
||||||
bool Create(wxDocManager *manager,
|
bool Create(wxDocManager *manager,
|
||||||
wxFrame *frame,
|
wxFrame *frame,
|
||||||
@@ -779,27 +808,106 @@ public:
|
|||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
const wxString& name = wxFrameNameStr);
|
const wxString& name = wxFrameNameStr)
|
||||||
|
{
|
||||||
|
m_docManager = manager;
|
||||||
|
|
||||||
wxDocManager *GetDocumentManager() const { return m_docManager; }
|
if ( !BaseFrame::Create(frame, id, title, pos, size, style, name) )
|
||||||
|
return false;
|
||||||
|
|
||||||
void OnExit(wxCommandEvent& event);
|
this->Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
|
||||||
void OnMRUFile(wxCommandEvent& event);
|
wxCommandEventHandler(wxDocParentFrameAny::OnExit));
|
||||||
void OnCloseWindow(wxCloseEvent& event);
|
this->Connect(wxID_FILE1, wxID_FILE9, wxEVT_COMMAND_MENU_SELECTED,
|
||||||
|
wxCommandEventHandler(wxDocParentFrameAny::OnMRUFile));
|
||||||
|
this->Connect(wxEVT_CLOSE_WINDOW,
|
||||||
|
wxCloseEventHandler(wxDocParentFrameAny::OnCloseWindow));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// hook the document manager into event handling chain here
|
// hook the document manager into event handling chain here
|
||||||
virtual bool TryBefore(wxEvent& event);
|
virtual bool TryBefore(wxEvent& event)
|
||||||
|
{
|
||||||
|
if ( m_docManager && m_docManager->ProcessEventLocally(event) )
|
||||||
|
return true;
|
||||||
|
|
||||||
wxDocManager *m_docManager;
|
return BaseFrame::TryBefore(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void OnExit(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
this->Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnMRUFile(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
DoOpenMRUFile(event.GetId() - wxID_FILE1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnCloseWindow(wxCloseEvent& event)
|
||||||
|
{
|
||||||
|
if ( m_docManager && !m_docManager->Clear(!event.CanVeto()) )
|
||||||
|
{
|
||||||
|
// The user decided not to close finally, abort.
|
||||||
|
event.Veto();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Just skip the event, base class handler will destroy the window.
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAny);
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef wxDocParentFrameAny<wxFrame> wxDocParentFrameBase;
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_CORE wxDocParentFrame : public wxDocParentFrameBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxDocParentFrame() : wxDocParentFrameBase() { }
|
||||||
|
|
||||||
|
wxDocParentFrame(wxDocManager *manager,
|
||||||
|
wxFrame *parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString& title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
|
const wxString& name = wxFrameNameStr)
|
||||||
|
: wxDocParentFrameBase(manager,
|
||||||
|
parent, id, title, pos, size, style, name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Create(wxDocManager *manager,
|
||||||
|
wxFrame *parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString& title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
|
const wxString& name = wxFrameNameStr)
|
||||||
|
{
|
||||||
|
return wxDocParentFrameBase::Create(manager,
|
||||||
|
parent, id, title,
|
||||||
|
pos, size, style, name);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef wxFrame base_type;
|
|
||||||
DECLARE_CLASS(wxDocParentFrame)
|
DECLARE_CLASS(wxDocParentFrame)
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
wxDECLARE_NO_COPY_CLASS(wxDocParentFrame);
|
wxDECLARE_NO_COPY_CLASS(wxDocParentFrame);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef __VISUALC6__
|
||||||
|
// reenable warning 4275
|
||||||
|
#pragma warning (pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Provide simple default printing facilities
|
// Provide simple default printing facilities
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: docmdi.cpp
|
// Name: src/common/docmdi.cpp
|
||||||
// Purpose: Frame classes for MDI document/view applications
|
// Purpose: Frame classes for MDI document/view applications
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart, Vadim Zeitlin
|
||||||
// Modified by:
|
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) 1997 Julian Smart
|
||||||
|
// (c) 2010 Vadim Zeitlin
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -20,73 +20,7 @@
|
|||||||
|
|
||||||
#include "wx/docmdi.h"
|
#include "wx/docmdi.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* Docview MDI parent frame
|
|
||||||
*/
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS(wxDocMDIParentFrame, wxMDIParentFrame)
|
IMPLEMENT_CLASS(wxDocMDIParentFrame, wxMDIParentFrame)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxDocMDIParentFrame, wxMDIParentFrame)
|
|
||||||
EVT_MENU(wxID_EXIT, wxDocMDIParentFrame::OnExit)
|
|
||||||
EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, wxDocMDIParentFrame::OnMRUFile)
|
|
||||||
EVT_CLOSE(wxDocMDIParentFrame::OnCloseWindow)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
wxDocMDIParentFrame::wxDocMDIParentFrame()
|
|
||||||
{
|
|
||||||
Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
wxDocMDIParentFrame::wxDocMDIParentFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title,
|
|
||||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
|
||||||
{
|
|
||||||
Init();
|
|
||||||
Create(manager, frame, id, title, pos, size, style, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxDocMDIParentFrame::Create(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title,
|
|
||||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
|
||||||
{
|
|
||||||
m_docManager = manager;
|
|
||||||
return wxMDIParentFrame::Create(frame, id, title, pos, size, style, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDocMDIParentFrame::OnExit(wxCommandEvent& WXUNUSED(event))
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDocMDIParentFrame::Init()
|
|
||||||
{
|
|
||||||
m_docManager = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDocMDIParentFrame::OnMRUFile(wxCommandEvent& event)
|
|
||||||
{
|
|
||||||
wxString f(m_docManager->GetHistoryFile(event.GetId() - wxID_FILE1));
|
|
||||||
if (!f.empty())
|
|
||||||
(void)m_docManager->CreateDocument(f, wxDOC_SILENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxDocMDIParentFrame::TryBefore(wxEvent& event)
|
|
||||||
{
|
|
||||||
if ( m_docManager && m_docManager->ProcessEventLocally(event) )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return wxMDIParentFrame::TryBefore(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDocMDIParentFrame::OnCloseWindow(wxCloseEvent& event)
|
|
||||||
{
|
|
||||||
if (m_docManager->Clear(!event.CanVeto()))
|
|
||||||
{
|
|
||||||
this->Destroy();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
event.Veto();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS(wxDocMDIChildFrame, wxMDIChildFrame)
|
IMPLEMENT_CLASS(wxDocMDIChildFrame, wxMDIChildFrame)
|
||||||
|
|
||||||
#endif // wxUSE_DOC_VIEW_ARCHITECTURE
|
#endif // wxUSE_DOC_VIEW_ARCHITECTURE
|
||||||
|
@@ -1889,54 +1889,11 @@ bool wxDocChildFrameAnyBase::CloseView(wxCloseEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Default parent frame
|
// wxDocParentFrameAnyBase
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxDocParentFrame, wxFrame)
|
void wxDocParentFrameAnyBase::DoOpenMRUFile(unsigned n)
|
||||||
EVT_MENU(wxID_EXIT, wxDocParentFrame::OnExit)
|
|
||||||
EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, wxDocParentFrame::OnMRUFile)
|
|
||||||
EVT_CLOSE(wxDocParentFrame::OnCloseWindow)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
wxDocParentFrame::wxDocParentFrame()
|
|
||||||
{
|
{
|
||||||
m_docManager = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxDocParentFrame::wxDocParentFrame(wxDocManager *manager,
|
|
||||||
wxFrame *frame,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxString& title,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxString& name)
|
|
||||||
: wxFrame(frame, id, title, pos, size, style, name)
|
|
||||||
{
|
|
||||||
m_docManager = manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxDocParentFrame::Create(wxDocManager *manager,
|
|
||||||
wxFrame *frame,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxString& title,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxString& name)
|
|
||||||
{
|
|
||||||
m_docManager = manager;
|
|
||||||
return base_type::Create(frame, id, title, pos, size, style, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDocParentFrame::OnExit(wxCommandEvent& WXUNUSED(event))
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDocParentFrame::OnMRUFile(wxCommandEvent& event)
|
|
||||||
{
|
|
||||||
int n = event.GetId() - wxID_FILE1; // the index in MRU list
|
|
||||||
wxString filename(m_docManager->GetHistoryFile(n));
|
wxString filename(m_docManager->GetHistoryFile(n));
|
||||||
if ( filename.empty() )
|
if ( filename.empty() )
|
||||||
return;
|
return;
|
||||||
@@ -1967,27 +1924,6 @@ void wxDocParentFrame::OnMRUFile(wxCommandEvent& event)
|
|||||||
filename);
|
filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extend event processing to search the view's event table
|
|
||||||
bool wxDocParentFrame::TryBefore(wxEvent& event)
|
|
||||||
{
|
|
||||||
if ( m_docManager && m_docManager->ProcessEventLocally(event) )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return wxFrame::TryBefore(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define the behaviour for the frame closing
|
|
||||||
// - must delete all frames except for the main one.
|
|
||||||
void wxDocParentFrame::OnCloseWindow(wxCloseEvent& event)
|
|
||||||
{
|
|
||||||
if (m_docManager->Clear(!event.CanVeto()))
|
|
||||||
{
|
|
||||||
Destroy();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
event.Veto();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if wxUSE_PRINTING_ARCHITECTURE
|
#if wxUSE_PRINTING_ARCHITECTURE
|
||||||
|
|
||||||
wxDocPrintout::wxDocPrintout(wxView *view, const wxString& title)
|
wxDocPrintout::wxDocPrintout(wxView *view, const wxString& title)
|
||||||
|
Reference in New Issue
Block a user