\chapter{Class reference}
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}

There is one major class by which toolbars are created and manipulated.

\section{\class{wxToolBar}: wxCanvas}

\membersection{wxToolBar::wxToolBar}

\func{void}{wxToolBar}{\param{wxFrame *}{frame}, \param{int}{ x = 0}, \param{int}{ y = 0},\\
  \param{int}{ width = -1}, \param{int}{ height = -1}, \param{int}{ style = 0},\\
  \param{int}{ orientation = wxVERTICAL}, \param{int}{ nRowsOrColumns = 2}}

Constructs a toolbar canvas, with the same arguments as a canvas plus
an orientation (wxVERTICAL or wxHORIZONTAL) and the number of rows or
columns, whose meaning depends on the orientation.  If laid out
vertically, the final argument refers to the number of rows to draw
before the next column is started; if horizontal, it refers to the
number of columns to draw before the next row is started.

\membersection{wxToolBar::\destruct{wxToolBar}}

\func{void}{\destruct{wxToolBar}}{\void}

Toolbar destructor.

\membersection{wxToolBar::AddTool}

\func{Bool}{AddTool}{\param{int}{ toolIndex},\\
  \param{wxBitmap *}{ bitmap1}, \param{wxBitmap *}{ bitmap2 = NULL},\\
  \param{Bool}{ isToggle = FALSE},\\
  \param{float}{ xPos = -1}, \param{float}{ yPos = -1}\\
  \param{wxObject *}{clientData}}

Adds a tool to the toolbar. The {\it toolIndex} is an integer by which
the tool may be identified in subsequent operations.  {\it isToggle}\rtfsp
specifies whether the tool is a toggle or not: a toggle tool may be in
two states, whereas a non-toggle tool is just a button.

The first bitmap is the primary tool bitmap for toggle and button
tools. The second bitmap specifies the on-state bitmap for a toggle
tool. If this is NULL, either an inverted version of the primary bitmap is
used for the on-state of a toggle tool (monochrome displays) or a black
border is drawn around the tool (colour displays).

The arguments {\it xPos} and {\it yPos} allow the programmer to specify
the position of the tool if automatic layout is not suitable. For
example, a toolbar along the top of a window may have groups of tools,
with spacing between groups. In this case, specifying {\it xPos} is all
that is required, and {\it yPos} will take its value from the current
vertical spacing value.

{\it clientData} is an optional pointer to client data which can be
retrieved later using {\bf GetToolClientData}.

\membersection{wxToolBar::DrawTool}

\func{void}{DrawTool}{\param{wxMemoryDC\& }{memDC}, \param{wxToolBarTool *}{tool}}

Draws the specified tool onto the canvas using the given memory device context.
Used internally, and should not need to be used by the programmer.

\membersection{wxToolBar::EnableTool}

\func{void}{EnableTool}{\param{int }{toolIndex}, \param{Bool}{ enable}}

Enables or disables the tool. Not currently implemented, but should give some
indication of whether the tool is active.

\membersection{wxToolBar::FindToolForPosition}

\func{wxToolBarTool *}{FindToolForPosition}{\param{float}{ x}, \param{float}{ y}}

Find a tool for the given mouse position, or return NULL. Used
internally, and should not need to be used by the programmer.

\membersection{wxToolBar::GetMaxSize}

\func{void}{GetMaxSize}{\param{float *}{w}, \param{float *}{h}}

Gets the maximum size taken up by the tools after layout, including margins.
This can be used to size a frame around the toolbar canvas.

\membersection{wxToolBar::GetToolClientData}

\func{wxObject *}{GetToolClientData}{\param{int }{toolIndex}}

Get any client data associated with the tool.

\membersection{wxToolBar::GetToolState}

\func{Bool}{GetToolState}{\param{int }{toolIndex}}

Gets the on/off state of a toggle tool.

\membersection{wxToolBar::Layout}

\func{void}{Layout}{\void}

Called by the application after the tools have been added to
automatically lay the tools out on the canvas. If you have given
absolute positions when adding the tools, do not call this.

\membersection{wxToolBar::OnLeftClick}

\func{Bool}{OnLeftClick}{\param{int}{ toolIndex}, \param{Bool}{ toggleDown}}

Called when the user clicks on a tool. The programmer should override this
function to detect tool clicks. {\it toolIndex} is the identifier passed
to {\bf AddTool}, and {\it toggleDown} is TRUE if the tool is a toggle and
the toggle is down, otherwise is FALSE.

If the tool is a toggle and this function returns FALSE, the toggle
toggle state (internal and visual) will not be changed. This provides a way of
specifying that toggle operations are not permitted in some circumstances.

\membersection{wxToolBar::OnMouseEnter}

\func{void}{OnMouseEnter}{\param{int}{ toolIndex}}

This is called when the mouse moves into a tool ({\it toolIndex} is
greater than -1) or out of the toolbox ({\it toolIndex} is -1). The
programmer can override this to provide extra information about the tool,
such as a short description on the status line. Icons are not always as
intuitive as they're cracked up to be!

\membersection{wxToolBar::SetMargins}

\func{void}{SetMargins}{\param{float}{ x}, \param{float}{ y}}

Set the values to be used as margins and spacing for the tools. This must be
called before the tools are added if absolute positioning is to be used, and the
default (zero-size) margins are to be overridden.

\membersection{wxToolBar::ToggleTool}

\func{void}{ToggleTool}{\param{int }{toolIndex}, \param{Bool}{ toggle}}

Toggles a tool on or off.

