CMFCRibbonGalleryMenuButton Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMFCRibbonGalleryMenuButton Class.

Implements a ribbon menu button that contains ribbon galleries.

class CMFCRibbonGalleryMenuButton : public CMFCToolBarMenuButton  

Public Constructors

NameDescription
CMFCRibbonGalleryMenuButton::CMFCRibbonGalleryMenuButtonConstructs and initializes a CMFCRibbonGalleryMenuButton object.

Public Methods

NameDescription
CMFCRibbonGalleryMenuButton::CopyFrom(Overrides CMFCToolBarMenuButton::CopyFrom.)
CMFCRibbonGalleryMenuButton::CreatePopupMenu(Overrides CMFCToolBarMenuButton::CreatePopupMenu.)
CMFCRibbonGalleryMenuButton::GetPalette
CMFCRibbonGalleryMenuButton::HasButton(Overrides CMFCToolBarMenuButton::HasButton.)
CMFCRibbonGalleryMenuButton::IsEmptyMenuAllowed(Overrides CMFCToolBarMenuButton::IsEmptyMenuAllowed.)

Remarks

The gallery menu button is displayed as a pop-up menu with an arrow. When the user clicks this button, a gallery of images is displayed. When you construct a gallery menu button, you must specify an image list that contains those images.

The following example demonstrates how to display a gallery of bullets in a menu button:

BOOL CMainFrame::OnShowPopupMenu (CMFCPopupMenu* pMenuPopup)  
{  
    int nBulletIndex = pMenuBar->CommandToIndex (ID_PARA_BULLETS);

    if (nBulletIndex>= 0)  
 {  
    CMFCToolBarButton* pExButton = 
    pMenuBar->GetButton(nBulletIndex);
ASSERT_VALID (pExButton);

    CMFCRibbonGalleryMenuButton paletteBullet (
    pExButton->m_nID, 
    pExButton->GetImage (),  
    pExButton->m_strText);

 InitBulletPalette (&paletteBullet.GetPalette ());

    pMenuBar->ReplaceButton (ID_PARA_BULLETS,
    paletteBullet);

 }  
}  

CObject CMFCToolBarButton CMFCToolBarMenuButton CMFCRibbonGalleryMenuButton

Header: afxRibbonPaletteGallery.h

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual void CopyFrom(const CMFCToolBarButton& src);

Parameters

[in] src

Remarks

Constructs and initializes a CMFCRibbonGalleryMenuButton object.

CMFCRibbonGalleryMenuButton(
    UINT uiID,  
    int iImage,  
    LPCTSTR lpszText,  
    CMFCToolBarImages& imagesPalette);

 
CMFCRibbonGalleryMenuButton(
    UINT uiID,  
    int iImage,  
    LPCTSTR lpszText,  
    UINT uiImagesPaletteResID = 0,  
    int cxPaletteImage = 0);

Parameters

uiID
The command ID of the button. This is the value sent in the WM_COMMAND message when the user clicks this button.

iImage
The index of the image to display with the gallery menu button. The images are stored in the imagesPalette parameter.

lpszText
The text to display on the menu button.

imagesPalette
Contains the list of images to display on the gallery.

uiImagesPaletteResID
The resource ID of the image list for the images to display on the gallery.

cxPaletteImage
Specifies the width in pixels of the image to display on the gallery.

Remarks

The gallery menu button is displayed as a pop-up menu that has an arrow. When the user clicks this button, a gallery of images is displayed.

Example

The following example demonstrates how to use the constructor of the CMFCRibbonGalleryMenuButton class. This code snippet is part of the MS Office 2007 Demo sample.

		// CMFCToolBarButton pExButton
		CMFCRibbonGalleryMenuButton paletteBullet(pExButton->m_nID, pExButton->GetImage(), pExButton->m_strText);

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual CMFCPopupMenu* CreatePopupMenu();

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

CMFCRibbonGallery& GetPalette();

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual BOOL HasButton() const;  

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual BOOL IsEmptyMenuAllowed() const;  

Return Value

Remarks

Hierarchy Chart
Classes
CMFCToolBarMenuButton Class
CMFCRibbonGallery Class

Show: