Esempio n. 1
0
void CRibbonSampleCntrItem::ActiveStateChanged(BOOL bActive)
{
	CMainFrame* pFrame = DYNAMIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
	if (!pFrame)
		return;


	CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)pFrame->GetCommandBars()->GetMenuBar();
	ASSERT(pRibbonBar);
	if (!pRibbonBar)
		return;

	pFrame->GetCommandBars()->OnSetPreviewMode(bActive);

	if (bActive)
	{
		pRibbonBar->EnableFrameTheme(FALSE);

		CDocTemplate* pTemplate = GetDocument()->GetDocTemplate();
		HMENU hMenuOLE = pTemplate->m_hMenuInPlace;

		::SetMenu(pFrame->GetSafeHwnd(), hMenuOLE);
	}
	else
	{
		pRibbonBar->EnableFrameTheme(TRUE);
	}

	pFrame->DelayRecalcLayout(FALSE);
}
Esempio n. 2
0
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();
}
Esempio n. 3
0
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();
}
Esempio n. 4
0
/////////////////////////////////////////////////////////////////////////////
// 加载扩展菜单
/////////////////////////////////////////////////////////////////////////////
BOOL CPlugIn::AddOwmSubMenu(CString strMainMenu, CString strSubMenu, CString strAction)
{
	CMainFrame* pMainFrame = (CMainFrame*)(theApp.GetMainWnd());
	CXTPCommandBars* pCommandBars = pMainFrame->GetCommandBars();
	if(!pCommandBars)
	{
		return FALSE;		
	}
	CXTPCommandBar* pMenuBar = pCommandBars->GetMenuBar();
	if(!pMenuBar)
	{
		return FALSE;
	}

	CXTPControls* pControls = pMenuBar->GetControls();
	CXTPControl* pControl = pControls->GetFirst();
	CXTPCommandBar* pMenuBarSub = NULL;
	CXTPControl* pControlExtSub = NULL;
	while(pControl)
	{
		if(pControl->GetCaption() == strMainMenu)
		{
			pMenuBarSub = pControl->GetCommandBar();
			CXTPControls* pControlsSub = pMenuBarSub->GetControls();
			pControl = pControlsSub->GetFirst();
			while(pControl)
			{
				if(pControl->GetCaption() == strSubMenu)
				{
					pControlExtSub = pControl;
					break;
				}
				pControlsSub->GetNext(pControl);
			}			
			break;
		}
		pControls->GetNext(pControl);
	}
	if(pMenuBarSub && !pControlExtSub)
	{
		CExtMenuInfo extMenuInfo;
		extMenuInfo.m_strVciId = m_strId;
		extMenuInfo.m_strMainMenu = strMainMenu;
		extMenuInfo.m_strSubMenu = strSubMenu;
		extMenuInfo.pProc = (TYPEOF_ClientMenu*)OnOwmExtMenuProc;
		extMenuInfo.pUpdateProc = NULL;
		extMenuInfo.nProcType = MENU_PROC_TYPE_PARAM_ID;
		
		int nExMenuId = IDM_OWMCMD+g_nIdOwmExMenu;
		extMenuInfo.m_strAction = strAction;
		extMenuInfo.nId = nExMenuId-IDM_OWMCMD;
		pMainFrame->m_arExtMenuInfo.Add(extMenuInfo);

		CXTPControls* pControlsSub = pMenuBarSub->GetControls();
		CMenu* pMenu = new CMenu();
		pMenu->CreatePopupMenu();
		pMenu->AppendMenu(MF_STRING, nExMenuId, strSubMenu);
		pControlsSub->AddMenuItem(pMenu, 0);
		delete pMenu;

		g_nIdOwmExMenu++;
	}

	return TRUE;
}