CMFCToolBarMenuButton Class
A toolbar button that contains a pop-up menu.
class CMFCToolBarMenuButton : public CMFCToolBarButton
Members
Public Constructors
Name |
Description |
---|---|
Constructs a CMFCToolBarMenuButton object. |
Public Methods
Name |
Description |
---|---|
Compares this instance with the provided CMFCToolBarButton object. (Overrides CMFCToolBarButton::CompareWith.) |
|
Copies the properties of another toolbar button to the current button. (Overrides CMFCToolBarButton::CopyFrom.) |
|
Initializes the toolbar menu from a Windows menu handle. |
|
Creates a Windows menu that consists of the commands in the toolbar menu. Returns a handle to the Windows menu. |
|
Creates a pop-up menu object (CMFCPopupMenu Class) to display the toolbar menu. |
|
|
|
Gives read-only access to the list of commands in the toolbar menu. |
|
Retrieves the bounding rectangle for the button image. |
|
Returns the number of rows in the pop-up menu when the menu is in palette mode. |
|
Returns a pointer to the pop-up menu object that is associated with the button. |
|
|
|
Determines whether a border of the button is displayed when a user selects the button. (Overrides CMFCToolBarButton::HaveHotBorder.) |
|
|
|
|
|
Determines whether the pop-up menu is displayed. |
|
Called by the framework to determine whether a user can open a submenu from the selected menu item. |
|
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. |
|
Determines whether the pop-up menu is in palette mode. |
|
|
|
Determines whether the pop-up menu has a tear-off bar. |
|
|
|
Specifies whether the button can be dragged. (Overrides CMFCToolBarButton::OnBeforeDrag.) |
|
Called by the framework to calculate the size of the button for the specified device context and docking state. (Overrides CMFCToolBarButton::OnCalculateSize.) |
|
Called by the framework to handle the WM_CANCELMODE message. (Overrides CMFCToolBarButton::OnCancelMode.) |
|
Called by the framework when the button is inserted into a new toolbar. (Overrides CMFCToolBarButton::OnChangeParentWnd.) |
|
Called by the framework when the user clicks the mouse button. (Overrides CMFCToolBarButton::OnClick.) |
|
Called by the framework when the user selects an item in the pop-up menu. |
|
Called by the framework when the parent toolbar handles a WM_HELPHITTEST message. (Overrides CMFCToolBarButton::OnContextHelp.) |
|
Called by the framework to draw the button by using the specified styles and options. (Overrides CMFCToolBarButton::OnDraw.) |
|
Called by the framework to draw the button in the Commands pane of the Customize dialog box. (Overrides CMFCToolBarButton::OnDrawOnCustomizeList.) |
|
Called by the framework when the user opens the pop-up menu. |
|
Sets to the default value the image that is associated with the button. (Overrides CMFCToolBarButton::ResetImageToDefault.) |
|
Saves the state of the toolbar button. (Overrides CMFCToolBarButton::SaveBarState.) |
|
Reads this object from an archive or writes it to an archive. (Overrides CMFCToolBarButton::Serialize.) |
|
Populates the provided CAccessibilityData object with accessibility data from the toolbar button. (Overrides CMFCToolBarButton::SetACCData.) |
|
Specifies whether the button can be added to a toolbar. |
|
Specifies whether the pop-up menu is in palette mode. |
|
|
|
Forces the toolbar menu button to display an icon indicating that it is selected. |
|
Specifies a tear-off bar ID for the pop-up menu. |
Protected Methods
Name |
Description |
---|---|
Draws an icon on the menu button. |
Data Members
Name |
Description |
---|---|
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.
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 WordPad Sample: MFC WordPad Application.
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.
pBorderType->SetMenuPaletteMode (TRUE, 2 /* Rows number */);
pBorderType->SetTearOff (ID_BORDER_TEAROFF);
Inheritance Hierarchy
Requirements
Header: afxtoolbarmenubutton.h
See Also
Concepts
Reference
Other Resources
Change History
Date |
History |
Reason |
---|---|---|
September 2009 |
Added information about an error condition. |
Customer feedback. |