static void PopulateBuildOrder(HWND hwnd) { HWND hwndLV = GetDlgItem(hwnd, IDC_DEPENDS); LV_COLUMN lvC; RECT r; PROJECTITEM *temp; int rows = 0; CreateProjectDependenciesList(); ListView_DeleteAllItems(hwndLV); ListView_DeleteColumn(hwndLV, 1); ListView_DeleteColumn(hwndLV, 0); ListView_SetExtendedListViewStyle(hwndLV, 0); GetWindowRect(hwndLV, &r); lvC.mask = LVCF_WIDTH | LVCF_SUBITEM ; lvC.cx = r.right - r.left - 10; lvC.iSubItem = 0; ListView_InsertColumn(hwndLV, 0, &lvC); temp = workArea->projectBuildList; while (temp) { LV_ITEM item; memset(&item, 0, sizeof(item)); item.iItem = rows++; item.iSubItem = 0; item.mask = LVIF_TEXT | LVIF_PARAM; item.lParam = (LPARAM)temp; item.pszText = temp->displayName; ListView_InsertItem(hwndLV, &item); temp = temp->projectBuildList; } }
void InitLangList() { char colTitles[LANG_LINE_SIZE]; char *catStr; char lineStr[LANG_LINE_SIZE]; short i; short category = -1; changedSomeStrings = 0; alreadySaving = 0; // If we have already displayed (created) the list, // then week need to delete the column headings... this seems to do it... if ( hWndLangBuilderListView ) { ListView_DeleteColumn( hWndLangBuilderListView, EDIT_LANGUAGE_LISTVIEW_POS ); ListView_DeleteColumn( hWndLangBuilderListView, DEFAULT_ENGLISH_LISTVIEW_POS ); ListView_DeleteColumn( hWndLangBuilderListView, CATEGORY_NAME_LISTVIEW_POS ); } // Initialise the Language list, means creating the column titles and adding them, // then making sure there is no data in the list mystrncpyNull( colTitles, ReturnString( IDS_LANGBUILDER_LISTTITLES ), LANG_LINE_SIZE ); mystrncatNull( colTitles, MyPrefStruct.language, LANG_LINE_SIZE ); hWndLangBuilderListView = InitGenericListView( hDlg, IDC_LANGTOKEN_LIST, 0, 0, colTitles ); ListView_DeleteAllItems( hWndLangBuilderListView ); ListView_SetColumnWidth( hWndLangBuilderListView, CATEGORY_NAME_LISTVIEW_POS, 100 ); ListView_SetColumnWidth( hWndLangBuilderListView, DEFAULT_ENGLISH_LISTVIEW_POS, 200 ); ListView_SetColumnWidth( hWndLangBuilderListView, EDIT_LANGUAGE_LISTVIEW_POS, 200 ); // Add the Language strings to the list for ( i = SUMM_BEGIN; i < END_OF_STRINGS; i++ ) { catStr = GetLangSectionName(i); if ( !catStr ) continue; mystrncpyNull( lineStr, catStr, LANG_LINE_SIZE ); mystrncatNull( lineStr, LANG_LIST_SEP, LANG_LINE_SIZE ); mystrncatNull( lineStr, DefaultEnglishStr(i), LANG_LINE_SIZE ); mystrncatNull( lineStr, LANG_LIST_SEP, LANG_LINE_SIZE ); mystrncatNull( lineStr, TranslateID(i), LANG_LINE_SIZE ); AddItemToListView( hWndLangBuilderListView, ListView_GetItemCount(hWndLangBuilderListView), 3, lineStr, LANG_LIST_SEP ); } ListView_GetItemText( hWndLangBuilderListView, 0, EDIT_LANGUAGE_LISTVIEW_POS, lineStr, LANG_LINE_SIZE ); SetWindowText( GetDlgItem( hDlg, IDC_LANGTOKEN_TEXT), lineStr ); SetFocus( GetDlgItem( hDlg, IDC_LANGTOKEN_LIST ) ); int state = LVIS_SELECTED|LVIS_FOCUSED; if ( hWndLangBuilderListView ) ListView_SetItemState( hWndLangBuilderListView, 0, state, state ); }
void Dlg_AchievementsReporter::SetupColumns() { // Remove all columns, while (ListView_DeleteColumn(m_hList, 0)) {} // Remove all data. ListView_DeleteAllItems(m_hList); auto limit{ static_cast<int>(col_num) }; for (auto i = 0; i < limit; i++) { auto sStr{ std::string{col_names.at(to_unsigned(i))} }; // you can't do it directly // would be easier with delegates... // Probably should be made in to a class from repetition LV_COLUMN col { LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT, LVCFMT_LEFT | LVCFMT_FIXED_WIDTH, col_sizes.at(to_unsigned(i)), sStr.data(), 255, i }; if (i == limit - 1) //If the last element: fill to the end col.fmt |= LVCFMT_FILL; ListView_InsertColumn(m_hList, i, &col); } }
void Dlg_MemBookmark::SetupColumns( HWND hList ) { // Remove all columns, while ( ListView_DeleteColumn( hList, 0 ) ) {} // Remove all data. ListView_DeleteAllItems( hList ); LV_COLUMN col; ZeroMemory( &col, sizeof( col ) ); for ( size_t i = 0; i < NumColumns; ++i ) { col.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT; col.cx = COLUMN_WIDTH[ i ]; tstring colTitle = NativeStr( COLUMN_TITLE[ i ] ).c_str(); col.pszText = const_cast<LPTSTR>( colTitle.c_str() ); col.cchTextMax = 255; col.iSubItem = i; col.fmt = LVCFMT_CENTER | LVCFMT_FIXED_WIDTH; if ( i == NumColumns - 1 ) col.fmt |= LVCFMT_FILL; ListView_InsertColumn( hList, i, (LPARAM)&col ); } m_nNumOccupiedRows = 0; BOOL bSuccess = ListView_SetExtendedListViewStyle( hList, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_DOUBLEBUFFER ); bSuccess = ListView_EnableGroupView( hList, FALSE ); }
inline void CListView::DeleteAllColumns() { size_t nColumns = NumColumns(); while (nColumns-- > 0) (void)ListView_DeleteColumn(m_hWnd, 0); }
void Dlg_AchievementsReporter::SetupColumns( HWND hList ) { // Remove all columns, while( ListView_DeleteColumn( hList, 0 ) ) {} // Remove all data. ListView_DeleteAllItems( hList ); LV_COLUMN col; ZeroMemory( &col, sizeof( col ) ); for( size_t i = 0; i < SIZEOF_ARRAY( COL_TITLE ); ++i ) { col.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT; col.cx = COL_SIZE[ i ]; col.cchTextMax = 255; std::wstring sStrWide = Widen( COL_TITLE[ i ] ); col.pszText = const_cast<LPWSTR>( sStrWide.c_str() ); col.iSubItem = i; col.fmt = LVCFMT_LEFT | LVCFMT_FIXED_WIDTH; if( i == SIZEOF_ARRAY( COL_TITLE ) - 1 ) col.fmt |= LVCFMT_FILL; ListView_InsertColumn( hList, i, reinterpret_cast<LPARAM>( &col ) ); } ms_nNumOccupiedRows = 0; }
void CreateResultsColumns(HWND hwndResults, struct FindAddDlgData *dat, char *szProto) { SaveColumnSizes(hwndResults); while (ListView_DeleteColumn(hwndResults, 0)); ListView_SetImageList(hwndResults, dat->himlComboIcons, LVSIL_SMALL); LoadColumnSizes(hwndResults, szProto); }
void EditorApplication::updateObjectsPaletteGUI(int index) { if (!library) return; current_category_index = index; HWND hPaletteList=GetDlgItem(hLeftDlg, IDL_PALETTE_LIST); // Cleanup old palette if(ListView_GetItemCount(hPaletteList)!=0) { ListView_DeleteAllItems(hPaletteList); while(ListView_DeleteColumn(hPaletteList,0) > 0); ListView_SetItemCount(hPaletteList,0); } // Create new palette LibGens::ObjectCategory *object_category=library->getCategoryByIndex(current_category_index); if (object_category) { vector<LibGens::Object *> objects=object_category->getTemplates(); char temp[128]; for (size_t i=0; i<objects.size(); i++) { LV_ITEM Item; Item.mask = LVIF_TEXT; strcpy(temp, objects[i]->getName().c_str()); Item.pszText = temp; Item.cchTextMax = strlen(temp); Item.iSubItem = 0; Item.lParam = (LPARAM) NULL; Item.iItem = ListView_GetItemCount(hPaletteList); ListView_InsertItem(hPaletteList, &Item); } } }
void Dlg_GameLibrary::SetupColumns(HWND hList) { // Remove all columns, while (ListView_DeleteColumn(hList, 0)) {} // Remove all data. ListView_DeleteAllItems(hList); LV_COLUMN col; ZeroMemory(&col, sizeof(col)); for (size_t i = 0; i < SIZEOF_ARRAY(COL_TITLE); ++i) { col.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT; col.cchTextMax = 255; tstring sCol = COL_TITLE[i]; // scoped cache col.pszText = const_cast<LPTSTR>( sCol.c_str() ); col.cx = COL_SIZE[i]; col.iSubItem = i; col.fmt = LVCFMT_LEFT | LVCFMT_FIXED_WIDTH; if (i == SIZEOF_ARRAY(COL_TITLE) - 1) // Final column should fill { col.fmt |= LVCFMT_FILL; } ListView_InsertColumn(hList, i, reinterpret_cast<LPARAM>(&col)); } }
// // SetListColumns // // BOOL CProgramProperties::SetListColumns() { LV_COLUMN lvColumn; int i; TCHAR szString[NUM_OF_PROGRAM_SUBITEM_COLUMN+1][MAX_LEN] = {TEXT("Program Number"), TEXT("PMT PID") }; //empty the list ListView_DeleteAllItems(m_hwndProgList); for(i = 0; i < NUM_OF_PROGRAM_SUBITEM_COLUMN; i++) { ListView_DeleteColumn(m_hwndProgList, 0); } //initialize the columns lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvColumn.fmt = LVCFMT_LEFT; for(i = 0; i < NUM_OF_PROGRAM_SUBITEM_COLUMN; i++) { lvColumn.pszText = szString[i]; lvColumn.iSubItem = i; lvColumn.cx = 180; if( ListView_InsertColumn(m_hwndProgList, i, &lvColumn) == -1) return FALSE; } return TRUE; }
// // SetListColumns // BOOL CProgramProperties::SetEsListColumns() { LV_COLUMN lvColumn; int i; TCHAR szString[NUM_OF_ES_SUBITEM_COLUMN+1][MAX_LEN] = {TEXT("PID"), TEXT("Stream Type"),TEXT("Contents") }; //empty the list ListView_DeleteAllItems(m_hwndEsList); for(i = 0; i < NUM_OF_ES_SUBITEM_COLUMN; i++) { ListView_DeleteColumn(m_hwndEsList, 0); } //initialize the columns lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvColumn.fmt = LVCFMT_LEFT; for(i = 0; i < NUM_OF_ES_SUBITEM_COLUMN; i++) { lvColumn.pszText = szString[i]; lvColumn.iSubItem = i; if( ListView_InsertColumn(m_hwndEsList, i, &lvColumn) == -1) return FALSE; } ListView_SetColumnWidth(m_hwndEsList, 0, 50); ListView_SetColumnWidth(m_hwndEsList, 1, 80); ListView_SetColumnWidth(m_hwndEsList, 2, 220); return TRUE; }
HRESULT CCListBox::ShowHeader(int nParts, LIST_COLUMN * Strings) { LVCOLUMN col; col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; m_nColumns = nParts; int i; for (i = 0 ; i <nParts; i++) { col.pszText = Strings[i].Title; col.cx=Strings[i].Size; col.fmt = Strings[i].Orientation; col.iSubItem = i; ListView_InsertColumn(m_hWnd, i, &col); } // Delete all columns to the right of these, just to make sure we're done. while(ListView_DeleteColumn(m_hWnd, i) == TRUE) { } return 0; }
static void FillListView(void) { IXMLDOMDocument* pXMLDom = NULL; if (!SUCCEEDED(InitXMLDOMParser())) return; if (SUCCEEDED(CreateAndInitXMLDOMDocument(&pXMLDom))) { // Load the internal tools list. if (LoadXMLDocumentFromResource(pXMLDom, L"MSCFGTL.XML")) ParseToolsList(pXMLDom, TRUE); // Try to load the user-provided tools list. If it doesn't exist, // then the second list-view's column "Standard" tool is removed. if (LoadXMLDocumentFromFile(pXMLDom, L"MSCFGTLC.XML", TRUE)) ParseToolsList(pXMLDom, FALSE); else ListView_DeleteColumn(hToolsListCtrl, 1); } SAFE_RELEASE(pXMLDom); UninitXMLDOMParser(); }
static void _resetStringList ( HWND hDlg ) { ListView_DeleteAllItems(GetDlgItem(hDlg, IDC_STRINGLIST)); while (ListView_DeleteColumn(GetDlgItem(hDlg, IDC_STRINGLIST), 0)); }
static void PopulateProject(HWND hwnd, PROJECTITEM *proj) { PROJECTITEM * temp; HWND hwndLV = GetDlgItem(hwnd, IDC_DEPENDS); LV_COLUMN lvC; RECT r; int rows = 0; ListView_DeleteAllItems(hwndLV); ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); ListView_DeleteColumn(hwndLV, 1); ListView_DeleteColumn(hwndLV, 0); GetWindowRect(hwndLV, &r); lvC.mask = LVCF_WIDTH | LVCF_SUBITEM ; lvC.cx = 20; lvC.iSubItem = 0; ListView_InsertColumn(hwndLV, 0, &lvC); lvC.mask = LVCF_WIDTH | LVCF_SUBITEM; lvC.cx = r.right - r.left - 24; lvC.iSubItem = 1; ListView_InsertColumn(hwndLV, 1, &lvC); temp = workArea->children; while (temp) { if (temp != proj) { int v; LV_ITEM item; memset(&item, 0, sizeof(item)); item.iItem = rows++; item.iSubItem = 0; item.mask = LVIF_PARAM; item.lParam = (LPARAM)temp; item.pszText = ""; // LPSTR_TEXTCALLBACK ; v = ListView_InsertItem(hwndLV, &item); if (hasDepend(proj, temp)) { ListView_SetCheckState(hwndLV, v, TRUE); } } temp = temp->next; } }
VOID ListView_DeleteAllColumns() { UINT8 columnCount; int i; columnCount = ListView_Columns; for (i = 0; i < columnCount; i++) ListView_DeleteColumn(0); }
int set_columns(HWND hlistview) { int i,max; char *cols[]={ "DISPLAYNAME","REGKEY" }; max=lv_get_column_count(hlistview); for(i=0;i<max;i++){ ListView_DeleteColumn(hlistview,0); } for(i=0;i<sizeof(cols)/sizeof(char *);i++){ lv_add_column(hlistview,cols[i],i); } }
BOOL wbClearListViewColumns(PWBOBJ pwbo) { int i, nCols; if(!pwbo || !pwbo->hwnd || !IsWindow(pwbo->hwnd)) return FALSE; nCols = wbGetListViewColumnWidths(pwbo, NULL) - 1; // Must delete in reverse, otherwise it won't work for(i = nCols; i >= 0; i--) ListView_DeleteColumn(pwbo->hwnd, i); return TRUE; }
/// Deletes the list view columns void MainWindow::delete_columns() { ListView_DeleteAllItems(m_hWndTable); // column 0 can't be deleted, so we gotta fake around it const int count = Header_GetItemCount(ListView_GetHeader(m_hWndTable)); LVCOLUMN lvc; lvc.mask = LVCF_WIDTH; lvc.cx = 0; ListView_InsertColumn(m_hWndTable, 0, &lvc); for(int i=0; i<count; ++i) ListView_DeleteColumn(m_hWndTable, 1); }
void pListView::setHeaderText(const lstring &list) { while(ListView_DeleteColumn(hwnd, 0)); lstring headers = list; if(headers.size() == 0) headers.append(""); //must have at least one column for(unsigned n = 0; n < headers.size(); n++) { LVCOLUMN column; column.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM; column.fmt = LVCFMT_LEFT; column.iSubItem = n; utf16_t headerText(headers[n]); column.pszText = headerText; ListView_InsertColumn(hwnd, n, &column); } autoSizeColumns(); }
void ProcessPage_OnViewSelectColumns(void) { int i; if (DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_COLUMNS_DIALOG), hMainWnd, ColumnsDialogWndProc) == IDOK) { for (i=Header_GetItemCount(hProcessPageHeaderCtrl)-1; i>=0; i--) { (void)ListView_DeleteColumn(hProcessPageListCtrl, i); } for (i=0; i<COLUMN_NMAX; i++) { TaskManagerSettings.ColumnOrderArray[i] = i; TaskManagerSettings.ColumnSizeArray[i] = ColumnPresets[i].size; } AddColumns(); } }
void TableViewImpl::deleteColumn(int c) { if( ListView_DeleteColumn(hWnd,c) == FALSE ) { log::error("ListView_DeleteColumn returned FALSE for hWnd ",hWnd); } }
void CSetPgDebug::SetLoggingType(GuiLoggingType aNewLogType) { m_ActivityLoggingType = aNewLogType; HWND hList = GetDlgItem(mh_Dlg, lbActivityLog); ListView_DeleteAllItems(hList); for (int c = 0; (c <= 40) && ListView_DeleteColumn(hList, 0); c++) ; //ListView_DeleteAllItems(hDetails); //for (int c = 0; (c <= 40) && ListView_DeleteColumn(hDetails, 0); c++); SetDlgItemText(mh_Dlg, ebActivityApp, L""); SetDlgItemText(mh_Dlg, ebActivityParm, L""); if ((m_ActivityLoggingType == glt_Processes) || (m_ActivityLoggingType == glt_Shell)) { LVCOLUMN col = { LVCF_WIDTH|LVCF_TEXT|LVCF_FMT, LVCFMT_LEFT, gpSetCls->EvalSize(80, esf_Horizontal|esf_CanUseDpi)}; wchar_t szTitle[64]; col.pszText = szTitle; ListView_SetExtendedListViewStyleEx(hList,LVS_EX_FULLROWSELECT,LVS_EX_FULLROWSELECT); ListView_SetExtendedListViewStyleEx(hList,LVS_EX_LABELTIP|LVS_EX_INFOTIP,LVS_EX_LABELTIP|LVS_EX_INFOTIP); wcscpy_c(szTitle, L"Time"); ListView_InsertColumn(hList, lpc_Time, &col); col.cx = gpSetCls->EvalSize(60, esf_Horizontal|esf_CanUseDpi); col.fmt = LVCFMT_RIGHT; wcscpy_c(szTitle, L"PPID"); ListView_InsertColumn(hList, lpc_PPID, &col); col.cx = gpSetCls->EvalSize(60, esf_Horizontal|esf_CanUseDpi); col.fmt = LVCFMT_LEFT; wcscpy_c(szTitle, L"Func"); ListView_InsertColumn(hList, lpc_Func, &col); col.cx = gpSetCls->EvalSize(50, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"Oper"); ListView_InsertColumn(hList, lpc_Oper, &col); col.cx = gpSetCls->EvalSize(40, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"Bits"); ListView_InsertColumn(hList, lpc_Bits, &col); wcscpy_c(szTitle, L"Syst"); ListView_InsertColumn(hList, lpc_System, &col); col.cx = gpSetCls->EvalSize(120, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"App"); ListView_InsertColumn(hList, lpc_App, &col); wcscpy_c(szTitle, L"Params"); ListView_InsertColumn(hList, lpc_Params, &col); //wcscpy_c(szTitle, L"CurDir"); ListView_InsertColumn(hList, 7, &col); col.cx = gpSetCls->EvalSize(120, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"Flags"); ListView_InsertColumn(hList, lpc_Flags, &col); col.cx = gpSetCls->EvalSize(80, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"StdIn"); ListView_InsertColumn(hList, lpc_StdIn, &col); wcscpy_c(szTitle, L"StdOut"); ListView_InsertColumn(hList, lpc_StdOut, &col); wcscpy_c(szTitle, L"StdErr"); ListView_InsertColumn(hList, lpc_StdErr, &col); } else if (m_ActivityLoggingType == glt_Input) { LVCOLUMN col = { LVCF_WIDTH|LVCF_TEXT|LVCF_FMT, LVCFMT_LEFT, gpSetCls->EvalSize(80, esf_Horizontal|esf_CanUseDpi)}; wchar_t szTitle[64]; col.pszText = szTitle; ListView_SetExtendedListViewStyleEx(hList,LVS_EX_FULLROWSELECT,LVS_EX_FULLROWSELECT); ListView_SetExtendedListViewStyleEx(hList,LVS_EX_LABELTIP|LVS_EX_INFOTIP,LVS_EX_LABELTIP|LVS_EX_INFOTIP); wcscpy_c(szTitle, L"Time"); ListView_InsertColumn(hList, lic_Time, &col); col.cx = gpSetCls->EvalSize(50, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"Type"); ListView_InsertColumn(hList, lic_Type, &col); col.cx = gpSetCls->EvalSize(50, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"##"); ListView_InsertColumn(hList, lic_Dup, &col); col.cx = gpSetCls->EvalSize(300, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"Event"); ListView_InsertColumn(hList, lic_Event, &col); } else if (m_ActivityLoggingType == glt_Commands) { mn_ActivityCmdStartTick = timeGetTime(); LVCOLUMN col = { LVCF_WIDTH|LVCF_TEXT|LVCF_FMT, LVCFMT_LEFT, gpSetCls->EvalSize(60, esf_Horizontal|esf_CanUseDpi)}; wchar_t szTitle[64]; col.pszText = szTitle; ListView_SetExtendedListViewStyleEx(hList,LVS_EX_FULLROWSELECT,LVS_EX_FULLROWSELECT); ListView_SetExtendedListViewStyleEx(hList,LVS_EX_LABELTIP|LVS_EX_INFOTIP,LVS_EX_LABELTIP|LVS_EX_INFOTIP); col.cx = gpSetCls->EvalSize(50, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"In/Out"); ListView_InsertColumn(hList, lcc_InOut, &col); col.cx = gpSetCls->EvalSize(70, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"Time"); ListView_InsertColumn(hList, lcc_Time, &col); col.cx = gpSetCls->EvalSize(60, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"Duration"); ListView_InsertColumn(hList, lcc_Duration, &col); col.cx = gpSetCls->EvalSize(50, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"Cmd"); ListView_InsertColumn(hList, lcc_Command, &col); wcscpy_c(szTitle, L"Size"); ListView_InsertColumn(hList, lcc_Size, &col); wcscpy_c(szTitle, L"PID"); ListView_InsertColumn(hList, lcc_PID, &col); col.cx = gpSetCls->EvalSize(300, esf_Horizontal|esf_CanUseDpi); wcscpy_c(szTitle, L"Pipe"); ListView_InsertColumn(hList, lcc_Pipe, &col); wcscpy_c(szTitle, L"Extra"); ListView_InsertColumn(hList, lcc_Extra, &col); } else { LVCOLUMN col = { LVCF_WIDTH|LVCF_TEXT|LVCF_FMT, LVCFMT_LEFT, gpSetCls->EvalSize(60, esf_Horizontal|esf_CanUseDpi)}; wchar_t szTitle[4]; col.pszText = szTitle; wcscpy_c(szTitle, L" "); ListView_InsertColumn(hList, 0, &col); //ListView_InsertColumn(hDetails, 0, &col); } ListView_DeleteAllItems(GetDlgItem(mh_Dlg, lbActivityLog)); gpConEmu->OnGlobalSettingsChanged(); }
static INT_PTR CALLBACK LangOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { HWND hwndList = GetDlgItem(hwndDlg, IDC_LANGLIST); LVITEM lvi; switch(msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); hwndLangOpt = hwndDlg; ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT|LVS_EX_LABELTIP); ListView_SetImageList(hwndList, CreateRadioImages(ListView_GetBkColor(hwndList), ListView_GetTextColor(hwndList)), LVSIL_STATE); /* auto-destroyed */ { LVCOLUMN lvc; lvc.mask = LVCF_TEXT; lvc.pszText = TranslateT("Installed Languages"); ListView_InsertColumn(hwndList, 0, &lvc); } if ( ServiceExists(MS_FLAGS_LOADFLAGICON)) ListView_SetImageList(hwndList, ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR24, 8, 8), LVSIL_SMALL); TCHAR szPath[MAX_PATH]; GetPackPath(szPath, SIZEOF(szPath), FALSE, _T("")); SetDlgItemText(hwndDlg, IDC_SKINROOTFOLDER, szPath); SendMessage(hwndDlg, M_RELOADLIST, 0, 0); SendMessage(hwndDlg, M_SHOWFILECOL, 0, 1); return TRUE; case M_RELOADLIST: /* init list */ ListView_DeleteAllItems(hwndList); ListView_DeleteColumn(hwndList, 1); /* if present */ { HIMAGELIST himl = ListView_GetImageList(hwndList, LVSIL_SMALL); ImageList_RemoveAll(himl); /* enum all packs */ EnumPacks(InsertPackItemEnumProc, _T("langpack_*.txt"), "Miranda Language Pack Version 1", (WPARAM)hwndList, (LPARAM)himl); /* make it use current langpack locale for sort */ ListView_SortItems(hwndList, CompareListItem, CallService(MS_LANGPACK_GETLOCALE, 0, 0)); //CheckDlgButton(hwndDlg, IDC_ENABLEAUTOUPDATES, db_get_b(NULL, "LangMan", "EnableAutoUpdates", SETTING_ENABLEAUTOUPDATES_DEFAULT) != 0); /* show selection */ int iItem = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED); if (iItem != -1) ListView_EnsureVisible(hwndList, iItem, FALSE); } return TRUE; case M_SHOWFILECOL: if ((BOOL)lParam && ListView_GetItemCount(hwndList) > 1) { /* add column */ LVCOLUMN lvc; ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE_USEHEADER); lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; lvc.pszText = TranslateT("File"); lvc.cx = 160; ListView_InsertColumn(hwndList, lvc.iSubItem = 1, &lvc); ListView_SetColumnWidth(hwndList, 0, ListView_GetColumnWidth(hwndList, 0) - lvc.cx); /* add text */ lvi.mask = LVIF_PARAM; lvi.iSubItem = 0; for (lvi.iItem = 0; ListView_GetItem(hwndList, &lvi); ++lvi.iItem) { LANGPACK_INFO *pack = (LANGPACK_INFO*)lvi.lParam; ListView_SetItemText(hwndList, lvi.iItem, 1, (pack->flags&LPF_DEFAULT) ? TranslateT("built-in") : pack->szFileName); } } else { ListView_DeleteColumn(hwndList, 1); ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE_USEHEADER); } return TRUE; case WM_DESTROY: ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_LANGLIST)); return TRUE; case WM_THEMECHANGED: case WM_SETTINGCHANGE: { HIMAGELIST himl = ListView_SetImageList(hwndList, CreateRadioImages(ListView_GetBkColor(hwndList), ListView_GetTextColor(hwndList)), LVSIL_STATE); /* auto-destroyed */ if (himl != NULL) ImageList_Destroy(himl); } break; case WM_CTLCOLORLISTBOX: /* mimic readonly edit */ return (BOOL)SendMessage(hwndDlg, WM_CTLCOLORSTATIC, wParam, lParam); case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_LANGEMAIL: { char buf[512]; lstrcpyA(buf, "mailto:"); if (GetWindowTextA(GetDlgItem(hwndDlg, LOWORD(wParam)), &buf[7], sizeof(buf)-7)) CallService(MS_UTILS_OPENURL, FALSE, (LPARAM)buf); return TRUE; } case IDC_MORELANG: CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)"http://miranda-ng.org/"); return TRUE; } break; case WM_CONTEXTMENU: if (GetDlgCtrlID((HWND)wParam) == IDC_LANGLIST) { /* get item */ LVHITTESTINFO hti; POINTSTOPOINT(hti.pt, MAKEPOINTS(lParam)); if (hti.pt.x == -1 && hti.pt.y == -1) { /* keyboard invoked */ hti.iItem = ListView_GetNextItem((HWND)wParam, -1, LVNI_SELECTED); if (hti.iItem != -1) break; RECT rc; if (!ListView_GetItemRect((HWND)wParam, hti.iItem, &rc, LVIR_SELECTBOUNDS)) break; hti.pt.x = rc.left + (rc.right - rc.left) / 2; hti.pt.y = rc.top + (rc.bottom - rc.top) / 2; ClientToScreen((HWND)wParam, &hti.pt); } else { ScreenToClient((HWND)wParam, &hti.pt); if (ListView_HitTest((HWND)wParam, &hti) == -1 || !(hti.flags&LVHT_ONITEM)) break; POINTSTOPOINT(hti.pt, MAKEPOINTS(lParam)); } /* param */ lvi.iItem = hti.iItem; lvi.iSubItem = 0; lvi.mask = LVIF_PARAM; if (!ListView_GetItem((HWND)wParam, &lvi)) break; /* context menu */ LANGPACK_INFO *pack = (LANGPACK_INFO*)lvi.lParam; if (!(pack->flags & LPF_DEFAULT)) { HMENU hContextMenu = CreatePopupMenu(); if (hContextMenu != NULL) { AppendMenu(hContextMenu, MF_STRING, 2, TranslateT("&Remove...")); if (TrackPopupMenuEx(hContextMenu, TPM_RETURNCMD | TPM_NONOTIFY | TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_HORPOSANIMATION | TPM_VERPOSANIMATION, hti.pt.x, hti.pt.y, (HWND)wParam, NULL)) DeletePackFile(hwndDlg, (HWND)wParam, hti.iItem, pack); DestroyMenu(hContextMenu); } } return TRUE; } break; case WM_NOTIFYFORMAT: SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, NFR_UNICODE); return TRUE; case WM_NOTIFY: NMHDR *nmhdr = (NMHDR*)lParam; switch (nmhdr->idFrom) { case IDC_LANGLIST: switch (nmhdr->code) { case LVN_DELETEITEM: lvi.iItem = ((NMLISTVIEW*)lParam)->iItem; /* nmlv->lParam is invalid */ lvi.iSubItem = 0; lvi.mask = LVIF_PARAM; if (ListView_GetItem(nmhdr->hwndFrom, &lvi)) mir_free((LANGPACK_INFO*)lvi.lParam); break; case LVN_ITEMCHANGED: { NMLISTVIEW *nmlv = (NMLISTVIEW*)lParam; if (!(nmlv->uChanged&LVIF_STATE)) break; /* display info and check radio item */ if (nmlv->uNewState&LVIS_SELECTED && !(nmlv->uOldState&LVIS_SELECTED)) { ListView_SetItemState(nmhdr->hwndFrom, nmlv->iItem, INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK); DisplayPackInfo(hwndDlg, (LANGPACK_INFO*)nmlv->lParam); } /* disable all other radio items */ else if (nmlv->uNewState&INDEXTOSTATEIMAGEMASK(2)) { for (int iItem = ListView_GetItemCount(nmhdr->hwndFrom) - 1; iItem != -1; --iItem) if (iItem != nmlv->iItem) ListView_SetItemState(nmhdr->hwndFrom, iItem, INDEXTOSTATEIMAGEMASK(1), LVIS_STATEIMAGEMASK); /* enable apply */ if (nmlv->uOldState) { SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); ShowWindow(GetDlgItem(hwndDlg, IDC_RESTART), SW_SHOW); } } } break; case LVN_KEYDOWN: { int iItem = ListView_GetNextItem(nmhdr->hwndFrom, -1, LVNI_SELECTED); switch (((NMLVKEYDOWN*)lParam)->wVKey) { case VK_SPACE: ListView_SetItemState(nmhdr->hwndFrom, iItem, INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK); break; case VK_DELETE: lvi.iItem = iItem; lvi.iSubItem = 0; lvi.mask = LVIF_PARAM; if (ListView_GetItem(nmhdr->hwndFrom, &lvi)) { LANGPACK_INFO *pack = (LANGPACK_INFO*)lvi.lParam; if (!(pack->flags&LPF_DEFAULT)) DeletePackFile(hwndDlg, nmhdr->hwndFrom, iItem, pack); } break; } } break; case NM_CLICK: LVHITTESTINFO hti; lParam = GetMessagePos(); POINTSTOPOINT(hti.pt, MAKEPOINTS(lParam)); ScreenToClient(nmhdr->hwndFrom, &hti.pt); if (ListView_HitTest(nmhdr->hwndFrom, &hti) != -1) if (hti.flags&(LVHT_ONITEMSTATEICON | LVHT_ONITEMICON)) /* one of them */ ListView_SetItemState(nmhdr->hwndFrom, hti.iItem, LVIS_SELECTED, LVIS_SELECTED); } break; case 0: switch (nmhdr->code) { case PSN_APPLY: lvi.mask = LVIF_STATE | LVIF_PARAM; lvi.stateMask = LVIS_STATEIMAGEMASK; lvi.iSubItem = 0; for (lvi.iItem = 0; ListView_GetItem(hwndList, &lvi); ++lvi.iItem) { LANGPACK_INFO *pack = (LANGPACK_INFO*)lvi.lParam; if (lvi.state&INDEXTOSTATEIMAGEMASK(2) && !(pack->flags & LPF_ENABLED)) { if(!(pack->flags & LPF_DEFAULT)) db_set_ws(NULL, "LangMan", "Langpack", pack->szFileName); else db_unset(NULL, "LangMan", "Langpack"); TCHAR szPath[MAX_PATH]; GetPackPath(szPath, SIZEOF(szPath), FALSE, pack->szFileName); CallService(MS_LANGPACK_RELOAD, 0, (LPARAM)szPath); pack->flags |= LPF_ENABLED; CloseWindow(GetParent(hwndDlg)); DestroyWindow(GetParent(hwndDlg)); } else pack->flags &= ~LPF_ENABLED; } return TRUE; } } break; } return FALSE; }
void ListView::ColumnsProxy::Clear() const { while (ListView_DeleteColumn( control, 0 )); }
INT_PTR CALLBACK DialogProc( _In_ HWND hDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam ) { UNREFERENCED_PARAMETER(lParam); switch (uMsg) { case WM_INITDIALOG: //全列削除 while (Header_GetItemCount(ListView_GetHeader(GetDlgItem(hDlg, IDC_LIST2)))) ListView_DeleteColumn(GetDlgItem(hDlg, IDC_LIST2), 0); //列作成 { LV_COLUMN lvcol = { 0, }; TCHAR Title[255]; TCHAR StartBlock[255]; lvcol.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvcol.fmt = LVCFMT_LEFT; lvcol.cx = 100; if (LoadString(hInst, IDS_COLUMN_TITLE, Title, sizeof(Title) / sizeof(Title[0]))) { lvcol.pszText = Title; } lvcol.iSubItem = 0; ListView_InsertColumn(GetDlgItem(hDlg, IDC_LIST2), 0, &lvcol); if (LoadString(hInst, IDS_COLUMN_STARTBLOCK, StartBlock, sizeof(StartBlock) / sizeof(StartBlock[0]))) { lvcol.pszText = StartBlock; } lvcol.iSubItem = 1; ListView_InsertColumn(GetDlgItem(hDlg, IDC_LIST2), 1, &lvcol); } return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { DestroyWindow(hDlg); return (INT_PTR)TRUE; } else if (LOWORD(wParam) == IDC_BUTTON_FROMFILE) { ReadFromFile(); } else if (LOWORD(wParam) == IDC_BUTTON_FROMCARD) { ReadFromCard(); } else if (LOWORD(wParam) == IDC_BUTTON_TOFILE) { WriteToFile(); } else if (LOWORD(wParam) == IDC_BUTTON_TOCARD) { WriteToCard(); } break; case WM_DESTROY: PostQuitMessage(0); break; } return (INT_PTR)FALSE; }
void CManageBookmarksDialog::OnListViewHeaderRClick() { DWORD dwCursorPos = GetMessagePos(); POINT ptCursor; ptCursor.x = GET_X_LPARAM(dwCursorPos); ptCursor.y = GET_Y_LPARAM(dwCursorPos); HMENU hMenu = CreatePopupMenu(); int iItem = 0; for each(auto ci in m_pmbdps->m_vectorColumnInfo) { TCHAR szColumn[128]; GetColumnString(ci.ColumnType,szColumn,SIZEOF_ARRAY(szColumn)); MENUITEMINFO mii; mii.cbSize = sizeof(mii); mii.fMask = MIIM_ID|MIIM_STRING|MIIM_STATE; mii.wID = ci.ColumnType; mii.dwTypeData = szColumn; mii.fState = 0; if(ci.bActive) { mii.fState |= MFS_CHECKED; } /* The name column cannot be removed. */ if(ci.ColumnType == CManageBookmarksDialogPersistentSettings::COLUMN_TYPE_NAME) { mii.fState |= MFS_DISABLED; } InsertMenuItem(hMenu,iItem,TRUE,&mii); ++iItem; } int iCmd = TrackPopupMenu(hMenu,TPM_LEFTALIGN|TPM_RETURNCMD,ptCursor.x,ptCursor.y,0,m_hDlg,NULL); DestroyMenu(hMenu); int iColumn = 0; for(auto itr = m_pmbdps->m_vectorColumnInfo.begin();itr != m_pmbdps->m_vectorColumnInfo.end();++itr) { if(itr->ColumnType == iCmd) { HWND hListView = GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_LISTVIEW); if(itr->bActive) { itr->iWidth = ListView_GetColumnWidth(hListView,iColumn); ListView_DeleteColumn(hListView,iColumn); } else { LVCOLUMN lvCol; TCHAR szTemp[128]; GetColumnString(itr->ColumnType,szTemp,SIZEOF_ARRAY(szTemp)); lvCol.mask = LVCF_TEXT|LVCF_WIDTH; lvCol.pszText = szTemp; lvCol.cx = itr->iWidth; ListView_InsertColumn(hListView,iColumn,&lvCol); HWND hTreeView = GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_TREEVIEW); HTREEITEM hSelected = TreeView_GetSelection(hTreeView); CBookmarkFolder &BookmarkFolder = m_pBookmarkTreeView->GetBookmarkFolderFromTreeView(hSelected); int iItem = 0; for(auto itrBookmarks = BookmarkFolder.begin();itrBookmarks != BookmarkFolder.end();++itrBookmarks) { TCHAR szColumn[256]; GetBookmarkItemColumnInfo(*itrBookmarks,itr->ColumnType,szColumn,SIZEOF_ARRAY(szColumn)); ListView_SetItemText(hListView,iItem,iColumn,szColumn); ++iItem; } } itr->bActive = !itr->bActive; break; } else { if(itr->bActive) { ++iColumn; } } } }
/*--------------------------------*/ void refresh() //odswiezanie widoku ListView { LVCOLUMN col; //struktura kolumny w kontrolce ListView HIMAGELIST hImgList; //lista obrazków, wykorzystana potem w ListView //RECT rect; DWORD pid; TBBUTTON tbb, *ptbb, tmp; char txt[256], *ptxt, path[512]; HWND hOkno; HICON hIcon = NULL; HANDLE hproc; SetCursor(LoadCursor(NULL, IDC_WAIT)); //zmiana kursora na klepsydrê, by u¿ytkownik //wiedzia³, ¿e coœ siê dzieje if (!hPasek) //je¿eli nie znany jest jeszcze uchwyt paska zadañ { hPasek = FindWindowEx(NULL, NULL, "Shell_TrayWnd", NULL); EnumChildWindows(hPasek, EnumChildProc, (LPARAM)txt); col.pszText = txt; col.cchTextMax = strlen(txt); GetWindowThreadProcessId(hPasek, &pid); //pobieranie ID procesu explorera proces = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ, false, pid); //otwieranie procesu explorera } else //je¿eli mamy ju¿ uchwyt paska zadañ { col.mask = LVCF_TEXT; col.pszText = txt; //tytu³ kolumny col.cchTextMax = 256; //maksymalny rozmiar tytu³u kolumny ListView_GetColumn(hList, 0, &col); ListView_DeleteAllItems(hList); ListView_DeleteColumn(hList, 0); ListView_DeleteColumn(hList, 0); } /*---alokowanie pamiêci dla przycisku i jego nazwy---*/ ptbb = (TBBUTTON*)VirtualAllocEx(proces, NULL, sizeof(TBBUTTON), MEM_COMMIT, PAGE_READWRITE); ptxt = (char*)VirtualAllocEx(proces, NULL, 256, MEM_COMMIT, PAGE_READWRITE); ile = SendMessage(hPasek, TB_BUTTONCOUNT, 0, 0); hImgList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, ile-1, 0); ListView_SetImageList(hList, hImgList, LVSIL_SMALL); item.mask = LVIF_STATE | LVIF_IMAGE | LVIF_INDENT | LVIF_PARAM | LVIF_TEXT; item.iItem = 0; item.iSubItem = 0; col.cx = 400; col.mask = LVCF_TEXT | LVCF_WIDTH; col.iSubItem = 0; ListView_InsertColumn(hList, 0, &col); strcpy(txt, "Stan"); col.iSubItem = 1; col.cx = 70; ListView_InsertColumn(hList, 1, &col); for (int i = 0; i < ile; i++) { SendMessage(hPasek, TB_GETBUTTON, (WPARAM)i, (LPARAM)ptbb); ReadProcessMemory(proces, (void*)ptbb, (void*)&tbb, sizeof(TBBUTTON), NULL); SendMessage(hPasek, TB_GETBUTTONTEXT, (WPARAM)tbb.idCommand, (LPARAM)ptxt); ReadProcessMemory(proces, (void*)ptxt, (void*)txt, 256, NULL); item.pszText = txt; item.cchTextMax = 256; item.iItem = i; item.iSubItem = 0; hIcon = NULL; if (tbb.fsStyle & BTNS_WHOLEDROPDOWN) //je¿eli przycisk jest przyciskiem grupowym { SendMessage(hPasek, TB_GETBUTTON, (WPARAM)(i+1), (LPARAM)ptbb); //i+1, by pobraæ ikonê przycisku tej grupy ReadProcessMemory(proces, (void*)ptbb, (void*)&tmp, sizeof(TBBUTTON), NULL); ReadProcessMemory(proces, (void*)tmp.dwData, (void*)&hOkno, sizeof(HWND), NULL); if (!hIcon) { GetWindowThreadProcessId(hOkno, &pid); hproc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, pid); GetModuleFileNameEx(hproc, NULL, path, 512); ExtractIconEx(path, 0, NULL, &hIcon, 1); CloseHandle(hproc); } if (!hIcon) hIcon = LoadIcon(NULL, IDI_APPLICATION); item.iImage = ImageList_AddIcon(hImgList, hIcon); item.iIndent = 0; } else { //w tbb.dwData umieszczony jest uchwyt do okna skojarzonego z przyciskiem ReadProcessMemory(proces, (void*)tbb.dwData, (void*)&hOkno, sizeof(HWND), NULL); if (!hIcon) hIcon = (HICON)SendMessage(hOkno, WM_GETICON, ICON_SMALL, 0); if (!hIcon) hIcon = (HICON)SendMessage(hOkno, WM_GETICON, ICON_BIG, 0); if (!hIcon) hIcon = (HICON)GetClassLong(hOkno, GCL_HICONSM); if (!hIcon) hIcon = (HICON)GetClassLong(hOkno, GCL_HICON); if (!hIcon) hIcon = (HICON)GetClassLongPtr(hOkno, GCLP_HICONSM); if (!hIcon) hIcon = (HICON)GetClassLongPtr(hOkno, GCLP_HICON); if (!hIcon) { GetWindowThreadProcessId(hOkno, &pid); hproc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, pid); GetModuleFileNameEx(hproc, NULL, path, 512); ExtractIconEx(path, 0, NULL, &hIcon, 1); CloseHandle(hproc); } if (!hIcon) hIcon = LoadIcon(NULL, IDI_APPLICATION); item.iImage = ImageList_AddIcon(hImgList, hIcon); item.iIndent = 1; item.lParam = (LPARAM)hOkno; } ListView_InsertItem(hList,&item); if (tbb.fsState & TBSTATE_HIDDEN) strcpy(txt, "[ukryty]"); else strcpy(txt, "[widoczny]"); ListView_SetItemText(hList, i, 1, txt); } VirtualFreeEx(proces, ptbb, 0, MEM_RELEASE); VirtualFreeEx(proces, ptxt, 0, MEM_RELEASE); }
// Re/initialize the ListControl Columns static void Picker_InternalResetColumnDisplay(HWND hWnd, BOOL bFirstTime) { LV_COLUMN lvc; int i = 0; int nColumn = 0; int *widths; int *order; int *shown; //int shown_columns; LVCOLUMN col; struct PickerInfo *pPickerInfo; HRESULT res = 0; BOOL b_res = 0; pPickerInfo = GetPickerInfo(hWnd); widths = (int*)malloc(pPickerInfo->nColumnCount * sizeof(*widths)); order = (int*)malloc(pPickerInfo->nColumnCount * sizeof(*order)); shown = (int*)malloc(pPickerInfo->nColumnCount * sizeof(*shown)); if (!widths || !order || !shown) goto done; memset(widths, 0, pPickerInfo->nColumnCount * sizeof(*widths)); memset(order, 0, pPickerInfo->nColumnCount * sizeof(*order)); memset(shown, 0, pPickerInfo->nColumnCount * sizeof(*shown)); pPickerInfo->pCallbacks->pfnGetColumnWidths(widths); pPickerInfo->pCallbacks->pfnGetColumnOrder(order); pPickerInfo->pCallbacks->pfnGetColumnShown(shown); if (!bFirstTime) { DWORD style = GetWindowLong(hWnd, GWL_STYLE); // switch the list view to LVS_REPORT style so column widths reported correctly SetWindowLong(hWnd, GWL_STYLE, (GetWindowLong(hWnd, GWL_STYLE) & ~LVS_TYPEMASK) | LVS_REPORT); // Retrieve each of the column widths i = 0; memset(&col, 0, sizeof(col)); col.mask = LVCF_WIDTH; while(ListView_GetColumn(hWnd, 0, &col)) { nColumn = Picker_GetRealColumnFromViewColumn(hWnd, i++); widths[nColumn] = col.cx; b_res = ListView_DeleteColumn(hWnd, 0); } pPickerInfo->pCallbacks->pfnSetColumnWidths(widths); // restore old style SetWindowLong(hWnd, GWL_STYLE, style); } nColumn = 0; for (i = 0; i < pPickerInfo->nColumnCount; i++) { if (shown[order[i]]) { lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT; lvc.pszText = (LPTSTR) pPickerInfo->ppszColumnNames[order[i]]; lvc.iSubItem = nColumn; lvc.cx = widths[order[i]]; lvc.fmt = LVCFMT_LEFT; if (lvc.pszText[0] > 0) // column name cannot be blank { res = ListView_InsertColumn(hWnd, nColumn, &lvc); pPickerInfo->pnColumnsOrder[nColumn] = order[i]; //dprintf("Visible column %d: Logical column %d; Width=%d\n", nColumn, order[i], widths[order[i]]); nColumn++; } } } //shown_columns = nColumn; /* Fill this in so we can still sort on columns NOT shown */ for (i = 0; i < pPickerInfo->nColumnCount && nColumn < pPickerInfo->nColumnCount; i++) { if (!shown[order[i]]) { pPickerInfo->pnColumnsOrder[nColumn] = order[i]; nColumn++; } } if (GetListFontColor() == RGB(255, 255, 255)) b_res = ListView_SetTextColor(hWnd, RGB(240, 240, 240)); else b_res = ListView_SetTextColor(hWnd, GetListFontColor()); done: if (widths) free(widths); if (order) free(order); if (shown) free(shown); res++; b_res++; }
// ----------------------------------------------- // List view di lettura (senza sort header) // ----------------------------------------------- void * ehzListView(struct OBJ *objCalled,EN_MESSAGE cmd,LONG info,void *ptr) { EH_DISPEXT *psExt=ptr; static SINT HdbMovi=-1; static INT16 iSend; DWORD dwExStyle; SINT iLVIndex; if (fReset) { if (cmd!=WS_START) win_infoarg("Inizializzare ehzListView()"); memset(&_arsLv,0,sizeof(EH_LVLIST)*LVMAX); EhListInizialize(); fReset=FALSE; return 0; } iLVIndex=LVFind(LV_FINDOBJ,objCalled); if (iLVIndex<0) iLVIndex=LVAlloc(objCalled); switch(cmd) { case WS_INF: return &_arsLv[iLVIndex]; case WS_OPEN: // Creazione objCalled->hWnd=CreateListView(objCalled->nome,sys.EhWinInstance,WindowNow()); _arsLv[iLVIndex].hWndList=objCalled->hWnd; _arsLv[iLVIndex].hWndHeader=ListView_GetHeader(objCalled->hWnd);//GetWindow(objCalled->hWnd, GW_CHILD); _arsLv[iLVIndex].idHeader=GetDlgCtrlID(_arsLv[iLVIndex].hWndHeader); _arsLv[iLVIndex].fLeftClick=TRUE; _arsLv[iLVIndex].fRightClick=TRUE; _arsLv[iLVIndex].fDoubleClick=FALSE; break; case WS_EXTNOTIFY: switch (info) { case 0: _arsLv[iLVIndex].subListNotify=ptr; break; case 1: _arsLv[iLVIndex].subMessage=ptr; break; case 2: _arsLv[iLVIndex].subHeaderNotify=ptr; break; } break; case WS_SETFLAG: if (!strcmp(ptr,"STYLE")) // Setta lo stile della finestra { DWORD dwStyle; dwStyle=GetWindowLong(objCalled->hWnd, GWL_STYLE); dwStyle|=info; SetWindowLong(objCalled->hWnd, GWL_STYLE, (DWORD) dwStyle); } if (!strcmp(ptr,"!STYLE")) // Setta lo stile della finestra { LONG lStyle; lStyle=GetWindowLong(objCalled->hWnd, GWL_STYLE); lStyle&=~info; SetWindowLong(objCalled->hWnd, GWL_STYLE, lStyle); } if (!strcmp(ptr,"STYLEMASK")) // Setta lo stile della finestra { DWORD dwStyle; dwStyle=GetWindowLong(objCalled->hWnd, GWL_STYLE); //win_infoarg("%08x",~LVS_TYPESTYLEMASK); dwStyle=dwStyle&~LVS_TYPESTYLEMASK|info; SetWindowLong(objCalled->hWnd, GWL_STYLE, (DWORD) dwStyle); } if (!strcmp(ptr,"EXSTYLE")) // Setta lo stile della finestra { dwExStyle=ListView_GetExtendedListViewStyle(objCalled->hWnd); dwExStyle|=info; ListView_SetExtendedListViewStyle(objCalled->hWnd,dwExStyle); } if (!strcmp(ptr,"!EXSTYLE")) // Setta lo stile della finestra { dwExStyle=ListView_GetExtendedListViewStyle(objCalled->hWnd); dwExStyle&=~info; ListView_SetExtendedListViewStyle(objCalled->hWnd,dwExStyle); } if (!strcmp(ptr,"DCLK")) // Setta il Double Click { _arsLv[iLVIndex].fDoubleClick=info; } break; case WS_CLOSE: // Distruzione DestroyWindow(objCalled->hWnd); break; case WS_DEL: // Cancella le colonne while (TRUE) { if (!ListView_DeleteColumn(objCalled->hWnd,0)) break; } break; case WS_ADD: // Aggiungi una colonna ListView_InsertColumn(objCalled->hWnd, info, (LV_COLUMN *) ptr); break; case WS_LINK: // Aggiunge un Item // if (ListView_SetItem(objCalled->hWnd,(LPLVITEM) ptr)==FALSE) {ListView_InsertItem(objCalled->hWnd,(LPLVITEM) ptr);} break; case WS_DO: // Spostamento / Ridimensionamento MoveWindow(objCalled->hWnd,psExt->px,psExt->py,psExt->lx,psExt->ly,TRUE); break; case WS_DISPLAY: InvalidateRect(objCalled->hWnd,NULL,TRUE); break; } return NULL; }