CMFCRibbonMiniToolBar Class

Implements a contextual popup toolbar.

Syntax

class CMFCRibbonMiniToolBar : public CMFCRibbonPanelMenu

Members

Public Constructors

Name Description
CMFCRibbonMiniToolBar::CMFCRibbonMiniToolBar Default constructor.
CMFCRibbonMiniToolBar::~CMFCRibbonMiniToolBar Destructor.

Public Methods

Name Description
CMFCRibbonMiniToolBar::CreateObject Used by the framework to create a dynamic instance of this class type.
CMFCRibbonMiniToolBar::GetThisClass Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.
CMFCRibbonMiniToolBar::IsContextMenuMode
CMFCRibbonMiniToolBar::IsRibbonMiniToolBar (Overrides CMFCPopupMenu::IsRibbonMiniToolBar.)
CMFCRibbonMiniToolBar::SetCommands Sets the list of commands to be displayed on the toolbar.
CMFCRibbonMiniToolBar::Show Displays the mini toolbar at the specified screen coordinates.
CMFCRibbonMiniToolBar::ShowWithContextMenu Displays the mini toolbar together with a context menu.

Remarks

The mini toolbar is typically displayed after the user selects an object in a document. For example, after the user selects a block of text in a word processing program, the application displays a mini toolbar that contains text formatting commands.

The mini toolbar becomes transparent when the mouse pointer is out of the bounds of the mini toolbar.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CFrameWnd

CMiniFrameWnd

CMFCPopupMenu

CMFCRibbonPanelMenu

CMFCRibbonMiniToolBar

Requirements

Header: afxRibbonMiniToolBar.h

CMFCRibbonMiniToolBar::SetCommands

Sets the list of commands to be displayed on the toolbar.

void SetCommands(
    CMFCRibbonBar* pRibbonBar,
    const CList<UINT,UINT>& lstCommands);

Parameters

pRibbonBar
[in] The ribbon bar that the mini toolbar searches for the buttons to display.

lstCommands
[in] The list of commands to be displayed on the mini toolbar. All ribbon categories are searched to find the associated buttons.

Remarks

Use this function to set the list of commands to be displayed in the mini toolbar.

Example

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

// CMFCRibbonMiniToolBar* pFloaty
CList<UINT, UINT> lstCmds;

lstCmds.AddTail(ID_FONT_FONT);
lstCmds.AddTail(ID_FONT_FONTSIZE);
lstCmds.AddTail(ID_FONT_GROWFONT);
lstCmds.AddTail(ID_FONT_SHRINK);
lstCmds.AddTail(ID_WRITE_CHANGESTYLES);
lstCmds.AddTail(ID_EDIT_COPYFORMAT);
lstCmds.AddTail(ID_FONT_BOLD);
lstCmds.AddTail(ID_FONT_ITALIC);
lstCmds.AddTail(ID_PARA_CENTER);
lstCmds.AddTail(ID_FONT_TEXTHIGHLIGHT);
lstCmds.AddTail(ID_FONT_COLOR);
lstCmds.AddTail(ID_PARA_DECREASEINDENT);
lstCmds.AddTail(ID_PARA_INCREASEINDENT);
lstCmds.AddTail(ID_PARA_BULLETS);

pFloaty->SetCommands(((CMainFrame*)GetTopLevelFrame())->GetRibbonBar(), lstCmds);

CMFCRibbonMiniToolBar::Show

Displays the mini toolbar at the specified screen coordinates.

BOOL Show(
    int x,
    int y);

Parameters

x
[in] Specifies the horizontal position of the mini toolbar in screen coordinates.

y
[in] Specifies the vertical position of the mini toolbar in screen coordinates.

Return Value

TRUE if the mini toolbar was displayed successfully; otherwise, FALSE.

CMFCRibbonMiniToolBar::ShowWithContextMenu

Displays the mini toolbar together with a context menu.

BOOL ShowWithContextMenu(
    int x,
    int y,
    UINT uiMenuResID,
    CWnd* pWndOwner);

Parameters

x
[in] Specifies the horizontal position of the context menu in screen coordinates.

y
[in] Specifies the vertical position of the context menu in screen coordinates.

uiMenuResID
[in] Specifies the resource ID of the context menu to display.

pWndOwner
[in] Identifies the window which receives messages from the context menu.

Return Value

TRUE if the context menu was displayed successfully; otherwise, FALSE.

Remarks

Use this function to display a mini toolbar that has a context menu. The context menu is positioned 15 pixels below the mini toolbar.

CMFCRibbonMiniToolBar::IsContextMenuMode

For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

BOOL IsContextMenuMode() const;

Return Value

Remarks

CMFCRibbonMiniToolBar::IsRibbonMiniToolBar

For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual BOOL IsRibbonMiniToolBar() const;

Return Value

Remarks

See also

Hierarchy Chart
Classes