void Cv11View::OnShape() { CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arr; ((CMainFrame*)AfxGetMainWnd())->m_wndRibbonBar.GetElementsByID(ID_SHAPE, arr); CMFCRibbonGallery* pGallery = (CMFCRibbonGallery*)arr.GetAt(0); shape = pGallery->GetSelectedItem(); shape1 = shape; Invalidate(); }
int CMainFrame::GetWeightFromLineWeight(int nButtonID) { CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arButtons; m_wndRibbonBar.GetElementsByID(nButtonID, arButtons); if (arButtons.GetSize() == 0) { return -1; } int weight = -1; CMFCRibbonGallery* pBtn = DYNAMIC_DOWNCAST(CMFCRibbonGallery, arButtons.GetAt(0)); if (pBtn != NULL && pBtn->GetSelectedItem() != -1) { weight = pBtn->GetSelectedItem() + 1; } return weight; }
BOOL CMainFrame::GetStyleFromStyles(XStyle& style) { CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arButtons; m_wndRibbonBar.GetElementsByID(ID_OBJECT_STYLES, arButtons); if (arButtons.GetSize() == 0) { return FALSE; } BOOL bRes = FALSE; CMFCRibbonGallery* pBtn = DYNAMIC_DOWNCAST(CMFCRibbonGallery, arButtons.GetAt(0)); if (pBtn != NULL && pBtn->GetSelectedItem() != -1) { style = c_Styles[pBtn->GetSelectedItem()]; bRes = TRUE; } return bRes; }