Public Member Functions

# wxRibbonGallery Class Reference
[Ribbon User Interface]

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

Inheritance diagram for wxRibbonGallery:
[legend]

## Detailed Description

A ribbon gallery is like a wxListBox, but for bitmaps rather than strings.

It displays a collection of bitmaps arranged in a grid and allows the user to choose one. As there are typically more bitmaps in a gallery than can be displayed in the space used for a ribbon, a gallery always has scroll buttons to allow the user to navigate through the entire gallery. It also has an "extension" button, the behaviour of which is outside the scope of the gallery control itself, though it typically displays some kind of dialog related to the gallery.

## Events emitted by this class

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

void handlerFuncName(wxRibbonGalleryEvent& event)

Event macros for events emitted by this class:

- EVT_RIBBONGALLERY_SELECTED(id, func):
  Triggered when the user selects an item from the gallery. Note that the ID is that of the gallery, not of the item.
- EVT_RIBBONGALLERY_CLICKED(id, func):
  Similar to EVT_RIBBONGALLERY_SELECTED but triggered every time a gallery item is clicked, even if it is already selected. Note that the ID of the event is that of the gallery, not of the item, just as above. This event is available since wxWidgets 2.9.2.
- EVT_RIBBONGALLERY_HOVER_CHANGED(id, func):
  Triggered when the item being hovered over by the user changes. The item in the event will be the new item being hovered, or NULL if there is no longer an item being hovered. Note that the ID is that of the gallery, not of the item.

## Events emitted by this class

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

void handlerFuncName(wxCommandEvent& event)

Event macros for events emitted by this class:

- EVT_BUTTON(id, func):
  Triggered when the "extension" button of the gallery is pressed.

##

Library: wxRibbon
Category: Ribbon User Interface

