- wxDocParentFrame(wxDocManager *manager,
- wxFrame *frame,
- wxWindowID id,
- const wxString& title,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long type = wxDEFAULT_FRAME_STYLE,
- const wxString& name = "frame");
-
- // Extend event processing to search the document manager's event table
- virtual bool ProcessEvent(wxEvent& event);
-
- wxDocManager *GetDocumentManager() const { return m_docManager; }
-
- void OnExit(wxCommandEvent& event);
- void OnMRUFile(wxCommandEvent& event);
- void OnCloseWindow(wxCloseEvent& event);
+ typedef ChildFrame BaseClass;
+
+ // default ctor, use Create after it
+ wxDocChildFrameAny() { }
+
+ // ctor for a frame showing the given view of the specified document
+ wxDocChildFrameAny(wxDocument *doc,
+ wxView *view,
+ ParentFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ {
+ Create(doc, view, parent, id, title, pos, size, style, name);
+ }
+
+ bool Create(wxDocument *doc,
+ wxView *view,
+ ParentFrame *parent,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxFrameNameStr)
+ {
+ if ( !wxDocChildFrameAnyBase::Create(doc, view, this) )
+ return false;
+
+ if ( !BaseClass::Create(parent, id, title, pos, size, style, name) )
+ return false;
+
+ this->Connect(wxEVT_ACTIVATE,
+ wxActivateEventHandler(wxDocChildFrameAny::OnActivate));
+ this->Connect(wxEVT_CLOSE_WINDOW,
+ wxCloseEventHandler(wxDocChildFrameAny::OnCloseWindow));
+
+ return true;
+ }
+
+ virtual bool Destroy()
+ {
+ // FIXME: why exactly do we do this? to avoid activation events during
+ // destructions maybe?
+ m_childView = NULL;
+ return BaseClass::Destroy();
+ }