CMFCRibbonSeparator 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 CMFCRibbonSeparator Class.

Implements the ribbon separator.

class CMFCRibbonSeparator : public CMFCRibbonBaseElement  

Public Constructors

NameDescription
CMFCRibbonSeparator::CMFCRibbonSeparatorConstructs a CMFCRibbonSeparator object.

Public Methods

NameDescription
CMFCRibbonSeparator::AddToListBoxAdds a separator to the Commands list in the Customize dialog box. (Overrides CMFCRibbonBaseElement::AddToListBox.)
CMFCRibbonSeparator::CreateObjectUsed by the framework to create a dynamic instance of this class type.
CMFCRibbonSeparator::GetThisClassUsed by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.

Protected Methods

NameDescription
CMFCRibbonSeparator::CopyFromA copy method that sets a separator's member variables from another object.
CMFCRibbonSeparator::GetRegularSizeReturns the size of a separator.
CMFCRibbonSeparator::IsSeparatorIndicates whether this is a separator.
CMFCRibbonSeparator::IsTabStopIndicates whether this is a tab stop.
CMFCRibbonSeparator::OnDrawCalled by the system to draw the separator on either the ribbon or the Quick Access Toolbar.
CMFCRibbonSeparator::OnDrawOnListCalled by the system to draw the separator on the Commands list.

A ribbon separator is a vertical or horizontal line that logically separates ribbon elements. A separator can be drawn on the ribbon control, the main application menu, the ribbon status bar, and the Quick Access Toolbar.

To use a separator in your application, construct the new object and add it to the main application menu as shown here:

CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(_T("Main Menu"),
    IDB_FILESMALL,
    IDB_FILELARGE);

...  
pMainPanel->Add(new CMFCRibbonSeparator(TRUE));

Call CMFCRibbonPanel::AddSeparator to add separators to ribbon panels. The separators are allocated and added internally by the AddSeparator method.

CObject

CMFCRibbonBaseElement

CMFCRibbonSeparator

Header: afxbaseribbonelement.h

Adds a separator to the Commands list in the Customize dialog box.

virtual int AddToListBox(
    CMFCRibbonCommandsListBox* pWndListBox,  
    BOOL bDeep);

Parameters

[in] pWndListBox
A pointer to the Commands list where the separator is added.

[in] bDeep
Ignored.

Return Value

Zero-based index to the string in the list box specified by pWndListBox.

Constructs a CMFCRibbonSeparator object.

CMFCRibbonSeparator(BOOL bIsHoriz = FALSE);

Parameters

[in] bIsHoriz
If TRUE, the separator is horizontal; if FALSE, the separator is vertical.

Remarks

Horizontal separators are used in application menus. Vertical separators are used in toolbars.

Example

The following example demonstrates how to construct an object of the CMFCRibbonSeparator class.

	// CMFCRibbonMainPanel* pMainPanel
	pMainPanel->Add(new CMFCRibbonSeparator(TRUE));

A copy method that sets a separator's member variables from another object.

virtual void CopyFrom(const CMFCRibbonBaseElement& src);

Parameters

[in] Src
The source ribbon element to copy from.

Returns the size of a separator.

virtual CSize GetRegularSize(CDC* pDC);

Parameters

[in] pDC
A pointer to a device content.

Return Value

The size of the separator on the given device context.

Indicates whether this is a separator.

virtual BOOL IsSeparator() const;  

Return Value

Always TRUE for this class.

Indicates whether this is a tab stop.

virtual BOOL IsTabStop() const;  

Return Value

Always FALSE for this class.

Remarks

A ribbon separator is not a tab stop.

Called by the system to draw the separator on either the ribbon or the Quick Access Toolbar.

virtual void OnDraw(CDC* pDC);

Parameters

[in] pDC
A pointer to a device context.

Called by the system to draw the separator on the Commands list.

virtual void OnDrawOnList(
    CDC* pDC,  
    CString strText,  
    int nTextOffset,  
    CRect rect,  
    BOOL bIsSelected,  
    BOOL bHighlighted);

Parameters

ParameterDescription
[in] pDCA pointer to a device context.
[in] strTextText displayed on the list.
[in] nTextOffsetSpacing between the text and the left side of the bounding rectangle.
[in] rectSpecifies the bounding rectangle.
[in] bIsSelectedIgnored.
[in] bHighlightedIgnored.

Hierarchy Chart
Classes

Show: