+ // create a child frame of appropriate class for the current mode
+ wxFrame *subframe;
+ wxDocument *doc = view->GetDocument();
+#if wxUSE_MDI_ARCHITECTURE
+ if ( GetMode() == Mode_MDI )
+ {
+ subframe = new wxDocMDIChildFrame
+ (
+ doc,
+ view,
+ wxStaticCast(GetTopWindow(), wxDocMDIParentFrame),
+ wxID_ANY,
+ "Child Frame",
+ wxDefaultPosition,
+ wxSize(300, 300)
+ );
+ }
+ else
+#endif // wxUSE_MDI_ARCHITECTURE
+ {
+ subframe = new wxDocChildFrame
+ (
+ doc,
+ view,
+ wxStaticCast(GetTopWindow(), wxDocParentFrame),
+ wxID_ANY,
+ "Child Frame",
+ wxDefaultPosition,
+ wxSize(300, 300)
+ );
+
+ subframe->Centre();
+ }
+
+ wxMenu *menuFile = new wxMenu;
+
+ menuFile->Append(wxID_NEW);
+ menuFile->Append(wxID_OPEN);
+ AppendDocumentFileCommands(menuFile, isCanvas);
+ menuFile->AppendSeparator();
+ menuFile->Append(wxID_EXIT);
+
+ wxMenu *menuEdit;
+ if ( isCanvas )
+ {
+ menuEdit = CreateDrawingEditMenu();
+
+ doc->GetCommandProcessor()->SetEditMenu(menuEdit);
+ doc->GetCommandProcessor()->Initialize();
+ }
+ else // text frame
+ {
+ menuEdit = new wxMenu;
+ menuEdit->Append(wxID_COPY);
+ menuEdit->Append(wxID_PASTE);
+ menuEdit->Append(wxID_SELECTALL);
+ }
+
+ CreateMenuBarForFrame(subframe, menuFile, menuEdit);
+
+ subframe->SetIcon(isCanvas ? wxICON(chrt) : wxICON(notepad));
+
+ return subframe;
+}
+
+void MyApp::OnAbout(wxCommandEvent& WXUNUSED(event))
+{
+ wxString modeName;
+ switch ( m_mode )
+ {
+#if wxUSE_MDI_ARCHITECTURE
+ case Mode_MDI:
+ modeName = "MDI";
+ break;
+#endif // wxUSE_MDI_ARCHITECTURE
+
+ case Mode_SDI:
+ modeName = "SDI";
+ break;
+
+ case Mode_Single:
+ modeName = "single document";
+ break;
+
+ default:
+ wxFAIL_MSG( "unknown mode ");
+ }
+
+ wxLogMessage
+ (
+ "This is the wxWidgets Document/View Sample\n"
+ "running in %s mode.\n"
+ "\n"
+ "Authors: Julian Smart, Vadim Zeitlin\n"
+ "\n"
+ "Usage: docview [--{mdi,sdi,single}]",
+ modeName
+ );