X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8bbe427f8e5a2078b266e282453595b5a634d35c..6a570331df89d26dfb682bedab0faf13e2c285d8:/samples/toolbar/test.cpp diff --git a/samples/toolbar/test.cpp b/samples/toolbar/test.cpp index 69bbfe4173..f9720337ab 100644 --- a/samples/toolbar/test.cpp +++ b/samples/toolbar/test.cpp @@ -56,12 +56,12 @@ bool MyApp::OnInit(void) // Make a menubar wxMenu *fileMenu = new wxMenu; - fileMenu->Append(wxID_EXIT, "E&xit"); + fileMenu->Append(wxID_EXIT, "E&xit", "Quit toolbar sample" ); wxMenu *helpMenu = new wxMenu; - helpMenu->Append(wxID_HELP, "&About"); + helpMenu->Append(wxID_HELP, "&About", "About toolbar sample"); - wxMenuBar* menuBar = new wxMenuBar; + wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE ); menuBar->Append(fileMenu, "&File"); menuBar->Append(helpMenu, "&Help"); @@ -70,7 +70,9 @@ bool MyApp::OnInit(void) frame->SetMenuBar(menuBar); // Create the toolbar - frame->CreateToolBar(wxNO_BORDER|wxHORIZONTAL|wxTB_FLAT, ID_TOOLBAR); + frame->CreateToolBar(wxNO_BORDER|wxTB_HORIZONTAL|wxTB_FLAT|wxTB_DOCKABLE, ID_TOOLBAR); + + frame->GetToolBar()->SetMargins( 2, 2 ); InitToolbar(frame->GetToolBar()); @@ -137,7 +139,9 @@ bool MyApp::InitToolbar(wxToolBar* toolBar) toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Print"); currentX += width + 5; toolBar->AddSeparator(); - toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Help"); + toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), *(toolBarBitmaps[6]), TRUE, currentX, -1, (wxObject *) NULL, "Help"); + + toolBar->EnableTool( wxID_PRINT, FALSE ); toolBar->Realize(); @@ -156,13 +160,13 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(wxID_HELP, MyFrame::OnAbout) EVT_CLOSE(MyFrame::OnCloseWindow) EVT_TOOL_RANGE(wxID_OPEN, wxID_PASTE, MyFrame::OnToolLeftClick) - EVT_TOOL_ENTER(wxID_OPEN, MyFrame::OnToolEnter) + EVT_TOOL_ENTER(ID_TOOLBAR, MyFrame::OnToolEnter) END_EVENT_TABLE() // Define my frame constructor MyFrame::MyFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): - wxFrame(parent, id, title, pos, size, style), m_timer(this) + wxFrame(parent, id, title, pos, size, style) { m_textWindow = new wxTextCtrl(this, -1, "", wxPoint(0, 0), wxSize(-1, -1), wxTE_MULTILINE); } @@ -174,10 +178,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { -// (void)wxMessageBox("wxWindows wxToolBar demo\n", "About wxToolBar"); - wxLogStatus("Started timer."); - - m_timer.Start(500, TRUE); + (void)wxMessageBox("wxWindows toolbar sample", "About wxToolBar"); } // Define the behaviour for the frame closing @@ -190,7 +191,7 @@ void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) void MyFrame::OnToolLeftClick(wxCommandEvent& event) { wxString str; - str.Printf("Clicked on tool %d", event.GetId()); + str.Printf( _T("Clicked on tool %d"), event.GetId()); SetStatusText(str); } @@ -199,7 +200,7 @@ void MyFrame::OnToolEnter(wxCommandEvent& event) if (event.GetSelection() > -1) { wxString str; - str.Printf("This is tool number %d", event.GetSelection()); + str.Printf(_T("This is tool number %d"), event.GetSelection()); SetStatusText(str); } else