Compartilhar via


CMFCRibbonGallery Class

Implements Office 2007-style ribbon galleries.

class CMFCRibbonGallery : public CMFCRibbonButton

Members

Public Constructors

Name

Description

CMFCRibbonGallery::CMFCRibbonGallery

Constructs and initializes a CMFCRibbonGallery object.

Public Methods

Name

Description

CMFCRibbonGallery::AddGroup

Adds a new group to the gallery.

CMFCRibbonGallery::AddSubItem

Adds a new menu item to the drop-down menu.

CMFCRibbonGallery::Clear

Clears the content of the gallery.

CMFCRibbonGallery::EnableMenuResize

Enables or disables resizing of the menu panel.

CMFCRibbonGallery::EnableMenuSideBar

Enables or disables the side bar to the left of the popup menu.

CMFCRibbonGallery::GetCompactSize

  (Overrides CMFCRibbonButton::GetCompactSize.)

CMFCRibbonGallery::GetDroppedDown

  (Overrides CMFCRibbonBaseElement::GetDroppedDown.)

CMFCRibbonGallery::GetGroupName

Returns the name of the group that is located at the specified index.

CMFCRibbonGallery::GetGroupOffset

 

CMFCRibbonGallery::GetIconsInRow

Returns the number of items in a row of the ribbon gallery.

CMFCRibbonGallery::GetItemToolTip

Returns the tooltip text that is associated with an item in the gallery.

CMFCRibbonGallery::GetLastSelectedItem

Returns the index of the last item in the gallery that the user selected.

CMFCRibbonGallery::GetPaletteID

Returns the command ID of the current gallery.

CMFCRibbonGallery::GetRegularSize

  (Overrides CMFCRibbonButton::GetRegularSize.)

CMFCRibbonGallery::GetSelectedItem

 

CMFCRibbonGallery::HasMenu

  (Overrides CMFCRibbonButton::HasMenu.)

CMFCRibbonGallery::IsButtonMode

Specifies whether the gallery is contained in a gallery button.

CMFCRibbonGallery::IsMenuResizeEnabled

Specifies whether menu resizing is enabled or disabled.

CMFCRibbonGallery::IsMenuResizeVertical

 

CMFCRibbonGallery::IsMenuSideBar

Specifies whether the side bar is enabled or disabled.

CMFCRibbonGallery::OnAfterChangeRect

  (Overrides CMFCRibbonButton::OnAfterChangeRect.)

CMFCRibbonGallery::OnDraw

  (Overrides CMFCRibbonButton::OnDraw.)

CMFCRibbonGallery::OnEnable

  (Overrides CMFCRibbonBaseElement::OnEnable.)

CMFCRibbonGallery::OnRTLChanged

  (Overrides CMFCRibbonBaseElement::OnRTLChanged.)

CMFCRibbonGallery::RedrawIcons

Redraws the gallery.

CMFCRibbonGallery::RemoveItemToolTips

Removes the tooltips from all items in the gallery.

CMFCRibbonGallery::SelectItem

 

CMFCRibbonGallery::SetACCData

  (Overrides CMFCRibbonButton::SetACCData.)

CMFCRibbonGallery::SetButtonMode

Specifies whether to display the ribbon gallery as a drop-down button or as a palette directly on the ribbon.

CMFCRibbonGallery::SetGroupName

Sets the name of a group.

CMFCRibbonGallery::SetIconsInRow

Defines the number of items per row in the gallery.

CMFCRibbonGallery::SetItemToolTip

Sets the tooltip text for an item in the gallery.

CMFCRibbonGallery::SetPalette

Attaches a palette to a ribbon gallery.

CMFCRibbonGallery::SetPaletteID

Defines the command ID that is sent in the WM_COMMAND message when a gallery item has been selected.

Protected Methods

Name

Description

CMFCRibbonGallery::OnDrawPaletteIcon

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

         CMFCRibbonGallery

Requirements

Header: afxRibbonPaletteGallery.h

See Also

Reference

Hierarchy Chart

CMFCRibbonButton Class

CMFCRibbonGalleryMenuButton Class

Other Resources

MFC Classes