本文整理汇总了C++中CBCGPRibbonBar类的典型用法代码示例。如果您正苦于以下问题:C++ CBCGPRibbonBar类的具体用法?C++ CBCGPRibbonBar怎么用?C++ CBCGPRibbonBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBCGPRibbonBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT_VALID
//******************************************************************************
void CBCGPRibbonSlider::NotifyCommand ()
{
ASSERT_VALID (this);
if (m_nID == 0 || m_nID == (UINT)-1)
{
return;
}
CBCGPRibbonBar* pRibbonBar = GetTopLevelRibbonBar ();
if (pRibbonBar == NULL)
{
return;
}
ASSERT_VALID (pRibbonBar);
CWnd* pWndParent = pRibbonBar->GetParent ();
if (pWndParent == NULL)
{
return;
}
pWndParent->SendMessage (WM_COMMAND, m_nID);
}
示例2: ASSERT_VALID
//*****************************************************************************
BOOL CBCGPFrameWnd::AddControlBar (CBCGPBaseControlBar* pControlBar, BOOL bTail)
{
ASSERT_VALID (this);
#ifndef BCGP_EXCLUDE_RIBBON
CBCGPRibbonBar* pRibbonBar = DYNAMIC_DOWNCAST (CBCGPRibbonBar, pControlBar);
if (pRibbonBar != NULL)
{
ASSERT_VALID (pRibbonBar);
if (pRibbonBar->IsMainRibbonBar ())
{
m_Impl.m_pRibbonBar = pRibbonBar;
}
}
CBCGPRibbonStatusBar* pRibbonStatusBar = DYNAMIC_DOWNCAST (CBCGPRibbonStatusBar, pControlBar);
if (pRibbonStatusBar != NULL)
{
ASSERT_VALID (pRibbonStatusBar);
m_Impl.m_pRibbonStatusBar = pRibbonStatusBar;
}
#endif
return m_dockManager.AddControlBar (pControlBar, bTail);
}
示例3: GetTopLevelFrame
void CBCGPMSOffice2007DemoView::OnFontname()
{
USES_CONVERSION;
CBCGPRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame ())->GetRibbonBar ();
ASSERT_VALID (pRibbon);
CBCGPRibbonFontComboBox* pFontCombo = DYNAMIC_DOWNCAST (
CBCGPRibbonFontComboBox, pRibbon->FindByID (ID_FONT_FONT));
if (pFontCombo == NULL)
{
return;
}
CCharFormat cf;
cf.szFaceName[0] = NULL;
cf.dwMask = CFM_FACE | CFM_CHARSET;
const CBCGPFontDesc* pDesc = pFontCombo->GetFontDesc ();
ASSERT_VALID (pDesc);
ASSERT(pDesc->m_strName.GetLength() < LF_FACESIZE);
#if _MSC_VER >= 1300
lstrcpyn(cf.szFaceName, pDesc->m_strName, LF_FACESIZE);
#else
lstrcpynA(cf.szFaceName,
T2A((LPTSTR) (LPCTSTR) pDesc->m_strName), LF_FACESIZE);
#endif
cf.bCharSet = pDesc->m_nCharSet;
cf.bPitchAndFamily = pDesc->m_nPitchAndFamily;
SetCharFormat (cf);
}
示例4: GetTopLevelFrame
void CEditFrameView::OnFontSize ()
{
CBCGPRibbonBar* pRibbon = ((CEditFrameDialog*) GetTopLevelFrame ())->GetRibbonBar ();
ASSERT_VALID (pRibbon);
CBCGPRibbonComboBox* pSizeCombo = DYNAMIC_DOWNCAST (
CBCGPRibbonComboBox, pRibbon->FindByID (ID_FONT_SIZE));
if (pSizeCombo == NULL)
{
return;
}
int nSize = GetTwipSize (pSizeCombo->GetItem (-1));
if (nSize == -2)
{
return;
}
if ((nSize >= 0 && nSize < 20) || nSize > 32760)
{
return;
}
if (nSize > 0)
{
CCharFormat cf;
cf.dwMask = CFM_SIZE;
cf.yHeight = nSize;
SetCharFormat (cf);
}
}
示例5: ASSERT_VALID
//**************************************************************************
BOOL CBCGPRibbonComboBox::SelectItem (int iIndex)
{
ASSERT_VALID (this);
if (iIndex >= m_lstItems.GetCount ())
{
return FALSE;
}
m_iSelIndex = max (-1, iIndex);
LPCTSTR lpszText = GetItem (m_iSelIndex);
m_strEdit = lpszText == NULL ? _T("") : lpszText;
if (m_pWndEdit->GetSafeHwnd () != NULL)
{
m_pWndEdit->SetWindowText (m_strEdit);
}
if (!m_bDontNotify)
{
CBCGPRibbonBar* pRibbonBar = GetTopLevelRibbonBar ();
if (pRibbonBar != NULL)
{
ASSERT_VALID (pRibbonBar);
CArray<CBCGPBaseRibbonElement*, CBCGPBaseRibbonElement*> arButtons;
pRibbonBar->GetElementsByID (m_nID, arButtons, TRUE);
for (int i = 0; i < arButtons.GetSize (); i++)
{
CBCGPRibbonComboBox* pOther =
DYNAMIC_DOWNCAST (CBCGPRibbonComboBox, arButtons [i]);
if (pOther != NULL && pOther != this)
{
ASSERT_VALID (pOther);
pOther->m_bDontNotify = TRUE;
pOther->SelectItem (iIndex);
pOther->m_bDontNotify = FALSE;
pOther->m_RecentChangeEvt = m_RecentChangeEvt;
}
}
}
}
Redraw ();
return TRUE;
}
示例6: ReSetLangLabel
void CSynBCGPEditView::ReSetLangLabel()
{
CBCGPRibbonBar *pRibbonBar = ((CMainFrame*)GetTopLevelFrame())->GetRibbonBar();
ASSERT_VALID(pRibbonBar);
CMyBCGPRibbonLabel *pRibbonLabel = DYNAMIC_DOWNCAST(CMyBCGPRibbonLabel, pRibbonBar->FindByID(ID_NOW_LANG));
if (pRibbonLabel)
{
CString strLabelText;
strLabelText.Format(_T("%16s"), m_pEdit->GetSelectLangString());
pRibbonLabel->SetTextEx(strLabelText);
pRibbonLabel->Redraw();
}
}
示例7: ConstructCategoryBackstage
void CBCGPRibbonConstructor::ConstructCategoryBackstage (CBCGPRibbonBar& bar, const CBCGPRibbonInfo::XCategoryBackstage& info) const
{
CBCGPRibbonBackstageViewPanel* pPanel = CreateCategoryBackstage (bar, info);
ASSERT_VALID (pPanel);
CBCGPRibbonCategory* pCategory = bar.GetBackstageCategory ();
ASSERT_VALID (pCategory);
const_cast<CBCGPToolBarImages&>(info.m_SmallImages.m_Image).CopyTo (pCategory->GetSmallImages ());
int i = 0;
for (i = 0; i < info.m_arElements.GetSize (); i++)
{
if (info.m_arElements[i]->GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Command) == 0)
{
CBCGPBaseRibbonElement* pElement =
CreateElement (*(const CBCGPRibbonInfo::XElement*)info.m_arElements[i]);
if (pElement != NULL)
{
ASSERT_VALID (pElement);
pElement->SetBackstageViewMode ();
pPanel->CBCGPRibbonMainPanel::Add (pElement);
}
}
}
}
示例8: BCGPPrintPreview
//*********************************************************************************
BCGCBPRODLLEXPORT void BCGPPrintPreview (CView* pView)
{
ASSERT_VALID (pView);
#ifndef BCGP_EXCLUDE_RIBBON
CFrameWnd* pParentFrame = BCGPGetParentFrame (pView);
ASSERT_VALID (pParentFrame);
CFrameWnd* pToplevelFrame = pParentFrame;
if (pToplevelFrame->IsKindOf (RUNTIME_CLASS (CBCGPMDIChildWnd)))
{
pToplevelFrame = pToplevelFrame->GetTopLevelFrame ();
}
CBCGPRibbonBar* pWndRibbonBar = DYNAMIC_DOWNCAST (CBCGPRibbonBar,
pToplevelFrame->GetDlgItem (AFX_IDW_RIBBON_BAR));
if (pWndRibbonBar != NULL && pWndRibbonBar->ShowBackstagePrintView())
{
return;
}
#endif
if (g_pActivePrintPreview != NULL &&
CWnd::FromHandlePermanent (g_pActivePrintPreview->GetSafeHwnd ()) != NULL)
{
return;
}
CPrintPreviewState *pState= new CPrintPreviewState;
ASSERT (g_pPrintPreviewlocaRes == NULL);
g_pPrintPreviewlocaRes = new CBCGPLocalResource;
if (!pView->DoPrintPreview (IDD_BCGBAR_RES_PRINT_PREVIEW, pView,
RUNTIME_CLASS (CBCGPPrintPreviewView), pState))
{
TRACE0("Error: OnFilePrintPreview failed.\n");
AfxMessageBox (AFX_IDP_COMMAND_FAILURE);
delete pState; // preview failed to initialize, delete State now
}
ASSERT (g_pPrintPreviewlocaRes == NULL);
}
示例9: GetCharFormatSelection
void CBCGPMSOffice2007DemoView::SyncFont ()
{
USES_CONVERSION;
CString strFontName;
// get the current font from the view and update
WPD_CHARFORMAT cf = GetCharFormatSelection ();
CBCGPRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame ())->GetRibbonBar ();
ASSERT_VALID (pRibbon);
// sync font name:
CBCGPRibbonFontComboBox* pFontCombo = DYNAMIC_DOWNCAST (
CBCGPRibbonFontComboBox, pRibbon->FindByID (ID_FONT_FONT));
if (pFontCombo != NULL && !pFontCombo->HasFocus ())
{
if ((cf.dwMask & (CFM_FACE|CFM_CHARSET)) == (CFM_FACE|CFM_CHARSET))
{
#if _MSC_VER >= 1300
strFontName = cf.szFaceName;
#else
strFontName = A2T(cf.szFaceName);
#endif
pFontCombo->SetFont (strFontName, DEFAULT_CHARSET, TRUE);
}
else
{
pFontCombo->SetText(_T(""));
}
}
// sync font size:
CBCGPRibbonComboBox* pFontSizeCombo = DYNAMIC_DOWNCAST (
CBCGPRibbonComboBox, pRibbon->FindByID (ID_FONT_FONTSIZE));
if (pFontSizeCombo != NULL && !pFontSizeCombo->HasFocus ())
{
pFontSizeCombo->SetEditText (TwipsToPointString (cf.yHeight));
}
SetFocus ();
}
示例10: ASSERT_VALID
void CRibbonListButton::OnShowPopupMenu ()
{
ASSERT_VALID (this);
CBCGPBaseRibbonElement::OnShowPopupMenu ();
if (m_sizeMaxText == CSize (0, 0))
{
CBCGPRibbonBar* pRibbonBar = GetTopLevelRibbonBar ();
ASSERT_VALID (pRibbonBar);
CClientDC dc (pRibbonBar);
CFont* pOldFont = dc.SelectObject (pRibbonBar->GetFont ());
ASSERT (pOldFont != NULL);
int i = 0;
for (i = 0; i < m_arLabels.GetSize (); i++)
{
CSize szText = dc.GetTextExtent (m_arLabels [i]);
m_sizeMaxText.cx = max (m_sizeMaxText.cx, szText.cx);
m_sizeMaxText.cy = max (m_sizeMaxText.cy, szText.cy);
}
const int cxImage = m_listImages.GetImageSize ().cx;
for (i = 0; i < m_arSubItems.GetSize (); i++)
{
CBCGPBaseRibbonElement* pButton = m_arSubItems [i];
ASSERT_VALID (pButton);
CString strText = pButton->GetText ();
CSize szText = dc.GetTextExtent (strText);
m_sizeMaxText.cx = max (m_sizeMaxText.cx, szText.cx - cxImage);
}
dc.SelectObject (pOldFont);
}
CBCGPRibbonPaletteButton::OnShowPopupMenu ();
}
示例11: ConstructQATElements
void CBCGPRibbonConstructor::ConstructQATElements (CBCGPRibbonBar& bar, const CBCGPRibbonInfo::XRibbonBar& info) const
{
const CBCGPRibbonInfo::XQAT::XArrayQATItem& items = info.m_QAT.m_arItems;
int count = (int)items.GetSize ();
if (count == 0)
{
return;
}
CBCGPRibbonQATDefaultState qatState;
for (int i = 0; i < count; i++)
{
qatState.AddCommand (items[i].m_ID.m_Value, items[i].m_bVisible);
}
bar.SetQuickAccessDefaultState (qatState);
bar.SetQuickAccessToolbarOnTop (info.m_QAT.m_bOnTop);
}
示例12: GetTopLevelFrame
void CSynBCGPEditView::OnEditUndo()
{
CBCGPRibbonBar *pRibbon = ((CMainFrame*) GetTopLevelFrame())->GetRibbonBar();
ASSERT_VALID(pRibbon);
CBCGPRibbonUndoButton *pEditUndo = DYNAMIC_DOWNCAST(CBCGPRibbonUndoButton, pRibbon->FindByID(ID_EDIT_UNDO));
ASSERT_VALID(pEditUndo);
int nActionNumber = pEditUndo->GetActionNumber();
if (-1 == nActionNumber)
{
m_pEdit->OnUndo();
return;
}
for (int i = 0; i < nActionNumber; i++)
{
if (!m_pEdit->OnUndo())
{
break;
}
}
}
示例13: OnClick
virtual void OnClick (CPoint /*point*/)
{
CBCGPBaseRibbonElement* pElement = (CBCGPBaseRibbonElement*) m_dwData;
ASSERT_VALID (pElement);
pElement->SetVisible (!pElement->IsVisible ());
Redraw ();
CBCGPRibbonBar* pRibbonStatusBar = pElement->GetParentRibbonBar ();
ASSERT_VALID (pRibbonStatusBar);
pRibbonStatusBar->RecalcLayout ();
pRibbonStatusBar->RedrawWindow ();
CFrameWnd* pParentFrame = pRibbonStatusBar->GetParentFrame ();
ASSERT_VALID (pParentFrame);
pParentFrame->RedrawWindow (NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
CRect rectScreen;
pRibbonStatusBar->GetWindowRect (&rectScreen);
CBCGPPopupMenu::UpdateAllShadows (rectScreen);
}
示例14: ConstructCategoryMain
void CBCGPRibbonConstructor::ConstructCategoryMain (CBCGPRibbonBar& bar, const CBCGPRibbonInfo::XCategoryMain& info) const
{
CBCGPRibbonMainPanel* pPanel = CreateCategoryMain (bar, info);
ASSERT_VALID (pPanel);
CBCGPRibbonCategory* pCategory = bar.GetMainCategory ();
ASSERT_VALID (pCategory);
const_cast<CBCGPToolBarImages&>(info.m_SmallImages.m_Image).CopyTo (pCategory->GetSmallImages ());
const_cast<CBCGPToolBarImages&>(info.m_LargeImages.m_Image).CopyTo (pCategory->GetLargeImages ());
if (info.m_bSearchEnable)
{
pPanel->EnableCommandSearch (info.m_bSearchEnable, info.m_strSearchLabel, info.m_strSearchKeys, info.m_nSearchWidth);
}
int i = 0;
for (i = 0; i < info.m_arElements.GetSize (); i++)
{
CBCGPBaseRibbonElement* pElement =
CreateElement (*(const CBCGPRibbonInfo::XElement*)info.m_arElements[i]);
if (pElement != NULL)
{
ASSERT_VALID (pElement);
if (info.m_arElements[i]->GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_MainPanel) == 0)
{
pPanel->AddToBottom ((CBCGPRibbonMainPanelButton*)pElement);
}
else
{
pPanel->Add (pElement);
}
}
}
if (info.m_bRecentListEnable)
{
pPanel->AddRecentFilesList (info.m_strRecentListLabel, info.m_nRecentListWidth, info.m_bRecentListShowPins);
}
}
示例15: ConstructTabElements
void CBCGPRibbonConstructor::ConstructTabElements (CBCGPRibbonBar& bar, const CBCGPRibbonInfo::XRibbonBar& info) const
{
int i = 0;
for (i = 0; i < info.m_TabElements.m_arButtons.GetSize (); i++)
{
CBCGPBaseRibbonElement* pElement =
CreateElement (*(const CBCGPRibbonInfo::XElement*)info.m_TabElements.m_arButtons[i]);
if (pElement != NULL)
{
CBCGPRibbonButton* pButton = DYNAMIC_DOWNCAST (CBCGPRibbonButton, pElement);
if (pButton != NULL && pButton->GetImageIndex (FALSE) != -1)
{
SetIcon (*pButton, CBCGPBaseRibbonElement::RibbonImageLarge,
GetInfo().GetRibbonBar ().m_Images.m_Image, FALSE);
}
ASSERT_VALID (pElement);
bar.AddToTabs (pElement);
}
}
}