void CBCGPRibbonCustomizeRibbonPage::OnSelendokCategoryCombo() { ASSERT_VALID (m_pRibbonBar); CWaitCursor wait; UpdateData (); if (m_nCategory < 0) { return; } m_wndRibbonTreeSrc.SetRedraw(FALSE); DWORD_PTR dwData = m_wndCategoryCombo.GetItemData (m_nCategory); if (dwData == 0) // Tabs { int nTabs = m_bNoContextCategories ? 1 : m_nCategory - m_wndCategoryCombo.GetCount() + 3; m_wndRibbonTreeSrc.RebuildItems(nTabs, m_strMainTabs); } else { CArray<CBCGPBaseRibbonElement*, CBCGPBaseRibbonElement*> arElements; CBCGPRibbonCategory* pCategory = DYNAMIC_DOWNCAST(CBCGPRibbonCategory, (CObject*)dwData); if (pCategory != NULL) { ASSERT_VALID(pCategory); pCategory->GetElements(arElements); m_wndRibbonTreeSrc.RebuildItems(arElements); } else { CBCGPRibbonCustomGroup* pCustomCategory = DYNAMIC_DOWNCAST(CBCGPRibbonCustomGroup, (CObject*)dwData); if (pCustomCategory != NULL) { ASSERT_VALID(pCustomCategory); for (POSITION pos = pCustomCategory->m_lstIDs.GetHeadPosition(); pos != NULL;) { UINT uiCmd = pCustomCategory->m_lstIDs.GetNext(pos); if (uiCmd != 0 && uiCmd != (UINT)-1) { CBCGPBaseRibbonElement* pElem = m_pRibbonBar->FindByID (uiCmd, FALSE, FALSE); if (pElem != NULL) { arElements.Add(pElem); } } } m_wndRibbonTreeSrc.RebuildItems(arElements); } } } m_wndRibbonTreeSrc.SetRedraw(); m_wndRibbonTreeSrc.RedrawWindow(); }
//************************************************************************************* void CBCGPKeyMapDlg::OnSelchangeCategory() { UpdateData (); ASSERT (m_lpAccel != NULL); int iIndex = m_wndCategoryList.GetCurSel (); if (iIndex == LB_ERR) { return; } HINSTANCE hInstRes = AfxGetResourceHandle (); #ifndef BCGP_EXCLUDE_RIBBON if (m_pWndRibbonBar != NULL) { CBCGPRibbonCategory* pCategory = NULL; if (m_pWndRibbonBar->GetMainCategory () != NULL) { iIndex--; if (iIndex < 0) { pCategory = m_pWndRibbonBar->GetMainCategory (); } } if (pCategory == NULL) { pCategory = m_pWndRibbonBar->GetCategory (iIndex); } ASSERT_VALID(pCategory); CArray<CBCGPBaseRibbonElement*, CBCGPBaseRibbonElement*> arElements; pCategory->GetElements (arElements); AfxSetResourceHandle (m_hInstDefault); int nItem = 0; m_KeymapList.DeleteAllItems(); for (int i = 0; i < (int)arElements.GetSize (); i++) { CBCGPBaseRibbonElement* pElem = arElements [i]; ASSERT_VALID (pElem); if (!pElem->IsKindOf (RUNTIME_CLASS (CBCGPRibbonSeparator)) && pElem->GetID() > 0 && pElem->GetID() != (UINT) -1) { CString strLabel = pElem->GetToolTip(); if (strLabel.IsEmpty ()) { strLabel = pElem->GetText(); } if (!strLabel.IsEmpty()) { OnInsertItem(pElem, nItem); if (m_bItemWasAdded) { nItem++; } } } } } else #endif { CObList* pCategoryButtonsList = (CObList*) m_wndCategoryList.GetItemData (iIndex); ASSERT_VALID (pCategoryButtonsList); AfxSetResourceHandle (m_hInstDefault); int nItem = 0; m_KeymapList.DeleteAllItems(); for (POSITION pos = pCategoryButtonsList->GetHeadPosition (); pos != NULL;) { CBCGPToolbarButton* pButton = (CBCGPToolbarButton*) pCategoryButtonsList->GetNext (pos); ASSERT (pButton != NULL); if (pButton->m_nID > 0 && pButton->m_nID != (UINT) -1) { OnInsertItem (pButton, nItem); if (m_bItemWasAdded) { nItem++; } } } } m_KeymapList.SortItems (listCompareFunc, (LPARAM) this); AfxSetResourceHandle (hInstRes); }