? D3.diff Index: dlls/comctl32/listview.c =================================================================== RCS file: /home/wine/wine/dlls/comctl32/listview.c,v retrieving revision 1.107 diff -u -r1.107 listview.c --- dlls/comctl32/listview.c 2001/08/21 17:04:02 1.107 +++ dlls/comctl32/listview.c 2002/01/08 02:32:12 @@ -4,6 +4,7 @@ * Copyright 1998, 1999 Eric Kohl * Copyright 1999 Luc Tourangeau * Copyright 2000 Jason Mawdsley + * Copyright 2002 Dimitrie O. Paun * * NOTES * Listview control implementation. @@ -19,13 +20,6 @@ * Data structure: * LISTVIEW_SetItemCount : not completed for non OWNERDATA * - * Unicode: - * LISTVIEW_SetItemW : no unicode support - * LISTVIEW_InsertItemW : no unicode support - * LISTVIEW_InsertColumnW : no unicode support - * LISTVIEW_GetColumnW : no unicode support - * LISTVIEW_SetColumnW : no unicode support - * * Advanced functionality: * LISTVIEW_GetNumberOfWorkAreas : not implemented * LISTVIEW_GetHotCursor : not implemented @@ -52,7 +46,7 @@ DEFAULT_DEBUG_CHANNEL(listview); /* Some definitions for inline edit control */ -typedef BOOL (*EditlblCallback)(HWND, LPSTR, DWORD); +typedef BOOL (*EditlblCallback)(HWND, LPWSTR, DWORD); typedef struct tagEDITLABEL_ITEM { @@ -63,7 +57,7 @@ typedef struct tagLISTVIEW_SUBITEM { - LPSTR pszText; + LPWSTR pszText; INT iImage; INT iSubItem; @@ -72,7 +66,7 @@ typedef struct tagLISTVIEW_ITEM { UINT state; - LPSTR pszText; + LPWSTR pszText; INT iImage; LPARAM lParam; INT iIndent; @@ -125,7 +119,7 @@ DWORD lastKeyPressTimestamp; /* Added */ WPARAM charCode; /* Added */ INT nSearchParamLength; /* Added */ - CHAR szSearchParam[ MAX_PATH ]; /* Added */ + WCHAR szSearchParam[ MAX_PATH ]; /* Added */ } LISTVIEW_INFO; /* @@ -171,21 +165,17 @@ /* * macros */ -#define ListView_LVNotify(hwnd,lCtrlId,plvnm) \ - (BOOL)SendMessageA((hwnd),WM_NOTIFY,(WPARAM)(INT)lCtrlId,(LPARAM)(LPNMLISTVIEW)(plvnm)) -#define ListView_Notify(hwnd,lCtrlId,pnmh) \ - (BOOL)SendMessageA((hwnd),WM_NOTIFY,(WPARAM)(INT)lCtrlId,(LPARAM)(LPNMHDR)(pnmh)) /* retrieve the number of items in the listview */ #define GETITEMCOUNT(infoPtr) ((infoPtr)->hdpaItems->nItemCount) -HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y, +HWND CreateEditLabelW(LPCWSTR text, DWORD style, INT x, INT y, INT width, INT height, HWND parent, HINSTANCE hinst, EditlblCallback EditLblCb, DWORD param); /* * forward declarations */ -static LRESULT LISTVIEW_GetItemA(HWND hwnd, LPLVITEMA lpLVItem, BOOL internal); +static LRESULT LISTVIEW_GetItemT(HWND hwnd, LPLVITEMW lpLVItem, BOOL internal, BOOL isW); static INT LISTVIEW_HitTestItem(HWND, LPLVHITTESTINFO, BOOL); static INT LISTVIEW_GetCountPerRow(HWND); static INT LISTVIEW_GetCountPerColumn(HWND); @@ -193,7 +183,7 @@ static VOID LISTVIEW_AlignTop(HWND); static VOID LISTVIEW_AddGroupSelection(HWND, INT); static VOID LISTVIEW_AddSelection(HWND, INT); -static BOOL LISTVIEW_AddSubItem(HWND, LPLVITEMA); +static BOOL LISTVIEW_AddSubItemW(HWND, LPLVITEMW); static INT LISTVIEW_FindInsertPosition(HDPA, INT); static INT LISTVIEW_GetItemHeight(HWND); static BOOL LISTVIEW_GetItemPosition(HWND, INT, LPPOINT); @@ -204,31 +194,32 @@ static INT LISTVIEW_CalculateWidth(HWND hwnd, INT nItem); static LISTVIEW_SUBITEM* LISTVIEW_GetSubItem(HDPA, INT); static LRESULT LISTVIEW_GetViewRect(HWND, LPRECT); -static BOOL LISTVIEW_InitItem(HWND, LISTVIEW_ITEM *, LPLVITEMA); -static BOOL LISTVIEW_InitSubItem(HWND, LISTVIEW_SUBITEM *, LPLVITEMA); +static BOOL LISTVIEW_InitItemW(HWND, LISTVIEW_ITEM *, LPLVITEMW); +static BOOL LISTVIEW_InitSubItemW(HWND, LISTVIEW_SUBITEM *, LPLVITEMW); static LRESULT LISTVIEW_MouseSelection(HWND, POINT); static BOOL LISTVIEW_RemoveColumn(HDPA, INT); static BOOL LISTVIEW_RemoveSubItem(HDPA, INT); static VOID LISTVIEW_SetGroupSelection(HWND, INT); -static BOOL LISTVIEW_SetItem(HWND, LPLVITEMA); +static BOOL LISTVIEW_SetItemA(HWND, LPLVITEMA); +static BOOL LISTVIEW_SetItemW(HWND, LPLVITEMW); static BOOL LISTVIEW_SetItemFocus(HWND, INT); static BOOL LISTVIEW_SetItemPosition(HWND, INT, LONG, LONG); static VOID LISTVIEW_UpdateScroll(HWND); static VOID LISTVIEW_SetSelection(HWND, INT); static VOID LISTVIEW_UpdateSize(HWND); -static BOOL LISTVIEW_SetSubItem(HWND, LPLVITEMA); +static BOOL LISTVIEW_SetSubItemW(HWND, LPLVITEMW); static LRESULT LISTVIEW_SetViewRect(HWND, LPRECT); static BOOL LISTVIEW_ToggleSelection(HWND, INT); static VOID LISTVIEW_UnsupportedStyles(LONG lStyle); -static HWND LISTVIEW_EditLabelA(HWND hwnd, INT nItem); -static BOOL LISTVIEW_EndEditLabel(HWND hwnd, LPSTR pszText, DWORD nItem); +static HWND LISTVIEW_EditLabelT(HWND hwnd, INT nItem, BOOL isW); +static BOOL LISTVIEW_EndEditLabelW(HWND hwnd, LPWSTR pszText, DWORD nItem); static LRESULT LISTVIEW_Command(HWND hwnd, WPARAM wParam, LPARAM lParam); static LRESULT LISTVIEW_SortItems(HWND hwnd, WPARAM wParam, LPARAM lParam); -static LRESULT LISTVIEW_GetStringWidthA(HWND hwnd, LPCSTR lpszText); +static LRESULT LISTVIEW_GetStringWidthT(HWND hwnd, LPCWSTR lpszText, BOOL isW); static INT LISTVIEW_ProcessLetterKeys( HWND hwnd, WPARAM charCode, LPARAM keyData ); static BOOL LISTVIEW_KeySelection(HWND hwnd, INT nItem); static LRESULT LISTVIEW_GetItemState(HWND hwnd, INT nItem, UINT uMask); -static LRESULT LISTVIEW_SetItemState(HWND hwnd, INT nItem, LPLVITEMA lpLVItem); +static LRESULT LISTVIEW_SetItemState(HWND hwnd, INT nItem, LPLVITEMW lpLVItem); static BOOL LISTVIEW_IsSelected(HWND hwnd, INT nItem); static VOID LISTVIEW_RemoveSelectionRange(HWND hwnd, INT lItem, INT uItem); static void LISTVIEW_FillBackground(HWND hwnd, HDC hdc, LPRECT rc); @@ -237,6 +228,91 @@ #define KEY_DELAY 450 +static inline BOOL is_text(LPCWSTR text) +{ + return text != NULL && text != LPSTR_TEXTCALLBACKW; +} + +static inline BOOL is_textT(LPCWSTR text, BOOL isW) +{ + /* we can ignore isW since LPSTR_TEXTCALLBACKW == LPSTR_TEXTCALLBACKA */ + return is_text(text); +} + +static inline int textlenT(LPCWSTR text, BOOL isW) +{ + return !is_textT(text, isW) ? 0 : + isW ? lstrlenW(text) : lstrlenA((LPCSTR)text); +} + +static inline BOOL ListView_DINotify(HWND hwnd, INT lCtrlId, LPNMLVDISPINFOW pdi) +{ + return (BOOL)SendMessageW(hwnd, WM_NOTIFY, (WPARAM)lCtrlId, (LPARAM)pdi); +} + +static inline BOOL ListView_LVNotify(HWND hwnd, INT lCtrlId, LPNMLISTVIEW plvnm) +{ + return (BOOL)SendMessageW(hwnd, WM_NOTIFY, (WPARAM)lCtrlId, (LPARAM)plvnm); +} + +static inline BOOL ListView_Notify(HWND hwnd, INT lCtrlId, LPNMHDR pnmh) +{ + return (BOOL)SendMessageW(hwnd, WM_NOTIFY, (WPARAM)lCtrlId,(LPARAM)pnmh); +} + +static inline LRESULT LISTVIEW_GetItemW(HWND hwnd, LPLVITEMW lpLVItem, BOOL internal) +{ + return LISTVIEW_GetItemT(hwnd, lpLVItem, internal, TRUE); +} + +static inline LRESULT LISTVIEW_GetItemA(HWND hwnd, LPLVITEMA lpLVItem, BOOL internal) +{ + return LISTVIEW_GetItemT(hwnd, (LPLVITEMW)lpLVItem, internal, FALSE); +} + +static inline int lstrncmpiW(LPCWSTR s1, LPCWSTR s2, int n) +{ + int res; + + n = min(min(n, strlenW(s1)), strlenW(s2)); + res = CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE, s1, n, s2, n); + return res ? res - 2 : res; +} + +/** + * Copies a LVITEMA to a LVITEMW structure, duplicating all text + * fields appropriately. + * The resulting LVITEMW structure must be cleaned up with a call + * to LISTVIEW_lvitem_rmW, before it is freed. + * It returns the lplviw argument on success or NULL on failures. + */ +static LPLVITEMW LISTVIEW_lvitem_cpyAtoW(LPLVITEMA lplvia, LPLVITEMW lplviw) +{ + if (lplvia == NULL) return NULL; + memcpy(lplviw, lplvia, sizeof(LVITEMA)); + if (lplviw->mask & LVIF_TEXT) { + if (lplvia->pszText == LPSTR_TEXTCALLBACKA) + lplviw->pszText = LPSTR_TEXTCALLBACKW; + else + lplviw->pszText = HEAP_strdupAtoW(GetProcessHeap(), 0, lplvia->pszText); + } + return lplviw; +} + +/** + * Prepares a LVITEMW structure initiallised by a call to + * LISTVIEW_lvitem_cpyAtoW for freeing. + * It returns the lplviw always. + */ +static LPLVITEMW LISTVIEW_lvitem_rmW(LPLVITEMW lplviw) +{ + if (lplviw->mask & LVIF_TEXT) { + if (lplviw->pszText != LPSTR_TEXTCALLBACKW) + HeapFree(GetProcessHeap(), 0, lplviw->pszText); + } + return lplviw; +} + static BOOL LISTVIEW_SendCustomDrawNotify (HWND hwnd, DWORD dwDrawStage, HDC hdc, RECT rc) @@ -247,11 +323,11 @@ TRACE("drawstage:%lx hdc:%x\n", dwDrawStage, hdc); - infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); nmcd= & nmcdhdr.nmcd; nmcd->hdr.hwndFrom = hwnd; - nmcd->hdr.idFrom = GetWindowLongA( hwnd, GWL_ID); + nmcd->hdr.idFrom = GetWindowLongW( hwnd, GWL_ID); nmcd->hdr.code = NM_CUSTOMDRAW; nmcd->dwDrawStage= dwDrawStage; nmcd->hdc = hdc; @@ -265,8 +341,8 @@ nmcdhdr.clrText = infoPtr->clrText; nmcdhdr.clrTextBk= infoPtr->clrBk; - return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY, - (WPARAM) GetWindowLongA( hwnd, GWL_ID), (LPARAM)&nmcdhdr); + return (BOOL)SendMessageW (GetParent (hwnd), WM_NOTIFY, + (WPARAM) GetWindowLongW( hwnd, GWL_ID), (LPARAM)&nmcdhdr); } static BOOL @@ -281,14 +357,14 @@ UINT uItemState; INT retval; RECT itemRect; - LVITEMA item; + LVITEMW item; - infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); - ZeroMemory(&item,sizeof(LVITEMA)); + ZeroMemory(&item,sizeof(item)); item.iItem = iItem; item.mask = LVIF_PARAM; - ListView_GetItemA(hwnd,&item); + ListView_GetItemW(hwnd,&item); dwDrawStage=CDDS_ITEM | uItemDrawState; dwItemSpec=iItem; @@ -303,10 +379,10 @@ nmcd= & nmcdhdr.nmcd; nmcd->hdr.hwndFrom = hwnd; - nmcd->hdr.idFrom = GetWindowLongA( hwnd, GWL_ID); + nmcd->hdr.idFrom = GetWindowLongW( hwnd, GWL_ID); nmcd->hdr.code = NM_CUSTOMDRAW; nmcd->dwDrawStage= dwDrawStage; - nmcd->hdc = hdc; + nmcd->hdc = hdc; nmcd->rc.left = itemRect.left; nmcd->rc.right = itemRect.right; nmcd->rc.bottom = itemRect.bottom; @@ -319,11 +395,11 @@ nmcdhdr.iSubItem =iSubItem; TRACE("drawstage:%lx hdc:%x item:%lx, itemstate:%x, lItemlParam:%lx\n", - nmcd->dwDrawStage, nmcd->hdc, nmcd->dwItemSpec, - nmcd->uItemState, nmcd->lItemlParam); + nmcd->dwDrawStage, nmcd->hdc, nmcd->dwItemSpec, + nmcd->uItemState, nmcd->lItemlParam); - retval=SendMessageA (GetParent (hwnd), WM_NOTIFY, - (WPARAM) GetWindowLongA( hwnd, GWL_ID), (LPARAM)&nmcdhdr); + retval=SendMessageW (GetParent (hwnd), WM_NOTIFY, + (WPARAM) GetWindowLongW( hwnd, GWL_ID), (LPARAM)&nmcdhdr); infoPtr->clrText=nmcdhdr.clrText; infoPtr->clrBk =nmcdhdr.clrTextBk; @@ -377,15 +453,15 @@ INT nItem; INT nSize; INT endidx,idx; - LVITEMA item; - CHAR buffer[MAX_PATH]; + LVITEMW item; + WCHAR buffer[MAX_PATH]; DWORD timestamp,elapsed; /* simple parameter checking */ if (!hwnd || !charCode || !keyData) return 0; - infoPtr=(LISTVIEW_INFO*)GetWindowLongA(hwnd, 0); + infoPtr=(LISTVIEW_INFO*)GetWindowLongW(hwnd, 0); if (!infoPtr) return 0; @@ -460,14 +536,14 @@ item.iSubItem = 0; item.pszText = buffer; item.cchTextMax = sizeof(buffer); - ListView_GetItemA( hwnd, &item ); + ListView_GetItemW( hwnd, &item ); /* check for a match */ - if (strncasecmp(item.pszText,infoPtr->szSearchParam,infoPtr->nSearchParamLength) == 0) { + if (lstrncmpiW(item.pszText,infoPtr->szSearchParam,infoPtr->nSearchParamLength) == 0) { nItem=idx; break; } else if ( (charCode != 0) && (nItem == -1) && (nItem != infoPtr->nFocusedItem) && - (strncasecmp(item.pszText,infoPtr->szSearchParam,1) == 0) ) { + (lstrncmpiW(item.pszText,infoPtr->szSearchParam,1) == 0) ) { /* This would work but we must keep looking for a longer match */ nItem=idx; } @@ -501,7 +577,7 @@ */ static VOID LISTVIEW_UpdateHeaderSize(HWND hwnd, INT nNewScrollPos) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); RECT winRect; POINT point[2]; @@ -533,8 +609,8 @@ */ static VOID LISTVIEW_UpdateScroll(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top; INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left; @@ -696,8 +772,8 @@ */ static VOID LISTVIEW_AlignTop(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left; POINT ptItem; RECT rcView; @@ -753,8 +829,8 @@ */ static VOID LISTVIEW_AlignLeft(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top; POINT ptItem; RECT rcView; @@ -812,7 +888,7 @@ */ static LRESULT LISTVIEW_SetViewRect(HWND hwnd, LPRECT lprcView) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongW(hwnd, 0); BOOL bResult = FALSE; TRACE("(hwnd=%x, left=%d, top=%d, right=%d, bottom=%d)\n", hwnd, @@ -844,7 +920,7 @@ */ static LRESULT LISTVIEW_GetViewRect(HWND hwnd, LPRECT lprcView) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongW(hwnd, 0); BOOL bResult = FALSE; POINT ptOrigin; @@ -914,8 +990,8 @@ */ static INT LISTVIEW_GetItemWidth(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LONG style = GetWindowLongA(hwnd, GWL_STYLE); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LONG style = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = style & LVS_TYPEMASK; INT nHeaderItemCount; RECT rcHeaderItem; @@ -998,8 +1074,8 @@ */ static INT LISTVIEW_CalculateWidth(HWND hwnd, INT nItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; INT nHeaderItemCount; RECT rcHeaderItem; INT nItemWidth = 0; @@ -1073,8 +1149,8 @@ */ static INT LISTVIEW_GetItemHeight(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; INT nItemHeight = 0; if (uView == LVS_ICON) @@ -1083,10 +1159,10 @@ } else { - TEXTMETRICA tm; + TEXTMETRICW tm; HDC hdc = GetDC(hwnd); HFONT hOldFont = SelectObject(hdc, infoPtr->hFont); - GetTextMetricsA(hdc, &tm); + GetTextMetricsW(hdc, &tm); if(infoPtr->himlState || infoPtr->himlSmall) nItemHeight = max(tm.tmHeight, infoPtr->iconSize.cy) + HEIGHT_PADDING; @@ -1103,7 +1179,7 @@ static void LISTVIEW_PrintSelectionRanges(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); LISTVIEW_SELECTION *selection; INT topSelection = infoPtr->hdpaSelectionRanges->nItemCount; INT i; @@ -1162,7 +1238,7 @@ */ static VOID LISTVIEW_AddSelectionRange(HWND hwnd, INT lItem, INT uItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); LISTVIEW_SELECTION *selection; INT topSelection = infoPtr->hdpaSelectionRanges->nItemCount; BOOL lowerzero=FALSE; @@ -1324,7 +1400,7 @@ */ static BOOL LISTVIEW_IsSelected(HWND hwnd, INT nItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); LISTVIEW_SELECTION selection; INT index; @@ -1353,14 +1429,14 @@ */ static LRESULT LISTVIEW_RemoveAllSelections(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); LISTVIEW_SELECTION *selection; INT i; - LVITEMA item; + LVITEMW item; TRACE("(0x%x)\n",hwnd); - ZeroMemory(&item,sizeof(LVITEMA)); + ZeroMemory(&item,sizeof(item)); item.stateMask = LVIS_SELECTED; do @@ -1394,7 +1470,7 @@ */ static VOID LISTVIEW_RemoveSelectionRange(HWND hwnd, INT lItem, INT uItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); LISTVIEW_SELECTION removeselection,*checkselection; INT index; @@ -1491,7 +1567,7 @@ */ static VOID LISTVIEW_ShiftIndices(HWND hwnd, INT nItem, INT direction) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); LISTVIEW_SELECTION selection,*checkselection; INT index; @@ -1558,16 +1634,16 @@ */ static VOID LISTVIEW_AddGroupSelection(HWND hwnd, INT nItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); INT nFirst = min(infoPtr->nSelectionMark, nItem); INT nLast = max(infoPtr->nSelectionMark, nItem); INT i; - LVITEMA item; + LVITEMW item; if (nFirst == -1) nFirst = nItem; - ZeroMemory(&item,sizeof(LVITEMA)); + ZeroMemory(&item,sizeof(item)); item.stateMask = LVIS_SELECTED; item.state = LVIS_SELECTED; @@ -1594,10 +1670,10 @@ */ static VOID LISTVIEW_AddSelection(HWND hwnd, INT nItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LVITEMA item; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LVITEMW item; - ZeroMemory(&item,sizeof(LVITEMA)); + ZeroMemory(&item,sizeof(item)); item.state = LVIS_SELECTED; item.stateMask = LVIS_SELECTED; @@ -1621,11 +1697,11 @@ */ static BOOL LISTVIEW_ToggleSelection(HWND hwnd, INT nItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); BOOL bResult; - LVITEMA item; + LVITEMW item; - ZeroMemory(&item,sizeof(LVITEMA)); + ZeroMemory(&item,sizeof(item)); item.stateMask = LVIS_SELECTED; if (LISTVIEW_IsSelected(hwnd,nItem)) @@ -1660,12 +1736,12 @@ */ static VOID LISTVIEW_SetSelectionRect(HWND hwnd, RECT rcSelRect) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); POINT ptItem; INT i; - LVITEMA item; + LVITEMW item; - ZeroMemory(&item,sizeof(LVITEMA)); + ZeroMemory(&item,sizeof(item)); item.stateMask = LVIS_SELECTED; for (i = 0; i < GETITEMCOUNT(infoPtr); i++) @@ -1673,15 +1749,10 @@ LISTVIEW_GetItemPosition(hwnd, i, &ptItem); if (PtInRect(&rcSelRect, ptItem) != FALSE) - { item.state = LVIS_SELECTED; - LISTVIEW_SetItemState(hwnd,i,&item); - } else - { item.state = 0; - LISTVIEW_SetItemState(hwnd,i,&item); - } + LISTVIEW_SetItemState(hwnd,i,&item); } } @@ -1698,11 +1769,11 @@ */ static VOID LISTVIEW_SetGroupSelection(HWND hwnd, INT nItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; - LVITEMA item; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LVITEMW item; - ZeroMemory(&item,sizeof(LVITEMA)); + ZeroMemory(&item,sizeof(item)); item.stateMask = LVIS_SELECTED; if ((uView == LVS_LIST) || (uView == LVS_REPORT)) @@ -1723,15 +1794,10 @@ for (i = 0; i <= GETITEMCOUNT(infoPtr); i++) { if ((i < nFirst) || (i > nLast)) - { item.state = 0; - LISTVIEW_SetItemState(hwnd,i,&item); - } else - { item.state = LVIS_SELECTED; - LISTVIEW_SetItemState(hwnd,i,&item); - } + LISTVIEW_SetItemState(hwnd,i,&item); } } else @@ -1765,9 +1831,9 @@ */ static BOOL LISTVIEW_SetItemFocus(HWND hwnd, INT nItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); BOOL bResult = FALSE; - LVITEMA lvItem; + LVITEMW lvItem; if (infoPtr->nFocusedItem != nItem) { @@ -1776,7 +1842,7 @@ INT oldFocus = infoPtr->nFocusedItem; bResult = TRUE; infoPtr->nFocusedItem = -1; - ZeroMemory(&lvItem, sizeof(LVITEMA)); + ZeroMemory(&lvItem, sizeof(lvItem)); lvItem.stateMask = LVIS_FOCUSED; ListView_SetItemState(hwnd, oldFocus, &lvItem); @@ -1806,10 +1872,10 @@ */ static VOID LISTVIEW_SetSelection(HWND hwnd, INT nItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LVITEMA lvItem; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LVITEMW lvItem; - ZeroMemory(&lvItem, sizeof(LVITEMA)); + ZeroMemory(&lvItem, sizeof(lvItem)); lvItem.stateMask = LVIS_FOCUSED; ListView_SetItemState(hwnd, infoPtr->nFocusedItem, &lvItem); @@ -1837,8 +1903,8 @@ */ static BOOL LISTVIEW_KeySelection(HWND hwnd, INT nItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); WORD wShift = HIWORD(GetKeyState(VK_SHIFT)); WORD wCtrl = HIWORD(GetKeyState(VK_CONTROL)); BOOL bResult = FALSE; @@ -1894,7 +1960,7 @@ */ static LRESULT LISTVIEW_MouseHover(HWND hwnd, WPARAM wParam, LPARAM lParam) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); POINT pt; pt.x = (INT)LOWORD(lParam); @@ -1922,7 +1988,7 @@ */ static LRESULT LISTVIEW_MouseMove(HWND hwnd, WPARAM wParam, LPARAM lParam) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); TRACKMOUSEEVENT trackinfo; /* see if we are supposed to be tracking mouse hovering */ @@ -1961,10 +2027,10 @@ */ static LRESULT LISTVIEW_MouseSelection(HWND hwnd, POINT pt) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); RECT rcItem; INT i,topindex,bottomindex; - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; topindex = ListView_GetTopIndex(hwnd); @@ -2051,25 +2117,18 @@ if (lpSubItem->iSubItem == nSubItem) { /* free string */ - if ((lpSubItem->pszText != NULL) && - (lpSubItem->pszText != LPSTR_TEXTCALLBACKA)) - { + if (is_text(lpSubItem->pszText)) COMCTL32_Free(lpSubItem->pszText); - } /* free item */ COMCTL32_Free(lpSubItem); /* free dpa memory */ if (DPA_DeletePtr(hdpaSubItems, i) == NULL) - { return FALSE; - } } else if (lpSubItem->iSubItem > nSubItem) - { return TRUE; - } } } @@ -2088,7 +2147,7 @@ * SUCCCESS : TRUE (EQUAL) * FAILURE : FALSE (NOT EQUAL) */ -static UINT LISTVIEW_GetItemChanges(LISTVIEW_ITEM *lpItem, LPLVITEMA lpLVItem) +static UINT LISTVIEW_GetItemChangesW(LISTVIEW_ITEM *lpItem, LPLVITEMW lpLVItem) { UINT uChanged = 0; @@ -2129,16 +2188,16 @@ if (lpLVItem->mask & LVIF_TEXT) { - if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) + if (lpLVItem->pszText == LPSTR_TEXTCALLBACKW) { - if (lpItem->pszText != LPSTR_TEXTCALLBACKA) + if (lpItem->pszText != LPSTR_TEXTCALLBACKW) { uChanged |= LVIF_TEXT; } } else { - if (lpItem->pszText == LPSTR_TEXTCALLBACKA) + if (lpItem->pszText == LPSTR_TEXTCALLBACKW) { uChanged |= LVIF_TEXT; } @@ -2148,7 +2207,7 @@ { if (lpItem->pszText) { - if (strcmp(lpLVItem->pszText, lpItem->pszText) != 0) + if (strcmpW(lpLVItem->pszText, lpItem->pszText) != 0) { uChanged |= LVIF_TEXT; } @@ -2185,10 +2244,10 @@ * SUCCCESS : TRUE * FAILURE : FALSE */ -static BOOL LISTVIEW_InitItem(HWND hwnd, LISTVIEW_ITEM *lpItem, - LPLVITEMA lpLVItem) +static BOOL LISTVIEW_InitItemW(HWND hwnd, LISTVIEW_ITEM *lpItem, + LPLVITEMW lpLVItem) { - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); BOOL bResult = FALSE; if ((lpItem != NULL) && (lpLVItem != NULL)) @@ -2218,7 +2277,7 @@ if (lpLVItem->mask & LVIF_TEXT) { - if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) + if (lpLVItem->pszText == LPSTR_TEXTCALLBACKW) { if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) { @@ -2226,21 +2285,21 @@ } if ((lpItem->pszText != NULL) && - (lpItem->pszText != LPSTR_TEXTCALLBACKA)) + (lpItem->pszText != LPSTR_TEXTCALLBACKW)) { COMCTL32_Free(lpItem->pszText); } - lpItem->pszText = LPSTR_TEXTCALLBACKA; + lpItem->pszText = LPSTR_TEXTCALLBACKW; } else { - if (lpItem->pszText == LPSTR_TEXTCALLBACKA) + if (lpItem->pszText == LPSTR_TEXTCALLBACKW) { lpItem->pszText = NULL; } - bResult = Str_SetPtrA(&lpItem->pszText, lpLVItem->pszText); + bResult = Str_SetPtrW(&lpItem->pszText, lpLVItem->pszText); } } } @@ -2264,10 +2323,10 @@ * SUCCCESS : TRUE * FAILURE : FALSE */ -static BOOL LISTVIEW_InitSubItem(HWND hwnd, LISTVIEW_SUBITEM *lpSubItem, - LPLVITEMA lpLVItem) +static BOOL LISTVIEW_InitSubItemW(HWND hwnd, LISTVIEW_SUBITEM *lpSubItem, + LPLVITEMW lpLVItem) { - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); BOOL bResult = FALSE; if ((lpSubItem != NULL) && (lpLVItem != NULL)) @@ -2285,7 +2344,7 @@ if (lpLVItem->mask & LVIF_TEXT) { - if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) + if (lpLVItem->pszText == LPSTR_TEXTCALLBACKW) { if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) { @@ -2293,21 +2352,21 @@ } if ((lpSubItem->pszText != NULL) && - (lpSubItem->pszText != LPSTR_TEXTCALLBACKA)) + (lpSubItem->pszText != LPSTR_TEXTCALLBACKW)) { COMCTL32_Free(lpSubItem->pszText); } - lpSubItem->pszText = LPSTR_TEXTCALLBACKA; + lpSubItem->pszText = LPSTR_TEXTCALLBACKW; } else { - if (lpSubItem->pszText == LPSTR_TEXTCALLBACKA) + if (lpSubItem->pszText == LPSTR_TEXTCALLBACKW) { lpSubItem->pszText = NULL; } - bResult = Str_SetPtrA(&lpSubItem->pszText, lpLVItem->pszText); + bResult = Str_SetPtrW(&lpSubItem->pszText, lpLVItem->pszText); } } } @@ -2328,14 +2387,14 @@ * SUCCESS : TRUE * FAILURE : FALSE */ -static BOOL LISTVIEW_AddSubItem(HWND hwnd, LPLVITEMA lpLVItem) +static BOOL LISTVIEW_AddSubItemW(HWND hwnd, LPLVITEMW lpLVItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); LISTVIEW_SUBITEM *lpSubItem = NULL; BOOL bResult = FALSE; HDPA hdpaSubItems; INT nPosition, nItem; - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); if (lStyle & LVS_OWNERDATA) return FALSE; @@ -2349,7 +2408,7 @@ if (lpSubItem != NULL) { ZeroMemory(lpSubItem, sizeof(LISTVIEW_SUBITEM)); - if (LISTVIEW_InitSubItem(hwnd, lpSubItem, lpLVItem) != FALSE) + if (LISTVIEW_InitSubItemW(hwnd, lpSubItem, lpLVItem) != FALSE) { nPosition = LISTVIEW_FindInsertPosition(hdpaSubItems, lpSubItem->iSubItem); @@ -2452,15 +2511,15 @@ * SUCCESS : TRUE * FAILURE : FALSE */ -static BOOL LISTVIEW_SetItem(HWND hwnd, LPLVITEMA lpLVItem) +static BOOL LISTVIEW_SetItemW(HWND hwnd, LPLVITEMW lpLVItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); BOOL bResult = FALSE; HDPA hdpaSubItems; LISTVIEW_ITEM *lpItem; NMLISTVIEW nmlv; - LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID); - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lCtrlId = GetWindowLongW(hwnd, GWL_ID); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uChanged; UINT uView = lStyle & LVS_TYPEMASK; INT item_width; @@ -2470,14 +2529,14 @@ { if ((lpLVItem->iSubItem == 0)&&(lpLVItem->mask == LVIF_STATE)) { - LVITEMA itm; + LVITEMW itm; - ZeroMemory(&itm,sizeof(LVITEMA)); + ZeroMemory(&itm, sizeof(itm)); itm.mask = LVIF_STATE | LVIF_PARAM; itm.stateMask = LVIS_FOCUSED | LVIS_SELECTED; itm.iItem = lpLVItem->iItem; itm.iSubItem = 0; - ListView_GetItemA(hwnd,&itm); + ListView_GetItemW(hwnd, &itm); ZeroMemory(&nmlv, sizeof(NMLISTVIEW)); @@ -2547,7 +2606,7 @@ nmlv.hdr.idFrom = lCtrlId; nmlv.hdr.code = LVN_ITEMCHANGING; nmlv.lParam = lpItem->lParam; - uChanged = LISTVIEW_GetItemChanges(lpItem, lpLVItem); + uChanged = LISTVIEW_GetItemChangesW(lpItem, lpLVItem); if (uChanged != 0) { if (uChanged & LVIF_STATE) @@ -2596,13 +2655,13 @@ ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv); /* copy information */ - bResult = LISTVIEW_InitItem(hwnd, lpItem, lpLVItem); + bResult = LISTVIEW_InitItemW(hwnd, lpItem, lpLVItem); /* if LVS_LIST or LVS_SMALLICON, update the width of the items based on the width of the items text */ if((uView == LVS_LIST) || (uView == LVS_SMALLICON)) { - item_width = LISTVIEW_GetStringWidthA(hwnd, lpItem->pszText); + item_width = LISTVIEW_GetStringWidthT(hwnd, lpItem->pszText, TRUE); if(item_width > infoPtr->nItemWidth) infoPtr->nItemWidth = item_width; @@ -2643,13 +2702,13 @@ * SUCCESS : TRUE * FAILURE : FALSE */ -static BOOL LISTVIEW_SetSubItem(HWND hwnd, LPLVITEMA lpLVItem) +static BOOL LISTVIEW_SetSubItemW(HWND hwnd, LPLVITEMW lpLVItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); BOOL bResult = FALSE; HDPA hdpaSubItems; LISTVIEW_SUBITEM *lpSubItem; - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); RECT rcItem; if (lStyle & LVS_OWNERDATA) @@ -2668,11 +2727,11 @@ lpSubItem = LISTVIEW_GetSubItem(hdpaSubItems, lpLVItem->iSubItem); if (lpSubItem != NULL) { - bResult = LISTVIEW_InitSubItem(hwnd, lpSubItem, lpLVItem); + bResult = LISTVIEW_InitSubItemW(hwnd, lpSubItem, lpLVItem); } else { - bResult = LISTVIEW_AddSubItem(hwnd, lpLVItem); + bResult = LISTVIEW_AddSubItemW(hwnd, lpLVItem); } rcItem.left = LVIR_BOUNDS; @@ -2698,7 +2757,7 @@ */ static INT LISTVIEW_GetTopIndex(HWND hwnd) { - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; INT nItem = 0; SCROLLINFO scrollInfo; @@ -2748,9 +2807,9 @@ static VOID LISTVIEW_DrawSubItem(HWND hwnd, HDC hdc, INT nItem, INT nSubItem, RECT rcItem, BOOL Selected) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - CHAR szDispText[DISP_TEXT_SIZE]; - LVITEMA lvItem; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + WCHAR szDispText[DISP_TEXT_SIZE]; + LVITEMW lvItem; UINT textoutOptions = ETO_CLIPPED | ETO_OPAQUE; RECT rcTemp; @@ -2758,13 +2817,13 @@ nItem, nSubItem); /* get information needed for drawing the item */ - ZeroMemory(&lvItem, sizeof(LVITEMA)); + ZeroMemory(&lvItem, sizeof(lvItem)); lvItem.mask = LVIF_TEXT; lvItem.iItem = nItem; lvItem.iSubItem = nSubItem; lvItem.cchTextMax = DISP_TEXT_SIZE; lvItem.pszText = szDispText; - LISTVIEW_GetItemA(hwnd, &lvItem, TRUE); + LISTVIEW_GetItemW(hwnd, &lvItem, TRUE); /* redraw the background of the item */ rcTemp = rcItem; @@ -2805,8 +2864,8 @@ SetTextColor(hdc, infoPtr->clrText); } - ExtTextOutA(hdc, rcItem.left, rcItem.top, textoutOptions, - &rcItem, lvItem.pszText, lstrlenA(lvItem.pszText), NULL); + ExtTextOutW(hdc, rcItem.left, rcItem.top, textoutOptions, + &rcItem, lvItem.pszText, lstrlenW(lvItem.pszText), NULL); if (Selected) { @@ -2817,13 +2876,13 @@ CopyRect(&rec,&rcItem); rec.left = rec.right; rec.right = rec.left+REPORT_MARGINX; - ExtTextOutA(hdc, rec.left , rec.top, textoutOptions, + ExtTextOutW(hdc, rec.left , rec.top, textoutOptions, &rec, NULL, 0, NULL); } CopyRect(&rec,&rcItem); rec.right = rec.left; rec.left = rec.left - REPORT_MARGINX; - ExtTextOutA(hdc, rec.left , rec.top, textoutOptions, + ExtTextOutW(hdc, rec.left , rec.top, textoutOptions, &rec, NULL, 0, NULL); } } @@ -2844,10 +2903,10 @@ */ static VOID LISTVIEW_DrawItem(HWND hwnd, HDC hdc, INT nItem, RECT rcItem, BOOL FullSelect, RECT* SuggestedFocus) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - CHAR szDispText[DISP_TEXT_SIZE]; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + WCHAR szDispText[DISP_TEXT_SIZE]; INT nLabelWidth; - LVITEMA lvItem; + LVITEMW lvItem; INT nMixMode; DWORD dwBkColor; DWORD dwTextColor,dwTextX; @@ -2860,14 +2919,14 @@ /* get information needed for drawing the item */ - ZeroMemory(&lvItem, sizeof(LVITEMA)); + ZeroMemory(&lvItem, sizeof(lvItem)); lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_INDENT; lvItem.stateMask = LVIS_SELECTED | LVIS_STATEIMAGEMASK; lvItem.iItem = nItem; lvItem.iSubItem = 0; lvItem.cchTextMax = DISP_TEXT_SIZE; lvItem.pszText = szDispText; - LISTVIEW_GetItemA(hwnd, &lvItem, TRUE); + LISTVIEW_GetItemW(hwnd, &lvItem, TRUE); /* redraw the background of the item */ rcTemp = rcItem; @@ -2939,7 +2998,7 @@ /* set raster mode */ nMixMode = SetROP2(hdc, R2_XORPEN); } - else if ((GetWindowLongA(hwnd, GWL_STYLE) & LVS_SHOWSELALWAYS) && + else if ((GetWindowLongW(hwnd, GWL_STYLE) & LVS_SHOWSELALWAYS) && (lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus == FALSE)) { dwBkColor = SetBkColor(hdc, GetSysColor(COLOR_3DFACE)); @@ -2967,7 +3026,7 @@ nMixMode = SetROP2(hdc, R2_COPYPEN); } - nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText); + nLabelWidth = ListView_GetStringWidthW(hwnd, lvItem.pszText); if (rcItem.left + nLabelWidth < rcItem.right) { if (!FullSelect) @@ -2982,8 +3041,8 @@ dwTextX += IMAGE_PADDING; if (lvItem.pszText) - ExtTextOutA(hdc, dwTextX, rcItem.top, textoutOptions, - &rcItem, lvItem.pszText, lstrlenA(lvItem.pszText), NULL); + ExtTextOutW(hdc, dwTextX, rcItem.top, textoutOptions, + &rcItem, lvItem.pszText, lstrlenW(lvItem.pszText), NULL); if ((FullSelect)&&(Header_GetItemCount(infoPtr->hwndHeader) > 1)) { @@ -2992,7 +3051,7 @@ CopyRect(&rec,&rcItem); rec.left = rec.right; rec.right = rec.left+REPORT_MARGINX; - ExtTextOutA(hdc, rec.left , rec.top, textoutOptions, + ExtTextOutW(hdc, rec.left , rec.top, textoutOptions, &rec, NULL, 0, NULL); } @@ -3026,12 +3085,12 @@ static VOID LISTVIEW_DrawLargeItem(HWND hwnd, HDC hdc, INT nItem, RECT rcItem, RECT *SuggestedFocus) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - CHAR szDispText[DISP_TEXT_SIZE]; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + WCHAR szDispText[DISP_TEXT_SIZE]; INT nDrawPosX = rcItem.left; INT nLabelWidth, rcWidth; - TEXTMETRICA tm; - LVITEMA lvItem; + TEXTMETRICW tm; + LVITEMW lvItem; UINT textoutOptions = ETO_CLIPPED | ETO_OPAQUE; RECT rcTemp; @@ -3040,14 +3099,14 @@ rcItem.bottom); /* get information needed for drawing the item */ - ZeroMemory(&lvItem, sizeof(LVITEMA)); + ZeroMemory(&lvItem, sizeof(lvItem)); lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED; lvItem.iItem = nItem; lvItem.iSubItem = 0; lvItem.cchTextMax = DISP_TEXT_SIZE; lvItem.pszText = szDispText; - LISTVIEW_GetItemA(hwnd, &lvItem, TRUE); + LISTVIEW_GetItemW(hwnd, &lvItem, TRUE); /* redraw the background of the item */ rcTemp = rcItem; @@ -3108,7 +3167,7 @@ InflateRect(&rcItem, -(2*CAPTION_BORDER), 0); rcItem.top += infoPtr->iconSize.cy + ICON_BOTTOM_PADDING; nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText); - GetTextMetricsA(hdc, &tm); + GetTextMetricsW(hdc, &tm); /* append an ellipse ('...') if the caption won't fit in the rect */ rcWidth = max(0, rcItem.right - rcItem.left); @@ -3118,9 +3177,9 @@ /* give or take a couple, how many average sized chars would fit? */ nCharsFit = tm.tmAveCharWidth > 0 ? (rcWidth/tm.tmAveCharWidth)+2 : 0; /* place the ellipse accordingly, without overrunning the buffer */ - len = strlen(szDispText); + len = strlenW(szDispText); eos = min((nCharsFit > 1 && nCharsFit < len) ? nCharsFit+3 : len+2, - sizeof(szDispText)-1); + sizeof(szDispText)/sizeof(WCHAR)-1); nLabelWidth = ListView_GetStringWidthA(hwnd, szDispText); while ((nLabelWidth > rcWidth) && (eos > 3)) @@ -3149,8 +3208,8 @@ /* draw label */ rcItem.bottom = rcItem.top + tm.tmHeight + HEIGHT_PADDING; - ExtTextOutA(hdc, rcItem.left + CAPTION_BORDER, rcItem.top, textoutOptions, - &rcItem, lvItem.pszText, lstrlenA(lvItem.pszText), NULL); + ExtTextOutW(hdc, rcItem.left + CAPTION_BORDER, rcItem.top, textoutOptions, + &rcItem, lvItem.pszText, lstrlenW(lvItem.pszText), NULL); CopyRect(SuggestedFocus,&rcItem); @@ -3169,7 +3228,7 @@ */ static VOID LISTVIEW_RefreshReport(HWND hwnd, HDC hdc, DWORD cdmode) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd,0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd,0); SCROLLINFO scrollInfo; INT nDrawPosY = infoPtr->rcList.top; INT nColumnCount; @@ -3179,7 +3238,7 @@ INT nLast; BOOL FullSelected; DWORD cditemmode = CDRF_DODEFAULT; - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); INT scrollOffset; ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); @@ -3193,17 +3252,17 @@ nLast = min(nLast, GETITEMCOUNT(infoPtr)); /* send cache hint notification */ - if (GetWindowLongA(hwnd,GWL_STYLE) & LVS_OWNERDATA) + if (GetWindowLongW(hwnd,GWL_STYLE) & LVS_OWNERDATA) { NMLVCACHEHINT nmlv; nmlv.hdr.hwndFrom = hwnd; - nmlv.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID); + nmlv.hdr.idFrom = GetWindowLongW(hwnd,GWL_ID); nmlv.hdr.code = LVN_ODCACHEHINT; nmlv.iFrom = nItem; nmlv.iTo = nLast; - SendMessageA(GetParent(hwnd), WM_NOTIFY, (WPARAM)nmlv.hdr.idFrom, + SendMessageW(GetParent(hwnd), WM_NOTIFY, (WPARAM)nmlv.hdr.idFrom, (LPARAM)&nmlv); } @@ -3230,9 +3289,9 @@ /* Do Owner Draw */ if (lStyle & LVS_OWNERDRAWFIXED) { - UINT uID = GetWindowLongA( hwnd, GWL_ID); + UINT uID = GetWindowLongW( hwnd, GWL_ID); DRAWITEMSTRUCT dis; - LVITEMA item; + LVITEMW item; RECT br; TRACE("Owner Drawn\n"); @@ -3255,14 +3314,14 @@ dis.rcItem.top = nDrawPosY; dis.rcItem.bottom = dis.rcItem.top + infoPtr->nItemHeight; - ZeroMemory(&item,sizeof(LVITEMA)); + ZeroMemory(&item,sizeof(item)); item.iItem = nItem; item.mask = LVIF_PARAM; - ListView_GetItemA(hwnd,&item); + ListView_GetItemW(hwnd, &item); dis.itemData = item.lParam; - if (SendMessageA(GetParent(hwnd),WM_DRAWITEM,(WPARAM)uID,(LPARAM)&dis)) + if (SendMessageW(GetParent(hwnd),WM_DRAWITEM,(WPARAM)uID,(LPARAM)&dis)) { nDrawPosY += infoPtr->nItemHeight; continue; @@ -3349,8 +3408,8 @@ */ static INT LISTVIEW_GetCountPerRow(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd,0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd,0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left; INT nCountPerRow = 1; @@ -3386,7 +3445,7 @@ */ static INT LISTVIEW_GetCountPerColumn(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd,0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd,0); INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top; INT nCountPerColumn = 1; @@ -3415,8 +3474,8 @@ */ static INT LISTVIEW_GetColumnCount(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); INT nColumnCount = 0; if ((lStyle & LVS_TYPEMASK) == LVS_LIST) @@ -3448,7 +3507,7 @@ */ static VOID LISTVIEW_RefreshList(HWND hwnd, HDC hdc, DWORD cdmode) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); RECT rcItem, FocusRect, rcTemp; INT i, j; INT nItem; @@ -3518,7 +3577,7 @@ */ static VOID LISTVIEW_RefreshIcon(HWND hwnd, HDC hdc, BOOL bSmall, DWORD cdmode) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); POINT ptPosition; POINT ptOrigin; RECT rcItem, SuggestedFocus, rcTemp; @@ -3599,8 +3658,8 @@ */ static VOID LISTVIEW_Refresh(HWND hwnd, HDC hdc) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; HFONT hOldFont; HPEN hPen, hOldPen; DWORD cdmode; @@ -3666,8 +3725,8 @@ static LRESULT LISTVIEW_ApproximateViewRect(HWND hwnd, INT nItemCount, WORD wWidth, WORD wHeight) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; INT nItemCountPerColumn = 1; INT nColumnCount = 0; DWORD dwViewRect = 0; @@ -3747,7 +3806,7 @@ */ static LRESULT LISTVIEW_Arrange(HWND hwnd, INT nAlignCode) { - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; BOOL bResult = FALSE; if ((uView == LVS_ICON) || (uView == LVS_SMALLICON)) @@ -3788,9 +3847,9 @@ */ static LRESULT LISTVIEW_DeleteAllItems(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID); - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LONG lCtrlId = GetWindowLongW(hwnd, GWL_ID); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; LISTVIEW_ITEM *lpItem; LISTVIEW_SUBITEM *lpSubItem; @@ -3841,11 +3900,8 @@ if (lpSubItem != NULL) { /* free subitem string */ - if ((lpSubItem->pszText != NULL) && - (lpSubItem->pszText != LPSTR_TEXTCALLBACKA)) - { + if (is_text(lpSubItem->pszText)) COMCTL32_Free(lpSubItem->pszText); - } /* free subitem */ COMCTL32_Free(lpSubItem); @@ -3865,11 +3921,8 @@ } /* free item string */ - if ((lpItem->pszText != NULL) && - (lpItem->pszText != LPSTR_TEXTCALLBACKA)) - { + if (is_text(lpItem->pszText)) COMCTL32_Free(lpItem->pszText); - } /* free item */ COMCTL32_Free(lpItem); @@ -3918,9 +3971,9 @@ */ static LRESULT LISTVIEW_DeleteColumn(HWND hwnd, INT nColumn) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; - UINT uOwnerData = GetWindowLongA(hwnd, GWL_STYLE) & LVS_OWNERDATA; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; + UINT uOwnerData = GetWindowLongW(hwnd, GWL_STYLE) & LVS_OWNERDATA; BOOL bResult = FALSE; if (Header_DeleteItem(infoPtr->hwndHeader, nColumn) != FALSE) @@ -3959,17 +4012,17 @@ */ static LRESULT LISTVIEW_DeleteItem(HWND hwnd, INT nItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; - LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID); + LONG lCtrlId = GetWindowLongW(hwnd, GWL_ID); NMLISTVIEW nmlv; BOOL bResult = FALSE; HDPA hdpaSubItems; LISTVIEW_ITEM *lpItem; LISTVIEW_SUBITEM *lpSubItem; INT i; - LVITEMA item; + LVITEMW item; TRACE("(hwnd=%x,nItem=%d)\n", hwnd, nItem); @@ -3980,12 +4033,12 @@ nmlv.hdr.idFrom = lCtrlId; nmlv.hdr.code = LVN_DELETEITEM; nmlv.iItem = nItem; - SendMessageA(GetParent(hwnd), WM_NOTIFY, (WPARAM)lCtrlId, + SendMessageW(GetParent(hwnd), WM_NOTIFY, (WPARAM)lCtrlId, (LPARAM)&nmlv); /* remove it from the selection range */ - ZeroMemory(&item,sizeof(LVITEMA)); + ZeroMemory(&item,sizeof(item)); item.stateMask = LVIS_SELECTED; LISTVIEW_SetItemState(hwnd,nItem,&item); @@ -4010,11 +4063,8 @@ if (lpSubItem != NULL) { /* free item string */ - if ((lpSubItem->pszText != NULL) && - (lpSubItem->pszText != LPSTR_TEXTCALLBACKA)) - { + if (is_text(lpSubItem->pszText)) COMCTL32_Free(lpSubItem->pszText); - } /* free item */ COMCTL32_Free(lpSubItem); @@ -4025,11 +4075,8 @@ if (lpItem != NULL) { /* free item string */ - if ((lpItem->pszText != NULL) && - (lpItem->pszText != LPSTR_TEXTCALLBACKA)) - { + if (is_text(lpItem->pszText)) COMCTL32_Free(lpItem->pszText); - } /* free item */ COMCTL32_Free(lpItem); @@ -4076,7 +4123,7 @@ */ static LRESULT LISTVIEW_GetEditControl(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); return infoPtr->hwndEdit; } @@ -4094,20 +4141,16 @@ * SUCCESS : TRUE * FAILURE : FALSE */ - -static BOOL LISTVIEW_EndEditLabel(HWND hwnd, LPSTR pszText, DWORD nItem) +static BOOL LISTVIEW_EndEditLabelW(HWND hwnd, LPWSTR pszText, DWORD nItem) { - NMLVDISPINFOA dispInfo; + NMLVDISPINFOW dispInfo; LISTVIEW_ITEM *lpItem; - INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + INT nCtrlId = GetWindowLongW(hwnd, GWL_ID); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); HDPA hdpaSubItems; - BOOL bUpdateItemText; LISTVIEW_ITEM lvItemRef; - LVITEMA item; - - ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA)); + LVITEMW item; if (!(lStyle & LVS_OWNERDATA)) { @@ -4120,40 +4163,35 @@ else { ZeroMemory(&lvItemRef,sizeof(LISTVIEW_ITEM)); - ZeroMemory(&item,sizeof(LVITEMA)); + ZeroMemory(&item,sizeof(item)); item.iItem = nItem; item.iSubItem = 0; item.mask = LVIF_PARAM | LVIF_STATE; - ListView_GetItemA(hwnd,&item); + ListView_GetItemW(hwnd, &item); lvItemRef.state = item.state; lvItemRef.iImage = item.iImage; lvItemRef.lParam = item.lParam; lpItem = &lvItemRef; } + ZeroMemory(&dispInfo, sizeof(dispInfo)); dispInfo.hdr.hwndFrom = hwnd; dispInfo.hdr.idFrom = nCtrlId; - dispInfo.hdr.code = LVN_ENDLABELEDITA; + dispInfo.hdr.code = LVN_ENDLABELEDITW; dispInfo.item.mask = 0; dispInfo.item.iItem = nItem; dispInfo.item.state = lpItem->state; dispInfo.item.stateMask = 0; dispInfo.item.pszText = pszText; - dispInfo.item.cchTextMax = pszText ? strlen(pszText) : 0; + dispInfo.item.cchTextMax = pszText ? lstrlenW(pszText) : 0; dispInfo.item.iImage = lpItem->iImage; dispInfo.item.lParam = lpItem->lParam; infoPtr->hwndEdit = 0; - bUpdateItemText = ListView_Notify(GetParent(hwnd), nCtrlId, &dispInfo); - /* Do we need to update the Item Text */ - if(bUpdateItemText) - { - if ((lpItem->pszText != LPSTR_TEXTCALLBACKA)&&(!(lStyle & LVS_OWNERDATA))) - { - Str_SetPtrA(&lpItem->pszText, pszText); - } - } + if(ListView_DINotify(GetParent(hwnd), nCtrlId, &dispInfo)) + if ((lpItem->pszText != LPSTR_TEXTCALLBACKW)&&(!(lStyle & LVS_OWNERDATA))) + Str_SetPtrW(&lpItem->pszText, pszText); return TRUE; } @@ -4165,40 +4203,37 @@ * PARAMETER(S): * [I] HWND : window handle * [I] INT : item index + * [I] isW : TRUE if it's a Unicode req, FALSE if ASCII * * RETURN: * SUCCESS : TRUE * FAILURE : FALSE */ - -static HWND LISTVIEW_EditLabelA(HWND hwnd, INT nItem) +static HWND LISTVIEW_EditLabelT(HWND hwnd, INT nItem, BOOL isW) { - NMLVDISPINFOA dispInfo; + NMLVDISPINFOW dispInfo; RECT rect; LISTVIEW_ITEM *lpItem; HWND hedit; - HINSTANCE hinst = GetWindowLongA(hwnd, GWL_HINSTANCE); - INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + HINSTANCE hinst = GetWindowLongW(hwnd, GWL_HINSTANCE); + INT nCtrlId = GetWindowLongW(hwnd, GWL_ID); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); HDPA hdpaSubItems; - CHAR szDispText[DISP_TEXT_SIZE]; - LVITEMA lvItem,item; + WCHAR szDispText[DISP_TEXT_SIZE]; + LVITEMW lvItem,item; LISTVIEW_ITEM lvItemRef; - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); - if (~GetWindowLongA(hwnd, GWL_STYLE) & LVS_EDITLABELS) + if (~GetWindowLongW(hwnd, GWL_STYLE) & LVS_EDITLABELS) return FALSE; /* Is the EditBox still there, if so remove it */ if(infoPtr->hwndEdit != 0) - { SetFocus(hwnd); - } LISTVIEW_SetSelection(hwnd, nItem); LISTVIEW_SetItemFocus(hwnd, nItem); - ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA)); if (!(lStyle & LVS_OWNERDATA)) { if (NULL == (hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem))) @@ -4210,11 +4245,11 @@ else { ZeroMemory(&lvItemRef,sizeof(LISTVIEW_ITEM)); - ZeroMemory(&item,sizeof(LVITEMA)); + ZeroMemory(&item, sizeof(item)); item.iItem = nItem; item.iSubItem = 0; item.mask = LVIF_PARAM | LVIF_STATE; - ListView_GetItemA(hwnd,&item); + ListView_GetItemW(hwnd, &item); lvItemRef.iImage = item.iImage; lvItemRef.state = item.state; lvItemRef.lParam = item.lParam; @@ -4222,42 +4257,46 @@ } /* get information needed for drawing the item */ - ZeroMemory(&lvItem, sizeof(LVITEMA)); + ZeroMemory(&lvItem, sizeof(lvItem)); lvItem.mask = LVIF_TEXT; lvItem.iItem = nItem; lvItem.iSubItem = 0; lvItem.cchTextMax = DISP_TEXT_SIZE; lvItem.pszText = szDispText; - ListView_GetItemA(hwnd, &lvItem); + ListView_GetItemW(hwnd, &lvItem); + ZeroMemory(&dispInfo, sizeof(dispInfo)); dispInfo.hdr.hwndFrom = hwnd; dispInfo.hdr.idFrom = nCtrlId; - dispInfo.hdr.code = LVN_BEGINLABELEDITA; + dispInfo.hdr.code = LVN_BEGINLABELEDITW; dispInfo.item.mask = 0; dispInfo.item.iItem = nItem; dispInfo.item.state = lpItem->state; dispInfo.item.stateMask = 0; dispInfo.item.pszText = lvItem.pszText; - dispInfo.item.cchTextMax = strlen(lvItem.pszText); + dispInfo.item.cchTextMax = lstrlenW(lvItem.pszText); dispInfo.item.iImage = lpItem->iImage; dispInfo.item.lParam = lpItem->lParam; - if (ListView_LVNotify(GetParent(hwnd), nCtrlId, &dispInfo)) + if (ListView_DINotify(GetParent(hwnd), nCtrlId, &dispInfo)) return 0; rect.left = LVIR_LABEL; if (!LISTVIEW_GetItemRect(hwnd, nItem, &rect)) return 0; - - if (!(hedit = CreateEditLabel(szDispText , WS_VISIBLE, + + /* FIXME: if !isW, should we create a ASCII edit label instead + * with a ASCII callback which should send ASCII notification msgs??? + */ + if (!(hedit = CreateEditLabelW(szDispText , WS_VISIBLE, rect.left-2, rect.top-1, 0, rect.bottom - rect.top+2, - hwnd, hinst, LISTVIEW_EndEditLabel, nItem))) + hwnd, hinst, LISTVIEW_EndEditLabelW, nItem))) return 0; infoPtr->hwndEdit = hedit; SetFocus(hedit); - SendMessageA(hedit, EM_SETSEL, 0, -1); + SendMessageW(hedit, EM_SETSEL, 0, -1); return hedit; } @@ -4278,8 +4317,8 @@ */ static BOOL LISTVIEW_EnsureVisible(HWND hwnd, INT nItem, BOOL bPartial) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; INT nScrollPosHeight = 0; INT nScrollPosWidth = 0; SCROLLINFO scrollInfo; @@ -4443,7 +4482,7 @@ */ static INT LISTVIEW_GetNearestItem(HWND hwnd, POINT pt, UINT vkDirection) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); LVHITTESTINFO lvHitTestInfo; INT nItem = -1; RECT rcView; @@ -4495,28 +4534,28 @@ * Searches for an item with specific characteristics. * * PARAMETER(S): - * [I] HWND : window handle - * [I] INT : base item index - * [I] LPLVFINDINFO : item information to look for + * [I] hwnd : window handle + * [I] nStart : base item index + * [I] lpFindInfo : item information to look for * * RETURN: * SUCCESS : index of item * FAILURE : -1 */ -static LRESULT LISTVIEW_FindItem(HWND hwnd, INT nStart, - LPLVFINDINFO lpFindInfo) +static LRESULT LISTVIEW_FindItemW(HWND hwnd, INT nStart, + LPLVFINDINFOW lpFindInfo) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); POINT ptItem; - CHAR szDispText[DISP_TEXT_SIZE]; - LVITEMA lvItem; + WCHAR szDispText[DISP_TEXT_SIZE]; + LVITEMW lvItem; BOOL bWrap = FALSE; INT nItem = nStart; INT nLast = GETITEMCOUNT(infoPtr); if ((nItem >= -1) && (lpFindInfo != NULL)) { - ZeroMemory(&lvItem, sizeof(LVITEMA)); + ZeroMemory(&lvItem, sizeof(lvItem)); if (lpFindInfo->flags & LVFI_PARAM) { @@ -4572,18 +4611,18 @@ lvItem.iItem = nItem; lvItem.iSubItem = 0; - if (LISTVIEW_GetItemA(hwnd, &lvItem, TRUE) != FALSE) + if (LISTVIEW_GetItemW(hwnd, &lvItem, TRUE) != FALSE) { if (lvItem.mask & LVIF_TEXT) { if (lpFindInfo->flags & LVFI_PARTIAL) { - if (strstr(lvItem.pszText, lpFindInfo->psz) == NULL) + if (strstrW(lvItem.pszText, lpFindInfo->psz) == NULL) continue; } else { - if (strcmp(lvItem.pszText, lpFindInfo->psz) != 0) + if (lstrcmpW(lvItem.pszText, lpFindInfo->psz) != 0) continue; } } @@ -4616,6 +4655,33 @@ /*** * DESCRIPTION: + * Searches for an item with specific characteristics. + * + * PARAMETER(S): + * [I] hwnd : window handle + * [I] nStart : base item index + * [I] lpFindInfo : item information to look for + * + * RETURN: + * SUCCESS : index of item + * FAILURE : -1 + */ +static LRESULT LISTVIEW_FindItemA(HWND hwnd, INT nStart, + LPLVFINDINFOA lpFindInfo) +{ + LVFINDINFOW fiw; + LRESULT res; + + memcpy(&fiw, lpFindInfo, sizeof(fiw)); + if (fiw.psz) + fiw.psz = HEAP_strdupAtoW(GetProcessHeap(), 0, lpFindInfo->psz); + res = LISTVIEW_FindItemW(hwnd, nStart, &fiw); + HeapFree(GetProcessHeap(), 0, (LPWSTR)fiw.psz); + return res; +} + +/*** + * DESCRIPTION: * Retrieves the background color of the listview control. * * PARAMETER(S): @@ -4626,7 +4692,7 @@ */ static LRESULT LISTVIEW_GetBkColor(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); return infoPtr->clrBk; } @@ -4661,7 +4727,7 @@ */ static UINT LISTVIEW_GetCallbackMask(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); return infoPtr->uCallbackMask; } @@ -4673,22 +4739,24 @@ * PARAMETER(S): * [I] HWND : window handle * [I] INT : column index - * [IO] LPLVCOLUMNA : column information + * [IO] LPLVCOLUMNW : column information + * [I] isW : if TRUE, then lpColumn is a LPLVCOLUMNW + * otherwise it is in fact a LPLVCOLUMNA * * RETURN: * SUCCESS : TRUE * FAILURE : FALSE */ -static LRESULT LISTVIEW_GetColumnA(HWND hwnd, INT nItem, LPLVCOLUMNA lpColumn) +static LRESULT LISTVIEW_GetColumn(HWND hwnd, INT nItem, LPLVCOLUMNW lpColumn, BOOL isW) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - HDITEMA hdi; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + HDITEMW hdi; BOOL bResult = FALSE; if (lpColumn != NULL) { /* initialize memory */ - ZeroMemory(&hdi, sizeof(HDITEMA)); + ZeroMemory(&hdi, sizeof(hdi)); if (lpColumn->mask & LVCF_FMT) { @@ -4716,8 +4784,12 @@ { hdi.mask |= HDI_ORDER; } + + if (isW) + bResult = Header_GetItemW(infoPtr->hwndHeader, nItem, &hdi); + else + bResult = Header_GetItemA(infoPtr->hwndHeader, nItem, &hdi); - bResult = Header_GetItemA(infoPtr->hwndHeader, nItem, &hdi); if (bResult != FALSE) { if (lpColumn->mask & LVCF_FMT) @@ -4768,12 +4840,10 @@ return bResult; } -/* LISTVIEW_GetColumnW */ - static LRESULT LISTVIEW_GetColumnOrderArray(HWND hwnd, INT iCount, LPINT lpiArray) { -/* LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); */ +/* LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); */ INT i; if (!lpiArray) @@ -4800,10 +4870,10 @@ */ static LRESULT LISTVIEW_GetColumnWidth(HWND hwnd, INT nColumn) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; INT nColumnWidth = 0; - HDITEMA hdi; + HDITEMW hdi; if (uView == LVS_LIST) { @@ -4812,9 +4882,9 @@ else if (uView == LVS_REPORT) { /* get column width from header */ - ZeroMemory(&hdi, sizeof(HDITEMA)); + ZeroMemory(&hdi, sizeof(hdi)); hdi.mask = HDI_WIDTH; - if (Header_GetItemA(infoPtr->hwndHeader, nColumn, &hdi) != FALSE) + if (Header_GetItemW(infoPtr->hwndHeader, nColumn, &hdi) != FALSE) { nColumnWidth = hdi.cxy; } @@ -4837,8 +4907,8 @@ */ static LRESULT LISTVIEW_GetCountPerPage(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; INT nItemCount = 0; if (uView == LVS_LIST) @@ -4879,7 +4949,7 @@ LISTVIEW_INFO *infoPtr; /* make sure we can get the listview info */ - if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0))) + if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0))) return (0); return (infoPtr->dwExStyle); @@ -4897,7 +4967,7 @@ */ static LRESULT LISTVIEW_GetHeader(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); return infoPtr->hwndHeader; } @@ -4918,7 +4988,7 @@ */ static LRESULT LISTVIEW_GetHoverTime(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); return infoPtr->dwHoverTime; } @@ -4937,7 +5007,7 @@ */ static LRESULT LISTVIEW_GetImageList(HWND hwnd, INT nImageList) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); HIMAGELIST himl = NULL; switch (nImageList) @@ -4963,27 +5033,29 @@ * Retrieves item attributes. * * PARAMETER(S): - * [I] HWND : window handle - * [IO] LPLVITEMA : item info + * [I] hwnd : window handle + * [IO] lpLVItem : item info * [I] internal : if true then we will use tricks that avoid copies * but are not compatible with the regular interface + * [I] isW : if TRUE, then lpLVItem is a LPLVITEMW, + * if FALSE, the lpLVItem is a LPLVITEMA. * * RETURN: * SUCCESS : TRUE * FAILURE : FALSE */ -static LRESULT LISTVIEW_GetItemA(HWND hwnd, LPLVITEMA lpLVItem, BOOL internal) +static LRESULT LISTVIEW_GetItemT(HWND hwnd, LPLVITEMW lpLVItem, BOOL internal, BOOL isW) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID); - NMLVDISPINFOA dispInfo; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LONG lCtrlId = GetWindowLongW(hwnd, GWL_ID); + NMLVDISPINFOW dispInfo; LISTVIEW_SUBITEM *lpSubItem; LISTVIEW_ITEM *lpItem; INT* piImage; - LPSTR* ppszText; + LPWSTR* ppszText; LPARAM *plParam; HDPA hdpaSubItems; - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); /* In the following: * lpLVItem describes the information requested by the user * lpItem/lpSubItem is what we have @@ -4999,17 +5071,19 @@ ) return FALSE; + ZeroMemory(&dispInfo, sizeof(dispInfo)); + dispInfo.hdr.hwndFrom = hwnd; + dispInfo.hdr.idFrom = lCtrlId; + dispInfo.hdr.code = isW ? LVN_GETDISPINFOW : LVN_GETDISPINFOA; + if (lStyle & LVS_OWNERDATA) { if (lpLVItem->mask & ~LVIF_STATE) { - dispInfo.hdr.hwndFrom = hwnd; - dispInfo.hdr.idFrom = lCtrlId; - dispInfo.hdr.code = LVN_GETDISPINFOA; - memcpy(&dispInfo.item,lpLVItem,sizeof(LVITEMA)); + memcpy(&dispInfo.item, lpLVItem, sizeof(LVITEMW)); - ListView_Notify(GetParent(hwnd), lCtrlId, &dispInfo); - memcpy(lpLVItem,&dispInfo.item,sizeof(LVITEMA)); + ListView_DINotify(GetParent(hwnd), lCtrlId, &dispInfo); + memcpy(lpLVItem, &dispInfo.item, sizeof(LVITEMW)); } if ((lpLVItem->mask & LVIF_STATE)&&(lpLVItem->iSubItem == 0)) @@ -5033,7 +5107,7 @@ if (lpItem == NULL) return FALSE; - ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA)); + ZeroMemory(&dispInfo.item, sizeof(LVITEMW)); if (lpLVItem->iSubItem == 0) { piImage=&lpItem->iImage; @@ -5069,7 +5143,7 @@ } if ((lpLVItem->mask & LVIF_TEXT) && - ((ppszText==NULL) || (*ppszText == LPSTR_TEXTCALLBACKA))) + ((ppszText==NULL) || (*ppszText == LPSTR_TEXTCALLBACKW))) { dispInfo.item.mask |= LVIF_TEXT; dispInfo.item.pszText = lpLVItem->pszText; @@ -5079,13 +5153,10 @@ if (dispInfo.item.mask != 0) { /* We don't have all the requested info, query the application */ - dispInfo.hdr.hwndFrom = hwnd; - dispInfo.hdr.idFrom = lCtrlId; - dispInfo.hdr.code = LVN_GETDISPINFOA; dispInfo.item.iItem = lpLVItem->iItem; dispInfo.item.iSubItem = lpLVItem->iSubItem; dispInfo.item.lParam = lpItem->lParam; - ListView_Notify(GetParent(hwnd), lCtrlId, &dispInfo); + ListView_DINotify(GetParent(hwnd), lCtrlId, &dispInfo); } if (dispInfo.item.mask & LVIF_IMAGE) @@ -5105,39 +5176,44 @@ { lpLVItem->lParam = dispInfo.item.lParam; if ((dispInfo.item.mask & LVIF_DI_SETITEM) && plParam) - { *plParam = dispInfo.item.lParam; - } } else if (lpLVItem->mask & LVIF_PARAM) - { lpLVItem->lParam = lpItem->lParam; - } if (dispInfo.item.mask & LVIF_TEXT) { - if ((dispInfo.item.mask & LVIF_DI_SETITEM) && (ppszText != NULL)) + if ((dispInfo.item.mask & LVIF_DI_SETITEM) && (ppszText != NULL)) { - Str_SetPtrA(ppszText, dispInfo.item.pszText); + if (isW) + Str_SetPtrW(ppszText, dispInfo.item.pszText); + else + Str_SetPtrA((LPSTR *)ppszText, (LPCSTR)dispInfo.item.pszText); } + /* If lpLVItem->pszText==dispInfo.item.pszText a copy is unnecessary, but */ /* some apps give a new pointer in ListView_Notify so we can't be sure. */ - if (lpLVItem->pszText!=dispInfo.item.pszText) { - lstrcpynA(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); + if (lpLVItem->pszText != dispInfo.item.pszText) + { + if (isW) + lstrcpynW(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); + else + lstrcpynA((LPSTR)lpLVItem->pszText, (LPCSTR)dispInfo.item.pszText, lpLVItem->cchTextMax); } if (ppszText == NULL) - { - lstrcpynA(lpLVItem->pszText, "", lpLVItem->cchTextMax); - } + lpLVItem->pszText = '\0'; } else if (lpLVItem->mask & LVIF_TEXT) { - if (internal==TRUE) - { + if (internal) lpLVItem->pszText=*ppszText; - } else { - lstrcpynA(lpLVItem->pszText, *ppszText, lpLVItem->cchTextMax); + else + { + if (isW) + lstrcpynW(lpLVItem->pszText, *ppszText, lpLVItem->cchTextMax); + else + lstrcpynA((LPSTR)lpLVItem->pszText, (LPCSTR)*ppszText, lpLVItem->cchTextMax); } } @@ -5197,7 +5273,7 @@ LISTVIEW_INFO *infoPtr; /* make sure we can get the listview info */ - if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0))) + if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0))) return (-1); return (infoPtr->nHotItem); @@ -5217,7 +5293,7 @@ */ static LRESULT LISTVIEW_GetItemCount(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); return GETITEMCOUNT(infoPtr); } @@ -5238,8 +5314,8 @@ static BOOL LISTVIEW_GetItemPosition(HWND hwnd, INT nItem, LPPOINT lpptPosition) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; BOOL bResult = FALSE; HDPA hdpaSubItems; LISTVIEW_ITEM *lpItem; @@ -5334,8 +5410,8 @@ */ static LRESULT LISTVIEW_GetItemRect(HWND hwnd, INT nItem, LPRECT lprc) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; BOOL bResult = FALSE; POINT ptOrigin; POINT ptItem; @@ -5344,18 +5420,18 @@ INT nLeftPos; INT nLabelWidth; INT nIndent; - TEXTMETRICA tm; - LVITEMA lvItem; + TEXTMETRICW tm; + LVITEMW lvItem; TRACE("(hwnd=%x, nItem=%d, lprc=%p)\n", hwnd, nItem, lprc); if (uView & LVS_REPORT) { - ZeroMemory(&lvItem, sizeof(LVITEMA)); + ZeroMemory(&lvItem, sizeof(lvItem)); lvItem.mask = LVIF_INDENT; lvItem.iItem = nItem; lvItem.iSubItem = 0; - LISTVIEW_GetItemA(hwnd, &lvItem, TRUE); + LISTVIEW_GetItemW(hwnd, &lvItem, TRUE); /* do indent */ if (lvItem.iIndent>0 && infoPtr->iconSize.cx > 0) @@ -5458,7 +5534,7 @@ hdc = GetDC(hwnd); hOldFont = SelectObject(hdc, infoPtr->hFont); - GetTextMetricsA(hdc, &tm); + GetTextMetricsW(hdc, &tm); lprc->bottom = lprc->top + tm.tmHeight + HEIGHT_PADDING; SelectObject(hdc, hOldFont); ReleaseDC(hwnd, hdc); @@ -5732,21 +5808,19 @@ */ static INT LISTVIEW_GetLabelWidth(HWND hwnd, INT nItem) { - CHAR szDispText[DISP_TEXT_SIZE]; + WCHAR szDispText[DISP_TEXT_SIZE]; INT nLabelWidth = 0; - LVITEMA lvItem; + LVITEMW lvItem; TRACE("(hwnd=%x, nItem=%d)\n", hwnd, nItem); - ZeroMemory(&lvItem, sizeof(LVITEMA)); + ZeroMemory(&lvItem, sizeof(lvItem)); lvItem.mask = LVIF_TEXT; lvItem.iItem = nItem; lvItem.cchTextMax = DISP_TEXT_SIZE; lvItem.pszText = szDispText; - if (LISTVIEW_GetItemA(hwnd, &lvItem, TRUE) != FALSE) - { - nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText); - } + if (LISTVIEW_GetItemW(hwnd, &lvItem, TRUE) != FALSE) + nLabelWidth = ListView_GetStringWidthW(hwnd, lvItem.pszText); return nLabelWidth; } @@ -5764,7 +5838,7 @@ */ static LRESULT LISTVIEW_GetItemSpacing(HWND hwnd, BOOL bSmall) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); LONG lResult; if (bSmall == FALSE) @@ -5773,7 +5847,7 @@ } else { - LONG style = GetWindowLongA(hwnd, GWL_STYLE); + LONG style = GetWindowLongW(hwnd, GWL_STYLE); if ((style & LVS_TYPEMASK) == LVS_ICON) { lResult = MAKELONG(DEFAULT_COLUMN_WIDTH, GetSystemMetrics(SM_CXSMICON)+HEIGHT_PADDING); @@ -5800,20 +5874,18 @@ */ static LRESULT LISTVIEW_GetItemState(HWND hwnd, INT nItem, UINT uMask) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LVITEMA lvItem; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LVITEMW lvItem; UINT uState = 0; if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr))) { - ZeroMemory(&lvItem, sizeof(LVITEMA)); + ZeroMemory(&lvItem, sizeof(lvItem)); lvItem.iItem = nItem; lvItem.stateMask = uMask; lvItem.mask = LVIF_STATE; - if (LISTVIEW_GetItemA(hwnd, &lvItem, TRUE) != FALSE) - { + if (LISTVIEW_GetItemW(hwnd, &lvItem, TRUE)) uState = lvItem.state; - } } return uState; @@ -5824,9 +5896,41 @@ * Retrieves the text of a listview control item or subitem. * * PARAMETER(S): - * [I] HWND : window handle - * [I] INT : item index - * [IO] LPLVITEMA : item information + * [I] hwnd : window handle + * [I] nItem : item index + * [IO] lpLVItem : item information + * + * RETURN: + * SUCCESS : string length + * FAILURE : 0 + */ +static LRESULT LISTVIEW_GetItemTextW(HWND hwnd, INT nItem, LPLVITEMW lpLVItem) +{ + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + INT nLength = 0; + + if (lpLVItem != NULL) + { + if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr))) + { + lpLVItem->mask = LVIF_TEXT; + lpLVItem->iItem = nItem; + if (LISTVIEW_GetItemW(hwnd, lpLVItem, FALSE)) + nLength = lstrlenW(lpLVItem->pszText); + } + } + + return nLength; +} + +/*** + * DESCRIPTION: + * Retrieves the text of a listview control item or subitem. + * + * PARAMETER(S): + * [I] hwnd : window handle + * [I] nItem : item index + * [IO] lpLVItem : item information * * RETURN: * SUCCESS : string length @@ -5834,7 +5938,7 @@ */ static LRESULT LISTVIEW_GetItemTextA(HWND hwnd, INT nItem, LPLVITEMA lpLVItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); INT nLength = 0; if (lpLVItem != NULL) @@ -5843,10 +5947,8 @@ { lpLVItem->mask = LVIF_TEXT; lpLVItem->iItem = nItem; - if (LISTVIEW_GetItemA(hwnd, lpLVItem, FALSE) != FALSE) - { + if (LISTVIEW_GetItemA(hwnd, lpLVItem, FALSE)) nLength = lstrlenA(lpLVItem->pszText); - } } } @@ -5868,16 +5970,16 @@ */ static LRESULT LISTVIEW_GetNextItem(HWND hwnd, INT nItem, UINT uFlags) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; UINT uMask = 0; - LVFINDINFO lvFindInfo; + LVFINDINFOW lvFindInfo; INT nCountPerColumn; INT i; if ((nItem >= -1) && (nItem < GETITEMCOUNT(infoPtr))) { - ZeroMemory(&lvFindInfo, sizeof(LVFINDINFO)); + ZeroMemory(&lvFindInfo, sizeof(lvFindInfo)); if (uFlags & LVNI_CUT) uMask |= LVIS_CUT; @@ -5907,7 +6009,7 @@ lvFindInfo.flags = LVFI_NEARESTXY; lvFindInfo.vkDirection = VK_UP; ListView_GetItemPosition(hwnd, nItem, &lvFindInfo.pt); - while ((nItem = ListView_FindItem(hwnd, nItem, &lvFindInfo)) != -1) + while ((nItem = ListView_FindItemW(hwnd, nItem, &lvFindInfo)) != -1) { if ((ListView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) return nItem; @@ -5930,7 +6032,7 @@ lvFindInfo.flags = LVFI_NEARESTXY; lvFindInfo.vkDirection = VK_DOWN; ListView_GetItemPosition(hwnd, nItem, &lvFindInfo.pt); - while ((nItem = ListView_FindItem(hwnd, nItem, &lvFindInfo)) != -1) + while ((nItem = ListView_FindItemW(hwnd, nItem, &lvFindInfo)) != -1) { if ((ListView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) return nItem; @@ -5954,7 +6056,7 @@ lvFindInfo.flags = LVFI_NEARESTXY; lvFindInfo.vkDirection = VK_LEFT; ListView_GetItemPosition(hwnd, nItem, &lvFindInfo.pt); - while ((nItem = ListView_FindItem(hwnd, nItem, &lvFindInfo)) != -1) + while ((nItem = ListView_FindItemW(hwnd, nItem, &lvFindInfo)) != -1) { if ((ListView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) return nItem; @@ -5978,7 +6080,7 @@ lvFindInfo.flags = LVFI_NEARESTXY; lvFindInfo.vkDirection = VK_RIGHT; ListView_GetItemPosition(hwnd, nItem, &lvFindInfo.pt); - while ((nItem = ListView_FindItem(hwnd, nItem, &lvFindInfo)) != -1) + while ((nItem = ListView_FindItemW(hwnd, nItem, &lvFindInfo)) != -1) { if ((ListView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) return nItem; @@ -6017,7 +6119,7 @@ */ static LRESULT LISTVIEW_GetOrigin(HWND hwnd, LPPOINT lpptOrigin) { - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; BOOL bResult = FALSE; @@ -6067,7 +6169,7 @@ static LRESULT LISTVIEW_GetSelectedCount(HWND hwnd) { /* REDO THIS */ - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); INT nSelectedCount = 0; INT i; @@ -6094,41 +6196,44 @@ */ static LRESULT LISTVIEW_GetSelectionMark(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); return infoPtr->nSelectionMark; } + /*** * DESCRIPTION: * Retrieves the width of a string. * * PARAMETER(S): - * [I] HWND : window handle + * [I] hwnd : window handle + * [I] lpszText : text string to process + * [I] isW : TRUE if lpszText is Unicode, FALSE otherwise * * RETURN: * SUCCESS : string width (in pixels) * FAILURE : zero */ -static LRESULT LISTVIEW_GetStringWidthA(HWND hwnd, LPCSTR lpszText) +static LRESULT LISTVIEW_GetStringWidthT(HWND hwnd, LPCWSTR lpszText, BOOL isW) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - HFONT hFont, hOldFont; - SIZE stringSize; - HDC hdc; - - ZeroMemory(&stringSize, sizeof(SIZE)); - if (lpszText != NULL && lpszText != LPSTR_TEXTCALLBACKA) + if (is_textT(lpszText, isW)) { - hFont = infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont; - hdc = GetDC(hwnd); - hOldFont = SelectObject(hdc, hFont); - GetTextExtentPointA(hdc, lpszText, lstrlenA(lpszText), &stringSize); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + HFONT hFont = infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont; + HDC hdc = GetDC(hwnd); + HFONT hOldFont = SelectObject(hdc, hFont); + SIZE stringSize; + ZeroMemory(&stringSize, sizeof(SIZE)); + if (isW) + GetTextExtentPointW(hdc, lpszText, lstrlenW(lpszText), &stringSize); + else + GetTextExtentPointA(hdc, (LPCSTR)lpszText, lstrlenA((LPCSTR)lpszText), &stringSize); SelectObject(hdc, hOldFont); ReleaseDC(hwnd, hdc); + return stringSize.cx; } - - return stringSize.cx; + return 0; } /*** @@ -6143,7 +6248,7 @@ */ static LRESULT LISTVIEW_GetTextBkColor(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongW(hwnd, 0); return infoPtr->clrTextBk; } @@ -6160,7 +6265,7 @@ */ static LRESULT LISTVIEW_GetTextColor(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongW(hwnd, 0); return infoPtr->clrText; } @@ -6181,10 +6286,10 @@ static INT LISTVIEW_HitTestItem( HWND hwnd, LPLVHITTESTINFO lpHitTestInfo, BOOL subitem ) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); RECT rcItem; INT i,topindex,bottomindex; - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; @@ -6260,7 +6365,7 @@ */ static LRESULT LISTVIEW_HitTest(HWND hwnd, LPLVHITTESTINFO lpHitTestInfo) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); INT nItem = -1; lpHitTestInfo->flags = 0; @@ -6301,17 +6406,17 @@ * PARAMETER(S): * [I] HWND : window handle * [I] INT : column index - * [I] LPLVCOLUMNA : column information + * [I] LPLVCOLUMNW : column information * * RETURN: * SUCCESS : new column index * FAILURE : -1 */ -static LRESULT LISTVIEW_InsertColumnA(HWND hwnd, INT nColumn, - LPLVCOLUMNA lpColumn) +static LRESULT LISTVIEW_InsertColumnW(HWND hwnd, INT nColumn, + LPLVCOLUMNW lpColumn) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - HDITEMA hdi; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + HDITEMW hdi; INT nNewColumn = -1; TRACE("(hwnd=%x, nColumn=%d, lpColumn=%p)\n",hwnd, nColumn, @@ -6320,7 +6425,7 @@ if (lpColumn != NULL) { /* initialize memory */ - ZeroMemory(&hdi, sizeof(HDITEMA)); + ZeroMemory(&hdi, sizeof(hdi)); if (lpColumn->mask & LVCF_FMT) { @@ -6376,7 +6481,7 @@ { hdi.mask |= HDI_TEXT | HDI_FORMAT; hdi.pszText = lpColumn->pszText; - hdi.cchTextMax = ((lpColumn->pszText!=NULL) && (lpColumn->pszText!=LPSTR_TEXTCALLBACKA) ? strlen(lpColumn->pszText) : 0); + hdi.cchTextMax = (is_text(lpColumn->pszText) ? lstrlenW(lpColumn->pszText) : 0); hdi.fmt |= HDF_STRING; } @@ -6393,7 +6498,7 @@ } /* insert item in header control */ - nNewColumn = SendMessageA(infoPtr->hwndHeader, HDM_INSERTITEMA, + nNewColumn = SendMessageW(infoPtr->hwndHeader, HDM_INSERTITEMW, (WPARAM)nColumn, (LPARAM)&hdi); /* Need to reset the item width when inserting a new column */ @@ -6406,23 +6511,23 @@ return nNewColumn; } -static LRESULT LISTVIEW_InsertColumnW(HWND hwnd, INT nColumn, - LPLVCOLUMNW lpColumn) +static LRESULT LISTVIEW_InsertColumnA(HWND hwnd, INT nColumn, + LPLVCOLUMNA lpColumn) { - LVCOLUMNA lvca; - LRESULT lres; + LVCOLUMNW lvcw; + LRESULT lres; - memcpy(&lvca,lpColumn,sizeof(lvca)); + memcpy(&lvcw, lpColumn, sizeof(lvcw)); if (lpColumn->mask & LVCF_TEXT) { - if (lpColumn->pszText == LPSTR_TEXTCALLBACKW) - lvca.pszText = LPSTR_TEXTCALLBACKA; + if (lpColumn->pszText == LPSTR_TEXTCALLBACKA) + lvcw.pszText = LPSTR_TEXTCALLBACKW; else - lvca.pszText = HEAP_strdupWtoA(GetProcessHeap(),0,lpColumn->pszText); + lvcw.pszText = HEAP_strdupAtoW(GetProcessHeap(),0,lpColumn->pszText); } - lres = LISTVIEW_InsertColumnA(hwnd,nColumn,&lvca); + lres = LISTVIEW_InsertColumnW(hwnd, nColumn, &lvcw); if (lpColumn->mask & LVCF_TEXT) { - if (lpColumn->pszText != LPSTR_TEXTCALLBACKW) - HeapFree(GetProcessHeap(),0,lvca.pszText); + if (lpColumn->pszText != LPSTR_TEXTCALLBACKA) + HeapFree(GetProcessHeap(), 0, lvcw.pszText); } return lres; } @@ -6449,8 +6554,8 @@ HDPA hdpa_second = (HDPA) second; LISTVIEW_ITEM* lv_first = (LISTVIEW_ITEM*) DPA_GetPtr( hdpa_first, 0 ); LISTVIEW_ITEM* lv_second = (LISTVIEW_ITEM*) DPA_GetPtr( hdpa_second, 0 ); - LONG lStyle = GetWindowLongA((HWND) lParam, GWL_STYLE); - INT cmpv = lstrcmpA( lv_first->pszText, lv_second->pszText ); + LONG lStyle = GetWindowLongW((HWND) lParam, GWL_STYLE); + INT cmpv = lstrcmpW( lv_first->pszText, lv_second->pszText ); /* if we're sorting descending, negate the return value */ return (lStyle & LVS_SORTDESCENDING) ? -cmpv : cmpv; } @@ -6461,18 +6566,18 @@ * * PARAMETER(S): * [I] HWND : window handle - * [I] LPLVITEMA : item information + * [I] LPLVITEMW : item information * * RETURN: * SUCCESS : new item index * FAILURE : -1 */ -static LRESULT LISTVIEW_InsertItemA(HWND hwnd, LPLVITEMA lpLVItem) +static LRESULT LISTVIEW_InsertItemW(HWND hwnd, LPLVITEMW lpLVItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; - LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID); + LONG lCtrlId = GetWindowLongW(hwnd, GWL_ID); NMLISTVIEW nmlv; INT nItem = -1; HDPA hdpaSubItems; @@ -6497,7 +6602,7 @@ if (lpItem != NULL) { ZeroMemory(lpItem, sizeof(LISTVIEW_ITEM)); - if (LISTVIEW_InitItem(hwnd, lpItem, lpLVItem) != FALSE) + if (LISTVIEW_InitItemW(hwnd, lpItem, lpLVItem) != FALSE) { /* insert item in listview control data structure */ hdpaSubItems = DPA_Create(8); @@ -6508,7 +6613,7 @@ { if ( ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) && !(lStyle & LVS_OWNERDRAWFIXED) - && (LPSTR_TEXTCALLBACKA != lpLVItem->pszText) ) + && (LPSTR_TEXTCALLBACKW != lpLVItem->pszText) ) { /* Insert the item in the proper sort order based on the pszText member. See comments for LISTVIEW_InsertCompare() for greater detail */ @@ -6591,27 +6696,17 @@ return nItem; } -static LRESULT LISTVIEW_InsertItemW(HWND hwnd, LPLVITEMW lpLVItem) { - LVITEMA lvia; - LRESULT lres; - - memcpy(&lvia,lpLVItem,sizeof(LVITEMA)); - if (lvia.mask & LVIF_TEXT) { - if (lpLVItem->pszText == LPSTR_TEXTCALLBACKW) - lvia.pszText = LPSTR_TEXTCALLBACKA; - else - lvia.pszText = HEAP_strdupWtoA(GetProcessHeap(),0,lpLVItem->pszText); - } - lres = LISTVIEW_InsertItemA(hwnd, &lvia); - if (lvia.mask & LVIF_TEXT) { - if (lpLVItem->pszText != LPSTR_TEXTCALLBACKW) - HeapFree(GetProcessHeap(),0,lvia.pszText); +static LRESULT LISTVIEW_InsertItemA(HWND hwnd, LPLVITEMA lpLVItem) { + LVITEMW lviw; + LRESULT lres = 0; + + if(LISTVIEW_lvitem_cpyAtoW(lpLVItem, &lviw)) { + lres = LISTVIEW_InsertItemW(hwnd, &lviw); + LISTVIEW_lvitem_rmW(&lviw); } return lres; } -/* LISTVIEW_InsertItemW */ - /*** * DESCRIPTION: * Redraws a range of items. @@ -6627,7 +6722,7 @@ */ static LRESULT LISTVIEW_RedrawItems(HWND hwnd, INT nFirst, INT nLast) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); BOOL bResult = FALSE; RECT rcItem; @@ -6667,7 +6762,7 @@ */ static LRESULT LISTVIEW_SetBkColor(HWND hwnd, COLORREF clrBk) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); infoPtr->clrBk = clrBk; InvalidateRect(hwnd, NULL, TRUE); @@ -6692,7 +6787,7 @@ */ static BOOL LISTVIEW_SetCallbackMask(HWND hwnd, UINT uMask) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); infoPtr->uCallbackMask = uMask; @@ -6706,24 +6801,26 @@ * PARAMETER(S): * [I] HWND : window handle * [I] INT : column index - * [I] LPLVCOLUMNA : column attributes + * [I] LPLVCOLUMNW : column attributes + * [I] isW: if TRUE, the lpColumn is a LPLVCOLUMNW, + * otherwise it is in fact a LPLVCOLUMNA * * RETURN: * SUCCESS : TRUE * FAILURE : FALSE */ -static LRESULT LISTVIEW_SetColumnA(HWND hwnd, INT nColumn, - LPLVCOLUMNA lpColumn) +static LRESULT LISTVIEW_SetColumn(HWND hwnd, INT nColumn, + LPLVCOLUMNW lpColumn, BOOL isW) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); BOOL bResult = FALSE; - HDITEMA hdi, hdiget; + HDITEMW hdi, hdiget; if ((lpColumn != NULL) && (nColumn >= 0) && (nColumn < Header_GetItemCount(infoPtr->hwndHeader))) { /* initialize memory */ - ZeroMemory(&hdi, sizeof(HDITEMA)); + ZeroMemory(&hdi, sizeof(hdi)); if (lpColumn->mask & LVCF_FMT) { @@ -6732,7 +6829,7 @@ /* get current format first */ hdiget.mask = HDI_FORMAT; - if (Header_GetItemA(infoPtr->hwndHeader, nColumn, &hdiget)) + if (Header_GetItemW(infoPtr->hwndHeader, nColumn, &hdiget)) /* preserve HDF_STRING if present */ hdi.fmt = hdiget.fmt & HDF_STRING; @@ -6784,7 +6881,7 @@ { hdi.mask |= HDI_TEXT | HDI_FORMAT; hdi.pszText = lpColumn->pszText; - hdi.cchTextMax = ((lpColumn->pszText!=NULL) && (lpColumn->pszText!=LPSTR_TEXTCALLBACKA) ? strlen(lpColumn->pszText) : 0); + hdi.cchTextMax = textlenT(lpColumn->pszText, isW); hdi.fmt |= HDF_STRING; } @@ -6801,14 +6898,12 @@ } /* set header item attributes */ - bResult = Header_SetItemA(infoPtr->hwndHeader, nColumn, &hdi); + bResult = Header_SetItemW(infoPtr->hwndHeader, nColumn, &hdi); } return bResult; } -/* LISTVIEW_SetColumnW */ - /*** * DESCRIPTION: * Sets the column order array @@ -6824,7 +6919,7 @@ */ static LRESULT LISTVIEW_SetColumnOrderArray(HWND hwnd, INT iCount, LPINT lpiArray) { -/* LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); */ +/* LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); */ FIXME("iCount %d lpiArray %p\n", iCount, lpiArray); @@ -6851,22 +6946,22 @@ static LRESULT LISTVIEW_SetColumnWidth(HWND hwnd, INT iCol, INT cx) { LISTVIEW_INFO *infoPtr; - HDITEMA hdi; + HDITEMW hdi; LRESULT lret; - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; HDC hdc; HFONT header_font; HFONT old_font; SIZE size; - CHAR text_buffer[DISP_TEXT_SIZE]; + WCHAR text_buffer[DISP_TEXT_SIZE]; INT header_item_count; INT item_index; RECT rcHeader; /* make sure we can get the listview info */ - if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0))) + if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0))) return (FALSE); if (!infoPtr->hwndHeader) /* make sure we have a header */ @@ -6910,7 +7005,7 @@ cx = 0; for(item_index = 0; item_index < (header_item_count - 1); item_index++) { - Header_GetItemA(infoPtr->hwndHeader, item_index, (LPARAM)(&hdi)); + Header_GetItemW(infoPtr->hwndHeader, item_index, (LPARAM)(&hdi)); cx+=hdi.cxy; } @@ -6922,20 +7017,20 @@ else { /* retrieve header font */ - header_font = SendMessageA(infoPtr->hwndHeader, WM_GETFONT, 0L, 0L); + header_font = SendMessageW(infoPtr->hwndHeader, WM_GETFONT, 0L, 0L); /* retrieve header text */ hdi.mask = HDI_TEXT; hdi.cchTextMax = sizeof(text_buffer); hdi.pszText = text_buffer; - Header_GetItemA(infoPtr->hwndHeader, iCol, (LPARAM)(&hdi)); + Header_GetItemW(infoPtr->hwndHeader, iCol, (LPARAM)(&hdi)); /* determine the width of the text in the header */ hdc = GetDC(hwnd); old_font = SelectObject(hdc, header_font); /* select the font into hdc */ - GetTextExtentPoint32A(hdc, text_buffer, strlen(text_buffer), &size); + GetTextExtentPoint32W(hdc, text_buffer, lstrlenW(text_buffer), &size); SelectObject(hdc, old_font); /* restore the old font */ ReleaseDC(hwnd, hdc); @@ -6975,7 +7070,7 @@ DWORD dwOldStyle; /* make sure we can get the listview info */ - if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0))) + if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0))) return (0); /* store previous style */ @@ -7010,7 +7105,7 @@ INT iOldIndex; /* make sure we can get the listview info */ - if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0))) + if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0))) return (-1); /* store previous index */ @@ -7035,7 +7130,7 @@ */ static LRESULT LISTVIEW_SetHoverTime(HWND hwnd, DWORD dwHoverTime) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); DWORD oldHoverTime = infoPtr->dwHoverTime; infoPtr->dwHoverTime = dwHoverTime; @@ -7060,7 +7155,7 @@ */ static LRESULT LISTVIEW_SetImageList(HWND hwnd, INT nType, HIMAGELIST himl) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); HIMAGELIST himlOld = 0; INT oldHeight; @@ -7104,32 +7199,19 @@ * SUCCESS : TRUE * FAILURE : FALSE */ -static LRESULT LISTVIEW_SetItemA(HWND hwnd, LPLVITEMA lpLVItem) +static BOOL LISTVIEW_SetItemA(HWND hwnd, LPLVITEMA lpLVItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LVITEMW lviw; BOOL bResult = FALSE; - if (lpLVItem != NULL) + if (LISTVIEW_lvitem_cpyAtoW(lpLVItem, &lviw)) { - if ((lpLVItem->iItem >= 0) && (lpLVItem->iItem < GETITEMCOUNT(infoPtr))) - { - if (lpLVItem->iSubItem == 0) - { - bResult = LISTVIEW_SetItem(hwnd, lpLVItem); - } - else - { - bResult = LISTVIEW_SetSubItem(hwnd, lpLVItem); - } - } + bResult = LISTVIEW_SetItemW(hwnd, &lviw); + LISTVIEW_lvitem_rmW(&lviw); } - - return bResult; } -/* LISTVIEW_SetItemW */ - /*** * DESCRIPTION: * Preallocates memory (does *not* set the actual count of items !) @@ -7145,9 +7227,9 @@ */ static BOOL LISTVIEW_SetItemCount(HWND hwnd, INT nItems, DWORD dwFlags) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongW(hwnd, 0); - if (GetWindowLongA(hwnd, GWL_STYLE) & LVS_OWNERDATA) + if (GetWindowLongW(hwnd, GWL_STYLE) & LVS_OWNERDATA) { int precount,topvisible; TRACE("LVS_OWNERDATA is set!\n"); @@ -7201,8 +7283,8 @@ static BOOL LISTVIEW_SetItemPosition(HWND hwnd, INT nItem, LONG nPosX, LONG nPosY) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongA(hwnd, 0); - UINT lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongW(hwnd, 0); + UINT lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; LISTVIEW_ITEM *lpItem; HDPA hdpaSubItems; @@ -7247,40 +7329,27 @@ * SUCCESS : TRUE * FAILURE : FALSE */ -static LRESULT LISTVIEW_SetItemState(HWND hwnd, INT nItem, LPLVITEMA lpLVItem) +static LRESULT LISTVIEW_SetItemState(HWND hwnd, INT nItem, LPLVITEMW lpLVItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - BOOL bResult = FALSE; - LVITEMA lvItem; - INT i; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + BOOL bResult = TRUE; + LVITEMW lvItem; + + ZeroMemory(&lvItem, sizeof(lvItem)); + lvItem.mask = LVIF_STATE; + lvItem.state = lpLVItem->state; + lvItem.stateMask = lpLVItem->stateMask ; + lvItem.iItem = nItem; if (nItem == -1) { - bResult = TRUE; - ZeroMemory(&lvItem, sizeof(LVITEMA)); - lvItem.mask = LVIF_STATE; - lvItem.state = lpLVItem->state; - lvItem.stateMask = lpLVItem->stateMask ; - /* apply to all items */ - for (i = 0; i< GETITEMCOUNT(infoPtr); i++) - { - lvItem.iItem = i; - if (ListView_SetItemA(hwnd, &lvItem) == FALSE) - { + for (lvItem.iItem = 0; lvItem.iItem < GETITEMCOUNT(infoPtr); lvItem.iItem++) + if (ListView_SetItemW(hwnd, &lvItem) == FALSE) bResult = FALSE; - } - } } else - { - ZeroMemory(&lvItem, sizeof(LVITEMA)); - lvItem.mask = LVIF_STATE; - lvItem.state = lpLVItem->state; - lvItem.stateMask = lpLVItem->stateMask; - lvItem.iItem = nItem; - bResult = ListView_SetItemA(hwnd, &lvItem); - } + bResult = ListView_SetItemW(hwnd, &lvItem); return bResult; } @@ -7300,7 +7369,7 @@ */ static BOOL LISTVIEW_SetItemTextA(HWND hwnd, INT nItem, LPLVITEMA lpLVItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); BOOL bResult = FALSE; LVITEMA lvItem; @@ -7332,7 +7401,7 @@ */ static LRESULT LISTVIEW_SetSelectionMark(HWND hwnd, INT nIndex) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); INT nOldIndex = infoPtr->nSelectionMark; infoPtr->nSelectionMark = nIndex; @@ -7354,7 +7423,7 @@ */ static LRESULT LISTVIEW_SetTextBkColor(HWND hwnd, COLORREF clrTextBk) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); infoPtr->clrTextBk = clrTextBk; InvalidateRect(hwnd, NULL, TRUE); @@ -7376,7 +7445,7 @@ */ static LRESULT LISTVIEW_SetTextColor (HWND hwnd, COLORREF clrText) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); infoPtr->clrText = clrText; InvalidateRect(hwnd, NULL, TRUE); @@ -7410,7 +7479,7 @@ /* Forward the call to the client defined callback */ INT rv; HWND hwnd = (HWND)lParam; - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); HDPA hdpa_first = (HDPA) first; HDPA hdpa_second = (HDPA) second; LISTVIEW_ITEM* lv_first = (LISTVIEW_ITEM*) DPA_GetPtr( hdpa_first, 0 ); @@ -7436,9 +7505,9 @@ */ static LRESULT LISTVIEW_SortItems(HWND hwnd, WPARAM wParam, LPARAM lParam) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); int nCount, i; - UINT lStyle = GetWindowLongA(hwnd, GWL_STYLE); + UINT lStyle = GetWindowLongW(hwnd, GWL_STYLE); HDPA hdpaSubItems=NULL; LISTVIEW_ITEM *pLVItem=NULL; LPVOID selectionMarkItem; @@ -7505,8 +7574,8 @@ */ static LRESULT LISTVIEW_Update(HWND hwnd, INT nItem) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); BOOL bResult = FALSE; RECT rc; @@ -7543,21 +7612,19 @@ */ static LRESULT LISTVIEW_Create(HWND hwnd, WPARAM wParam, LPARAM lParam) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LPCREATESTRUCTA lpcs = (LPCREATESTRUCTA)lParam; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LPCREATESTRUCTW lpcs = (LPCREATESTRUCTW)lParam; UINT uView = lpcs->style & LVS_TYPEMASK; - LOGFONTA logFont; + LOGFONTW logFont; /* initialize info pointer */ ZeroMemory(infoPtr, sizeof(LISTVIEW_INFO)); /* determine the type of structures to use */ - infoPtr->notifyFormat = SendMessageA(GetParent(hwnd), WM_NOTIFYFORMAT, + infoPtr->notifyFormat = SendMessageW(GetParent(hwnd), WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_QUERY); - if (infoPtr->notifyFormat != NFR_ANSI) - { - FIXME("ANSI notify format is NOT used\n"); - } + if (infoPtr->notifyFormat != NFR_UNICODE) + FIXME("ASCII notify format is NOT used\n"); /* initialize color information */ infoPtr->clrBk = GetSysColor(COLOR_WINDOW); @@ -7577,18 +7644,18 @@ infoPtr->nEditLabelItem = -1; /* get default font (icon title) */ - SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0, &logFont, 0); - infoPtr->hDefaultFont = CreateFontIndirectA(&logFont); + SystemParametersInfoW(SPI_GETICONTITLELOGFONT, 0, &logFont, 0); + infoPtr->hDefaultFont = CreateFontIndirectW(&logFont); infoPtr->hFont = infoPtr->hDefaultFont; /* create header */ - infoPtr->hwndHeader = CreateWindowA(WC_HEADERA, (LPCSTR)NULL, + infoPtr->hwndHeader = CreateWindowW(WC_HEADERW, (LPCWSTR)NULL, WS_CHILD | HDS_HORZ | HDS_BUTTONS, 0, 0, 0, 0, hwnd, (HMENU)0, lpcs->hInstance, NULL); /* set header font */ - SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, + SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, (LPARAM)TRUE); if (uView == LVS_ICON) @@ -7605,8 +7672,8 @@ else { /* set HDS_HIDDEN flag to hide the header bar */ - SetWindowLongA(infoPtr->hwndHeader, GWL_STYLE, - GetWindowLongA(infoPtr->hwndHeader, GWL_STYLE) | HDS_HIDDEN); + SetWindowLongW(infoPtr->hwndHeader, GWL_STYLE, + GetWindowLongW(infoPtr->hwndHeader, GWL_STYLE) | HDS_HIDDEN); } @@ -7654,12 +7721,12 @@ static LRESULT LISTVIEW_EraseBackground(HWND hwnd, WPARAM wParam, LPARAM lParam) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); BOOL bResult; if (infoPtr->clrBk == CLR_NONE) { - bResult = SendMessageA(GetParent(hwnd), WM_ERASEBKGND, wParam, lParam); + bResult = SendMessageW(GetParent(hwnd), WM_ERASEBKGND, wParam, lParam); } else { @@ -7677,7 +7744,7 @@ static void LISTVIEW_FillBackground(HWND hwnd, HDC hdc, LPRECT rc) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); if (infoPtr->clrBk != CLR_NONE) { @@ -7699,7 +7766,7 @@ */ static LRESULT LISTVIEW_GetFont(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); return infoPtr->hFont; } @@ -7723,8 +7790,8 @@ { SCROLLINFO scrollInfo; - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - SendMessageA(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0); ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); scrollInfo.cbSize = sizeof(SCROLLINFO); @@ -7737,29 +7804,21 @@ { case SB_LINEUP: if (scrollInfo.nPos > scrollInfo.nMin) - { scrollInfo.nPos--; - } break; case SB_LINEDOWN: if (scrollInfo.nPos < scrollInfo.nMax) - { scrollInfo.nPos++; - } break; case SB_PAGEUP: if (scrollInfo.nPos > scrollInfo.nMin) { if (scrollInfo.nPos >= scrollInfo.nPage) - { scrollInfo.nPos -= scrollInfo.nPage; - } else - { scrollInfo.nPos = scrollInfo.nMin; - } } break; @@ -7767,13 +7826,9 @@ if (scrollInfo.nPos < scrollInfo.nMax) { if (scrollInfo.nPos <= scrollInfo.nMax - scrollInfo.nPage) - { scrollInfo.nPos += scrollInfo.nPage; - } else - { scrollInfo.nPos = scrollInfo.nMax; - } } break; @@ -7819,8 +7874,8 @@ { SCROLLINFO scrollInfo; - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - SendMessageA(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0); ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); @@ -7835,29 +7890,21 @@ { case SB_LINELEFT: if (scrollInfo.nPos > scrollInfo.nMin) - { scrollInfo.nPos--; - } break; case SB_LINERIGHT: if (scrollInfo.nPos < scrollInfo.nMax) - { scrollInfo.nPos++; - } break; case SB_PAGELEFT: if (scrollInfo.nPos > scrollInfo.nMin) { if (scrollInfo.nPos >= scrollInfo.nPage) - { scrollInfo.nPos -= scrollInfo.nPage; - } else - { scrollInfo.nPos = scrollInfo.nMin; - } } break; @@ -7865,13 +7912,9 @@ if (scrollInfo.nPos < scrollInfo.nMax) { if (scrollInfo.nPos <= scrollInfo.nMax - scrollInfo.nPage) - { scrollInfo.nPos += scrollInfo.nPage; - } else - { scrollInfo.nPos = scrollInfo.nMax; - } } break; @@ -7889,7 +7932,7 @@ if (nOldScrollPos != scrollInfo.nPos) { - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; scrollInfo.fMask = SIF_POS; SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); if(uView == LVS_REPORT) @@ -7911,7 +7954,7 @@ UINT pulScrollLines = 3; SCROLLINFO scrollInfo; - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0); gcWheelDelta -= wheelDelta; @@ -7965,14 +8008,14 @@ */ static LRESULT LISTVIEW_KeyDown(HWND hwnd, INT nVirtualKey, LONG lKeyData) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + INT nCtrlId = GetWindowLongW(hwnd, GWL_ID); HWND hwndParent = GetParent(hwnd); NMLVKEYDOWN nmKeyDown; NMHDR nmh; INT nItem = -1; BOOL bRedraw = FALSE; - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; /* send LVN_KEYDOWN notification */ @@ -7982,7 +8025,7 @@ nmKeyDown.hdr.code = LVN_KEYDOWN; nmKeyDown.wVKey = nVirtualKey; nmKeyDown.flags = 0; - SendMessageA(hwndParent, WM_NOTIFY, (WPARAM)nCtrlId, (LPARAM)&nmKeyDown); + SendMessageW(hwndParent, WM_NOTIFY, (WPARAM)nCtrlId, (LPARAM)&nmKeyDown); /* initialize */ nmh.hwndFrom = hwnd; @@ -8085,12 +8128,12 @@ */ static LRESULT LISTVIEW_KillFocus(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongA(hwnd, 0); - INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)GetWindowLongW(hwnd, 0); + INT nCtrlId = GetWindowLongW(hwnd, GWL_ID); NMHDR nmh; INT i,nTop,nBottom; RECT rcItem; - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; TRACE("(hwnd=%x)\n", hwnd); @@ -8145,7 +8188,7 @@ static LRESULT LISTVIEW_LButtonDblClk(HWND hwnd, WORD wKey, WORD wPosX, WORD wPosY) { - LONG nCtrlId = GetWindowLongA(hwnd, GWL_ID); + LONG nCtrlId = GetWindowLongW(hwnd, GWL_ID); LVHITTESTINFO htInfo; NMHDR nmh; NMLISTVIEW nmlv; @@ -8206,9 +8249,9 @@ static LRESULT LISTVIEW_LButtonDown(HWND hwnd, WORD wKey, WORD wPosX, WORD wPosY) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); - INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); + INT nCtrlId = GetWindowLongW(hwnd, GWL_ID); static BOOL bGroupSelect = TRUE; POINT ptPosition; NMHDR nmh; @@ -8312,13 +8355,13 @@ static LRESULT LISTVIEW_LButtonUp(HWND hwnd, WORD wKey, WORD wPosX, WORD wPosY) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY); if (infoPtr->bLButtonDown != FALSE) { - INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); + INT nCtrlId = GetWindowLongW(hwnd, GWL_ID); NMLISTVIEW nmlv; LVHITTESTINFO lvHitTestInfo; INT ret; @@ -8353,9 +8396,7 @@ if(infoPtr->nEditLabelItem != -1) { if(lvHitTestInfo.iItem == infoPtr->nEditLabelItem) - { - LISTVIEW_EditLabelA(hwnd, lvHitTestInfo.iItem); - } + LISTVIEW_EditLabelT(hwnd, lvHitTestInfo.iItem, TRUE); infoPtr->nEditLabelItem = -1; } } @@ -8383,20 +8424,20 @@ /* allocate memory for info structure */ infoPtr = (LISTVIEW_INFO *)COMCTL32_Alloc(sizeof(LISTVIEW_INFO)); - SetWindowLongA(hwnd, 0, (LONG)infoPtr); + SetWindowLongW(hwnd, 0, (LONG)infoPtr); if (infoPtr == NULL) { ERR("could not allocate info memory!\n"); return 0; } - if ((LISTVIEW_INFO *)GetWindowLongA(hwnd, 0) != infoPtr) + if ((LISTVIEW_INFO *)GetWindowLongW(hwnd, 0) != infoPtr) { ERR("pointer assignment error!\n"); return 0; } - return DefWindowProcA(hwnd, WM_NCCREATE, wParam, lParam); + return DefWindowProcW(hwnd, WM_NCCREATE, wParam, lParam); } /*** @@ -8411,7 +8452,7 @@ */ static LRESULT LISTVIEW_NCDestroy(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); TRACE("(hwnd=%x)\n", hwnd); @@ -8432,7 +8473,7 @@ /* free listview info pointer*/ COMCTL32_Free(infoPtr); - SetWindowLongA(hwnd, 0, 0); + SetWindowLongW(hwnd, 0, 0); return 0; } @@ -8450,22 +8491,22 @@ */ static LRESULT LISTVIEW_Notify(HWND hwnd, INT nCtrlId, LPNMHDR lpnmh) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); if (lpnmh->hwndFrom == infoPtr->hwndHeader) { /* handle notification from header control */ - if (lpnmh->code == HDN_ENDTRACKA) + if (lpnmh->code == HDN_ENDTRACKW) { infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd); InvalidateRect(hwnd, NULL, TRUE); } - else if(lpnmh->code == HDN_ITEMCLICKA) + else if(lpnmh->code == HDN_ITEMCLICKW) { /* Handle sorting by Header Column */ NMLISTVIEW nmlv; - LPNMHEADERA pnmHeader = (LPNMHEADERA) lpnmh; - LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID); + LPNMHEADERW pnmHeader = (LPNMHEADERW) lpnmh; + LONG lCtrlId = GetWindowLongW(hwnd, GWL_ID); ZeroMemory(&nmlv, sizeof(NMLISTVIEW)); nmlv.hdr.hwndFrom = hwnd; @@ -8509,17 +8550,15 @@ */ static LRESULT LISTVIEW_NotifyFormat(HWND hwndFrom, HWND hwnd, INT nCommand) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); if (nCommand == NF_REQUERY) { /* determine the type of structure to use */ - infoPtr->notifyFormat = SendMessageA(hwndFrom, WM_NOTIFYFORMAT, + infoPtr->notifyFormat = SendMessageW(hwndFrom, WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_QUERY); - if (infoPtr->notifyFormat == NFR_UNICODE) - { - FIXME("NO support for unicode structures\n"); - } + if (infoPtr->notifyFormat == NFR_ANSI) + FIXME("NO support for ASCII notification messages\n"); } return 0; @@ -8540,7 +8579,7 @@ { PAINTSTRUCT ps; - TRACE("(hwnd=%x,hdc=%x)\n", hwnd, hdc); + TRACE("(hwnd=%x,hdc=%x)\n", hwnd, hdc); if (hdc == 0) { @@ -8572,7 +8611,7 @@ static LRESULT LISTVIEW_RButtonDblClk(HWND hwnd, WORD wKey, WORD wPosX, WORD wPosY) { - INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); + INT nCtrlId = GetWindowLongW(hwnd, GWL_ID); NMHDR nmh; TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY); @@ -8606,8 +8645,8 @@ static LRESULT LISTVIEW_RButtonDown(HWND hwnd, WORD wKey, WORD wPosX, WORD wPosY) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + INT nCtrlId = GetWindowLongW(hwnd, GWL_ID); POINT ptPosition; NMHDR nmh; INT nItem; @@ -8666,8 +8705,8 @@ static LRESULT LISTVIEW_RButtonUp(HWND hwnd, WORD wKey, WORD wPosX, WORD wPosY) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + INT nCtrlId = GetWindowLongW(hwnd, GWL_ID); TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY); @@ -8711,7 +8750,7 @@ ClientToScreen(hwnd, &pt); /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */ - SendMessageA( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y)); + SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y)); } return 0; @@ -8730,8 +8769,8 @@ */ static LRESULT LISTVIEW_SetFocus(HWND hwnd, HWND hwndLoseFocus) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + INT nCtrlId = GetWindowLongW(hwnd, GWL_ID); NMHDR nmh; TRACE("(hwnd=%x, hwndLoseFocus=%x)\n", hwnd, hwndLoseFocus); @@ -8764,24 +8803,17 @@ */ static LRESULT LISTVIEW_SetFont(HWND hwnd, HFONT hFont, WORD fRedraw) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + UINT uView = GetWindowLongW(hwnd, GWL_STYLE) & LVS_TYPEMASK; TRACE("(hwnd=%x,hfont=%x,redraw=%hu)\n", hwnd, hFont, fRedraw); - if (hFont == 0) - { - infoPtr->hFont = infoPtr->hDefaultFont; - } - else - { - infoPtr->hFont = hFont; - } + infoPtr->hFont = hFont ? hFont : infoPtr->hDefaultFont; if (uView == LVS_REPORT) { /* set header font */ - SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont, + SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(fRedraw, 0)); } @@ -8789,9 +8821,7 @@ InvalidateRect(hwnd, NULL, TRUE); if (fRedraw != FALSE) - { UpdateWindow(hwnd); - } return 0; } @@ -8811,7 +8841,7 @@ static LRESULT LISTVIEW_SetRedraw(HWND hwnd, BOOL bRedraw) { LRESULT lResult; - lResult = DefWindowProcA(hwnd, WM_SETREDRAW, bRedraw, 0); + lResult = DefWindowProcW(hwnd, WM_SETREDRAW, bRedraw, 0); if(bRedraw) { RedrawWindow(hwnd, NULL, 0, @@ -8835,7 +8865,7 @@ */ static LRESULT LISTVIEW_Size(HWND hwnd, int Width, int Height) { - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; TRACE("(hwnd=%x, width=%d, height=%d)\n",hwnd, Width, Height); @@ -8874,8 +8904,8 @@ */ static VOID LISTVIEW_UpdateSize(HWND hwnd) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); - LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); + LONG lStyle = GetWindowLongW(hwnd, GWL_STYLE); UINT uView = lStyle & LVS_TYPEMASK; RECT rcList; @@ -8929,7 +8959,7 @@ static INT LISTVIEW_StyleChanged(HWND hwnd, WPARAM wStyleType, LPSTYLESTRUCT lpss) { - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); UINT uNewView = lpss->styleNew & LVS_TYPEMASK; UINT uOldView = lpss->styleOld & LVS_TYPEMASK; RECT rcList = infoPtr->rcList; @@ -9031,7 +9061,7 @@ ((uNewView & (LVS_ICON|LVS_LIST|LVS_SMALLICON)) != ((LVS_ICON|LVS_LIST|LVS_SMALLICON) & uOldView))) { - SendMessageA(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0); + SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0); } return 0; @@ -9046,8 +9076,8 @@ LPARAM lParam) { TRACE("hwnd=%x uMsg=%x wParam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam); - if (!GetWindowLongA(hwnd, 0) && (uMsg != WM_NCCREATE)) - return DefWindowProcA( hwnd, uMsg, wParam, lParam ); + if (!GetWindowLongW(hwnd, 0) && (uMsg != WM_NCCREATE)) + return DefWindowProcW( hwnd, uMsg, wParam, lParam ); switch (uMsg) { case LVM_APPROXIMATEVIEWRECT: @@ -9068,14 +9098,19 @@ return LISTVIEW_DeleteItem(hwnd, (INT)wParam); case LVM_EDITLABELW: + return LISTVIEW_EditLabelT(hwnd, (INT)wParam, TRUE); + case LVM_EDITLABELA: - return LISTVIEW_EditLabelA(hwnd, (INT)wParam); + return LISTVIEW_EditLabelT(hwnd, (INT)wParam, FALSE); case LVM_ENSUREVISIBLE: return LISTVIEW_EnsureVisible(hwnd, (INT)wParam, (BOOL)lParam); + case LVM_FINDITEMW: + return LISTVIEW_FindItemW(hwnd, (INT)wParam, (LPLVFINDINFOW)lParam); + case LVM_FINDITEMA: - return LISTVIEW_FindItem(hwnd, (INT)wParam, (LPLVFINDINFO)lParam); + return LISTVIEW_FindItemA(hwnd, (INT)wParam, (LPLVFINDINFOA)lParam); case LVM_GETBKCOLOR: return LISTVIEW_GetBkColor(hwnd); @@ -9086,9 +9121,10 @@ return LISTVIEW_GetCallbackMask(hwnd); case LVM_GETCOLUMNA: - return LISTVIEW_GetColumnA(hwnd, (INT)wParam, (LPLVCOLUMNA)lParam); + return LISTVIEW_GetColumn(hwnd, (INT)wParam, (LPLVCOLUMNW)lParam, FALSE); -/* case LVM_GETCOLUMNW: */ + case LVM_GETCOLUMNW: + return LISTVIEW_GetColumn(hwnd, (INT)wParam, (LPLVCOLUMNW)lParam, TRUE); case LVM_GETCOLUMNORDERARRAY: return LISTVIEW_GetColumnOrderArray(hwnd, (INT)wParam, (LPINT)lParam); @@ -9124,7 +9160,8 @@ case LVM_GETITEMA: return LISTVIEW_GetItemA(hwnd, (LPLVITEMA)lParam, FALSE); -/* case LVM_GETITEMW: */ + case LVM_GETITEMW: + return LISTVIEW_GetItemW(hwnd, (LPLVITEMW)lParam, FALSE); case LVM_GETITEMCOUNT: return LISTVIEW_GetItemCount(hwnd); @@ -9145,7 +9182,9 @@ LISTVIEW_GetItemTextA(hwnd, (INT)wParam, (LPLVITEMA)lParam); break; -/* case LVM_GETITEMTEXTW: */ + case LVM_GETITEMTEXTW: + LISTVIEW_GetItemTextW(hwnd, (INT)wParam, (LPLVITEMW)lParam); + break; case LVM_GETNEXTITEM: return LISTVIEW_GetNextItem(hwnd, (INT)wParam, LOWORD(lParam)); @@ -9162,9 +9201,11 @@ return LISTVIEW_GetSelectionMark(hwnd); case LVM_GETSTRINGWIDTHA: - return LISTVIEW_GetStringWidthA (hwnd, (LPCSTR)lParam); + return LISTVIEW_GetStringWidthT(hwnd, (LPCWSTR)lParam, FALSE); -/* case LVM_GETSTRINGWIDTHW: */ + case LVM_GETSTRINGWIDTHW: + return LISTVIEW_GetStringWidthT(hwnd, (LPCWSTR)lParam, TRUE); + /* case LVM_GETSUBITEMRECT: */ case LVM_GETTEXTBKCOLOR: @@ -9215,11 +9256,10 @@ return LISTVIEW_SetCallbackMask(hwnd, (UINT)wParam); case LVM_SETCOLUMNA: - return LISTVIEW_SetColumnA(hwnd, (INT)wParam, (LPLVCOLUMNA)lParam); + return LISTVIEW_SetColumn(hwnd, (INT)wParam, (LPLVCOLUMNW)lParam, FALSE); case LVM_SETCOLUMNW: - FIXME("Unimplemented msg LVM_SETCOLUMNW\n"); - return 0; + return LISTVIEW_SetColumn(hwnd, (INT)wParam, (LPLVCOLUMNW)lParam, TRUE); case LVM_SETCOLUMNORDERARRAY: return LISTVIEW_SetColumnOrderArray(hwnd, (INT)wParam, (LPINT)lParam); @@ -9246,7 +9286,8 @@ case LVM_SETITEMA: return LISTVIEW_SetItemA(hwnd, (LPLVITEMA)lParam); -/* case LVM_SETITEMW: */ + case LVM_SETITEMW: + return LISTVIEW_SetItemW(hwnd, (LPLVITEMW)lParam); case LVM_SETITEMCOUNT: return LISTVIEW_SetItemCount(hwnd, (INT)wParam, (DWORD)lParam); @@ -9260,7 +9301,7 @@ ((POINT*)lParam)->y); case LVM_SETITEMSTATE: - return LISTVIEW_SetItemState(hwnd, (INT)wParam, (LPLVITEMA)lParam); + return LISTVIEW_SetItemState(hwnd, (INT)wParam, (LPLVITEMW)lParam); case LVM_SETITEMTEXTA: return LISTVIEW_SetItemTextA(hwnd, (INT)wParam, (LPLVITEMA)lParam); @@ -9382,7 +9423,7 @@ case WM_MOUSEWHEEL: if (wParam & (MK_SHIFT | MK_CONTROL)) - return DefWindowProcA( hwnd, uMsg, wParam, lParam ); + return DefWindowProcW( hwnd, uMsg, wParam, lParam ); return LISTVIEW_MouseWheel(hwnd, (short int)HIWORD(wParam));/* case WM_WINDOWPOSCHANGED: */ /* case WM_WININICHANGE: */ @@ -9395,7 +9436,7 @@ } /* call default window procedure */ - return DefWindowProcA(hwnd, uMsg, wParam, lParam); + return DefWindowProcW(hwnd, uMsg, wParam, lParam); } return 0; @@ -9413,17 +9454,17 @@ */ VOID LISTVIEW_Register(void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory(&wndClass, sizeof(WNDCLASSA)); + ZeroMemory(&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.lpfnWndProc = (WNDPROC)LISTVIEW_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *); - wndClass.hCursor = LoadCursorA(0, IDC_ARROWA); + wndClass.hCursor = LoadCursorW(0, IDC_ARROWW); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wndClass.lpszClassName = WC_LISTVIEWA; - RegisterClassA(&wndClass); + wndClass.lpszClassName = WC_LISTVIEWW; + RegisterClassW(&wndClass); } /*** @@ -9438,7 +9479,7 @@ */ VOID LISTVIEW_Unregister(void) { - UnregisterClassA(WC_LISTVIEWA, (HINSTANCE)NULL); + UnregisterClassW(WC_LISTVIEWW, (HINSTANCE)NULL); } /*** @@ -9458,30 +9499,30 @@ /* * Adjust the edit window size */ - char buffer[1024]; - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); + WCHAR buffer[1024]; + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); HDC hdc = GetDC(infoPtr->hwndEdit); HFONT hFont, hOldFont = 0; RECT rect; SIZE sz; int len; - len = GetWindowTextA(infoPtr->hwndEdit, buffer, 1023); + len = GetWindowTextW(infoPtr->hwndEdit, buffer, sizeof(buffer)/sizeof(buffer[0])); GetWindowRect(infoPtr->hwndEdit, &rect); /* Select font to get the right dimension of the string */ - hFont = SendMessageA(infoPtr->hwndEdit, WM_GETFONT, 0, 0); + hFont = SendMessageW(infoPtr->hwndEdit, WM_GETFONT, 0, 0); if(hFont != 0) { hOldFont = SelectObject(hdc, hFont); } - if (GetTextExtentPoint32A(hdc, buffer, strlen(buffer), &sz)) + if (GetTextExtentPoint32W(hdc, buffer, lstrlenW(buffer), &sz)) { - TEXTMETRICA textMetric; + TEXTMETRICW textMetric; /* Add Extra spacing for the next character */ - GetTextMetricsA(hdc, &textMetric); + GetTextMetricsW(hdc, &textMetric); sz.cx += (textMetric.tmMaxCharWidth * 2); SetWindowPos ( @@ -9504,7 +9545,7 @@ } default: - return SendMessageA (GetParent (hwnd), WM_COMMAND, wParam, lParam); + return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, lParam); } return 0; @@ -9519,11 +9560,11 @@ * * RETURN: */ -LRESULT CALLBACK EditLblWndProc(HWND hwnd, UINT uMsg, +LRESULT CALLBACK EditLblWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { BOOL cancel = FALSE; - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(GetParent(hwnd), 0); + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(GetParent(hwnd), 0); EDITLABEL_ITEM *einfo = infoPtr->pedititem; static BOOL bIgnoreKillFocus = FALSE; switch (uMsg) @@ -9541,10 +9582,10 @@ case WM_DESTROY: { WNDPROC editProc = einfo->EditWndProc; - SetWindowLongA(hwnd, GWL_WNDPROC, (LONG)editProc); + SetWindowLongW(hwnd, GWL_WNDPROC, (LONG)editProc); COMCTL32_Free(einfo); infoPtr->pedititem = NULL; - return CallWindowProcA(editProc, hwnd, uMsg, wParam, lParam); + return CallWindowProcW(editProc, hwnd, uMsg, wParam, lParam); } case WM_KEYDOWN: @@ -9552,30 +9593,29 @@ { cancel = TRUE; break; - } else if (VK_RETURN == (INT)wParam) break; default: - return CallWindowProcA(einfo->EditWndProc, hwnd, + return CallWindowProcW(einfo->EditWndProc, hwnd, uMsg, wParam, lParam); } if (einfo->EditLblCb) { - char *buffer = NULL; + WCHAR *buffer = NULL; if (!cancel) { - int len = 1 + GetWindowTextLengthA(hwnd); + int len = 1 + GetWindowTextLengthW(hwnd); if (len > 1) { - if (NULL != (buffer = (char *)COMCTL32_Alloc(len*sizeof(char)))) + if (NULL != (buffer = COMCTL32_Alloc(len*sizeof(WCHAR)))) { - GetWindowTextA(hwnd, buffer, len); + GetWindowTextW(hwnd, buffer, len); } } } @@ -9591,7 +9631,7 @@ bIgnoreKillFocus = FALSE; } - SendMessageA(hwnd, WM_CLOSE, 0, 0); + SendMessageW(hwnd, WM_CLOSE, 0, 0); return TRUE; } @@ -9604,16 +9644,17 @@ * * RETURN: */ -HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y, +HWND CreateEditLabelW(LPCWSTR text, DWORD style, INT x, INT y, INT width, INT height, HWND parent, HINSTANCE hinst, EditlblCallback EditLblCb, DWORD param) { + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(parent, 0); + WCHAR editName[5] = { 'E', 'd', 'i', 't', '\0' }; HWND hedit; SIZE sz; HDC hdc; HDC hOldFont=0; - TEXTMETRICA textMetric; - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(parent, 0); + TEXTMETRICW textMetric; if (NULL == (infoPtr->pedititem = COMCTL32_Alloc(sizeof(EDITLABEL_ITEM)))) return 0; @@ -9628,10 +9669,10 @@ } /*Get String Lenght in pixels */ - GetTextExtentPoint32A(hdc, text, strlen(text), &sz); + GetTextExtentPoint32W(hdc, text, lstrlenW(text), &sz); /*Add Extra spacing for the next character */ - GetTextMetricsA(hdc, &textMetric); + GetTextMetricsW(hdc, &textMetric); sz.cx += (textMetric.tmMaxCharWidth * 2); if(infoPtr->hFont != 0) @@ -9640,7 +9681,7 @@ } ReleaseDC(parent, hdc); - if (!(hedit = CreateWindowA("Edit", text, style, x, y, sz.cx, height, + if (!(hedit = CreateWindowW(editName, text, style, x, y, sz.cx, height, parent, 0, hinst, 0))) { COMCTL32_Free(infoPtr->pedititem); @@ -9649,10 +9690,10 @@ infoPtr->pedititem->param = param; infoPtr->pedititem->EditLblCb = EditLblCb; - infoPtr->pedititem->EditWndProc = (WNDPROC)SetWindowLongA(hedit, - GWL_WNDPROC, (LONG) EditLblWndProc); + infoPtr->pedititem->EditWndProc = (WNDPROC)SetWindowLongW(hedit, + GWL_WNDPROC, (LONG) EditLblWndProcW); - SendMessageA(hedit, WM_SETFONT, infoPtr->hFont, FALSE); + SendMessageW(hedit, WM_SETFONT, infoPtr->hFont, FALSE); return hedit; } Index: include/commctrl.h =================================================================== RCS file: /home/wine/wine/include/commctrl.h,v retrieving revision 1.81 diff -u -r1.81 commctrl.h --- include/commctrl.h 2002/01/04 18:46:02 1.81 +++ include/commctrl.h 2002/01/08 02:32:43 @@ -2925,17 +2925,27 @@ #define _LV_HITTESTINFO tagLVHITTESTINFO #define LVHITTESTINFO_V1_SIZE CCSIZEOF_STRUCT(LVHITTESTINFO,iItem) -typedef struct tagLVFINDINFO +typedef struct tagLVFINDINFOA { UINT flags; LPCSTR psz; LPARAM lParam; POINT pt; UINT vkDirection; -} LVFINDINFO, *LPLVFINDINFO; +} LVFINDINFOA, *LPLVFINDINFOA; -#define LV_FINDINFO LVFINDINFO +typedef struct tagLVFINDINFOW +{ + UINT flags; + LPCWSTR psz; + LPARAM lParam; + POINT pt; + UINT vkDirection; +} LVFINDINFOW, *LPLVFINDINFOW; +#define LVFINDINFO WINELIB_NAME_AW(LVFINDINFO) +#define LPLVFINDINFO WINELIB_NAME_AW(LPLVFINDINFO) + typedef struct tagTCHITTESTINFO { POINT pt; @@ -2966,17 +2976,24 @@ #define LPNM_CACHEHINT LPNMLVCACHEHINT #define PNM_CACHEHINT LPNMLVCACHEHINT #define NM_CACHEHINT NMLVCACHEHINT + +typedef struct tagNMLVFINDITEMA +{ + NMHDR hdr; + int iStart; + LVFINDINFOA lvfi; +} NMLVFINDITEMA, *LPNMLVFINDITEMA; -typedef struct tagNMLVFINDITEM +typedef struct tagNMLVFINDITEMW { NMHDR hdr; int iStart; - LVFINDINFO lvfi; -} NMLVFINDITEM, *LPNMLVFINDITEM; + LVFINDINFOW lvfi; +} NMLVFINDITEMW, *LPNMLVFINDITEMW; -#define NM_FINDITEM NMLVFINDITEM -#define PNM_FINDITEM LPNMLVFINDITEM -#define LPNM_FINDITEM LPNMLVFINDITEM +#define NMFINDITEM WINELIB_NAME_AW(NMLVFINDITEM) +#define PNMFINDITEM LPNMLVFINDITEM +#define LPNMFINDITEM WINELIB_NAME_AW(LPNMLVFINDITEM) typedef struct tagNMLVODSTATECHANGE { @@ -3011,8 +3028,10 @@ #define ListView_GetNextItem(hwnd,nItem,flags) \ (INT)SendMessageA((hwnd),LVM_GETNEXTITEM,(WPARAM)(INT)(nItem),(LPARAM)(MAKELPARAM(flags,0))) -#define ListView_FindItem(hwnd,nItem,plvfi) \ - (INT)SendMessageA((hwnd),LVM_FINDITEMA,(WPARAM)(INT)(nItem),(LPARAM)(LVFINDINFO*)(plvfi)) +#define ListView_FindItemA(hwnd,nItem,plvfi) \ + (INT)SendMessageA((hwnd),LVM_FINDITEMA,(WPARAM)(INT)(nItem),(LPARAM)(LVFINDINFOA*)(plvfi)) +#define ListView_FindItemW(hwnd,nItem,plvfi) \ + (INT)SendMessageW((hwnd),LVM_FINDITEMW,(WPARAM)(INT)(nItem),(LPARAM)(LVFINDINFOW*)(plvfi)) #define ListView_Arrange(hwnd,code) \ (INT)SendMessageA((hwnd),LVM_ARRANGE,(WPARAM)(INT)(code),0L) #define ListView_GetItemPosition(hwnd,i,ppt) \ Index: windows/spy.c =================================================================== RCS file: /home/wine/wine/windows/spy.c,v retrieving revision 1.30 diff -u -r1.30 spy.c --- windows/spy.c 2002/01/04 18:28:38 1.30 +++ windows/spy.c 2002/01/08 02:33:08 @@ -1466,7 +1466,7 @@ SPNFY(LVN_HOTTRACK, NMLISTVIEW), SPNFY(LVN_GETDISPINFOA, NMLVDISPINFOA), SPNFY(LVN_SETDISPINFOA, NMLVDISPINFOA), - SPNFY(LVN_ODFINDITEMA, NMLVFINDITEM), + SPNFY(LVN_ODFINDITEMA, NMLVFINDITEMA), SPNFY(LVN_KEYDOWN, NMLVKEYDOWN), SPNFY(LVN_MARQUEEBEGIN, NMLISTVIEW), SPNFY(LVN_GETINFOTIPA, NMLVGETINFOTIPA), @@ -1475,7 +1475,7 @@ SPNFY(LVN_ENDLABELEDITW, NMLVDISPINFOW), SPNFY(LVN_GETDISPINFOW, NMLVDISPINFOW), SPNFY(LVN_SETDISPINFOW, NMLVDISPINFOW), - SPNFY(LVN_ODFINDITEMW, NMLVFINDITEM), + SPNFY(LVN_ODFINDITEMW, NMLVFINDITEMW), /* Header 0U-300U to 0U-399U */ SPNFY(HDN_ITEMCHANGINGA, NMHDR), SPNFY(HDN_ITEMCHANGEDA, NMHDR),