void CBackstagePageInfo::OnCheckForIssuesDropDown() { CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd(); CXTPPopupBar* pPopupBar = CXTPPopupBar::CreatePopupBar(pMainFrame->GetCommandBars()); pPopupBar->SetDefaultButtonStyle(xtpButtonCaptionAndDescription); pPopupBar->SetShowGripper(FALSE); pPopupBar->GetControls()->Add(xtpControlButton, IDS_CHECK_INSPECT_DOCUMENT); pPopupBar->GetControls()->Add(xtpControlButton, IDS_CHECK_ACCESSIBILITY); CXTPWindowRect rcButton(GetDlgItem(IDC_BUTTON_CHECKFORISSUE)); pMainFrame->GetCommandBars()->TrackPopupMenu(pPopupBar, TPM_RETURNCMD | TPM_NONOTIFY, rcButton.left, rcButton.bottom, this); pPopupBar->InternalRelease(); }
void CBackstagePageInfo::OnProtectDocumentDropDown() { CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd(); CXTPPopupBar* pPopupBar = CXTPPopupBar::CreatePopupBar(pMainFrame->GetCommandBars()); pPopupBar->SetDefaultButtonStyle(xtpButtonCaptionAndDescription); pPopupBar->SetShowGripper(FALSE); pPopupBar->SetIconSize(CSize(32, 32)); pPopupBar->GetControls()->Add(xtpControlButton, IDS_PROTECT_MARK_AS_FINAL); pPopupBar->GetControls()->Add(xtpControlButton, IDS_PROTECT_ENCRYPT); UINT nIDs[] = {IDS_PROTECT_ENCRYPT}; XTPImageManager()->SetIcons(IDC_BUTTON_PROTECTDOCUMENT, nIDs, 1, CSize(0, 0), xtpImageNormal); CXTPWindowRect rcButton(GetDlgItem(IDC_BUTTON_PROTECTDOCUMENT)); pMainFrame->GetCommandBars()->TrackPopupMenu(pPopupBar, TPM_RETURNCMD | TPM_NONOTIFY, rcButton.left, rcButton.bottom, this); pPopupBar->InternalRelease(); }
void CXTPRibbonBuilder::BuildControlPopupBar(CXTPPropExchange* pPX, CXTPControl*& pParent, CRuntimeClass* pPopupBarClass) { CXTPPropExchangeEnumeratorPtr pEnumerator(pPX->GetEnumerator(_T("ELEMENT"))); BOOL bBeginGroup = FALSE; BOOL bEmpty = TRUE; POSITION pos = pEnumerator->GetPosition(0); while (pos) { CXTPPropExchangeSection pxControl(pEnumerator->GetNext(pos)); CString strElementName; PX_String(&pxControl, _T("ELEMENT_NAME"), strElementName); if (strElementName == _T("Separator")) { bBeginGroup = TRUE; continue; } CCmdTarget* pElement = CreateElement(strElementName); if (pElement == NULL) continue; CXTPControl* pControl = DYNAMIC_DOWNCAST(CXTPControl, pElement); if (!pControl) { delete pElement; continue; } if (bEmpty) { CXTPControlPopup* pPopupButton = CXTPControlPopup::CreateControlPopup(xtpControlPopup); CXTPPopupBar* pPopupBar = (CXTPPopupBar*)pPopupBarClass->CreateObject(); if (pPopupBar->IsKindOf(RUNTIME_CLASS(CXTPRibbonSystemPopupBarPage))) { pPopupBar->SetIconSize(CSize(32, 32)); pPopupBar->SetWidth(300); pPopupBar->SetShowGripper(FALSE); pPopupBar->SetDefaultButtonStyle(xtpButtonCaptionAndDescription); } pPopupButton->SetCommandBar(pPopupBar); pPopupBar->InternalRelease(); pParent->InternalRelease(); pParent = pPopupButton; bEmpty = FALSE; } BuildControl(&pxControl, pControl); pParent->GetCommandBar()->GetControls()->Add(pControl, pControl->GetID()); pParent->SetBeginGroup(bBeginGroup); bBeginGroup = FALSE; } }