The toolbar library is in wx/utils/toolbar, spread over the usual src, lib and docs directories. Include the file wx_tbar.h in your application, and specify the library -ltbar_ol (XView version), -ltbar_motif (Motif version) or toolbar.lib (Windows version).
An example of toolbar use is given in the program contained in test.cc and test.h. This creates a main window, and two toolbars: a floating toolbar with 24 tools, and a toolbar along the top of the main drawing canvas, divided into groups. The icons for this second toolbar would normally be quite small.
The test program defines a general-purpose derived frame called wxFrameWithToolBar which can manage a frame with one main subwindow and one horizontal toolbar.
Note that one of the bitmaps on the floating toolbar is a small version of the main graphic: this demonstrates how a memory device context can be used to draw into a bitmap. An application which allowed the user to build up a symbol library dynamically might create this kind of bitmap.
Left clicks and movements over the toolbars are intercepted and information is displayed on the status line.
The following fragment illustrates the essence of creating a toolbar.
toolBarBitmaps[0] = new wxBitmap("icon1"); toolBarBitmaps[1] = new wxBitmap("icon2"); toolBarBitmaps[2] = new wxBitmap("icon3"); ... toolBarFrame = new wxFrame(NULL, "Tools", 0, 0, 300, 200, wxSDI | wxDEFAULT_FRAME | wxSTAY_ON_TOP); toolBar = new TestToolBar(toolBarFrame, 10, 10, -1, -1, 0, wxVERTICAL, 5); toolBar->SetMargins(2, 2); toolBar->GetDC()->SetBackground(wxGREY_BRUSH); for (int i = 10; i < 25; i++) toolBar->AddTool(i, toolBarBitmaps[i], NULL, TRUE); toolBar->Layout(); float maxWidth, maxHeight; toolBar->GetMaxSize(&maxWidth, &maxHeight); toolBarFrame->SetClientSize((int)maxWidth, (int)maxHeight); toolBarFrame->Show(TRUE);