BCGControlBar Pro for MFC
CBCGPColorBar

Detailed Description

The CBCGPColorBar class provides the functionality of the regular docking control bar specially designed to handle various color selection issues in the document/application. The list of built-in features (no additional programming required) includes:

  • automatically adjusted list of document colors
  • ability to save and restore its state in conjunction with the document state
  • "automatic" button
  • custom color selection by using CBCGPColorPickerCtrl control
  • "tear-off" state (when created from CBCGPColorMenuButton)

Usually, you don't need to create the CBCGPColorBar object directly. It's creation should be handled by CBCGPColorMenuButton (used from menu / toolbar) or by CBCGPColorButton otherwise. You have to perform the following steps to incorporate the CBCGPColorBar functionality into your application:

It's advised to set all the desired styles and enable/disable required features of the CBCGPColorBar during CBCGPColorMenuButton creation, because it will create dynamically the CBCGPColorBar object when the BCGP Framework calls CreatePopupMenu().

CBCGPColorBar object notifies its parents about user selection by sending ON_COMMAND message, where the command ID is the identifier that was assigned to the replaced menu button (ID_CHAR_COLOR in the example above).

See also
CBCGPColorMenuButton, CBCGPColorButton, CBCGPColorPickerCtrl, CBCGPFrameWnd, CBCGPToolBar
+ Inheritance diagram for CBCGPColorBar:

Public Member Functions

 CreateCreates a Windows control and performs additional initializations
 
 CreateControlCreates the Windows control and performs additional initialization steps for the color bar control.
 
 EnableAutomaticButtonShows or hides the automatic button
 
 EnableBorderShows or hides a border around color bar.
 
 EnableOtherButtonEnables ability to show a new dialog box to select an alternative color
 
 GetColorRetrieves the current selected color
 
 GetCommandIDRetrieves a control's command ID
 
 GetHorzMarginReturns the horizontal margin - the spacing between the left or right color cell and the client area bounds.
 
 GetVertMarginReturns the vertical margin - the spacing between the top or bottom color cell and the client area bounds.
 
 HasBorderTells whether a border around color bar is visible, or hidden.
 
 OnDrawPaletteColorBoxCalled by the framework when the palette color box should be drawn.
 
 SetColorSets a new selected color
 
 SetCommandIDSets a new command ID
 
 SetDocumentColorsSets the displayed colors from a specific document
 
 SetHorzMarginSets the horizontal margin - the spacing between the left or right color cell and the client area bounds.
 
 SetVertMarginSets the vertical margin - the spacing between the top or bottom color cell and the client area bounds.
 
- Public Member Functions inherited from CBCGPToolBar
 AreTextLabelsTells whether toolbar buttons should display text labels below images.
 
 ButtonToIndexGiven a pointer to CBCGPToolbarButton object returns the button's index.
 
 CanBeClosedReturns nonzero if the toolbar can be closed by the user.
 
 CanBeRestoredReturns nonzero if the application can revert a toolbar to its original state after customization.
 
 CommandToIndexGiven a toolbar button's command ID returns the button's index.
 
 CreateCreates the control bar control and attaches it to a CBCGPToolBar object.
 
 CreateExCreates a CBCGPToolBar object with additional styles.
 
 EnableCustomizeButtonEnables or disables an additional "customize" button on the toolbar.
 
 EnableCustomizeButtonEnables or disables an additional "customize" button on the toolbar.
 
 EnableLargeIconsEnables and disables large icons (images) on toolbar buttons.
 
 EnableTextLabelsEnables and disables text labels below toolbar button's images.
 
 GetAllButtonsGives read-only access to the internal list of toolbar buttons.
 
 GetButtonGiven an index returns a toolbar button.
 
 GetButtonInfoGiven an index of toolbar button, returns an information about this button.
 
 GetButtonSizeReturns the current size of a toolbar's buttons.
 
 GetButtonStyleReturns a style of a toolbar button.
 
 GetButtonTextReturns a text label of a toolbar button.
 
 GetButtonTextReturns a text label of a toolbar button.
 
 GetColumnWidthReturns the width of toolbar buttons.
 
 GetCountReturns a number of buttons on a toolbar.
 
 GetGrayDisabledButtonsTells whether the images of the toolbar's disabled buttons should be grayed out or taken from the collection of disabled images.
 
 GetHighlightedButtonReturns a highlighted toolbar button.
 
 GetHotBorderTells whether the border presentation appears or not.
 
 GetHwndLastFocusReturns a handle to window that previously had the input focus.
 
 GetImageSizeRetrieves the size of toolbar images.
 
 GetImagesOffsetRetrieves the offset of the toolbar images in the shared (global) collection of toolbar images.
 
 GetItemIDGiven a toolbar button's index retrieves the button's command ID.
 
 GetItemRectGiven a toolbar button's index returns the button's bounding rectangle.
 
 GetRouteCommandsViaFrameDetermines whether the toolbar commands are routed via its direct owner (if not NULL) or via the parent frame.
 
 HideEmptyMenusSpecifies whether toolbar/menu bar items with an empty items should be hidden.
 
 HitTestDetermines which toolbar button is at a specified position.
 
 InsertButtonInserts a button into list of toolbar buttons.
 
 InsertSeparatorInsets the separator at a specified position.
 
 IsHideEmptyMenusTells whether toolbar/menu bar items with an empty items should be hidden.
 
 IsToolBarImagesInDropDownMenusTells whether toolbar images should be displayed in drop-down menus.
 
 IsUserDefinedDetermines whether a toolbar is the user-defined toolbar.
 
 LoadBitmapLoads toolbar images from the application resources.
 
 LoadBitmapExLoads toolbar images from the application resources including large images.
 
 LoadStateLoads a toolbar state from the Windows registry.
 
 LoadToolBarLoads toolbar from the resources.
 
 LoadToolBarExLoads toolbar images from the resources using CBCGPToolBarParams helper that allows to handle large images.
 
 OnResetCalled when a toolbar is reverted to its original state.
 
 RemoveAllButtonsRemoves all buttons from a toolbar.
 
 RemoveButtonRemoves a button from a toolbar.
 
 RemoveStateFromRegistryRemoves a toolbar's state from the Windows registry.
 
 ReplaceButtonReplaces a toolbar button with another toolbar button.
 
 ResetImagesReset all toolbar images except user-defined to the default state.
 
 RestoreOriginalstateRestores an original state of a toolbar.
 
 SaveStateStores a toolbar's state into the Windows registry.
 
 SetButtonInfoSets properties for a toolbar button.
 
 SetButtonsRemoves existing buttons from a toolbar and inserts a collection of new buttons.
 
 SetButtonTextSets a new text label for a toolbar button.
 
 SetGrayDisabledButtonsSets a special mode, when images of disabled buttons are grayed or taken from a collection of disabled images.
 
 SetHeightCall this function to set the height of a toolbar.
 
 SetHotBorderSets a flag indicating whether toolbar buttons are hot-tracked or not.
 
 SetLockedSizesSets the size of locked toolbar buttons and locked images.
 
 SetPermamentSets a flag indicating that a toolbar is permanent and can't be closed.
 
 SetRouteCommandsViaFrameSets a flag indicating whether the toolbar commands are routed via its direct owner (if not NULL) or via the parent frame.
 
 SetToolBarBtnTextSets a new text label to the specified toolbar button, and specifies whether the toolbar button's text and image should be displayed or not.
 
 SetUseToolBarImagesInDropDownMenusSpecifies whether toolbar images should be used in drop-down menus.
 
- Public Member Functions inherited from CBCGPControlBar
 CalcInsideRectCalculates the inside rectangle of a control bar taking into account the borders and grippers.
 
 CanBeDockedDetermines whether a control bar can be docked at the specified dock bar.
 
 CanBeTabbedDocumentTells whether control bar can be converted to tabbed document.
 
 CreateCreates the Windows control bar and attaches it to the CBCGPControlBar object.
 
 CreateDefaultMiniframeCreates a mini-frame window for a control bar when it's being floated.
 
 CreateExCreates the Windows control bar and attaches it to the CBCGPControlBar object.
 
 DockControlBarDocks the control bar to a dock bar.
 
 DoesAllowSiblingBarsIndicates whether it is possible to dock another control bar at the same row where this control bar is docked.
 
 FloatControlBarMakes the control bar floating.
 
 GetBordersReturns the width of the control bar borders.
 
 GetExclusiveRowModeTells whether the control bar is in exclusive row mode or not.
 
 OnBeforeFloatCalled by the framework when a control bar is about to float.
 
 OnPressCloseButtonCalled by the framework when user presses the close button on control bar's caption.
 
 SetBordersSets the border values of the control bar.
 
 SetBordersSets the border values of the control bar.
 
 SetExclusiveRowModeEnables or disables the exclusive row mode.
 
 SetMiniFrameRTCSets the runtime class information about the default mini-frame window.
 
 ToggleAutoHideToggles autohide mode.
 
