BCGControlBar Pro for MFC
CBCGPToolbarButton

Detailed Description

CBCGPToolbarButton objects are non-Windows controls that reside on toolbars. Their behavior is similar to the regular buttons and they can be assigned an image and a text label. In addition, a toolbar button can have a command ID. This command is executed when the user clicks the button.

The CBCGPToolbarButton class can serve as a base class for more complicated toolbar button objects, like "menu button", "edit box button" or "combo box button".

Usually, toolbar buttons can be customized, the user is able to drag them from one toolbar to another, copy, paste, delete, edit text labels and images. If you want to make a toolbar button non-editable, you can lock the button or "protect" the button's command ID (SetProtectedCommands()).

The CBCGPToolbarButton objects display images from collections of toolbar images (CBCGPToolBarImages). These collections are maintained by a parent toolbar object (CBCGPToolBar). The parent toolbar manages an internal collection of toolbar buttons and notifies them about the user input.

When the user clicks a toolbar button:

  • its parent toolbar processes the message
  • changes the button's state
  • asks the button to redraw itself according to the new state
  • gives the button a chance to process this click
  • notifies the parent frame window about a command to be executed, if the button has a valid command ID
See also
CBCGPToolBar, CBCGPToolBarImages, OnClick, NotifyCommand
+ Inheritance diagram for CBCGPToolbarButton:

Public Member Functions

 CBCGPToolbarButtonConstructs and initializes a CBCGPToolbarButton object.
 
 CanBeDroppedIndicates whether a button can be dropped on a toolbar.
 
 CanBeStretchedIndicates whether a button can be stretched in customization mode.
 
 CopyFromCopies another toolbar button to the button.
 
 ExportToMenuButtonCalled by the framework to copy the toolbar button into a menu button.
 
 GetHwndReturns a handle to a window associated with a toolbar button.
 
 GetImageReturns a toolbar button's image.
 
 GetTextSizeReturns the size (in pixels) of the button text.
 
 HaveHotBorderDetermines whether a button displays the border in selected state or not.
 
 IsDrawImageTells whether a button's image is displayed.
 
 IsDrawTextTells whether a button's text label is displayed.
 
 IsEditableTells whether a button is customizable or not.
 
 IsExtraSizeDetermines whether the border's extra size should be taken into account.
 
 IsHiddenTells whether a button is hidden or not.
 
 IsLockedReturns a flag indicating whether a button belongs to the locked (non-customizable) toolbar and can't be customized (dragged, dropped or edited).
 
 IsOnGlassChecks if button is located on DWM ("Glass") area of the parent toolbar.
 
 IsVisibleDetermines whether a toolbar button is visible or not.
 
 NotifyCommandCalled by the framework when the WM_COMMAND message is about to be send to a parent window.
 
 OnBeforeDragCalled by the framework before user begins to drag the button.
 
 OnBeforeDropCalled by the framework before button is dropped on target.
 
 OnCalculateSizeCalled by the framework when it needs to determine the size of the toolbar button for the specified device context.
 
 OnChangeParentWndCalled by the framework when a button is inserted into a toolbar.
 
 OnClickCalled by the framework when the user clicks the button.
 
 OnClickUpCalled by the framework when the user releases the toolbar button.
 
 OnContextHelpCalled by the framework when the parent toolbar processes the WM_HELPHITTEST message.
 
 OnCtlColorCalled by the framework when the parent toolbar processes OnCtlColor.
 
 OnDblClickCalled by the framework when the parent toolbar handles OnLButtonDblClk.
 
 OnDPIChangedCalled by the framework when the parent toolbar DPI is changed
 
 OnDrawCalled by the framework when the button is required to display itself.
 
 OnDrawOnCustomizeListCalled by the framework when the button is required to draw itself on the customize list in the customization dialog.
 
 OnGetCustomToolTipTextCalled by the framework when it needs to display a tooltip for the toolbar button.
 
 OnGlobalFontsChangedCalled by the framework when the global font has been changed.
 
 OnMoveCalled by the framework when the parent toolbar is moved.
 
 OnShowCalled by the framework to notify the button that it becomes visible or invisible.
 
 OnSizeCalled by the framework to notify the button that its parent toolbar has changed its size and/or position and the button should resize itself accordingly.
 
 OnToolHitTestCalled by the framework when the parent toolbar needs to determine whether a point is in the bounding rectangle of the specified tool.
 
 RectReturns a buttons' bounding rectangle.
 
 SetImageSets a button's image.
 
 SetRadioCalled by the framework when a button changes its check state.
 
 SetRectSets a new button's bounding rectangle.
 
 SetStyleSets a new button's style.
 
 SetVisibleShows or hides a toolbar button.
 
 ShowMakes a button visible or hidden.
 

Static Public Member Functions

 GetProtectedCommandsReturns a reference to CList object, which contains a collection of commands that can't be customized by the user.
 
 SetProtectedCommandsSets a list of protected commands.
 

Public Attributes

 m_bImageIndicates whether the image of the toolbar button is displayed or not.
 
 m_bTextIndicates whether the text label of the toolbar button is displayed or not.
 
 m_bTextBelowIndicates whether the button's text label is displayed below the image.
 
 m_bUserButtonIndicates whether a button has the user-defined image (TRUE) or not (FALSE).
 
 m_bWholeTextIndicates whether a button displays full text label (TRUE), or clips the text and replace the rest by "..." if the text doesn't fit to the bounding rectangle.
 
 m_bWrapIf this flag is TRUE for a separator, the next to the separator button will be placed on the next row.
 
 m_nIDContains the command ID of a button.
 
 m_nStyleContains the style of a toolbar button.
 
 m_strTextContains the text label of a button.
 

Static Public Attributes

 m_bWrapTextIf TRUE, enables multi-line text labels.