## Public Member Functions
| wxRibbonGallery ()
| Default constructor.
| wxRibbonGallery (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
| Construct a ribbon gallery with the given parameters.
virtual | ~wxRibbonGallery ()
| Destructor.
bool | Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
| Create a gallery in two-step gallery construction.
void | Clear ()
| Remove all items from the gallery.
bool | IsEmpty () const
| Query if the gallery has no items in it.
unsigned int | GetCount () const
| Get the number of items in the gallery.
wxRibbonGalleryItem * | GetItem (unsigned int n)
| Get an item by index.
wxRibbonGalleryItem * | Append (const wxBitmap &bitmap, int id)
| Add an item to the gallery (with no client data).
wxRibbonGalleryItem * | Append (const wxBitmap &bitmap, int id, void *clientData)
| Add an item to the gallery (with simple client data).
wxRibbonGalleryItem * | Append (const wxBitmap &bitmap, int id, wxClientData *clientData)
| Add an item to the gallery (with complex client data).
void | SetItemClientObject (wxRibbonGalleryItem *item, wxClientData *data)
| Set the client object associated with a gallery item.
wxClientData * | GetItemClientObject (const wxRibbonGalleryItem *item) const
| Get the client object associated with a gallery item.
void | SetItemClientData (wxRibbonGalleryItem *item, void *data)
| Set the client data associated with a gallery item.
void * | GetItemClientData (const wxRibbonGalleryItem *item) const
| Get the client data associated with a gallery item.
void | SetSelection (wxRibbonGalleryItem *item)
| Set the selection to the given item, or removes the selection if item == NULL.
wxRibbonGalleryItem * | GetSelection () const
| Get the currently selected item, or NULL if there is none.
wxRibbonGalleryItem * | GetHoveredItem () const
| Get the currently hovered item, or NULL if there is none.
wxRibbonGalleryItem * | GetActiveItem () const
| Get the currently active item, or NULL if there is none.
wxRibbonGalleryButtonState | GetUpButtonState () const
| Get the state of the scroll up button.
wxRibbonGalleryButtonState | GetDownButtonState () const
| Get the state of the scroll down button.
wxRibbonGalleryButtonState | GetExtensionButtonState () const
| Get the state of the "extension" button.
bool | IsHovered () const
| Query is the mouse is currently hovered over the gallery.
virtual bool | ScrollLines (int lines)
| Scroll the gallery contents by some amount.
bool | ScrollPixels (int pixels)
| Scroll the gallery contents by some fine-grained amount.
void | EnsureVisible (const wxRibbonGalleryItem *item)
| Scroll the gallery to ensure that the given item is visible.

List of all members.

## Constructor & Destructor Documentation

wxRibbonGallery::wxRibbonGallery | ( |  | ) |

Default constructor.

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

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

Construct a ribbon gallery with the given parameters.

Parameters:

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

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

Destructor.

## Member Function Documentation

wxRibbonGalleryItem* wxRibbonGallery::Append | ( | const wxBitmap & | bitmap,
|  | int | id |
| ) |  |  |

Add an item to the gallery (with no client data).

Parameters:

  | bitmap | The bitmap to display for the item. Note that all items must have equally sized bitmaps.
  | id | ID number to associate with the item. Not currently used for anything important.

wxRibbonGalleryItem* wxRibbonGallery::Append | ( | const wxBitmap & | bitmap,
|  | int | id,
|  | wxClientData * | clientData |
| ) |  |  |

Add an item to the gallery (with complex client data).

Parameters:

  | bitmap | The bitmap to display for the item. Note that all items must have equally sized bitmaps.
  | id | ID number to associate with the item. Not currently used for anything important.
  | clientData | An object which contains data to associate with the item. The item takes ownership of this pointer, and will delete it when the item client data is changed to something else, or when the item is destroyed.

wxRibbonGalleryItem* wxRibbonGallery::Append | ( | const wxBitmap & | bitmap,
|  | int | id,
|  | void * | clientData |
| ) |  |  |

Add an item to the gallery (with simple client data).

Parameters:

  | bitmap | The bitmap to display for the item. Note that all items must have equally sized bitmaps.
  | id | ID number to associate with the item. Not currently used for anything important.
  | clientData | An opaque pointer to associate with the item.

void wxRibbonGallery::Clear | ( |  | ) |

Remove all items from the gallery.

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

Create a gallery in two-step gallery construction.

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

void wxRibbonGallery::EnsureVisible | ( | const wxRibbonGalleryItem * | item | ) |

Scroll the gallery to ensure that the given item is visible.

wxRibbonGalleryItem* wxRibbonGallery::GetActiveItem | ( |  | ) | const

Get the currently active item, or NULL if there is none.

The active item is the item being pressed by the user, and will thus become the selected item if the user releases the mouse button.

unsigned int wxRibbonGallery::GetCount | ( |  | ) | const

Get the number of items in the gallery.

wxRibbonGalleryButtonState wxRibbonGallery::GetDownButtonState | ( |  | ) | const

Get the state of the scroll down button.

wxRibbonGalleryButtonState wxRibbonGallery::GetExtensionButtonState | ( |  | ) | const

Get the state of the "extension" button.

wxRibbonGalleryItem* wxRibbonGallery::GetHoveredItem | ( |  | ) | const

Get the currently hovered item, or NULL if there is none.

The hovered item is the item underneath the mouse cursor.

wxRibbonGalleryItem* wxRibbonGallery::GetItem | ( | unsigned int | n | ) |

Get an item by index.

void* wxRibbonGallery::GetItemClientData | ( | const wxRibbonGalleryItem * | item | ) | const

Get the client data associated with a gallery item.

wxClientData* wxRibbonGallery::GetItemClientObject | ( | const wxRibbonGalleryItem * | item | ) | const

Get the client object associated with a gallery item.

wxRibbonGalleryItem* wxRibbonGallery::GetSelection | ( |  | ) | const

Get the currently selected item, or NULL if there is none.

The selected item is set by SetSelection(), or by the user clicking on an item.

wxRibbonGalleryButtonState wxRibbonGallery::GetUpButtonState | ( |  | ) | const

Get the state of the scroll up button.

bool wxRibbonGallery::IsEmpty | ( |  | ) | const

Query if the gallery has no items in it.

bool wxRibbonGallery::IsHovered | ( |  | ) | const

Query is the mouse is currently hovered over the gallery.

Returns:
  true if the cursor is within the bounds of the gallery (not just hovering over an item), false otherwise.

virtual bool wxRibbonGallery::ScrollLines | ( | int | lines | ) | `[virtual]`

Scroll the gallery contents by some amount.

Parameters:

  | lines | Positive values scroll toward the end of the gallery, while negative values scroll toward the start.

Returns:
  true if the gallery scrolled at least one pixel in the given direction, false if it did not scroll.

Reimplemented from wxWindow.

bool wxRibbonGallery::ScrollPixels | ( | int | pixels | ) |

Scroll the gallery contents by some fine-grained amount.

Parameters:

  | pixels | Positive values scroll toward the end of the gallery, while negative values scroll toward the start.

Returns:
  true if the gallery scrolled at least one pixel in the given direction, false if it did not scroll.

void wxRibbonGallery::SetItemClientData | ( | wxRibbonGalleryItem * | item,
|  | void * | data |
| ) |  |  |

Set the client data associated with a gallery item.

void wxRibbonGallery::SetItemClientObject | ( | wxRibbonGalleryItem * | item,
|  | wxClientData * | data |
| ) |  |  |

Set the client object associated with a gallery item.

void wxRibbonGallery::SetSelection | ( | wxRibbonGalleryItem * | item | ) |

Set the selection to the given item, or removes the selection if item == NULL.

Note that this not cause any events to be emitted.

|  | [ top ]