- Public Member Functions inherited from CBCGPBaseControlBar
 AddControlBarAdds a control bar to docking manager.
 
 AdjustDockingLayoutRedirects a call to docking manager to adjust docking layout.
 
 CanAcceptBarDetermines whether another control bar can be docked to this control bar.
 
 CanAutoHideDetermines whether the control bar can be switched to autohide mode.
 
 CanBeAttachedCalled by the framework to determine if the control bar can be docked to another control bar or frame window.
 
 CanBeResizedDetermines whether this control bar can be resized.
 
 CanFloatDetermines whether the control bar can float.
 
 CreateExCreates a Windows control.
 
 DoesAllowDynInsertBeforeDetermines whether it is possible to dynamically insert a control bar before this control bar.
 
 EnableGripperEnables/disables the control caption (gripper).
 
 GetBarIconReturns control bar icon.
 
 GetBarStyleReturns the control bar style.
 
 GetBCGStyleReturns the library specific control bar styles.
 
 GetCaptionHeightReturns the gripper (caption) height.
 
 GetCurrentAlignmentReturns the current control bar alignment.
 
 GetDockRowReturns a pointer to a dock bar row.
 
 GetDockSiteReturns a pointer to dock site.
 
 GetEnabledAlignmentReturns the enabled alignment.
 
 GetParentMiniFrameReturns a pointer to the parent mini-frame window.
 
 GetParentTabWndRetrieves a pointer to the parent tabbed window.
 
 HideInPrintPreviewModeTells the framework whether control bar should be hidden in print preview mode.
 
 IsDockedDetermines whether the control bar is docked or not.
 
 IsHorizontalDetermines whether the control bar is docked horizontally.
 
 IsMDITabbedTells whether control bar is placed on MDI child window as tabbed document.
 
 IsVisibleDetermines whether a control bar is visible or not.
 
 OnControlBarContextMenuCalled by the framework when it needs to build a menu with the list of control bars.
 
 OnRemoveFromMiniFrameCalled by the framework when a control bar is being removed from its parent mini-frame window.
 
 SetBarAlignmentSets the current alignment for a control bar.
 
 SetBarStyleSets a control bar style
 
 SetDockModeSets a new docking method for a control bar.
 
 ShowControlBarShows or hides a control bar.
 

Static Public Member Functions

 SetColorNameSets a new color name for a specific color
 
