#endif
#include "wx/toolbar.h"
+#include <wx/log.h>
+
#include "test.h"
#if defined(__WXGTK__) || defined(__WXMOTIF__)
IMPLEMENT_APP(MyApp)
-
// The `main program' equivalent, creating the windows and returning the
// main frame
bool MyApp::OnInit(void)
frame->CreateStatusBar();
// Give it an icon
-#ifdef __WXMSW__
- frame->SetIcon(wxIcon("mondrian"));
-#else
- frame->SetIcon( wxIcon(mondrian_xpm) );
-#endif
+ frame->SetIcon(wxICON(mondrian));
// 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");
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());
bool MyApp::InitToolbar(wxToolBar* toolBar)
{
- toolBar->SetMargins(5, 5);
-
// Set up toolbar
wxBitmap* toolBarBitmaps[8];
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();
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
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
- (void)wxMessageBox("wxWindows wxToolBar demo\n", "About wxToolBar");
+ (void)wxMessageBox("wxWindows toolbar sample", "About wxToolBar");
}
// Define the behaviour for the frame closing
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);
}
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