# wxRibbonToolBar Class Reference
[Ribbon User Interface]

`#include </home/work/projects/wx/2.9/wx/interface/wx/ribbon/toolbar.h>`

Inheritance diagram for wxRibbonToolBar:
[legend]

## Detailed Description

A ribbon tool bar is similar to a traditional toolbar which has no labels.

It contains one or more tool groups, each of which contains one or more tools. Each tool is represented by a (generally small, i.e. 16x15) bitmap.

## Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxRibbonToolBarEvent& event)

Event macros for events emitted by this class:

- EVT_RIBBONTOOLBAR_CLICKED(id, func):
  Triggered when the normal (non-dropdown) region of a tool on the tool bar is clicked.
- EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED(id, func):
  Triggered when the dropdown region of a tool on the tool bar is clicked. wxRibbonToolBarEvent::PopupMenu() should be called by the event handler if it wants to display a popup menu (which is what most dropdown tools should be doing).

##

Library: wxRibbon
Category: Ribbon User Interface

## Public Member Functions

| wxRibbonToolBar ()
| Default constructor.
| wxRibbonToolBar (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
| Construct a ribbon tool bar with the given parameters.
virtual | ~wxRibbonToolBar ()
| Destructor.
bool | Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
| Create a tool bar in two-step tool bar construction.
virtual wxRibbonToolBarToolBase * | AddTool (int tool_id, const wxBitmap &bitmap, const wxString &help_string, wxRibbonButtonKind kind=wxRIBBON_BUTTON_NORMAL)
| Add a tool to the tool bar (simple version).
virtual wxRibbonToolBarToolBase * | AddDropdownTool (int tool_id, const wxBitmap &bitmap, const wxString &help_string=wxEmptyString)
| Add a dropdown tool to the tool bar (simple version).
virtual wxRibbonToolBarToolBase * | AddHybridTool (int tool_id, const wxBitmap &bitmap, const wxString &help_string=wxEmptyString)
| Add a hybrid tool to the tool bar (simple version).
virtual wxRibbonToolBarToolBase * | AddTool (int tool_id, const wxBitmap &bitmap, const wxBitmap &bitmap_disabled=wxNullBitmap, const wxString &help_string=wxEmptyString, wxRibbonButtonKind kind=wxRIBBON_BUTTON_NORMAL, wxObject *client_data=NULL)
| Add a tool to the tool bar.
virtual wxRibbonToolBarToolBase * | AddSeparator ()
| Add a separator to the tool bar.
virtual void | SetRows (int nMin, int nMax=-1)
| Set the number of rows to distribute tool groups over.

List of all members.

## Constructor & Destructor Documentation

wxRibbonToolBar::wxRibbonToolBar | ( |  | ) |

Default constructor.

With this constructor, Create() should be called in order to create the tool bar.

wxRibbonToolBar::wxRibbonToolBar | ( | wxWindow * | parent,
|  | wxWindowID | id = `wxID_ANY`,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | long | style = `0` |
| ) |  |  |

Construct a ribbon tool bar with the given parameters.

Parameters:

  | parent | Parent window for the tool bar (typically a wxRibbonPanel).
  | id | An identifier for the toolbar. `wxID_ANY` is taken to mean a default.
  | pos | Initial position of the tool bar.
  | size | Initial size of the tool bar.
  | style | Tool bar style, currently unused.

virtual wxRibbonToolBar::~wxRibbonToolBar | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

virtual wxRibbonToolBarToolBase* wxRibbonToolBar::AddDropdownTool | ( | int | tool_id,
|  | const wxBitmap & | bitmap,
|  | const wxString & | help_string = `wxEmptyString` |
| ) |  |  | `[virtual]`

Add a dropdown tool to the tool bar (simple version).

See also:
  AddTool()

virtual wxRibbonToolBarToolBase* wxRibbonToolBar::AddHybridTool | ( | int | tool_id,
|  | const wxBitmap & | bitmap,
|  | const wxString & | help_string = `wxEmptyString` |
| ) |  |  | `[virtual]`

Add a hybrid tool to the tool bar (simple version).

See also:
  AddTool()

virtual wxRibbonToolBarToolBase* wxRibbonToolBar::AddSeparator | ( |  | ) | `[virtual]`

Add a separator to the tool bar.

Separators are used to separate tools into groups. As such, a separator is not explicitly drawn, but is visually seen as the gap between tool groups.

virtual wxRibbonToolBarToolBase* wxRibbonToolBar::AddTool | ( | int | tool_id,
|  | const wxBitmap & | bitmap,
|  | const wxBitmap & | bitmap_disabled = `wxNullBitmap`,
|  | const wxString & | help_string = `wxEmptyString`,
|  | wxRibbonButtonKind | kind = `wxRIBBON_BUTTON_NORMAL`,
|  | wxObject * | client_data = `NULL` |
| ) |  |  | `[virtual]`

Add a tool to the tool bar.

Parameters:

  | tool_id | ID of the new tool (used for event callbacks).
  | bitmap | Bitmap to use as the foreground for the new tool. Does not have to be the same size as other tool bitmaps, but should be similar as otherwise it will look visually odd.
  | bitmap_disabled | Bitmap to use when the tool is disabled. If left as wxNullBitmap, then a bitmap will be automatically generated from bitmap.
  | help_string | The UI help string to associate with the new tool.
  | kind | The kind of tool to add.
  | client_data | Client data to associate with the new tool.

Returns:
  An opaque pointer which can be used only with other tool bar methods.

See also:
  AddDropdownTool(), AddHybridTool(), AddSeparator()

virtual wxRibbonToolBarToolBase* wxRibbonToolBar::AddTool | ( | int | tool_id,
|  | const wxBitmap & | bitmap,
|  | const wxString & | help_string,
|  | wxRibbonButtonKind | kind = `wxRIBBON_BUTTON_NORMAL` |
| ) |  |  | `[virtual]`

Add a tool to the tool bar (simple version).

bool wxRibbonToolBar::Create | ( | wxWindow * | parent,
|  | wxWindowID | id = `wxID_ANY`,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | long | style = `0` |
| ) |  |  |

Create a tool bar in two-step tool bar construction.

Should only be called when the default constructor is used, and arguments have the same meaning as in the full constructor.

virtual void wxRibbonToolBar::SetRows | ( | int | nMin,
|  | int | nMax = `-1` |
| ) |  |  | `[virtual]`

Set the number of rows to distribute tool groups over.

Tool groups can be distributed over a variable number of rows. The way in which groups are assigned to rows is not specified, and the order of groups may change, but they will be distributed in such a way as to minimise the overall size of the tool bar.

Parameters:

  | nMin | The minimum number of rows to use.
  | nMax | The maximum number of rows to use (defaults to nMin).

|  | [ top ]