Esempio n. 1
0
void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
{
    // Make another frame, containing a canvas
    MyChild *subframe ;

    m_children.Append (new MyChild(frame, wxT("SVG Frame"),
        wxPoint(-1, -1), wxSize(-1, -1),
        wxDEFAULT_FRAME_STYLE )   ) ;

    subframe = (MyChild *) m_children.GetLast() -> GetData ();
    wxString title;
    title.Printf(wxT("SVG Test Window %d"), nWinCreated );
    // counts number of children previously, even if now closed
    nWinCreated ++ ;

    // Give it a title and icon
    subframe->SetTitle(title);
    subframe->SetIcon(wxICON(mondrian));

    // Make a menubar
    wxMenu *file_menu = new wxMenu;

    file_menu->Append(MDI_NEW_WINDOW, wxT("&Another test\tCtrl+N"));
    file_menu->Append(MDI_SAVE, wxT("&Save\tCtrl+S"), wxT("Save in SVG format"));
    file_menu->Append(MDI_CHILD_QUIT, wxT("&Close child\tCtrl+F4"));
    file_menu->Append(MDI_QUIT, wxT("&Exit\tAlt+X"));

    wxMenu *help_menu = new wxMenu;
    help_menu->Append(MDI_ABOUT, wxT("&About"));

    wxMenuBar *menu_bar = new wxMenuBar;

    menu_bar->Append(file_menu, wxT("&File"));
    menu_bar->Append(help_menu, wxT("&Help"));

    // Associate the menu bar with the frame
    subframe->SetMenuBar(menu_bar);

    subframe->Show(true);
}