- int width, height;
- parent->GetClientSize(&width, &height);
-
- // Non-retained canvas
- MyCanvas *canvas = new MyCanvas(view, parent, wxPoint(0, 0), wxSize(width, height), 0);
- canvas->SetCursor(wxCursor(wxCURSOR_PENCIL));
-
- // Give it scrollbars
- canvas->SetScrollbars(20, 20, 50, 50);
- canvas->SetBackgroundColour(*wxWHITE);
- canvas->Clear();
-
- return canvas;
+ // 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;