| 28 | } |
| 29 | |
| 30 | INT_PTR SelectColumnsDialog::OnInitDialog() |
| 31 | { |
| 32 | HWND hListView = GetDlgItem(m_hDlg, IDC_COLUMNS_LISTVIEW); |
| 33 | SetWindowTheme(hListView, L"Explorer", nullptr); |
| 34 | |
| 35 | ListView_SetExtendedListViewStyleEx(hListView, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES); |
| 36 | |
| 37 | LVCOLUMN lvColumn; |
| 38 | lvColumn.mask = 0; |
| 39 | ListView_InsertColumn(hListView, 0, &lvColumn); |
| 40 | |
| 41 | auto currentColumns = m_shellBrowser->ExportCurrentColumns(); |
| 42 | |
| 43 | std::sort(currentColumns.begin(), currentColumns.end(), |
| 44 | std::bind(&SelectColumnsDialog::CompareColumns, this, std::placeholders::_1, |
| 45 | std::placeholders::_2)); |
| 46 | |
| 47 | int iItem = 0; |
| 48 | |
| 49 | for (const auto &column : currentColumns) |
| 50 | { |
| 51 | std::wstring text = ResourceHelper::LoadString( |
| 52 | GetInstance(), ShellBrowser::LookupColumnNameStringIndex(column.type)); |
| 53 | |
| 54 | LVITEM lvItem; |
| 55 | lvItem.mask = LVIF_TEXT | LVIF_PARAM; |
| 56 | lvItem.iItem = iItem; |
| 57 | lvItem.iSubItem = 0; |
| 58 | lvItem.pszText = text.data(); |
| 59 | lvItem.lParam = static_cast<LPARAM>(column.type); |
| 60 | ListView_InsertItem(hListView, &lvItem); |
| 61 | |
| 62 | ListView_SetCheckState(hListView, iItem, column.bChecked); |
| 63 | |
| 64 | iItem++; |
| 65 | } |
| 66 | |
| 67 | ListView_SetColumnWidth(hListView, 0, LVSCW_AUTOSIZE); |
| 68 | |
| 69 | ListViewHelper::SelectItem(hListView, 0, TRUE); |
| 70 | SetFocus(hListView); |
| 71 | |
| 72 | m_persistentSettings->RestoreDialogPosition(m_hDlg, true); |
| 73 | |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | wil::unique_hicon SelectColumnsDialog::GetDialogIcon(int iconWidth, int iconHeight) const |
| 78 | { |
nothing calls this directly
no test coverage detected