void CBCGPRibbonConstructor::ConstructBaseElement (CBCGPBaseRibbonElement& element, const CBCGPRibbonInfo::XElement& info, BOOL bSubItems) const { element.SetText (info.m_strText); element.SetToolTipText (info.m_strToolTip); element.SetDescription (info.m_strDescription); element.SetKeys (info.m_strKeys, info.m_strMenuKeys); SetID (element, info.m_ID); CBCGPRibbonButton* pButton = DYNAMIC_DOWNCAST (CBCGPRibbonButton, &element); if (pButton != NULL) { const CBCGPRibbonInfo::XElementButton& infoElement = (const CBCGPRibbonInfo::XElementButton&)info; if (pButton->GetIcon (FALSE) == NULL && pButton->GetIcon (TRUE) == NULL) { pButton->SetImageIndex (infoElement.m_nSmallImageIndex, FALSE); pButton->SetImageIndex (infoElement.m_nLargeImageIndex, TRUE); } pButton->SetAlwaysLargeImage (info.m_bIsAlwaysLarge); pButton->SetDefaultCommand (infoElement.m_bIsDefaultCommand); pButton->SetQATType (infoElement.m_QATType); if (bSubItems) { CBCGPRibbonPaletteButton* pButtonPalette = DYNAMIC_DOWNCAST (CBCGPRibbonPaletteButton, pButton); for (int i = 0; i < infoElement.m_arSubItems.GetSize (); i++) { CBCGPBaseRibbonElement* pSubItem = CreateElement (*(const CBCGPRibbonInfo::XElement*)infoElement.m_arSubItems[i]); if (pSubItem == NULL) { continue; } if (pButtonPalette != NULL) { pButtonPalette->AddSubItem (pSubItem, -1, infoElement.m_bIsOnPaletteTop); } else { pButton->AddSubItem (pSubItem); if (pSubItem->GetID() >= AFX_IDM_WINDOW_FIRST && pSubItem->GetID() <= AFX_IDM_WINDOW_LAST) { pButton->m_bIsWindowsMenu = TRUE; } } } } } }