CMFCRibbonGallery Class
Implements Office 2007-style ribbon galleries.
class CMFCRibbonGallery : public CMFCRibbonButton
Members
Public Constructors
Name |
Description |
---|---|
Constructs and initializes a CMFCRibbonGallery object. |
Public Methods
Name |
Description |
---|---|
Adds a new group to the gallery. |
|
Adds a new menu item to the drop-down menu. |
|
Clears the content of the gallery. |
|
Enables or disables resizing of the menu panel. |
|
Enables or disables the side bar to the left of the popup menu. |
|
(Overrides CMFCRibbonButton::GetCompactSize.) |
|
(Overrides CMFCRibbonBaseElement::GetDroppedDown.) |
|
Returns the name of the group that is located at the specified index. |
|
|
|
Returns the number of items in a row of the ribbon gallery. |
|
Returns the tooltip text that is associated with an item in the gallery. |
|
Returns the index of the last item in the gallery that the user selected. |
|
Returns the command ID of the current gallery. |
|
(Overrides CMFCRibbonButton::GetRegularSize.) |
|
|
|
(Overrides CMFCRibbonButton::HasMenu.) |
|
Specifies whether the gallery is contained in a gallery button. |
|
Specifies whether menu resizing is enabled or disabled. |
|
|
|
Specifies whether the side bar is enabled or disabled. |
|
(Overrides CMFCRibbonButton::OnAfterChangeRect.) |
|
(Overrides CMFCRibbonButton::OnDraw.) |
|
(Overrides CMFCRibbonBaseElement::OnEnable.) |
|
(Overrides CMFCRibbonBaseElement::OnRTLChanged.) |
|
Redraws the gallery. |
|
Removes the tooltips from all items in the gallery. |
|
|
|
(Overrides CMFCRibbonButton::SetACCData.) |
|
Specifies whether to display the ribbon gallery as a drop-down button or as a palette directly on the ribbon. |
|
Sets the name of a group. |
|
Defines the number of items per row in the gallery. |
|
Sets the tooltip text for an item in the gallery. |
|
Attaches a palette to a ribbon gallery. |
|
Defines the command ID that is sent in the WM_COMMAND message when a gallery item has been selected. |
Protected Methods
Name |
Description |
---|---|
Called by the framework when a gallery icon is drawn. |
Remarks
A gallery button behaves just like a regular menu button except that it displays a gallery when a user opens it. When you select an item in a gallery, the framework sends the WM_COMMAND message together with command ID of the button. When you handle the message, you should call CMFCRibbonGallery::GetLastSelectedItem to determine which item was selected from the gallery.
Example
The following example demonstrates how to use various methods in the CMFCRibbonGallery class to configure a CMFCRibbonGallery object. The example illustrates how to specify the number of items per row in the gallery, enable resizing of the menu panel, enable the side bar to the left of the pop-up menu, and display the ribbon gallery as a palette directly on the ribbon bar. This code snippet is part of the Draw Client sample.
CMFCRibbonGallery* pBtnStyles = new CMFCRibbonGallery(ID_OBJECT_STYLES, _T("Styles\nk"), 0, 0, IDB_STYLES, 40);
pBtnStyles->SetIconsInRow(7);
pBtnStyles->EnableMenuResize(TRUE, TRUE);
pBtnStyles->EnableMenuSideBar();
pBtnStyles->SetButtonMode(false);
pBtnStyles->RedrawIcons();
Inheritance Hierarchy
CObject CMFCRibbonBaseElement CMFCRibbonButton
Requirements
Header: afxRibbonPaletteGallery.h
See Also
Reference
CMFCRibbonGalleryMenuButton Class