CMFCPopupMenuBar 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 CMFCPopupMenuBar Class.

A menu bar embedded into a pop-up menu.

class CMFCPopupMenuBar : public CMFCToolBar  

Public Methods

NameDescription
CMFCPopupMenuBar::AdjustSizeImmediateImmediately recalculates the layout of a pane. (Overrides CPane::AdjustSizeImmediate.)
CMFCPopupMenuBar::BuildOrigItemsLoads popup menu items from a specified menu resource.
CMFCPopupMenuBar::CloseDelayedSubMenuCloses a delayed popup menu button.
CMFCPopupMenuBar::ExportToMenuBuilds a menu from the popup-menu buttons.
CMFCPopupMenuBar::FindDestintationToolBarLocates the toolbar where a specified point lies.
CMFCPopupMenuBar::GetCurrentMenuImageSizeIndicates the size of menu-button images.
CMFCPopupMenuBar::GetDefaultMenuIdReturns the identifier of the default menu item.
CMFCPopupMenuBar::GetLastCommandIndexGets the index of the most recently invoked menu command.
CMFCPopupMenuBar::GetOffsetGets the row offset of the popup menu bar.
CMFCPopupMenuBar::ImportFromMenuImports popup menu buttons from a specified menu.
CMFCPopupMenuBar::IsDropDownListModeIndicates whether the popup menu bar is in drop-down-list mode.
CMFCPopupMenuBar::IsPaletteModeIndicates whether the popup menu bar is in palette mode.
CMFCPopupMenuBar::IsRibbonPanelIndicates whether this is a ribbon panel ( FALSE by default).
CMFCPopupMenuBar::IsRibbonPanelInRegularModeIndicates whether this is a ribbon panel in regular mode ( FALSE by default).
CMFCPopupMenuBar::LoadFromHashLoads an archived menu.
CMFCPopupMenuBar::RestoreDelayedSubMenuRestores a delayed menu button for closing the popup menu bar.
CMFCPopupMenuBar::SetButtonStyleSets the style of the toolbar button at the given index. (Overrides CMFCToolBar::SetButtonStyle.)
CMFCPopupMenuBar::SetOffsetSets the row offset of the popup menu bar.
CMFCPopupMenuBar::StartPopupMenuTimerStarts the timer for a specified delayed popup menu button.

Data Members

NameDescription
CMFCPopupMenuBar::m_bDisableSideBarInXPModeSpecifies whether the gray sidebar will be displayed when the application has a Windows XP appearance.

The CMFCPopupMenuBar is created at the same time as a CMFCPopupMenu Class and embedded inside it. The CMFCPopupMenuBar covers the entire client area of the CMFCPopupMenu object. It supports keyboard and mouse input. It also communicates that input to the CMFCPopupMenu and to the top-level frame window.

The following example demonstrates how to initialize a CMFCPopupMenuBar object from a CMFCPopupMenu object. This code snippet is part of the Draw Client sample.

	// CMFCPopupMenu* pMenuPopup
	CMFCPopupMenuBar* pMenuBar = pMenuPopup->GetMenuBar();

CObject

CCmdTarget

CWnd

CBasePane

CPane

CMFCBaseToolBar

CMFCToolBar

CMFCPopupMenuBar

Header: afxpopupmenubar.h

