Bagikan melalui


CMFCRibbonUndoButton Class

The CMFCRibbonUndoButton class implements a drop-down list button that contains the most recent user commands. Users can select one or more of the most recent commands from the drop-down list to either redo or undo them.

class CMFCRibbonUndoButton : public CMFCRibbonGallery

Members

Public Constructors

Name

Description

CMFCRibbonUndoButton::CMFCRibbonUndoButton

Constructs a new CMFCRibbonUndoButton object by using the command ID that you specify, text label and images from the image list of the parent object.

Public Methods

Name

Description

CMFCRibbonUndoButton::AddUndoAction

Adds a new action to the list of actions.

CMFCRibbonUndoButton::CleanUpUndoList

Clears the action list, which is the drop-down list.

CMFCRibbonUndoButton::GetActionNumber

Determines the number of items that a user selected from the drop-down list.

CMFCRibbonUndoButton::HasMenu

Indicates whether the object contains a menu.

Remarks

The CMFCRibbonUndoButton class uses a stack to represent the drop-down list.

Example

The following example demonstrates how to construct an object of the CMFCRibbonUndoButton class, and add a new action to the list of actions. This code snippet is part of the Ribbon Gadgets sample.

    // The third parameter is the zero-based index in the image list of the parent 
    // object for the button's small image.
    // The fourth parameter is the zero-based index in the image list of the parent object 
    // for the of button's large image.
    CMFCRibbonUndoButton* pBtn1 = new CMFCRibbonUndoButton(ID_RIBBON_OBTN_1, _T("Undo"), 0, 0);
    for (int i = 0; i < 20; i++)
    {
        CString str;
        str.Format(_T("Action %d"), i + 1);
        pBtn1->AddUndoAction(str);
    }

Inheritance Hierarchy

CObject

   CMFCRibbonBaseElement

      CMFCRibbonButton

         CMFCRibbonGallery

            CMFCRibbonUndoButton

Requirements

Header: afxribbonundobutton.h

See Also

Reference

Hierarchy Chart

CMFCRibbonGallery Class

CMFCRibbonButton Class

Other Resources

MFC Classes