void CXTPRibbonGroup::OnGroupAdded() { CXTPControl* pGroupOption = GetControlGroupOption(); m_pParent->GetControls()->Add(pGroupOption); pGroupOption->InternalAddRef(); pGroupOption->SetHideFlag(xtpHideRibbonTab, !IsVisible()); pGroupOption->SetID(GetID()); CXTPControl* pGroupPopup = (CXTPControl*)GetControlGroupPopup(); m_pParent->GetControls()->Add(pGroupPopup); pGroupPopup->SetCaption(GetCaption()); pGroupPopup->SetDescription(NULL); pGroupPopup->InternalAddRef(); pGroupPopup->SetHideFlag(xtpHideRibbonTab, !IsVisible()); CXTPCommandBars* pCommandBars = m_pRibbonBar->GetCommandBars(); ASSERT(pCommandBars); if (pCommandBars && pCommandBars->IsActionsEnabled()) { CXTPControlAction* pAction = pCommandBars->CreateAction(GetID()); if (pAction->GetCaption().IsEmpty()) pAction->SetCaption(GetCaption()); pGroupPopup->SetAction(pAction); pGroupOption->SetAction(pAction); } }
BOOL CXTPRibbonBuilder::BuildMainButton(CXTPPropExchange* pPX, CXTPRibbonBar* pRibbonBar) { CString strElementName; PX_String(pPX, _T("ELEMENT_NAME"), strElementName); if (strElementName != _T("Button_Main")) return FALSE; CXTPControl* pControl = pRibbonBar->AddSystemButton(0); CXTPPropExchangeSection pxImage(pPX->GetSection(_T("IMAGE"))); CXTPPropExchangeSection pxImageId(pxImage->GetSection(_T("ID"))); int nId = -1; PX_Int(&pxImageId, _T("VALUE"), nId); if (nId != -1) { UINT nIcons[] = {(UINT)nId}; pRibbonBar->GetImageManager()->SetIcons(nId, nIcons, 1, CSize(0, 0), xtpImageNormal); pControl->SetID(nId); } CString strKeys; PX_String(pPX, _T("KEYS"), strKeys); pControl->SetKeyboardTip(strKeys); return TRUE; }