\documentstyle[a4,makeidx,verbatim,texhelp,fancyhea,mysober,mytitle]{report}
\parindent 0pt
\parskip 11pt
%\input psbox.tex
\title{User Manual for wxToolBar  1.075 beta}
\author{Julian Smart\\Decision Support Group\\Artificial Intelligence Applications Institute\\80 South Bridge\\University of Edinburgh\\EH1 1HN}
\date{August 1993}
\makeindex
\begin{document}
\maketitle
%
\pagestyle{fancyplain}
\bibliographystyle{plain}
\pagenumbering{roman}
\setheader{{\it CONTENTS}}{}{}{}{}{{\it CONTENTS}}
\setfooter{\thepage}{}{}{}{}{\thepage}
\tableofcontents%
\newpage%
\pagenumbering{arabic}%
\chapter{Introduction}
\pagenumbering{arabic}%
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}

The wxToolBar class gives wxWindows programs an extra, and increasingly
popular, user interface component: a set of bitmap buttons or toggles.
A toolbar gives faster access to an application's facilities than
menus, which have to be popped up and selected rather laboriously.
Besides which, a toolbar looks prettier than a purely menu-based
interface.

wxToolBar uses a canvas subwindow for drawing bitmaps, and so bitmap
images cannot be mixed with panel items, but in most cases this won't
be important. A toolbar might appear as a single row of images under
the menubar, or it might be in a separate frame layout in several rows
and columns. The class handles the layout of the images, unless explicit
positioning is requested.

A tool is a bitmap which can either be a button (there is no `state',
it just generates an event when clicked) or it can be a toggle. If a
toggle, a second bitmap can be provided to depict the `on' state; if
the second bitmap is omitted, either the inverse of the first bitmap
will be used (for monochrome displays) or a thick border is drawn
around the bitmap (for colour displays where inverting will not have
the desired result).

Mouse click events for a given button are sent to a member called
\rtfsp{\bf OnLeftClick}, and so an application must derive from wxToolBar in order
to use it. The application can also handle {\bf OnMouseEnter} events for
the tools, to give the user extra feedback about the tools as the mouse
moves over them.

\chapter{Using the toolbar library}
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}

The toolbar library is in {\tt wx/utils/toolbar}, spread over the
usual {\tt src}, {\tt lib} and {\tt docs} directories. Include the
file {\tt wx\_tbar.h} in your application, and specify the library {\tt
-ltbar\_ol} (XView version), {\tt -ltbar\_motif} (Motif version) or {\tt
toolbar.lib} (Windows version).

An example of toolbar use is given in the program contained in {\tt
test.cc} and {\tt 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
\rtfsp{\bf 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.

\begin{verbatim}
  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);
\end{verbatim}
%
\input classes.tex
%
\addcontentsline{toc}{chapter}{Index}
\printindex
\end{document}

