CMFCColorPopupMenu Class
Represents a pop-up menu that users use to select colors in a document or application.
Syntax
class CMFCColorPopupMenu : public CMFCPopupMenu
Members
Public Constructors
Name | Description |
---|---|
CMFCColorPopupMenu::CMFCColorPopupMenu | Constructs a CMFCColorPopupMenu object. |
CMFCColorPopupMenu::~CMFCColorPopupMenu |
Destructor. |
Public Methods
Name | Description |
---|---|
CMFCColorPopupMenu::CreateTearOffBar | Creates a dockable tear-off color bar. (Overrides CMFCPopupMenu::CreateTearOffBar.) |
CMFCColorPopupMenu::GetMenuBar | Returns the CMFCPopupMenuBar that is embedded inside the pop-up menu. (Overrides CMFCPopupMenu::GetMenuBar.) |
CMFCColorPopupMenu::GetThisClass |
Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type. |
CMFCColorPopupMenu::SetPropList | Sets the property grid control object of the embedded CMFCColorBar object. |
Data Members
Name | Description |
---|---|
m_bEnabledInCustomizeMode |
A Boolean value that determines whether to show the color bar. |
m_wndColorBar |
The 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.
Inheritance Hierarchy
Requirements
Header: afxcolorpopupmenu.h
CMFCColorPopupMenu::CMFCColorPopupMenu
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
colors
[in] An array of colors that the framework displays on the pop-up menu.
color
[in] The default selected color.
lpszAutoColor
[in] The text label of the automatic (default) color button, or NULL.
The standard label for the automatic button is Automatic.
lpszOtherColor
[in] The text label of the other button, which displays more color choices, or NULL.
The standard label for the other button is More Colors....
lpszDocColors
[in] The text label of the document colors button. The document colors palette lists all the colors that the document currently uses.
lstDocColors
[in] A list of colors that the document currently uses.
nColumns
[in] The number of columns that the array of colors has.
nHorzDockRows
[in] The number of rows that the color bar has when it is docked horizontally.
nVertDockColumns
[in] The number of columns that the color bar has when it is docked vertically.
colorAutomatic
[in] The default color that the framework applies when you click the automatic button.
uiCommandID
[in] The color bar control command ID.
bStdColorDlg
[in] A Boolean that indicates whether to show the standard system color dialog box or the CMFCColorDialog dialog box.
pParentBtn
[in] A pointer to a parent button.
nID
[in] 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);
CMFCColorPopupMenu::CreateTearOffBar
Creates a dockable tear-off color bar.
virtual CPane* CreateTearOffBar(
CFrameWnd* pWndMain,
UINT uiID,
LPCTSTR lpszName);
Parameters
pWndMain
[in] Pointer to the parent window of the tear-off bar.
uiID
[in] The command ID of the tear-off bar.
lpszName
[in] The 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.
CMFCColorPopupMenu::GetMenuBar
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.
CMFCColorPopupMenu::SetPropList
Sets the property grid control object of the embedded CMFCColorBar
object.
void SetPropList(CMFCPropertyGridCtrl* pWndList);
Parameters
pWndList
[in] Pointer to a property grid control object.