- Static Public Member Functions inherited from CBCGPToolBar
 AddBasicCommandAdds a command to a list of basic commands.
 
 AddToolBarForImageCollectionLoads a bitmap with toolbar images from the resources and adds it to the collection of toolbar images.
 
 AutoGrayInactiveImagesEnables a mode when disabled images are generated automatically by the library.
 
 CleanUpImagesFrees the system resources allocated for toolbar images.
 
 EnableQuickCustomizationEnables and disables the "quick" customization of toolbars by pressing the "Alt" key and dragging a button to a new location.
 
 GetAllToolbarsGives read-only access to all toolbars in the application.
 
 GetBasicCommandsGives read-only access to the global collection of basic commands defined in the application.
 
 GetColdImagesReturns a pointer to collection of cold images.
 
 GetCommandButtonsReturns a collection of buttons with the same command ID form all the application toolbars.
 
 GetDefaultImageReturns an index of the default image for a toolbar button with the specified command ID.
 
 GetDisabledImagesReturns a pointer to collection of disabled images.
 
 GetDisabledMenuImagesReturns a pointer to collection of disabled menu images.
 
 GetHotTextColorRetrieves a text color of a toolbar button in highlighted state.
 
 GetImagesRetrieves a pointer to the collection of toolbar images.
 
 GetLargeColdImagesReturns a pointer to collection of large cold images.
 
 GetLargeDisabledImagesReturns a pointer to collection of large disabled images.
 
 GetLargeImagesReturns a pointer to collection of large images.
 
 GetMenuButtonSizeRetrieves the size of menu buttons.
 
 GetMenuImagesReturns a pointer to collection of menu images.
 
 GetMenuImageSizeRetrieves the size of menu images.
 
 GetShowTooltipsDetermines whether tool tips are shown for toolbar buttons.
 
 GetUserImagesReturns a pointer to the global collection of user-defined toolbar images.
 
 IsAutoGrayInactiveImagesTells whether the option "automatic gray of inactive images" is enabled or disabled.
 
 IsBasicCommandDetermines whether the specified command is a basic command.
 
 IsCommandPermittedDetermines whether the command is allowed to be executed or not.
 
 IsCommandRarelyUsedDetermines whether the specified command is rarely used or not.
 
 IsCustomizeModeTells whether the framework is in the customization mode or not.
 
 IsGrayDisabledImagesTells whether the toolbar disabled images should be grayed or not.
 
 IsLargeIconsTells whether the application toolbars currently display large icons.
 
 IsLastCommandFromButtonDetermines whether the last command was sent from a toolbar button.
 
 IsLook2000Tells whether the application's GUI elements have Microsoft Office 2000 look and feel.
 
 LoadParametersLoads general (global) toolbar parameters from the Windows registry.
 
 ResetAllRestores all toolbars to an original state.
 
 ResetAllImagesResets all images.
 
 SetBasicCommandsSets basic commands.
 
 SetCommandUsageOptionsAllows to customize the appearance method of recently used menus.
 
 SetCustomizeModeSwitches the customize mode for all toolbars on and off.
 
 SetGrayDisabledImagesSpecifies whether the toolbar disabled images should be grayed or not.
 
 SetHotTextColorSets the text color for selected toolbar buttons to the specified color.
 
 SetLargeIconsSets a flag indicating whether toolbar buttons display large icons or regular icons.
 
 SetLook2000Sets a flag indicating whether the application GUI elements have Microsoft Office 2000 look and feel.
 
 SetMenuSizesSets the size of buttons and their images for toolbars working in the "menu mode".
 
 SetNonPermittedCommandsSets a list of commands, which are not allowed to be executed by the user.
 
 SetShowTooltipsTurns tool tips on and off.
 
 SetSizesSets sizes for all toolbar buttons and images.
 
 SetUserImagesSets user-defined images.
 

Protected Member Functions

 CBCGPColorBarConstructs a CBCGColorBar object
 
 CBCGPColorBarConstructs a CBCGColorBar object
 
 CBCGPColorBarConstructs a CBCGColorBar object
 
 AdjustLocationsCalled by the framework as a part of WM_SIZE message processing
 
 AllowChangeTextLabelsSpecifies whether the color's text labels are changeable
 
 AllowShowOnListSpecifies whether the CBCGColorBar object may appear in toolbar list during customization process.
 
 CalcSizeCalled by the framework as a part of layout calculation process
 
 OnKeyCalled by the framework when user presses a keyboard button
 
 OnUpdateCmdUICalled by the framework when the user-interface item for the CBCGColorBar command ID should be updated
 
 OpenColorDialogCalled by the framework when user is about to open a color dialog
 
 ShowCommandMessageStringSends to its owner the WM_SETMESSAGESTRING message
 
- Protected Member Functions inherited from CBCGPToolBar
 CalcMaxButtonHeightCalculates the maximal button height.
 
 DrawButtonCalled when a toolbar's button need to be repainted.
 
- Protected Member Functions inherited from CBCGPControlBar
 OnBeforeDockCalled by the framework when the control bar is about to be docked.
 

Additional Inherited Members

- Public Attributes inherited from CBCGPPopupMenuBar
 m_bDisableSideBarInXPModeIf TRUE, the gray bar in XP mode won't be displayed. The default value is FALSE.
 
- Public Attributes inherited from CBCGPControlBar
 m_recentDockInfoContains the recent docking information.
 
- Static Public Attributes inherited from CBCGPToolBar
 m_bDontScaleImagesPrevents image scaling when image sizes don't match button sizes.
 
 m_bDPIAwareControlWidthsIf this global member is TRUE, toolbar control (such as combo boxes or edit boxes) widthes width will be automatically scaled according to current DPI.
 
 m_dblLargeImageRatioSpecifies the ratio for large images.
 
- Static Public Attributes inherited from CBCGPControlBar
 m_bHandleMinSizeEnables consistent handling of minimal size.
 
- Protected Attributes inherited from CBCGPToolBar
 m_bDontScaleLockedPrevents scaling of locked images when image sizes don't match button sizes.