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

Represents a pop-up menu that users use to select colors in a document or application.

class CMFCColorPopupMenu : public CMFCPopupMenu  

Public Constructors

NameDescription
CMFCColorPopupMenu::CMFCColorPopupMenuConstructs a CMFCColorPopupMenu object.
CMFCColorPopupMenu::~CMFCColorPopupMenuDestructor.

Public Methods

NameDescription
CMFCColorPopupMenu::CreateTearOffBarCreates a dockable tear-off color bar. (Overrides CMFCPopupMenu::CreateTearOffBar.)
CMFCColorPopupMenu::GetMenuBarReturns the CMFCPopupMenuBar that is embedded inside the pop-up menu. (Overrides CMFCPopupMenu::GetMenuBar.)
CMFCColorPopupMenu::GetThisClassUsed by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.
CMFCColorPopupMenu::SetPropListSets the property grid control object of the embedded CMFCColorBar object.

Data Members

NameDescription
m_bEnabledInCustomizeModeA Boolean value that determines whether to show the color bar.
m_wndColorBarThe CMFCColorBar object that provides color selection.

Remarks

This class inherits the pop-up menu functionality of the CMFCPopupMenu class and manages a CMFCColorBar object that provides color selection. When the toolbar framework is in customization mode and the m_bEnabledInCustomizeMode member is set to FALSE, the color bar object is not shown. For more information about customization mode, see CMFCToolBar::IsCustomizeMode

For more information about CMFCColorBar, see CMFCColorBar Class.

CObject

CCmdTarget

CWnd

CFrameWnd

CMiniFrameWnd

CMFCPopupMenu

CMFCColorPopupMenu

Header: afxcolorpopupmenu.h

Constructs a CMFCColorPopupMenu object.

CMFCColorPopupMenu(
    const CArray<COLORREF, COLORREF>& colors,  
    COLORREF color,  
    LPCTSTR lpszAutoColor,  
    LPCTSTR lpszOtherColor,  
    LPCTSTR lpszDocColors, CList<COLORREF, COLORREF>& lstDocColors,  
    int nColumns,  
    int nHorzDockRows,  
    int nVertDockColumns,  
    COLORREF colorAutomatic,  
    UINT uiCommandID,  
    BOOL bStdColorDlg = FALSE);

 
CMFCColorPopupMenu(
    CMFCColorButton* pParentBtn,  
    const CArray<COLORREF, COLORREF>& colors,  
    COLORREF color,  
    LPCTSTR lpszAutoColor,  
    LPCTSTR lpszOtherColor,  
    LPCTSTR lpszDocColors, CList<COLORREF, COLORREF>& lstDocColors,  
    int nColumns,  
    COLORREF colorAutomatic);

 
CMFCColorPopupMenu(
    CMFCRibbonColorButton* pParentBtn,  
    const CArray<COLORREF, COLORREF>& colors,  
    COLORREF color,  
    LPCTSTR lpszAutoColor,  
    LPCTSTR lpszOtherColor,  
    LPCTSTR lpszDocColors, CList<COLORREF, COLORREF>& lstDocColors,  
    int nColumns,  
    COLORREF colorAutomatic,  
    UINT nID);

Parameters

[in] colors
An array of colors that the framework displays on the pop-up menu.

[in] color
The default selected color.

[in] lpszAutoColor
The text label of the automatic (default) color button, or NULL.

The standard label for the automatic button is Automatic.

[in] lpszOtherColor
The text label of the other button, which displays more color choices, or NULL.

The standard label for the other button is More Colors....

[in] lpszDocColors
The text label of the document colors button. The document colors palette lists all the colors that the document currently uses.

[in] lstDocColors
A list of colors that the document currently uses.

[in] nColumns
The number of columns that the array of colors has.

[in] nHorzDockRows
The number of rows that the color bar has when it is docked horizontally.

[in] nVertDockColumns
The number of columns that the color bar has when it is docked vertically.

[in] colorAutomatic
The default color that the framework applies when you click the automatic button.

[in] uiCommandID
The color bar control command ID.

[in] bStdColorDlg
A Boolean that indicates whether to show the standard system color dialog box or the CMFCColorDialog dialog box.

[in] pParentBtn
A pointer to a parent button.

[in] nID
The command ID.

Remarks

Each overloaded constructor sets the m_bEnabledInCustomizeMode member to FALSE.

Example

The following example demonstrates how to construct a CMFCColorPopupMenu object.

	COLORREF color;
	CArray<COLORREF, COLORREF> colors;
	CString strAutoColorText;
	CString strOtherText;
	CString strDocColorsText;
	CList<COLORREF,COLORREF> lstDocColors;
	COLORREF colorAutomatic;
	int nColumns;
	CMFCColorButton colorButton;
	CMFCColorPopupMenu* pPopup = new CMFCColorPopupMenu(&colorButton, colors, color, strAutoColorText, strOtherText, strDocColorsText, lstDocColors, nColumns, colorAutomatic);

Creates a dockable tear-off color bar.

virtual CPane* CreateTearOffBar(
    CFrameWnd* pWndMain,  
    UINT uiID,  
    LPCTSTR lpszName);

Parameters

ParameterDescription
[in] pWndMainPointer to the parent window of the tear-off bar.
[in] uiIDThe command ID of the tear-off bar.
[in] lpszNameThe window text of the tear-off bar.

Return Value

A pointer to the new tear-off control bar object.

Remarks

This method creates a CMFCColorBar Class object and casts it to a CPane Class pointer. You can cast this value back to a CMFCColorBar Class pointer by using one of the casting macros described in Type Casting of MFC Class Objects.

Returns the CMFCPopupMenuBar that is embedded inside the pop-up menu.

virtual CMFCPopupMenuBar* GetMenuBar();

Return Value

A pointer to the embedded CMFCPopupMenuBar.

Remarks

The color pop-up menu has an embedded CMFCPopupMenuBar Class object. Override this method in a derived class if your application uses a different embedded type.

Sets the property grid control object of the embedded CMFCColorBar object.

void SetPropList(CMFCPropertyGridCtrl* pWndList);

Parameters

[in] pWndList
Pointer to a property grid control object.

Hierarchy Chart
Classes

Show: