CMFCRibbonQuickAccessToolBarDefaultState
Class
A helper class that manages default state for the Quick Access Toolbar that is positioned on the ribbon bar (CMFCRibbonBar
Class).
Syntax
class CMFCRibbonQuickAccessToolBarDefaultState
Members
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 method doesn't 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 method doesn't change the toolbar itself. |
Remarks
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 chooses the Reset button on the Customize page of your application's Options dialog box.
Inheritance Hierarchy
CMFCRibbonQuickAccessToolBarDefaultState
Example
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);
Requirements
Header: afxribbonquickaccesstoolbar.h
CMFCRibbonQuickAccessToolBarDefaultState::AddCommand
Adds a command to the default state for the Quick Access Toolbar.
void AddCommand(
UINT uiCmd,
BOOL bIsVisible=TRUE);
Parameters
uiCmd
[in] Specifies command ID.
bIsVisible
[in] 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 chooses the Reset button in the Customize dialog box. Third, if you haven't 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've 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.
CMFCRibbonQuickAccessToolBarDefaultState::CopyFrom
Copies the properties of one Quick Access Toolbar to another.
void CopyFrom(const CMFCRibbonQuickAccessToolBarDefaultState& src);
Parameters
src
[in] 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.
CMFCRibbonQuickAccessToolBarDefaultState::CMFCRibbonQuickAccessToolBarDefaultState
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.
CMFCRibbonQuickAccessToolBarDefaultState::RemoveAll
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.
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for