BCGControlBar Pro for MFC
CBCGPButton

Detailed Description

The CBCGPButton class provides the extended functionality of the standard Windows button controls. It includes the new look & feel styles, the various ways to align text, ability to combine an image and text, set cursor and tool tip.

In addition, the CBCGPURLLinkButton derived from the CBCGPButton supports creation of Internet-style links, as well as CBCGPColorButton specially aimed to create Office-style color-filled button controls and color pickers.

The new look & feel styles are 3D, flat, semi-flat and no border styles. The text may be aligned at the left, top and center positions and when combined with image you can control at the run-time its appearance as text and image, text only and image only. You can assign a specific mouse cursor to be displayed when it is moved over the button.

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 CBCGPButton to construct the CBCGPButton object; then call the Create() member function to create the Windows control and attach it to the CBCGPButton 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 CBCGPButton type.

If you want to handle Windows notification messages, such as BN_CLICKED, sent by a button control to its parent (usually a class derived from CDialog), add to the CDialog - derived object a message-map entry and message-handler member function for each message. The notifications sent by a CBCGPButton object are the same as those sent by a CButton object.

See also
CBCGPURLLinkButton, CBCGPColorButton, CBCGPMenuButton
+ Inheritance diagram for CBCGPButton:

Public Types

enum  AlignStyle
 
enum  FlatStyle
 

Public Member Functions

 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.
 
 IsAutoInverseIconsInDarkThemeTells whether the button's icon should be automatically inversed in the dark themes.
 
 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.
 
 SetAutoInverseIconsInDarkThemeSpecifies whether the button's icon should be automatically inversed in the dark themes.
 
 SetAutorepeatModePuts a button in the autorepeat mode.
 
 SetCheckedImageSpecifies an SVG icon 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
 
 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
 
 SetImageSpecifies an SVG icon 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
 
 SizeToContentChanges the size of the button's control according to its text and image size.
 

Static Public Member Functions

 EnableWinXPThemeAllows to draw button borders using the current Windows theme.
 

Public Attributes

 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.
 

Static Public Attributes

 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.
 

Protected Member Functions

 OnDrawCalled by the framework when the button should be redrawn
 
 OnDrawBorderCalled by the framework when the button's border should be redrawn
 
 OnDrawFocusRectCalled when a button has focus to redraw the focus rectangle
 
 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
 
 OnFillBackgroundCalled by the framework when the button's background should be filled
 
 SelectFontCalled when a new font is about to be selected