BCGControlBar Pro for MFC
CBCGPColorButton

Detailed Description

The CBCGPColorButton class is designed to allow easy integration with CBCGPColorBar object when you want to implement a color picker functionality in a dialog box. By default it behaves as a push button that opens a popup bar with the array of small color buttons and custom color picker. When a new color is selected the CBCGPColorButton automatically reflects the changes and displays the selected color.

The popup bar (CBCGPColorBar) is created during processing of OnLButtonDown message by calling OnShowColorPopup() method that may be overridden by derived class, allowing thus a custom color selection handling.

You can create a button control either from a dialog template as a regular button or directly in your code. In both cases, first call the constructor CBCGPColorButton to construct the CBCGPColorButton object; then call the Create() member function to create the Windows control and attach it to the CBCGPColorButton object. When you're using the ClassWizard to associate this control with a CDialog - derived class member you need to replace the CButton type to the CBCGPColorButton type.

The CBCGColorButton object notifies its parent about color changing by WM_COMMAND | BN_CLICKED notification. The parent may retrieve the current color by calling GetColor() method.

See also
CBCGPButton, CBCGPColorBar, CBCGPColorButton::OnShowColorPopup
+ Inheritance diagram for CBCGPColorButton:

Public Member Functions

 CBCGPColorButtonConstructor.
 
 EnableAutomaticButtonEnables and disables "automatic" button that appears above the regular color buttons.
 
 EnableOtherButtonEnables and disables the "Other" button, which appears below the regular color buttons.
 
 GetAutomaticColorReturns current automatic color.
 
 GetColorReturns the currently selected color.
 
 IsDrawColorInDisabledControlTells whether a color box should be drawn in the disabled control.
 
 OnDrawPaletteColorBoxCalled by the framework when the palette color box should be drawn.
 
 SetColorSets the current button's color.
 
 SetColorsAllows to specify a colors set to be displayed on the color bar as standard colors.
 
 SetColumnsNumberSets the number of columns on the popup color bar.
 
 SetDocumentColorsAllows to specify a list of RGB values to be displayed on the color bar as document colors.
 
 SetDrawColorInDisabledControlSpecifies whether a color box should be drawn in disabled in disabled control.
 
 SetPaletteAllows to specify a color palette to be displayed on the color bar as standard colors.
 
 SetWebColorsAllows to specify a standard Web colors to be displayed on the color bar.
 
 SizeToContentChanges the size of the button's control according to its text and image size.
 
- Public Member Functions inherited from CBCGPButton
 CleanUpFrees the allocated resources
 
 ClearNumericNotificationBadgeClears the numeric notification badge.
 
 EnableFullTextTooltipAllows to show tooltip even if there is enough space for the text on the button
 
 EnableMenuFontEnables or disables using of the menu font when displaying the button's text
 
 GetDescriptionGets a description.
 
 GetNumericNotificationBadgeGets a notification badge numeric value.
 
 GetNumericNotificationBadgeColorGets a notification badge background color.
 
 GetTooltipObtain the button's tooltip.
 
 GetToolTipCtrlGets a reference to the embedded tooltip control
 
 GetTooltipDescriptionObtain the button's description.
 
 IsAutoCheckTells whether a buttons is an auto-check or auto-radio button.
 
 IsAutorepeatCommandModeDetermines whether a button is working in autorepeat mode.
 
 IsCheckBoxTells whether a button is a check-box button.
 
 IsHighlightedDetermines whether the button is highlighted
 
 IsImageAutoScaleTells whether The button's image should be scaled according to current DPI.
 
 IsPressedDetermines whether the button is pressed
 
 IsPushedDetermines whether the button is pushed
 
 IsRadioButtonTells whether a button is a radio button.
 
 SetAutorepeatModePuts a button in the autorepeat mode.
 
 SetCheckedImageSpecifies an image to be displayed on the checked button
 
 SetCheckedImageSpecifies an image to be displayed on the checked button
 
 SetCheckedImageSpecifies an image to be displayed on the checked button
 
 SetDescriptionSpecified a new description.
 
 SetFaceColorSets a new background color
 
 SetImageSpecifies an image to be displayed on the button
 
 SetImageSpecifies an image to be displayed on the button
 
 SetImageSpecifies an image to be displayed on the button
 
 SetImageAutoScaleThe button's image should be scaled according to current DPI.
 
 SetMouseCursorSpecifies a new cursor hand image to be displayed on the button
 
 SetMouseCursorHandSpecifies a new cursor hand image to be displayed on the button
 
 SetNumericNotificationBadgeSets a numeric notification badge.
 
 SetStdIconSet the button's image to be a standard stock icon.
 
 SetStdImageSet the button's image to be a standard image taken from CBCGPMenuImages
 
 SetTextColorSpecifies a new text color for non-selected button's state
 
 SetTextHotColorSpecifies a new text color for selected button state
 
 SetTooltipSpecifies a new tooltip
 

Static Public Member Functions

 SetColorNameSets a color name.
 
- Static Public Member Functions inherited from CBCGPButton
 EnableWinXPThemeAllows to draw button borders using the current Windows theme.
 

Public Attributes

 m_bEnabledInCustomizeModeIndicates whether the color button is enabled in customization mode.
 
- Public Attributes inherited from CBCGPButton
 m_bDrawFocusIf nonzero, a focus rectangle is drawn around the button's text and image when the button receives focus
 
 m_bHighlightCheckedSpecifies whether to highlight buttons with the style BS_CHECKBOX or not when the mouse is hovered over.
 
 m_bOnGlassSpecifies whether a control is located on the "glass" (DWM) area of the parent window.
 
 m_bRighImageIf nonzero, the button's image is shown from the right side
 
 m_bTopImageIf nonzero, the button's image is shown on top
 
 m_bTransparentIf non-zero, the button is transparent.
 
 m_bVisualManagerStyleSpecifies whether a control has a Visual Manager style look.
 
 m_nAlignStyleSpecifies alignment of the button's text label.
 
 m_nFlatStyleSpecifies the button's flat style.
 

Protected Member Functions

 OnDrawCalled by the framework to render an image of the button.
 
 OnDrawBorderCalled by the framework to display a border of the button.
 
 OnDrawFocusRectCalled by the framework to display a focus rectangle when the button has a focus.
 
 OnShowColorPopupCalled by the framework when the popup color bar is about to be displayed.
 
 UpdateColorCalled by the framework when the users selects a color from the color bar's palette.
 
- Protected Member Functions inherited from CBCGPButton
 OnDrawImageCalled when a button's image should be redrawn.
 
 OnDrawNotificationBadgeCalled when a button's notification badge should be redrawn.
 
 OnDrawTextCalled when a button's text should be redrawn
 
 SelectFontCalled when a new font is about to be selected
 

Additional Inherited Members

- Public Types inherited from CBCGPButton
enum  AlignStyle
 
enum  FlatStyle
 
- Static Public Attributes inherited from CBCGPButton
 m_bDontSetCaptureIf this global flag is TRUE, SetCapture/ReleaseCapture methods are never called for all CBCGPButton controls.
 
 m_bUseTitleFontInCommandLinksIf this global flag is TRUE, the title of the command link will be drawn using a title (smaller than caption) font that makes control appearance closer to the standard Windows command link.