CMFCRibbonMainPanel Class

 

The latest version of this topic can be found at CMFCRibbonMainPanel Class.

Implements a ribbon panel that displays when you click the CMFCRibbonApplicationButton.

Syntax

class CMFCRibbonMainPanel : public CMFCRibbonPanel  

Members

Public Constructors

Name Description
CMFCRibbonMainPanel::CMFCRibbonMainPanel Default constructor.
CMFCRibbonMainPanel::~CMFCRibbonMainPanel Destructor.

Public Methods

Name Description
CMFCRibbonMainPanel::Add Adds a ribbon element to the left pane of the application button panel. (Overrides CMFCRibbonPanel::Add.)
CMFCRibbonMainPanel::AddRecentFilesList Adds a text string to the recent files list menu.
CMFCRibbonMainPanel::AddToBottom Adds a ribbon element to the bottom pane of the ribbon application panel.
CMFCRibbonMainPanel::AddToRight Adds a ribbon element to the right pane of the application button panel.
CMFCRibbonMainPanel::CreateObject Used by the framework to create a dynamic instance of this class type.
CMFCRibbonMainPanel::GetCommandsFrame Returns a rectangle that represents the area of the ribbon main panel.
CMFCRibbonMainPanel::GetThisClass Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.

Remarks

The framework displays the CMFCRibbonMainPanel when you open the application panel. It contains three panes:

  • The left pane contains commands associated with files, such as Open, Save, Print, and Close. To add a command to this pane, call CMFCRibbonMainPanel::Add.

  • The right pane contains options that modify the command that you click in the left pane. For example, if you click Save As from the left pane, the right pane can display available file types. To add an item to this pane, call CMFCRibbonMainPanel::AddToRight.

  • The bottom pane contains buttons that allow you to change the application's settings and to exit the program. To add an item to this pane, call CMFCRibbonMainPanel::AddToBottom.

Inheritance Hierarchy

CObject

CMFCRibbonPanel

CMFCRibbonMainPanel

Requirements

Header: afxRibbonMainPanel.h

CMFCRibbonMainPanel::Add

Adds a ribbon element to the left pane of the application button panel.

virtual void Add(CMFCRibbonBaseElement* pElem);

Parameters

[in] [out] pElem
A pointer to the ribbon element to add to the main panel.

Remarks

Adds a ribbon element to the panel. Elements added using this method will be located in the left column of the main panel.

CMFCRibbonMainPanel::AddRecentFilesList

Adds a text string to the recent files list menu.

void AddRecentFilesList(
    LPCTSTR lpszLabel,  
    int nWidth = 300);

Parameters

lpszLabel
Specifies the string to add to the recent files list.

nWidth
Specifies the width, in pixels, of the recent files list panel.

Remarks

CMFCRibbonMainPanel::AddToBottom

Adds a ribbon element to the bottom pane of the ribbon application panel.

void AddToBottom(CMFCRibbonMainPanelButton* pElem);

Parameters

[in] [out] pElem
A pointer to the ribbon element to add to the bottom of the main panel.

Remarks

CMFCRibbonMainPanel::AddToRight

Adds a ribbon element to the right pane of the application button panel.

void AddToRight(
    CMFCRibbonBaseElement* pElem,  
    int nWidth = 300);

Parameters

pElem
A pointer to a ribbon element to be added to the right side of the main panel.

nWidth
Specifies the width, in pixels, of the right panel.

Remarks

Use this function to add a ribbon element to the right panel. The right panel typically displays the recent files list, but you can add any other ribbon element here.

CMFCRibbonMainPanel::GetCommandsFrame

Returns a rectangle that represents the area of the ribbon main panel.

CRect GetCommandsFrame() const;  

Return Value

A rectangle that represents the area of the ribbon main panel.

See Also

Hierarchy Chart
Classes
CMFCRibbonPanel Class