The wxDocParentFrame class provides a default top-level frame for applications using the document/view framework.
It cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplates classes.
See the example application in samples/docview.
wxDocParentFrame::wxDocParentFrame
wxDocParentFrame::~wxDocParentFrame
wxDocParentFrame::OnClose
wxDocParentFrame::OnMenuCommand
void wxDocParentFrame(wxFrame *parent, char *title, int x, int y, int width, int height, long style, char *name)
Constructor.
void ~wxDocParentFrame(void)
Destructor.
Bool OnClose(void)
Deletes all views and documents. If no user input cancelled the operation, the function returns TRUE and the application will exit.
Since understanding how document/view clean-up takes place can be difficult, the implementation of this function is shown below.
Bool wxDocParentFrame::OnClose(void) { // Delete all views and documents wxNode *node = docManager->GetDocuments().First(); while (node) { wxDocument *doc = (wxDocument *)node->Data(); wxNode *next = node->Next(); if (!doc->Close()) return FALSE; // Implicitly deletes the document when the last // view is removed (deleted) doc->DeleteAllViews(); // Check document is deleted if (docManager->GetDocuments().Member(doc)) delete doc; // This assumes that documents are not connected in // any way, i.e. deleting one document does NOT // delete another. node = next; } return TRUE; }
void OnMenuCommand(int cmd)
Processes the wxID_EXIT and wxID_FILEn (file history) commands. Other commands are routed to wxDocManager::OnMenuCommand.