CMFCRibbonQuickAccessToolBarDefaultState Class
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at CMFCRibbonQuickAccessToolBarDefaultState Class.
A helper class that manages default state for the Quick Access Toolbar that is positioned on the ribbon bar ( CMFCRibbonBar Class).
class CMFCRibbonQuickAccessToolBarDefaultState
Public Constructors
| Name | Description |
|---|---|
| CMFCRibbonQuickAccessToolBarDefaultState::CMFCRibbonQuickAccessToolBarDefaultState | Constructs a CMFCRibbonQuickAccessToolbarDefaultState object. |
Public Methods
| Name | Description |
|---|---|
| CMFCRibbonQuickAccessToolBarDefaultState::AddCommand | Adds a command to the default state for the Quick Access Toolbar. This does not change the toolbar itself. |
| CMFCRibbonQuickAccessToolBarDefaultState::CopyFrom | Copies the properties of one Quick Access Toolbar to another. |
| CMFCRibbonQuickAccessToolBarDefaultState::RemoveAll | Removes all commands from the Quick Access Toolbar. This does not change the toolbar itself. |
After you create the Quick Access Toolbar in your application, we recommend that you set its default state by calling CMFCRibbonBar::SetQuickAccessDefaultState. This default state is restored when a user clicks the Reset button on the Customize page of your application's Options dialog box.
CMFCRibbonQuickAccessToolBarDefaultState
The following example demonstrates how to construct an object of the CMFCRibbonQuickAccessToolbarDefaultState class and how to add a command to the default state for the Quick Access Toolbar.
CMFCRibbonQuickAccessToolBarDefaultState* qaToolBarState = new CMFCRibbonQuickAccessToolBarDefaultState(); qaToolBarState->AddCommand(ID_FILE_NEW, true); qaToolBarState->AddCommand(ID_FILE_OPEN, true);
Header: afxribbonquickaccesstoolbar.h
Adds a command to the default state for the Quick Access Toolbar.
void AddCommand(
UINT uiCmd,
BOOL bIsVisible=TRUE);
Parameters
[in] uiCmd
Specifies command ID.
[in] bIsVisible
Sets the visibility of the command when the Quick Access Toolbar is in the default state.
Remarks
Adding a command to the CMFCRibbonQuickAccessToolBarDefaultState accomplishes three results. First, each added command is listed on the dropdown on the right side of the Quick Access Toolbar. In this manner, a user can easily add or remove that command from the Quick Access Toolbar. Second, the Quick Access Toolbar is reset to show only those commands that are listed as visible in the default state when the user clicks the Reset button in the Customize dialog box. Third, if you have not called CMFCRibbonBar::SetQuickAccessCommands, the Quick Access Toolbar uses the visible commands from this list as the default visible commands the first time a user runs your application. After you have added all the commands that you want, call CMFCRibbonBar::SetQuickAccessDefaultState to set this instance as the default state for the Quick Access Toolbar of that Ribbon Bar.
Copies the properties of one Quick Access Toolbar to another.
void CopyFrom(const CMFCRibbonQuickAccessToolBarDefaultState& src);
Parameters
[in] src
A reference to the source CMFCRibbonQuickAccessToolBarDefaultState object to copy from.
Remarks
This method copies each command from the source CMFCRibbonQuickAccessToolBarDefaultState object to this object by using the CMFCRibbonQuickAccessToolBarDefaultState::AddCommand method.
Constructs the Quick Access Toolbar default state object.
CMFCRibbonQuickAccessToolBarDefaultState();
Remarks
By default, the list of commands that the new instance of CMFRibbonQuickAccessToolBarDefaultState contains is empty.
Clears the list of default commands in the Quick Access Toolbar.
void RemoveAll();
Remarks
This function removes from this instance all the commands that the previous calls to CMFCRibbonQuickAccessToolBarDefaultState::AddCommand added.