CMFCToolBarMenuButton Class

A toolbar button that contains a pop-up menu.

class CMFCToolBarMenuButton : public CMFCToolBarButton

Members

Public Constructors

Name

Description

CMFCToolBarMenuButton::CMFCToolBarMenuButton

Constructs a CMFCToolBarMenuButton object.

Public Methods

Name

Description

CMFCToolBarMenuButton::CompareWith

Compares this instance with the provided CMFCToolBarButton object. (Overrides CMFCToolBarButton::CompareWith.)

CMFCToolBarMenuButton::CopyFrom

Copies the properties of another toolbar button to the current button. (Overrides CMFCToolBarButton::CopyFrom.)

CMFCToolBarMenuButton::CreateFromMenu

Initializes the toolbar menu from a Windows menu handle.

CMFCToolBarMenuButton::CreateMenu

Creates a Windows menu that consists of the commands in the toolbar menu. Returns a handle to the Windows menu.

CMFCToolBarMenuButton::CreatePopupMenu

Creates a pop-up menu object (CMFCPopupMenu Class) to display the toolbar menu.

CMFCToolBarMenuButton::EnableQuickCustomize

 

CMFCToolBarMenuButton::GetCommands

Gives read-only access to the list of commands in the toolbar menu.

CMFCToolBarMenuButton::GetImageRect

Retrieves the bounding rectangle for the button image.

CMFCToolBarMenuButton::GetPaletteRows

Returns the number of rows in the pop-up menu when the menu is in palette mode.

CMFCToolBarMenuButton::GetPopupMenu

Returns a pointer to the pop-up menu object that is associated with the button.

CMFCToolBarMenuButton::HasButton

 

CMFCToolBarMenuButton::HaveHotBorder

Determines whether a border of the button is displayed when a user selects the button. (Overrides CMFCToolBarButton::HaveHotBorder.)

CMFCToolBarMenuButton::IsBorder

 

CMFCToolBarMenuButton::IsClickedOnMenu

 

CMFCToolBarMenuButton::IsDroppedDown

Determines whether the pop-up menu is displayed.

CMFCToolBarMenuButton::IsEmptyMenuAllowed

Called by the framework to determine whether a user can open a submenu from the selected menu item.

CMFCToolBarMenuButton::IsExclusive

Determines whether the button is in exclusive mode, that is, whether the pop-up menu remains open even when the user moves the pointer over another toolbar or button.

CMFCToolBarMenuButton::IsMenuPaletteMode

Determines whether the pop-up menu is in palette mode.

CMFCToolBarMenuButton::IsQuickMode

 

CMFCToolBarMenuButton::IsTearOffMenu

Determines whether the pop-up menu has a tear-off bar.

CMFCToolBarMenuButton::OnAfterCreatePopupMenu

 

CMFCToolBarMenuButton::OnBeforeDrag

Specifies whether the button can be dragged. (Overrides CMFCToolBarButton::OnBeforeDrag.)

CMFCToolBarMenuButton::OnCalculateSize

Called by the framework to calculate the size of the button for the specified device context and docking state. (Overrides CMFCToolBarButton::OnCalculateSize.)

CMFCToolBarMenuButton::OnCancelMode

Called by the framework to handle the WM_CANCELMODE message. (Overrides CMFCToolBarButton::OnCancelMode.)

CMFCToolBarMenuButton::OnChangeParentWnd

Called by the framework when the button is inserted into a new toolbar. (Overrides CMFCToolBarButton::OnChangeParentWnd.)

CMFCToolBarMenuButton::OnClick

Called by the framework when the user clicks the mouse button. (Overrides CMFCToolBarButton::OnClick.)

CMFCToolBarMenuButton::OnClickMenuItem

Called by the framework when the user selects an item in the pop-up menu.

CMFCToolBarMenuButton::OnContextHelp

Called by the framework when the parent toolbar handles a WM_HELPHITTEST message. (Overrides CMFCToolBarButton::OnContextHelp.)

CMFCToolBarMenuButton::OnDraw

Called by the framework to draw the button by using the specified styles and options. (Overrides CMFCToolBarButton::OnDraw.)

CMFCToolBarMenuButton::OnDrawOnCustomizeList

Called by the framework to draw the button in the Commands pane of the Customize dialog box. (Overrides CMFCToolBarButton::OnDrawOnCustomizeList.)

CMFCToolBarMenuButton::OpenPopupMenu

Called by the framework when the user opens the pop-up menu.

CMFCToolBarMenuButton::ResetImageToDefault

Sets to the default value the image that is associated with the button. (Overrides CMFCToolBarButton::ResetImageToDefault.)

CMFCToolBarMenuButton::SaveBarState

Saves the state of the toolbar button. (Overrides CMFCToolBarButton::SaveBarState.)

CMFCToolBarMenuButton::Serialize

Reads this object from an archive or writes it to an archive. (Overrides CMFCToolBarButton::Serialize.)

CMFCToolBarMenuButton::SetACCData

Populates the provided CAccessibilityData object with accessibility data from the toolbar button. (Overrides CMFCToolBarButton::SetACCData.)

CMFCToolBarMenuButton::SetMenuOnly

Specifies whether the button can be added to a toolbar.

CMFCToolBarMenuButton::SetMenuPaletteMode

Specifies whether the pop-up menu is in palette mode.

CMFCToolBarMenuButton::SetMessageWnd

 

CMFCToolBarMenuButton::SetRadio

Forces the toolbar menu button to display an icon indicating that it is selected.

CMFCToolBarMenuButton::SetTearOff

Specifies a tear-off bar ID for the pop-up menu.

Protected Methods

Name

Description

CMFCToolBarMenuButton::DrawDocumentIcon

Draws an icon on the menu button.

Data Members

Name

Description

CMFCToolBarMenuButton::m_bAlwaysCallOwnerDraw

If TRUE, the framework always calls CFrameWndEx::OnDrawMenuImage when a button is drawn.

Remarks

A CMFCToolBarMenuButton can appear as a menu, a menu item that has a sub-menu, a button that either executes a command or displays a menu, or a button that displays only a menu. You determine the behavior and appearance of the menu button by specifying parameters such as the image, text, menu handle, and command ID that is associated with the button in the constructor CMFCToolbarMenuButton::CMFCToolbarMenuButton.

A custom class derived from the CMFCToolbarMenuButton class must use the DECLARE_SERIAL macro. The DECLARE_DYNCREATE macro generates an error when the application closes.

Example

The following example demonstrates how to configure a CMFCToolBarMenuButton object. The code illustrates how to specify that the drop-down menu is in palette mode, and specify the ID for the tear-off bar that is created when the user drags the menu button off of a menu bar. This code snippet is part of the Word Pad sample.

    pBorderType->SetMenuPaletteMode (TRUE, 2 /* Rows number */);
    pBorderType->SetTearOff (ID_BORDER_TEAROFF);

Inheritance Hierarchy

CObject

   CMFCToolBarButton

      CMFCToolBarMenuButton

Requirements

Header: afxtoolbarmenubutton.h

See Also

Reference

Hierarchy Chart

CMFCToolBarButton Class

CMFCToolBar Class

CMFCPopupMenu Class

Other Resources

MFC Classes