// Creates a canvas. Called either from view.cc when a new drawing // view is created, or in OnInit as a child of the main window, // if in 'single window' mode. MyCanvas *MyFrame::CreateCanvas(wxView *view, wxFrame *parent) { 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->ClearBackground(); return canvas; }