X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5d55595cb67337c56f02e26db2bd51f514af0d9a..f1567cddead054974c4a079ed8ee2c798ef998dc:/samples/minifram/test.cpp diff --git a/samples/minifram/test.cpp b/samples/minifram/test.cpp index a6d0889355..6d1b34c895 100644 --- a/samples/minifram/test.cpp +++ b/samples/minifram/test.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx/wx.h". @@ -49,23 +49,23 @@ wxButton *button = (wxButton*) NULL; // The `main program' equivalent, creating the windows and returning the // main frame -bool MyApp::OnInit(void) +bool MyApp::OnInit() { // Create the mini frame window mini_frame = new MyMiniFrame((wxFrame *) NULL, -1, "wxMiniFrame sample", - wxPoint(100, 100), wxSize(205, 100)); + wxPoint(100, 100), wxSize(220, 100)); mini_frame_exists = TRUE; - mini_frame->CreateToolBar(wxNO_BORDER|wxHORIZONTAL|wxTB_FLAT, ID_TOOLBAR); + mini_frame->CreateToolBar(wxNO_BORDER|wxTB_HORIZONTAL|wxTB_FLAT, ID_TOOLBAR); InitToolbar(mini_frame->GetToolBar()); - + // Create the main frame window main_frame = new MyMainFrame((wxFrame *) NULL, -1, "wxFrame sample", wxPoint(100, 100), wxSize(300, 200)); - - main_frame->CreateToolBar(wxNO_BORDER|wxHORIZONTAL, ID_TOOLBAR); + + main_frame->CreateToolBar(wxNO_BORDER|wxTB_VERTICAL, ID_TOOLBAR); InitToolbar(main_frame->GetToolBar()); - + button = new wxButton( main_frame, ID_REPARENT, "Press to reparent!" ); #ifdef __WXMSW__ @@ -77,7 +77,7 @@ bool MyApp::OnInit(void) #endif SetTopWindow(main_frame); - + main_frame->Show(TRUE); mini_frame->Show(TRUE); @@ -133,13 +133,13 @@ bool MyApp::InitToolbar(wxToolBar* toolBar) toolBar->AddTool(wxID_PASTE, *(toolBarBitmaps[5]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Paste"); currentX += width + 5; toolBar->AddSeparator(); - toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Print"); + toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Reparent the button"); currentX += width + 5; toolBar->AddSeparator(); toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Help"); toolBar->Realize(); - + toolBar->EnableTool( wxID_HELP, FALSE ); // Can delete the bitmaps since they're reference counted @@ -155,6 +155,7 @@ bool MyApp::InitToolbar(wxToolBar* toolBar) BEGIN_EVENT_TABLE(MyMiniFrame, wxMiniFrame) EVT_CLOSE ( MyMiniFrame::OnCloseWindow) EVT_BUTTON (ID_REPARENT, MyMiniFrame::OnReparent) + EVT_MENU (wxID_PRINT, MyMiniFrame::OnReparent) END_EVENT_TABLE() MyMiniFrame::MyMiniFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos, @@ -180,6 +181,7 @@ void MyMiniFrame::OnReparent(wxCommandEvent& WXUNUSED(event)) BEGIN_EVENT_TABLE(MyMainFrame, wxFrame) EVT_CLOSE ( MyMainFrame::OnCloseWindow) EVT_BUTTON (ID_REPARENT, MyMainFrame::OnReparent) + EVT_MENU (wxID_PRINT, MyMainFrame::OnReparent) END_EVENT_TABLE() MyMainFrame::MyMainFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos, @@ -199,8 +201,8 @@ void MyMainFrame::OnReparent(wxCommandEvent& WXUNUSED(event)) // after closing the mini_frame. We'll have the last laugh. if (! mini_frame_exists) wxMessageBox("The miniframe no longer exists.\n" - "You don't want to make this button an orphan, do you?", - "You got to be kidding"); + "You don't want to make this button an orphan, do you?", + "You got to be kidding"); else button->Reparent( mini_frame ); }