void CMainFrame::OnLvnItemchangedListGislayer(NMHDR *pNMHDR, LRESULT *pResult) { LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR); // TODO: Add your control notification handler code here *pResult = 0; CListCtrl * pGISLayerList = (CListCtrl *)m_GISLayerBar.GetDlgItem(IDC_LIST_GISLAYER); // determine which layer is active POSITION pos = pGISLayerList->GetFirstSelectedItemPosition(); if (pos != NULL) { int nItem = pGISLayerList->GetNextSelectedItem(pos); m_iSelectedLayer = (layer_mode) nItem; BOOL bChecked = pGISLayerList->GetCheck(nItem); m_bShowLayerMap[m_iSelectedLayer] = bChecked; } // detemine the selection status if(bLayerInitialized) { for(int nItem =0 ; nItem < pGISLayerList->GetItemCount(); nItem++) { BOOL bChecked = ListView_GetCheckState(pGISLayerList->m_hWnd,nItem); m_bShowLayerMap[(layer_mode) nItem] = bChecked; } } pGISLayerList->Invalidate (1); UpdateAllViews(); }
void CPPageExternalFilters::Exchange(CListCtrl& list, int i, int j) { CString text = list.GetItemText(i, 0); DWORD_PTR data = list.GetItemData(i); int check = list.GetCheck(i); bool selected = !!list.GetItemState(i, LVIS_SELECTED); list.SetItemText(i, 0, list.GetItemText(j, 0)); list.SetItemData(i, list.GetItemData(j)); list.SetCheck(i, list.GetCheck(j)); list.SetItemState(i, LVIS_SELECTED, list.GetItemState(j, LVIS_SELECTED)); list.SetItemText(j, 0, text); list.SetItemData(j, data); list.SetCheck(j, check); list.SetItemState(j, LVIS_SELECTED, selected ? LVIS_SELECTED : 0); int mark = list.GetSelectionMark(); if (mark == i) { list.SetSelectionMark(j); } else if (mark == j) { list.SetSelectionMark(i); } }
void CLevelTexturesOptionsDlg::OnOK() { //get the list CListCtrl* pList = ((CListCtrl*)GetDlgItem(IDC_LIST_TEXTURE_COLUMNS)); //run through the various detectors and add them to the list for(uint32 nCurrDet = 0; nCurrDet < pList->GetItemCount(); nCurrDet++) { //get the current detector CLevelTexturesColumn* pCol = (CLevelTexturesColumn*)pList->GetItemData(nCurrDet); //update the enabled status pCol->m_bEnabled = pList->GetCheck(nCurrDet); } CDialog::OnOK(); }
void CfsclientwDlg::OnBnClickedButdw() { CListCtrl* pl = (CListCtrl*)GetDlgItem(IDC_FLIST); file_info fi; vector<file_info> vfiles; char buf[MAX_PATH]; for (int i = 0; i < pl->GetItemCount(); i++) { if (pl->GetCheck(i) == 0) { continue; } pl->GetItemText(i, IDX_FILENAME, buf, sizeof(buf)); if (strcmp(buf, "..") == 0) { continue; } fi.basename = buf; pl->GetItemText(i, IDX_FULLNAME, buf, sizeof(buf)); fi.filename = buf; pl->GetItemText(i, IDX_FILEINFO, buf, sizeof(buf)); fi.isFolder = !strcmp(buf, "<enter>"); pl->GetItemText(i, IDX_FILESIZE, buf, sizeof(buf)); fi.filesize = str_i64(buf); vfiles.push_back(fi); } if (vfiles.size()) { m_dwWin.setDwFiles(vfiles); m_dwWin.DoModal(); return; } CEdit* pe = (CEdit*)GetDlgItem(IDC_EDIT_FILE); char filename[256]; pe->GetWindowText(filename, sizeof(filename)); if (filename[0] == 0) { MessageBox("Please select or input a file name", "no file name"); return; } if (filename[0] == '/' && filename[1] == 0) { MessageBox("Are your sure? you cannot download root directory", "wrong path"); return; } //regular file if (!str_endwith(filename, '/')) { file_info fi; //nameConvert(filename, fi); fi.filesize = m_dwM->getFileSize(filename); if (fi.filesize < 0) { MessageBox("404 file not found", "error"); return; } if (fi.filesize < 10) { MessageBox("I refuse to download file < 10 bytes", "error"); return; } fi.filename = filename; char* pt = strrchr(filename, '/'); if (pt) { fi.basename = pt + 1; } else { fi.basename = filename; } vfiles.push_back(fi); m_dwWin.setDwFiles(vfiles); } else //this is a folder, list files, give files and folder name to dw-win { size_t len = strlen(filename); filename[len - 1] = 0; m_dwM->dir(vfiles, filename); if (vfiles.size() == 0) { MessageBox("no files need to download", "error"); return; } char* pt = strrchr(filename, '/'); if (pt) { m_dwWin.setDwFiles(vfiles, pt + 1); } else { m_dwWin.setDwFiles(vfiles, filename); } } m_dwWin.DoModal(); }