Immediately recalculates the layout of the popup menu bar pane. (Overrides CPane::AdjustSizeImmediate.

virtual void AdjustSizeImmediate(BOOL bRecalcLayout);

Parameters

[in] bRecalcLayout
TRUE to automatically recalculate the layout of the popup menu bar pane; otherwise, FALSE.

Remarks

Loads popup menu items from a specified menu resource.

BOOL BuildOrigItems(UINT uiMenuResID);

Parameters

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

Return Value

Returns TRUE if successful or FALSE if not.

Remarks

Closes a popup menu button that has been delayed.

virtual void CloseDelayedSubMenu();

Remarks

Builds a menu from the popup menu buttons.

virtual HMENU ExportToMenu() const;  

Return Value

Returns a handle to the new menu.

Remarks

Locates the toolbar where a specified point lies.

CMFCToolBar* FindDestintationToolBar(CPoint point);

Parameters

[in] point
A point on the screen.

Return Value

Returns a handle to the toolbar where the point lies, if therei is one, or NULL if not.

Remarks

Indicates the size of menu-button images.

virtual CSize GetCurrentMenuImageSize() const;  

Return Value

Returns the size of menu-button images in the toolbar.

Remarks

Returns the identifier of the default menu item.

UINT GetDefaultMenuId() const;  

Return Value

Returns the identifier of the default menu item in the popup menu bar.

Remarks

Gets the index of the most recently invoked menu command.

static int __stdcall GetLastCommandIndex();

Return Value

Returns the index of the last menu command that has been invoked.

Remarks

Gets the row offset of the popup menu bar.

int GetOffset() const;  

Return Value

Returns the row offset of the popup menu bar.

Remarks

This value is set using CMFCPopupMenuBar::SetOffset.

Imports popup menu buttons from a specified menu.

virtual BOOL ImportFromMenu(
    HMENU hMenu,  
    BOOL bShowAllCommands = FALSE);

Parameters

[in] hMenu
The menu from which to import the popup menu buttons.

[in] bShowAllCommands
TRUE if all commands on the menu are to be imported, or FALSE if rarely used ones may be hidden.

Return Value

Returns TRUE if the menu buttons were successfully imported from the menu, or FALSE if not.

Remarks

Indicates whether the popup menu bar is in drop-down-list mode.

BOOL IsDropDownListMode() const;  

Return Value

Returns TRUE if the popup menu bar is in drop-down-list mode, or FALSE if not.

Remarks

Indicates whether the popup menu bar is in palette mode.

BOOL IsPaletteMode() const;  

Return Value

Returns TRUE if palette mode is enabled, or FALSE if not.

Remarks

When the menu bar is set to palette mode, menu items appear in multiple columns and a limited number of rows.

Indicates whether this is a ribbon panel ( FALSE by default).

virtual BOOL IsRibbonPanel() const;  

Return Value

Returns FALSE by default, indicating that this is not a ribbon panel.

Remarks

Indicates whether this is a ribbon panel in regular mode ( FALSE by default).

virtual BOOL IsRibbonPanelInRegularMode() const;  

Return Value

Returns FALSE by default, indicating that this is not a ribbon panel in regular mode.

Remarks

Loads an archived menu.

BOOL LoadFromHash(HMENU hMenu);

Parameters

[in] hMenu
A handle to the archived menu to load.

Return Value

Returns TRUE if the menu is loaded successfully, or FALSE if not.

Remarks

A Boolean parameter that indicates whether your application has a gray sidebar when it has a Windows XP appearance.

BOOL m_bDisableSideBarInXPMode;  

Remarks

If this member variable is set to FALSE and your application has a Windows XP appearance, the framework draws a gray sidebar in your application.

The default value is FALSE.

Restores a delayed menu button for closing the popup menu bar.

virtual void RestoreDelayedSubMenu();

Remarks

Sets the style of the toolbar button at the given index. (Overrides CMFCToolBar::SetButtonStyle.)

virtual void SetButtonStyle(
    int nIndex,  
    UINT nStyle);

Parameters

[in] nIndex
The zero-based index of the toolbar button whose style is to be set.

[in] nStyle
The style of the button. See ToolBar Control Styles for the list of available toolbar button styles.

Remarks

Sets the row offset of the popup menu bar.

void SetOffset(int iOffset);

Parameters

[in] iOffset
The number of rows that the popup menu bar should be offset.

Remarks

Starts the timer for a specified delayed popup menu button.

void StartPopupMenuTimer(
    CMFCToolBarMenuButton* pMenuButton,  
    int nDelayFactor = 1);

Parameters

[in] pMenuButton
Pointer to the menu button for which to set the delay timer.

[in] nDelayFactor
A delay factor, equal to at least one, to multiply by the standard menu delay time (generally between a half second and five seconds).

Remarks

Hierarchy Chart
Classes
CMFCColorBar Class
CMFCPopupMenu Class

Show: