共用方式為


CMFCRibbonBaseElement Class

The CMFCRibbonBaseElement class is the base class for all elements that you can add to a ribbon bar. Examples of ribbon elements are ribbon buttons, ribbon check boxes, and ribbon combo boxes.

class CMFCRibbonBaseElement : public CObject

Members

Public Constructors

Name

Description

CMFCRibbonBaseElement

Constructs a CMFCRibbonBaseElement object.

Public Methods

Name

Description

CMFCRibbonBaseElement::AddToKeyList

Adds a keytip for the ribbon element to an array of keytips.

CMFCRibbonBaseElement::AddToListBox

Adds a ribbon element to the specified ribbon commands list box.

CMFCRibbonBaseElement::CanBeAddedToQuickAccessToolBar

Indicates whether the ribbon element can be added to the quick access toolbar.

CMFCRibbonBaseElement::CanBeCompacted

Indicates whether the size of the ribbon element can be compact.

CMFCRibbonBaseElement::CanBeStretched

Indicates whether the height of the ribbon element can increase vertically to the height of a ribbon row.

CMFCRibbonBaseElement::CanBeStretchedHorizontally

Indicates whether the width of the ribbon element can change.

CMFCRibbonBaseElement::CleanUpSizes

Cleans up the dimension settings for the ribbon element.

CMFCRibbonBaseElement::ClosePopupMenu

Closes the popup menu for the ribbon element.

CMFCRibbonBaseElement::CopyFrom

Copies the state of the specified CMFCRibbonBaseElement to the current object.

CMFCRibbonBaseElement::DestroyCtrl

Destroys the ribbon element.

CMFCRibbonBaseElement::DrawImage

Draws the image for the ribbon element.

CMFCRibbonBaseElement::Find

Returns the specified pointer to the ribbon element if it points to the current object.

CMFCRibbonBaseElement::FindByData

Retrieves a pointer to the ribbon element if it contains the specified data.

CMFCRibbonBaseElement::FindByID

Retrieves a pointer to the ribbon element if that element is identified by the specified command ID.

CMFCRibbonBaseElement::FindByOriginal

Retrieves a pointer to the ribbon element if its original ribbon element matches the specified ribbon element.

CMFCRibbonBaseElement::GetCompactSize

Returns the compact size of the ribbon element.

CMFCRibbonBaseElement::GetData

Retrieves the user-defined data associated with the ribbon element.

CMFCRibbonBaseElement::GetDescription

Returns the description of the ribbon element.

CMFCRibbonBaseElement::GetDroppedDown

Retrieves a pointer to the ribbon element if its pop-up menu is dropped down.

CMFCRibbonBaseElement::GetElements

Adds the current ribbon element to the specified array.

CMFCRibbonBaseElement::GetElementsByID

Adds the current ribbon element to the specified array if the current ribbon element contains the specified command ID.

CMFCRibbonBaseElement::GetHighlighted

Retrieves a pointer to the ribbon element if it is highlighted.

CMFCRibbonBaseElement::GetID

Returns the command ID of the ribbon element.

CMFCRibbonBaseElement::GetImageSize

Returns the image size of the ribbon element.

CMFCRibbonBaseElement::GetIntermediateSize

Returns the size of the ribbon element in its intermediate state.

CMFCRibbonBaseElement::GetKeys

Returns the keytip associated with the ribbon element.

CMFCRibbonBaseElement::GetKeyTipRect

Retrieves the keytip boundary rectangle for the ribbon element.

CMFCRibbonBaseElement::GetKeyTipSize

Retrieves the size of the keytip text.

CMFCRibbonBaseElement::GetLocationInGroup

Indicates the display location of the ribbon element in a ribbon group.

CMFCRibbonBaseElement::GetMenuKeys

Returns the keytips associated with a button.

CMFCRibbonBaseElement::GetNotifyID

Retrieves the notification command ID for the ribbon element.

CMFCRibbonBaseElement::GetOriginal

Retrieves the original ribbon element.

CMFCRibbonBaseElement::GetParentCategory

Retrieves the ribbon category for the ribbon element.

CMFCRibbonBaseElement::GetParentPanel

Retrieves the ribbon panel that contains the ribbon element.

CMFCRibbonBaseElement::GetParentRibbonBar

Retrieves the parent ribbon bar for the ribbon element.

CMFCRibbonBaseElement::GetParentWnd

Retrieves the parent window for the ribbon element.

CMFCRibbonBaseElement::GetPressed

Retrieves a pointer to the ribbon element if the user currently presses it.

CMFCRibbonBaseElement::GetQuickAccessToolBarID

Retrieves the command ID of the ribbon element when it is located in the quick access toolbar.

