Public Member Functions

# wxRibbonButtonBar Class Reference
[Ribbon User Interface]

`#include <wx/ribbon/buttonbar.h>`

Inheritance diagram for wxRibbonButtonBar:
[legend]

## Detailed Description

A ribbon button bar is similar to a traditional toolbar.

It contains one or more buttons (button bar buttons, not wxButtons), each of which has a label and an icon. It differs from a wxRibbonToolBar in several ways:

- Individual buttons can grow and contract.
- Buttons have labels as well as bitmaps.
- Bitmaps are typically larger (at least 32x32 pixels) on a button bar compared to a tool bar (which typically has 16x15).
- There is no grouping of buttons on a button bar
- A button bar typically has a border around each individual button, whereas a tool bar typically has a border around each group of buttons.

## Events emitted by this class

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

void handlerFuncName(wxRibbonButtonBarEvent& event)

Event macros for events emitted by this class:

- EVT_RIBBONBUTTONBAR_CLICKED(id, func):
  Triggered when the normal (non-dropdown) region of a button on the button bar is clicked.
- EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED(id, func):
  Triggered when the dropdown region of a button on the button bar is clicked. wxRibbonButtonBarEvent::PopupMenu() should be called by the event handler if it wants to display a popup menu (which is what most dropdown buttons should be doing).

##

Library: wxRibbon
Category: Ribbon User Interface

