+ 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,
+ wxFrame *frame,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ {
+ m_docManager = manager;
+
+ if ( !BaseFrame::Create(frame, id, title, pos, size, style, name) )
+ return false;
+
+ this->Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxDocParentFrameAny::OnExit));
+ this->Connect(wxEVT_CLOSE_WINDOW,
+ wxCloseEventHandler(wxDocParentFrameAny::OnCloseWindow));
+
+ return true;
+ }
+
+protected:
+ // hook the document manager into event handling chain here
+ virtual bool TryBefore(wxEvent& event)
+ {
+ if ( m_docManager && m_docManager->ProcessEventLocally(event) )
+ return true;
+
+ return BaseFrame::TryBefore(event);
+ }