CMFCPopupMenu Class
Implements Windows pop-up menu functionality and extends it by adding features such as tear-off menus and tooltips.
class CMFCPopupMenu : public CMiniFrameWnd
Members
Protected Constructors
Name |
Description |
---|---|
Constructs a CMFCPopupMenu object. |
Public Methods
Name |
Description |
---|---|
|
|
Sets whether a pop-up menu is enabled to show empty entries for user-defined tools. |
|
|
|
Determines the location of a point relative to the pop-up menu. |
|
|
|
Creates a pop-up menu and attaches it to the CMFCPopupMenu object. |
|
|
|
Initializes the logo for a pop-up menu. |
|
Enables menu sound. |
|
|
|
|
|
|
|
|
|
Returns the currently active menu. |
|
Returns the animation speed for pop-up menus. |
|
Returns the current type of pop-up menu animation. |
|
|
|
Indicates whether the focus is returned to the menu bar when a pop-up menu is displayed. |
|
|
|
Returns a handle to the attached menu resource. |
|
Returns the CMFCPopupMenuBar embedded inside the pop-up menu. |
|
Returns a pointer to the menu item at the specified index. |
|
Returns the number of items in a popup menu. |
|
Returns a pointer to the window where the framework routes the pop-up menu messages. |
|
|
|
Returns a pointer to the parent toolbar button. |
|
Returns a pointer to the parent pop-up menu. |
|
|
|
Returns a pointer to the parent toolbar. |
|
|
|
Returns a pointer to the currently selected menu command. |
|
|
|
Indicates whether the pop-up menu can hide rarely used commands. |
|
|
|
Inserts a new item into the pop-up menu at the specified location. |
|
Inserts a separator into the pop-up menu at the specified location. |
|
|
|
|
|
Indicates whether the pop-up menu is functioning as a QuickCustomizePane. |
|
|
|
Indicates whether a pop-up menu is currently idle. |
|
|
|
Determines whether the associated CMFCToolBarMenuButton Class is in QuickCustomize mode. |
|
|
|
Indicates whether the menu is right-aligned or left-aligned. |
|
|
|
Indicates whether the framework notifies the parent frame when the user selects a command from the pop-up menu. |
|
Indicates whether the pop-up menu is currently visible. |
|
|
|
(Overrides CFrameWnd::OnCmdMsg.) |
|
|
|
(Overrides CFrameWnd::PreTranslateMessage.) |
|
Called by the framework when the standard control bars are toggled on or off or when the frame window is resized. (Overrides CFrameWnd::RecalcLayout.) |
|
Clears all the items from a pop-up menu. |
|
Removes the specified item from a pop-up menu. |
|
|
|
Sets the animation speed for pop-up menus. |
|
Sets the animation type for the pop-up menu. |
|
|
|
Sets the default command for the pop-up menu. |
|
Forces the input focus to return to the menu bar when a pop-up menu is displayed. |
|
Forces the framework to draw menu shadows when pop-up menus appear outside the main frame. |
|
Set the maximum width for the pop-up menu. |
|
|
|
|
|
|
|
|
|
Sets the menu alignment for pop-up menus. |
|
Sets a flag that controls whether the pop-up menu notifies its parent frame when the user selects a command. |
|
Forces the pop-up menu to display all commands. |
|
|
|
Updates the shadows for all opened pop-up menus. |
|
Updates the shadow for the pop-up menu. |
Protected Methods
Name |
Description |
---|---|
|
|
|
|
|
Remarks
Normally, MFC creates pop-up menus automatically. If you want to create a CMFCPopupMenu object manually, allocate one on the heap and then call CMFCPopupMenu::Create.
Example
The following example demonstrates how to configure a pop-up menu object. The example shows how to set the logo and the sound of the pop-up menu, set the animation speed and type, draw menu shadows when the pop-up menu appears outside the main frame, set the maximum width, and set the right menu alignment of the pop-up menu. This code snippet is part of the Custom Pages sample.
// 30 is the size of the logo in pixels.
pPopupMenu->EnableMenuLogo(30);
pPopupMenu->EnableMenuSound();
// 500 is the animation speed in milliseconds.
pPopupMenu->SetAnimationSpeed(500);
pPopupMenu->SetAnimationType(CMFCPopupMenu::SLIDE);
pPopupMenu->SetForceShadow(true);
// 200 is the maximum width of the pop-up menu in pixels.
pPopupMenu->SetMaxWidth(200);
pPopupMenu->SetRightAlign();
pPopupMenu->InsertSeparator();
Inheritance Hierarchy
Requirements
Header: afxpopupmenu.h