## Public Member Functions
| wxRibbonButtonBar ()
| Default constructor.
| wxRibbonButtonBar (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
| Construct a ribbon button bar with the given parameters.
virtual | ~wxRibbonButtonBar ()
| Destructor.
bool | Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
| Create a button bar in two-step button bar construction.
virtual wxRibbonButtonBarButtonBase * | AddButton (int button_id, const wxString &label, const wxBitmap &bitmap, const wxString &help_string, wxRibbonButtonBarButtonKind kind=wxRIBBON_BUTTONBAR_BUTTON_NORMAL)
| Add a button to the button bar (simple version).
virtual wxRibbonButtonBarButtonBase * | AddDropdownButton (int button_id, const wxString &label, const wxBitmap &bitmap, const wxString &help_string=wxEmptyString)
| Add a dropdown button to the button bar (simple version).
virtual wxRibbonButtonBarButtonBase * | AddHybridButton (int button_id, const wxString &label, const wxBitmap &bitmap, const wxString &help_string=wxEmptyString)
| Add a hybrid button to the button bar (simple version).
virtual wxRibbonButtonBarButtonBase * | AddToggleButton (int button_id, const wxString &label, const wxBitmap &bitmap, const wxString &help_string=wxEmptyString)
| Add a toggle button to the button bar (simple version).
virtual wxRibbonButtonBarButtonBase * | AddButton (int button_id, const wxString &label, const wxBitmap &bitmap, const wxBitmap &bitmap_small=wxNullBitmap, const wxBitmap &bitmap_disabled=wxNullBitmap, const wxBitmap &bitmap_small_disabled=wxNullBitmap, wxRibbonButtonBarButtonKind kind=wxRIBBON_BUTTONBAR_BUTTON_NORMAL, const wxString &help_string=wxEmptyString, wxObject *client_data=NULL)
| Add a button to the button bar.
virtual bool | Realize ()
| Calculate button layouts and positions.
virtual void | ClearButtons ()
| Delete all buttons from the button bar.
virtual bool | DeleteButton (int button_id)
| Delete a single button from the button bar.
virtual void | EnableButton (int button_id, bool enable=true)
| Enable or disable a single button on the bar.
virtual void | ToggleButton (int button_id, bool checked)
| Set a toggle button to the checked or unchecked state.

List of all members.

## Constructor & Destructor Documentation

wxRibbonButtonBar::wxRibbonButtonBar | ( |  | ) |

Default constructor.

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

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

Construct a ribbon button bar with the given parameters.

Parameters:

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

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

Destructor.

## Member Function Documentation

virtual wxRibbonButtonBarButtonBase* wxRibbonButtonBar::AddButton | ( | int | button_id,
|  | const wxString & | label,
|  | const wxBitmap & | bitmap,
|  | const wxString & | help_string,
|  | wxRibbonButtonBarButtonKind | kind = `wxRIBBON_BUTTONBAR_BUTTON_NORMAL` |
| ) |  |  | `[virtual]`

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

virtual wxRibbonButtonBarButtonBase* wxRibbonButtonBar::AddButton | ( | int | button_id,
|  | const wxString & | label,
|  | const wxBitmap & | bitmap,
|  | const wxBitmap & | bitmap_small = `wxNullBitmap`,
|  | const wxBitmap & | bitmap_disabled = `wxNullBitmap`,
|  | const wxBitmap & | bitmap_small_disabled = `wxNullBitmap`,
|  | wxRibbonButtonBarButtonKind | kind = `wxRIBBON_BUTTONBAR_BUTTON_NORMAL`,
|  | const wxString & | help_string = `wxEmptyString`,
|  | wxObject * | client_data = `NULL` |
| ) |  |  | `[virtual]`

Add a button to the button bar.

Parameters:

  | button_id | ID of the new button (used for event callbacks).
  | label | Label of the new button.
  | bitmap | Large bitmap of the new button. Must be the same size as all other large bitmaps used on the button bar.
  | bitmap_small | Small bitmap of the new button. If left as null, then a small bitmap will be automatically generated. Must be the same size as all other small bitmaps used on the button bar.
  | bitmap_disabled | Large bitmap of the new button when it is disabled. If left as null, then a bitmap will be automatically generated from bitmap.
  | bitmap_small_disabled | Small bitmap of the new button when it is disabled. If left as null, then a bitmap will be automatically generated from bitmap_small.
  | kind | The kind of button to add.
  | help_string | The UI help string to associate with the new button.
  | client_data | Client data to associate with the new button.

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

See also:
  AddDropdownButton()
  AddHybridButton()
  AddToggleButton()

virtual wxRibbonButtonBarButtonBase* wxRibbonButtonBar::AddDropdownButton | ( | int | button_id,
|  | const wxString & | label,
|  | const wxBitmap & | bitmap,
|  | const wxString & | help_string = `wxEmptyString` |
| ) |  |  | `[virtual]`

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

See also:
  AddButton()

virtual wxRibbonButtonBarButtonBase* wxRibbonButtonBar::AddHybridButton | ( | int | button_id,
|  | const wxString & | label,
|  | const wxBitmap & | bitmap,
|  | const wxString & | help_string = `wxEmptyString` |
| ) |  |  | `[virtual]`

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

See also:
  AddButton()

virtual wxRibbonButtonBarButtonBase* wxRibbonButtonBar::AddToggleButton | ( | int | button_id,
|  | const wxString & | label,
|  | const wxBitmap & | bitmap,
|  | const wxString & | help_string = `wxEmptyString` |
| ) |  |  | `[virtual]`

Add a toggle button to the button bar (simple version).

See also:
  AddButton()

virtual void wxRibbonButtonBar::ClearButtons | ( |  | ) | `[virtual]`

Delete all buttons from the button bar.

See also:
  DeleteButton()

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

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

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

virtual bool wxRibbonButtonBar::DeleteButton | ( | int | button_id | ) | `[virtual]`

Delete a single button from the button bar.

See also:
  ClearButtons()

virtual void wxRibbonButtonBar::EnableButton | ( | int | button_id,
|  | bool | enable = `true` |
| ) |  |  | `[virtual]`

Enable or disable a single button on the bar.

Parameters:

  | button_id | ID of the button to enable or disable.
  | enable | true to enable the button, false to disable it.

virtual bool wxRibbonButtonBar::Realize | ( |  | ) | `[virtual]`

Calculate button layouts and positions.

Must be called after buttons are added to the button bar, as otherwise the newly added buttons will not be displayed. In normal situations, it will be called automatically when wxRibbonBar::Realize() is called.

Reimplemented from wxRibbonControl.

virtual void wxRibbonButtonBar::ToggleButton | ( | int | button_id,
|  | bool | checked |
| ) |  |  | `[virtual]`

Set a toggle button to the checked or unchecked state.

Parameters:

  | button_id | ID of the toggle button to manipulate.
  | checked | true to set the button to the toggled/pressed/checked state, false to set it to the untoggled/unpressed/unchecked state.

|  | [ top ]