- // Make another frame, containing a canvas
- MyChild *subframe = new MyChild(frame, "Canvas Frame",
- wxPoint(-1, -1), wxSize(-1, -1),
- wxDEFAULT_FRAME_STYLE);
-
- wxString title;
- title.Printf(_T("Canvas Frame %d"), ++gs_nFrames);
-
- subframe->SetTitle(title);
-
- // Give it an icon
-#ifdef __WXMSW__
- subframe->SetIcon(wxIcon("chrt_icn"));
-#else
- subframe->SetIcon(wxIcon( mondrian_xpm ));
-#endif
-
- // Make a menubar
- wxMenu *file_menu = new wxMenu;
-
- file_menu->Append(MDI_NEW_WINDOW, "&New window");
- file_menu->Append(MDI_CHILD_QUIT, "&Close child", "Close this window");
- file_menu->Append(MDI_QUIT, "&Exit");
-
- wxMenu *option_menu = new wxMenu;
-
- option_menu->Append(MDI_REFRESH, "&Refresh picture");
- option_menu->Append(MDI_CHANGE_TITLE, "Change &title...\tCtrl-T");
- option_menu->AppendSeparator();
- option_menu->Append(MDI_CHANGE_POSITION, "Move frame\tCtrl-M");
- option_menu->Append(MDI_CHANGE_SIZE, "Resize frame\tCtrl-S");
-
- wxMenu *help_menu = new wxMenu;
- help_menu->Append(MDI_ABOUT, "&About");
-
- wxMenuBar *menu_bar = new wxMenuBar;
-
- menu_bar->Append(file_menu, "&File");
- menu_bar->Append(option_menu, "&Child");
- menu_bar->Append(help_menu, "&Help");
-
- // Associate the menu bar with the frame
- subframe->SetMenuBar(menu_bar);
-
- subframe->CreateStatusBar();
- subframe->SetStatusText(title);
-
- int width, height;
- subframe->GetClientSize(&width, &height);
- MyCanvas *canvas = new MyCanvas(subframe, wxPoint(0, 0), wxSize(width, height));
- canvas->SetCursor(wxCursor(wxCURSOR_PENCIL));
- subframe->canvas = canvas;
-
- // Give it scrollbars
- canvas->SetScrollbars(20, 20, 50, 50);
-
- subframe->Show(TRUE);