void CVCDlg::InitDeviceComboBox() { ProfileNode* pRoot = ProfileMgr::GetInstance()->GetRootProfile(); int nChildCount = ((pRoot == NULL) ? 0 : pRoot->GetChildCount()); std::string szText; AttribMap* pAttribMap = NULL; for(int i = 0; i < nChildCount; i++) { ProfileNode* pProfile = (ProfileNode*)pRoot->GetChild(i); pAttribMap = (AttribMap*)pProfile->GetData(); if(!pAttribMap->Get(PF_ATTRIB_DESC, szText)) { pAttribMap->Get(PF_ATTRIB_NAME, szText); } LIST_ITEM item; item.strText = CFL_A2T(szText.c_str()); item.vpItemData = pProfile; m_deviceComboBox.AddItem(&item); } if(nChildCount > 0) { m_deviceComboBox.SetCurSel(0); OnCategorySelChanged(); } }
void CVCDlg::OnCategorySelChanged() { m_profileComboBox.DeleteAllItems(); int nCurSel = m_deviceComboBox.GetCurSel(); if(nCurSel >= 0) { ProfileNode* pParent = (ProfileNode*)m_deviceComboBox.GetItemDataPtr(nCurSel); int nChildCount = ((pParent == NULL) ? 0 : pParent->GetChildCount()); for(int i = 0; i < nChildCount; i++) { ProfileNode* pProfile = (ProfileNode*)pParent->GetChild(i); AddProfile(pProfile, NULL); } if(nChildCount > 0) { m_profileComboBox.SetCurSel(0); OnProfileSelChanged(); } } }