CMFCRibbonBaseElement::GetRect

Returns the bounding rectangle of the ribbon element.

CMFCRibbonBaseElement::GetRegularSize

Returns the regular size of the ribbon element.

CMFCRibbonBaseElement::GetSize

Returns the current size of the ribbon element.

CMFCRibbonBaseElement::GetText

Returns the text associated with the ribbon element.

CMFCRibbonBaseElement::GetToolTipText

Returns tooltip text of the ribbon element.

CMFCRibbonBaseElement::GetTopLevelRibbonBar

Retrieves the top level ribbon bar for the ribbon element.

CMFCRibbonBaseElement::HasCompactMode

Specifies whether the ribbon element has a compact mode.

CMFCRibbonBaseElement::HasFocus

Indicates whether the parent element has keyboard focus.

CMFCRibbonBaseElement::HasIntermediateMode

Specifies whether the ribbon element has an intermediate mode.

CMFCRibbonBaseElement::HasLargeMode

Specifies whether the ribbon element has a large mode.

CMFCRibbonBaseElement::HasMenu

Indicates whether the ribbon element has a menu.

CMFCRibbonBaseElement::HitTest

Retrieves a pointer to the ribbon element if the specified point is located in it.

CMFCRibbonBaseElement::IsAlignByColumn

Indicates whether the ribbon element is aligned vertically with other ribbon elements.

CMFCRibbonBaseElement::IsAlwaysLargeImage

Indicates whether the ribbon element image size is always large.

CMFCRibbonBaseElement::IsAutoRepeatMode

Indicates whether the ribbon element is in auto repeat mode.

CMFCRibbonBaseElement::IsChecked

Specifies whether the ribbon element is checked.

CMFCRibbonBaseElement::IsCompactMode

Specifies whether the ribbon element is in a compact mode.

CMFCRibbonBaseElement::IsDefaultMenuLook

 

CMFCRibbonBaseElement::IsDisabled

Specifies whether the ribbon element is disabled.

CMFCRibbonBaseElement::IsDroppedDown

Determines whether the ribbon element displays a popup menu and is dropped down.

CMFCRibbonBaseElement::IsFocused

Specifies whether the ribbon element has the focus.

CMFCRibbonBaseElement::IsGalleryIcon

Indicates whether the ribbon element is contained in a ribbon gallery.

CMFCRibbonBaseElement::IsHighlighted

Specifies whether ribbon element is highlighted.

CMFCRibbonBaseElement::IsIntermediateMode

Indicates whether the current image for the ribbon element is intermediate size.

CMFCRibbonBaseElement::IsLargeMode

Indicates whether the current image for the ribbon element is large sized.

CMFCRibbonBaseElement::IsMenuMode

Indicates whether the ribbon element is contained in a menu.

CMFCRibbonBaseElement::IsPressed

Indicates whether the user has clicked the ribbon element.

CMFCRibbonBaseElement::IsQATMode

Indicates whether the ribbon element is contained in the quick access toolbar.

CMFCRibbonBaseElement::IsSeparator

Indicates whether the ribbon element is a display separator.

CMFCRibbonBaseElement::IsShowGroupBorder

Indicates whether the ribbon element is contained in a group that displays a common border.

CMFCRibbonBaseElement::IsShowTooltipOnBottom

Indicates whether the tooltip is displayed under the ribbon element.

CMFCRibbonBaseElement::IsTabStop

Indicates whether the ribbon element can be selected with the keyboard.

CMFCRibbonBaseElement::IsTextAlwaysOnRight

Indicates whether the text for the ribbon element is displayed on the right.

CMFCRibbonBaseElement::IsVisible

Indicates whether the ribbon element is currently displayed.

CMFCRibbonBaseElement::IsWholeRowHeight

Indicates whether the display heigth of the ribbon element is the same as the display height of the ribbon panel that contains it.

CMFCRibbonBaseElement::NotifyCommand

Sends a command notification to the parent window of the ribbon element.

CMFCRibbonBaseElement::NotifyHighlightListItem

Notifies the parent window of the ribbon bar when a user highlights a ribbon element that is located in a list.

CMFCRibbonBaseElement::OnAddToQAToolbar

Adds the ribbon element to the specified quick access toolbar.

CMFCRibbonBaseElement::OnAfterChangeRect

Updates the tooltip for the ribbon element.

CMFCRibbonBaseElement::OnAutoRepeat

Updates the ribbon element in response to sustained user input.

CMFCRibbonBaseElement::OnCalcTextSize

Calculates the size of the text for the ribbon element.

CMFCRibbonBaseElement::OnChangeMenuHighlight

Called by the framework when the highlight changes for a ribbon element that is located in a menu.

CMFCRibbonBaseElement::OnDraw

Called by the framework to draw the ribbon element.

CMFCRibbonBaseElement::OnDrawKeyTip

Called by the framework to draw the keytip for the ribbon element.

CMFCRibbonBaseElement::OnDrawMenuImage

Called by the framework when the menu image for the ribbon element is drawn.

CMFCRibbonBaseElement::OnDrawOnList

Called by the framework to draw the ribbon element in a commands list box.

CMFCRibbonBaseElement::OnKey

Called by the framework when the user presses a keytip and the ribbon element has the focus.

CMFCRibbonBaseElement::OnMenuKey

CMFCRibbonBaseElement::OnRTLChanged

Called by the framework when the layout changes direction.

CMFCRibbonBaseElement::OnShow

Called by the framework to show or hide the ribbon element.

CMFCRibbonBaseElement::OnShowPopupMenu

Called by the framework when the ribbon element is going to display a popup menu.

CMFCRibbonBaseElement::PostMenuCommand

CMFCRibbonBaseElement::Redraw

Updates the display for the ribbon element.

CMFCRibbonBaseElement::SetACCData

Sets the accessibility data for the ribbon element.

CMFCRibbonBaseElement::SetCompactMode

Sets the display size for the ribbon element.

CMFCRibbonBaseElement::SetData

Associates a data item with the ribbon element.

CMFCRibbonBaseElement::SetDefaultMenuLook

 

CMFCRibbonBaseElement::SetDescription

Sets the description for the ribbon element.

CMFCRibbonBaseElement::SetID

Sets the command ID of the ribbon element.

CMFCRibbonBaseElement::SetInitialMode

Sets the initial display size for the ribbon element.

CMFCRibbonBaseElement::SetKeys

Sets a keytip for the ribbon element.

CMFCRibbonBaseElement::SetOriginal

Sets the original ribbon element for the ribbon element.

CMFCRibbonBaseElement::SetParentCategory

Sets the parent category for the ribbon element.

CMFCRibbonBaseElement::SetParentMenu

Sets the parent menu container for the ribbon element.

CMFCRibbonBaseElement::SetParentRibbonBar

Sets the parent ribbon bar for the ribbon element.

CMFCRibbonBaseElement::SetRect

Sets the dimensions fot he display rectangle for the ribbon element.

CMFCRibbonBaseElement::SetText

Sets the text for the ribbon element.

CMFCRibbonBaseElement::SetTextAlwaysOnRight

Sets the text for the ribbon element to display on the right.

CMFCRibbonBaseElement::SetToolTipText

Sets the tooltip text for the ribbon element.

CMFCRibbonBaseElement::SetVisible

Sets the visibility state of the ribbon element.

CMFCRibbonBaseElement::StretchHorizontally

Stretches the width of the ribbon element.

CMFCRibbonBaseElement::StretchToWholeRow

Changes the display height of the ribbon element to the specified row height.

CMFCRibbonBaseElement::UpdateTooltipInfo

Updates the tooltip text by using the command resource for the ribbon element.

Protected Methods

Name

Description

CMFCRibbonBaseElement::OnProcessKey

Called by the framework when the user presses a shortcut key.

CMFCRibbonBaseElement::OnSetFocus

Called by the framework when a ribbon element receives or loses the input focus.

Remarks

The CMFCRibbonBaseElement class defines the properties that are common to all ribbon elements that include command ID, text label, tooltip text, element description, and state (which can be focused, highlighted, pressed, disabled, checked, or dropped down).

The image size of a ribbon element is defined by the RibbonImageType member, which can be one of the following values:

  • RibbonImageLarge

  • RibbonImageSmall

Depending on its size, a ribbon element displays either a small or large image.

Example

The following example demonstrates how to use various methods in the CMFCRibbonBaseElement class. The example shows how to get a CMFCRibbonBaseElement object from a CMFCRibbonStatusBar class, set the description for the ribbon element, set the text, set a keytip, and set the tooltip text for the ribbon element. This code snippet is part of the Draw Client sample.

// CMFCRibbonStatusBar m_wndStatusBar
    CMFCRibbonBaseElement* pPane = m_wndStatusBar.FindByID(nID);


...


        pPane->SetDescription(_T("a pane"));
        // CString strText
        pPane->SetText(strText);
        pPane->SetKeys(_T("p"));
        pPane->SetToolTipText(_T("this is a pane"));

Inheritance Hierarchy

CObject

   CMFCRibbonBaseElement

Requirements

Header: afxbaseribbonelement.h

See Also

Reference

Hierarchy Chart

Other Resources

MFC Classes