From 565cf7f36d74e144b03264efd231d6cd500e510f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Thu, 17 Nov 2005 19:36:54 +0000 Subject: [PATCH] =?UTF-8?q?Sync=20to=20Wine-0=5F9=5F1:=20Vitaliy=20Margole?= =?UTF-8?q?n=20=20-=20Unify=20HEADER=5FGetItem[A/?= =?UTF-8?q?W]=20into=20one=20function.=20-=20Unify=20HEADER=5FInsertItem[A?= =?UTF-8?q?/W]=20into=20one=20function.=20-=20Unify=20HEADER=5FSetItem[A/W?= =?UTF-8?q?]=20into=20one=20function.=20Michael=20Kaufmann=20=20-=20Handle=20WM=5FPRINTCLIENT.=20=20=20Don't?= =?UTF-8?q?=20use=20SelectClipRgn=20in=20WM=5FPRINTCLIENT.=20Dimi=20Paun?= =?UTF-8?q?=20=20-=20Validate=20the=20column=20index=20p?= =?UTF-8?q?assed=20in=20by=20the=20caller.=20Alex=20Villac=C3=ADs=20Lasso?= =?UTF-8?q?=20=20-=20Do=20not=20issue=20a=20Ge?= =?UTF-8?q?tUpdateRect()=20to=20query=20an=20update=20region=20for=20=20?= =?UTF-8?q?=20WM=5FPAINT(wParam=3DHDC)=20case.=20Instead,=20use=20GetClien?= =?UTF-8?q?tRect()=20for=20a=20bounding=20=20=20rect.=20Vincent=20B=C3=A9r?= =?UTF-8?q?on=20=20-=20Move=20functions=20in?= =?UTF-8?q?=20comctl32/string.c=20to=20remove=20function=20declaration.=20?= =?UTF-8?q?Dmitry=20Timoshkov=20=20-=20Use=20Win32?= =?UTF-8?q?=20APIs=20for=20string=20comparison.=20-=20Avoid=20printing=20o?= =?UTF-8?q?ut=20a=20possibly=20uninitialized=20variable.=20Ulrich=20Czekal?= =?UTF-8?q?la=20=20-=20Clear=20bLButtonDown=20flag?= =?UTF-8?q?s=20if=20mouse=20is=20not=20down.=20Martin=20Fuchs=20=20-=20Include=20config.h=20and=20port.h=20for=20st?= =?UTF-8?q?rncasecmp()=20in=20MSVC=20port.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/trunk/; revision=19296 --- reactos/lib/comctl32/animate.c | 1 + reactos/lib/comctl32/comboex.c | 2 +- reactos/lib/comctl32/datetime.c | 1 + reactos/lib/comctl32/header.c | 516 +++++++++++-------------------- reactos/lib/comctl32/hotkey.c | 1 + reactos/lib/comctl32/imagelist.c | 3 +- reactos/lib/comctl32/listview.c | 12 +- reactos/lib/comctl32/monthcal.c | 1 + reactos/lib/comctl32/pager.c | 2 + reactos/lib/comctl32/progress.c | 1 + reactos/lib/comctl32/propsheet.c | 1 + reactos/lib/comctl32/rebar.c | 3 +- reactos/lib/comctl32/status.c | 1 + reactos/lib/comctl32/string.c | 93 +++--- reactos/lib/comctl32/syslink.c | 1 + reactos/lib/comctl32/tab.c | 4 +- reactos/lib/comctl32/toolbar.c | 1 + reactos/lib/comctl32/tooltips.c | 1 + reactos/lib/comctl32/trackbar.c | 1 + reactos/lib/comctl32/treeview.c | 19 +- reactos/lib/comctl32/updown.c | 1 + 21 files changed, 267 insertions(+), 399 deletions(-) diff --git a/reactos/lib/comctl32/animate.c b/reactos/lib/comctl32/animate.c index 6d06d221ebd..3c2c64825f9 100644 --- a/reactos/lib/comctl32/animate.c +++ b/reactos/lib/comctl32/animate.c @@ -899,6 +899,7 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP case WM_TIMER: return ANIMATE_Timer(infoPtr); + case WM_PRINTCLIENT: case WM_PAINT: { /* the animation isn't playing, or has not decompressed diff --git a/reactos/lib/comctl32/comboex.c b/reactos/lib/comctl32/comboex.c index 65c5d8fbb62..b2ed2ac69d8 100644 --- a/reactos/lib/comctl32/comboex.c +++ b/reactos/lib/comctl32/comboex.c @@ -1395,7 +1395,7 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis) if (!item) { item = get_item_data(infoPtr, dis->itemID); if (item == (CBE_ITEMDATA *)CB_ERR) { - ERR("invalid item for id %d \n", dis->itemID); + ERR("invalid item for id %d\n", dis->itemID); return 0; } } diff --git a/reactos/lib/comctl32/datetime.c b/reactos/lib/comctl32/datetime.c index f024207b21d..83d53af56ee 100644 --- a/reactos/lib/comctl32/datetime.c +++ b/reactos/lib/comctl32/datetime.c @@ -1284,6 +1284,7 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_GETDLGCODE: return DLGC_WANTARROWS | DLGC_WANTCHARS; + case WM_PRINTCLIENT: case WM_PAINT: return DATETIME_Paint (infoPtr, (HDC)wParam); diff --git a/reactos/lib/comctl32/header.c b/reactos/lib/comctl32/header.c index cb66b7be901..1e0c4619be1 100644 --- a/reactos/lib/comctl32/header.c +++ b/reactos/lib/comctl32/header.c @@ -598,7 +598,96 @@ HEADER_SendHeaderNotify (HWND hwnd, UINT code, INT iItem, INT mask) nmitem.iImage = infoPtr->items[iItem].iImage; return (BOOL)SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, - (WPARAM)nmhdr.hdr.idFrom, (LPARAM)&nmhdr); + (WPARAM)nmhdr.hdr.idFrom, (LPARAM)&nmhdr); +} + +/** + * Send Disp Info notification. + * depends on NMHDDISPINFOW having same structure as NMHDDISPINFOA + * (so we handle the two cases only doing a specific cast for pszText). + * + * @param hwnd : hwnd header container handler + * @param mask : notification mask (usually HDI_TEXT or HDI_IMAGE) + * @param pDispInfo : NMHDDISPINFO structure (can be unicode or ansi) + * @param isW : TRUE if dispinfo is Unicode + */ +static BOOL +HEADER_SendHeaderDispInfoNotify(HWND hwnd, INT iItem, INT mask, LPHDITEMW phdi, HEADER_ITEM* lpItem, BOOL isW) +{ + HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); + BOOL ret; + BOOL convertToAnsi = FALSE; + BOOL convertToUnicode = FALSE; + BOOL isUnicodeNotify = FALSE; + NMHDDISPINFOW dispInfo; + + if (mask & HDI_TEXT) + { + convertToAnsi = (isW && infoPtr->nNotifyFormat == NFR_ANSI); + convertToUnicode = (!isW && infoPtr->nNotifyFormat == NFR_UNICODE); + } + isUnicodeNotify = (isW && !convertToAnsi); + + memset(&dispInfo, 0, sizeof(NMHDDISPINFOW)); + dispInfo.hdr.hwndFrom = hwnd; + dispInfo.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); + if (isUnicodeNotify || convertToUnicode) + { + dispInfo.hdr.code = HDN_GETDISPINFOW; + } + else + { + dispInfo.hdr.code = HDN_GETDISPINFOA; + } + dispInfo.iItem = iItem; + dispInfo.mask = mask; + /* + dispInfo.pszText = Alloc(sizeof(WCHAR) * 260); + dispInfo.cchTextMax = 260; + */ + ret = (BOOL) SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, + (WPARAM) dispInfo.hdr.idFrom, + (LPARAM) &dispInfo); + + TRACE("SendMessage returns(mask:0x%x,str:%s,lParam:%p)\n", + dispInfo.mask, + (isUnicodeNotify ? debugstr_w(dispInfo.pszText) : (LPSTR) dispInfo.pszText), + (void*) dispInfo.lParam); + + if (dispInfo.mask & HDI_DI_SETITEM) + { + if (dispInfo.mask & HDI_IMAGE) + { + lpItem->iImage = dispInfo.iImage; + } + if (dispInfo.mask & HDI_TEXT) + { + if (isUnicodeNotify || convertToUnicode) + Str_SetPtrW(&lpItem->pszText, (LPCWSTR)dispInfo.pszText); + else /*if (convertToAnsi || !isW)*/ + Str_SetPtrAtoW(&lpItem->pszText, (LPCSTR)dispInfo.pszText); + } + + FIXME("NMHDDISPINFO returns with flags HDI_DI_SETITEM\n"); + } + + if (NULL != phdi) + { + if ((phdi->mask & mask) & HDI_IMAGE) + { + phdi->iImage = dispInfo.iImage; + } + if ((phdi->mask & mask) & HDI_TEXT) + { + if (isUnicodeNotify) + Str_GetPtrW ((LPCWSTR)dispInfo.pszText, phdi->pszText, phdi->cchTextMax); + else if (convertToUnicode) + Str_GetPtrWtoA ((LPCWSTR)dispInfo.pszText, (LPSTR)phdi->pszText, phdi->cchTextMax); + else /*if (!isW) */ + Str_GetPtrA ((LPCSTR)dispInfo.pszText, (LPSTR)phdi->pszText, phdi->cchTextMax); + } + } + return ret; } @@ -712,11 +801,9 @@ HEADER_GetImageList (HWND hwnd) static LRESULT -HEADER_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_GetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - HDITEMA *phdi = (HDITEMA*)lParam; - INT nItem = (INT)wParam; HEADER_ITEM *lpItem; if (!phdi) @@ -727,12 +814,10 @@ HEADER_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) if (phdi->mask == 0) return TRUE; - if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) { + if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) lpItem = NULL; - } - else { + else lpItem = &infoPtr->items[nItem]; - } if (phdi->mask & HDI_BITMAP) phdi->hbm = (lpItem != NULL) ? lpItem->hbm : 0; @@ -746,85 +831,33 @@ HEADER_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) if (phdi->mask & HDI_LPARAM) phdi->lParam = (lpItem != NULL) ? lpItem->lParam : 0; - if (phdi->mask & HDI_TEXT) { - if (lpItem == NULL) { - *phdi->pszText = 0; - } - else if (lpItem->pszText != LPSTR_TEXTCALLBACKW) { - if (lpItem->pszText) - WideCharToMultiByte (CP_ACP, 0, lpItem->pszText, -1, - phdi->pszText, phdi->cchTextMax, NULL, NULL); - else - *phdi->pszText = 0; - } - else - phdi->pszText = LPSTR_TEXTCALLBACKA; + if (phdi->mask & HDI_IMAGE) + { + phdi->iImage = (lpItem != NULL) ? lpItem->iImage : 0; + if (lpItem->iImage == I_IMAGECALLBACK) + { + HEADER_SendHeaderDispInfoNotify(hwnd, nItem, HDI_IMAGE, phdi, lpItem, bUnicode); + } } - if (phdi->mask & HDI_IMAGE) - phdi->iImage = (lpItem != NULL) ? lpItem->iImage : 0; - if (phdi->mask & HDI_ORDER) phdi->iOrder = (lpItem != NULL) ? lpItem->iOrder : 0; - return TRUE; -} - - -static LRESULT -HEADER_GetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - HDITEMW *phdi = (HDITEMW*)lParam; - INT nItem = (INT)wParam; - HEADER_ITEM *lpItem; - - if (!phdi) - return FALSE; - - TRACE("[nItem=%d]\n", nItem); - - if (phdi->mask == 0) - return TRUE; - - if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) { - lpItem = NULL; + if (phdi->mask & HDI_TEXT) + { + if (lpItem == NULL) *phdi->pszText = 0; /* null pointer check */ + else if (lpItem->pszText == LPSTR_TEXTCALLBACKW) /* covers == TEXTCALLBACKA too */ + { + HEADER_SendHeaderDispInfoNotify(hwnd, nItem, HDI_TEXT, phdi, lpItem, bUnicode); + } + else + { + if (bUnicode) + Str_GetPtrW (lpItem->pszText, phdi->pszText, phdi->cchTextMax); + else + Str_GetPtrWtoA (lpItem->pszText, (LPSTR)phdi->pszText, phdi->cchTextMax); + } } - else { - lpItem = &infoPtr->items[nItem]; - } - - if (phdi->mask & HDI_BITMAP) - phdi->hbm = (lpItem != NULL) ? lpItem->hbm : 0; - - if (phdi->mask & HDI_FORMAT) - phdi->fmt = (lpItem != NULL) ? lpItem->fmt : 0; - - if (phdi->mask & HDI_WIDTH) - phdi->cxy = (lpItem != NULL) ? lpItem->cxy : 0; - - if (phdi->mask & HDI_LPARAM) - phdi->lParam = (lpItem != NULL) ? lpItem->lParam : 0; - - if (phdi->mask & HDI_TEXT) { - if (lpItem == NULL) { - *phdi->pszText = 0; - } - else if (lpItem->pszText != LPSTR_TEXTCALLBACKW) { - if (lpItem->pszText) - lstrcpynW (phdi->pszText, lpItem->pszText, phdi->cchTextMax); - else - *phdi->pszText = 0; - } - else - phdi->pszText = LPSTR_TEXTCALLBACKW; - } - - if (phdi->mask & HDI_IMAGE) - phdi->iImage = (lpItem != NULL) ? lpItem->iImage : 0; - - if (phdi->mask & HDI_ORDER) - phdi->iOrder = (lpItem != NULL) ? lpItem->iOrder : 0; return TRUE; } @@ -914,13 +947,11 @@ HEADER_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -HEADER_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_InsertItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - HDITEMA *phdi = (HDITEMA*)lParam; - INT nItem = (INT)wParam; HEADER_ITEM *lpItem; - INT len, iOrder; + INT iOrder; UINT i; if ((phdi == NULL) || (nItem < 0)) @@ -988,150 +1019,49 @@ HEADER_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) if (phdi->mask & HDI_WIDTH) lpItem->cxy = phdi->cxy; - if (phdi->mask & HDI_TEXT) { - if (!phdi->pszText) /* null pointer check */ - phdi->pszText = ""; - if (phdi->pszText != LPSTR_TEXTCALLBACKA) { - len = MultiByteToWideChar(CP_ACP, 0, phdi->pszText, -1, NULL, 0); - lpItem->pszText = Alloc( len*sizeof(WCHAR) ); - MultiByteToWideChar(CP_ACP, 0, phdi->pszText, -1, lpItem->pszText, len); - } - else - lpItem->pszText = LPSTR_TEXTCALLBACKW; - } - if (phdi->mask & HDI_FORMAT) lpItem->fmt = phdi->fmt; if (lpItem->fmt == 0) lpItem->fmt = HDF_LEFT; - if (!(lpItem->fmt & HDF_STRING) && (phdi->mask & HDI_TEXT)) - { - lpItem->fmt |= HDF_STRING; - } if (phdi->mask & HDI_BITMAP) lpItem->hbm = phdi->hbm; if (phdi->mask & HDI_LPARAM) lpItem->lParam = phdi->lParam; - if (phdi->mask & HDI_IMAGE) - lpItem->iImage = phdi->iImage; - - lpItem->iOrder = iOrder; - - HEADER_SetItemBounds (hwnd); - - InvalidateRect(hwnd, NULL, FALSE); - - return nItem; -} - - -static LRESULT -HEADER_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - HDITEMW *phdi = (HDITEMW*)lParam; - INT nItem = (INT)wParam; - HEADER_ITEM *lpItem; - INT len, iOrder; - UINT i; - - if ((phdi == NULL) || (nItem < 0)) - return -1; - - if (nItem > infoPtr->uNumItem) - nItem = infoPtr->uNumItem; - - iOrder = (phdi->mask & HDI_ORDER) ? phdi->iOrder : nItem; - - if (infoPtr->uNumItem == 0) { - infoPtr->items = Alloc (sizeof (HEADER_ITEM)); - infoPtr->order = Alloc(sizeof(INT)); - infoPtr->uNumItem++; - } - else { - HEADER_ITEM *oldItems = infoPtr->items; - INT *oldOrder = infoPtr->order; - - infoPtr->uNumItem++; - infoPtr->items = Alloc (sizeof (HEADER_ITEM) * infoPtr->uNumItem); - if (nItem == 0) { - memcpy (&infoPtr->items[1], &oldItems[0], - (infoPtr->uNumItem-1) * sizeof(HEADER_ITEM)); - } - else - { - /* pre insert copy */ - if (nItem > 0) { - memcpy (&infoPtr->items[0], &oldItems[0], - nItem * sizeof(HEADER_ITEM)); - } - - /* post insert copy */ - if (nItem < infoPtr->uNumItem - 1) { - memcpy (&infoPtr->items[nItem+1], &oldItems[nItem], - (infoPtr->uNumItem - nItem - 1) * sizeof(HEADER_ITEM)); - } - } - - infoPtr->order = Alloc(infoPtr->uNumItem * sizeof(INT)); - memcpy(infoPtr->order, oldOrder, iOrder * sizeof(INT)); - infoPtr->order[iOrder] = nItem; - memcpy(&infoPtr->order[iOrder + 1], &oldOrder[iOrder], - (infoPtr->uNumItem - iOrder - 1) * sizeof(INT)); - - Free (oldItems); - Free(oldOrder); - } - - for (i = 0; i < infoPtr->uNumItem; i++) + if (phdi->mask & HDI_IMAGE) { - if (i != iOrder && infoPtr->order[i] >= nItem) - infoPtr->order[i]++; - infoPtr->items[infoPtr->order[i]].iOrder = infoPtr->order[i]; + if (phdi->iImage != I_IMAGECALLBACK) + { + lpItem->iImage = phdi->iImage; + } + else + { + lpItem->iImage = phdi->iImage; + HEADER_SendHeaderDispInfoNotify(hwnd, nItem, HDI_IMAGE, NULL, lpItem, bUnicode); + } } - lpItem = &infoPtr->items[nItem]; - lpItem->bDown = FALSE; - - if (phdi->mask & HDI_WIDTH) - lpItem->cxy = phdi->cxy; - - if (phdi->mask & HDI_TEXT) { - WCHAR wide_null_char = 0; - if (!phdi->pszText) /* null pointer check */ - phdi->pszText = &wide_null_char; - if (phdi->pszText != LPSTR_TEXTCALLBACKW) { - len = strlenW (phdi->pszText); - lpItem->pszText = Alloc ((len+1)*sizeof(WCHAR)); - strcpyW (lpItem->pszText, phdi->pszText); - } - else - lpItem->pszText = LPSTR_TEXTCALLBACKW; + if (phdi->mask & HDI_TEXT) + { + if (!phdi->pszText) phdi->pszText = '\0'; /* null pointer check */ + if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */ + { + if (bUnicode) + Str_SetPtrW(&lpItem->pszText, phdi->pszText); + else + Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)phdi->pszText); + } + else + { + lpItem->pszText = phdi->pszText; + HEADER_SendHeaderDispInfoNotify(hwnd, nItem, HDI_TEXT, NULL, lpItem, bUnicode); + } + lpItem->fmt |= HDF_STRING; } - if (phdi->mask & HDI_FORMAT) - lpItem->fmt = phdi->fmt; - - if (lpItem->fmt == 0) - lpItem->fmt = HDF_LEFT; - - if (!(lpItem->fmt &HDF_STRING) && (phdi->mask & HDI_TEXT)) - { - lpItem->fmt |= HDF_STRING; - } - if (phdi->mask & HDI_BITMAP) - lpItem->hbm = phdi->hbm; - - if (phdi->mask & HDI_LPARAM) - lpItem->lParam = phdi->lParam; - - if (phdi->mask & HDI_IMAGE) - lpItem->iImage = phdi->iImage; - lpItem->iOrder = iOrder; HEADER_SetItemBounds (hwnd); @@ -1207,11 +1137,9 @@ HEADER_SetBitmapMargin(HWND hwnd, WPARAM wParam) } static LRESULT -HEADER_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_SetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - HDITEMA *phdi = (HDITEMA*)lParam; - INT nItem = (INT)wParam; HEADER_ITEM *lpItem; if (phdi == NULL) @@ -1221,7 +1149,8 @@ HEADER_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) TRACE("[nItem=%d]\n", nItem); - if (HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGINGA, nItem, phdi->mask)) + if (HEADER_SendHeaderNotify (hwnd, bUnicode ? HDN_ITEMCHANGINGW : HDN_ITEMCHANGINGA, + nItem, phdi->mask)) return FALSE; lpItem = &infoPtr->items[nItem]; @@ -1234,27 +1163,45 @@ HEADER_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) if (phdi->mask & HDI_LPARAM) lpItem->lParam = phdi->lParam; - if (phdi->mask & HDI_TEXT) { - if (phdi->pszText != LPSTR_TEXTCALLBACKA) { - if (lpItem->pszText) { - Free (lpItem->pszText); - lpItem->pszText = NULL; - } - if (phdi->pszText) { - INT len = MultiByteToWideChar (CP_ACP,0,phdi->pszText,-1,NULL,0); - lpItem->pszText = Alloc( len*sizeof(WCHAR) ); - MultiByteToWideChar (CP_ACP,0,phdi->pszText,-1,lpItem->pszText,len); - } - } - else - lpItem->pszText = LPSTR_TEXTCALLBACKW; - } - if (phdi->mask & HDI_WIDTH) lpItem->cxy = phdi->cxy; - if (phdi->mask & HDI_IMAGE) - lpItem->iImage = phdi->iImage; + if (phdi->mask & HDI_IMAGE) + { + if (phdi->iImage != I_IMAGECALLBACK) + { + lpItem->iImage = phdi->iImage; + } + else + { + lpItem->iImage = phdi->iImage; + HEADER_SendHeaderDispInfoNotify(hwnd, nItem, HDI_IMAGE, NULL, lpItem, bUnicode); + } + } + + if (phdi->mask & HDI_TEXT) + { + if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */ + { + if (lpItem->pszText) + { + Free(lpItem->pszText); + lpItem->pszText = NULL; + } + if (phdi->pszText) + { + if (bUnicode) + Str_SetPtrW(&lpItem->pszText, phdi->pszText); + else + Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)phdi->pszText); + } + } + else + { + lpItem->pszText = phdi->pszText; + HEADER_SendHeaderDispInfoNotify(hwnd, nItem, HDI_TEXT, NULL, lpItem, bUnicode); + } + } if (phdi->mask & HDI_ORDER) { @@ -1281,92 +1228,8 @@ HEADER_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) } } - HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGEDA, nItem, phdi->mask); - - HEADER_SetItemBounds (hwnd); - - InvalidateRect(hwnd, NULL, FALSE); - - return TRUE; -} - - -static LRESULT -HEADER_SetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - HDITEMW *phdi = (HDITEMW*)lParam; - INT nItem = (INT)wParam; - HEADER_ITEM *lpItem; - - if (phdi == NULL) - return FALSE; - if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) - return FALSE; - - TRACE("[nItem=%d]\n", nItem); - - if (HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGINGW, nItem, phdi->mask)) - return FALSE; - - lpItem = &infoPtr->items[nItem]; - if (phdi->mask & HDI_BITMAP) - lpItem->hbm = phdi->hbm; - - if (phdi->mask & HDI_FORMAT) - lpItem->fmt = phdi->fmt; - - if (phdi->mask & HDI_LPARAM) - lpItem->lParam = phdi->lParam; - - if (phdi->mask & HDI_TEXT) { - if (phdi->pszText != LPSTR_TEXTCALLBACKW) { - if (lpItem->pszText) { - Free (lpItem->pszText); - lpItem->pszText = NULL; - } - if (phdi->pszText) { - INT len = strlenW (phdi->pszText); - lpItem->pszText = Alloc ((len+1)*sizeof(WCHAR)); - strcpyW (lpItem->pszText, phdi->pszText); - } - } - else - lpItem->pszText = LPSTR_TEXTCALLBACKW; - } - - if (phdi->mask & HDI_WIDTH) - lpItem->cxy = phdi->cxy; - - if (phdi->mask & HDI_IMAGE) - lpItem->iImage = phdi->iImage; - - if (phdi->mask & HDI_ORDER) - { - INT i, nMin, nMax; - - if (lpItem->iOrder < phdi->iOrder) - { - memmove(&infoPtr->order[lpItem->iOrder], - &infoPtr->order[lpItem->iOrder + 1], - (phdi->iOrder - lpItem->iOrder) * sizeof(INT)); - } - if (phdi->iOrder < lpItem->iOrder) - { - memmove(&infoPtr->order[phdi->iOrder + 1], - &infoPtr->order[phdi->iOrder], - (lpItem->iOrder - phdi->iOrder) * sizeof(INT)); - } - infoPtr->order[phdi->iOrder] = nItem; - nMin = min(lpItem->iOrder, phdi->iOrder); - nMax = max(lpItem->iOrder, phdi->iOrder); - for (i = nMin; i <= nMax; i++) - { - infoPtr->items[infoPtr->order[i]].iOrder = infoPtr->order[i]; - } - } - - HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGEDW, nItem, phdi->mask); + HEADER_SendHeaderNotify (hwnd, bUnicode ? HDN_ITEMCHANGEDW : HDN_ITEMCHANGEDA, + nItem, phdi->mask); HEADER_SetItemBounds (hwnd); @@ -1889,10 +1752,8 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return HEADER_GetImageList (hwnd); case HDM_GETITEMA: - return HEADER_GetItemA (hwnd, wParam, lParam); - case HDM_GETITEMW: - return HEADER_GetItemW (hwnd, wParam, lParam); + return HEADER_GetItemT (hwnd, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_GETITEMW); case HDM_GETITEMCOUNT: return HEADER_GetItemCount (hwnd); @@ -1910,10 +1771,8 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return HEADER_HitTest (hwnd, wParam, lParam); case HDM_INSERTITEMA: - return HEADER_InsertItemA (hwnd, wParam, lParam); - case HDM_INSERTITEMW: - return HEADER_InsertItemW (hwnd, wParam, lParam); + return HEADER_InsertItemT (hwnd, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_INSERTITEMW); case HDM_LAYOUT: return HEADER_Layout (hwnd, wParam, lParam); @@ -1932,10 +1791,8 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return HEADER_SetImageList (hwnd, (HIMAGELIST)lParam); case HDM_SETITEMA: - return HEADER_SetItemA (hwnd, wParam, lParam); - case HDM_SETITEMW: - return HEADER_SetItemW (hwnd, wParam, lParam); + return HEADER_SetItemT (hwnd, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_SETITEMW); case HDM_SETORDERARRAY: return HEADER_SetOrderArray(hwnd, wParam, lParam); @@ -1982,6 +1839,7 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_THEMECHANGED: return HEADER_ThemeChanged (hwnd); + case WM_PRINTCLIENT: case WM_PAINT: return HEADER_Paint (hwnd, wParam); diff --git a/reactos/lib/comctl32/hotkey.c b/reactos/lib/comctl32/hotkey.c index ab8d7465cbf..635916483f1 100644 --- a/reactos/lib/comctl32/hotkey.c +++ b/reactos/lib/comctl32/hotkey.c @@ -516,6 +516,7 @@ HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NCCREATE: return HOTKEY_NCCreate (hwnd, (LPCREATESTRUCTW)lParam); + case WM_PRINTCLIENT: case WM_PAINT: HOTKEY_Paint(infoPtr, (HDC)wParam); return 0; diff --git a/reactos/lib/comctl32/imagelist.c b/reactos/lib/comctl32/imagelist.c index 70712b417bf..551f91a04f4 100644 --- a/reactos/lib/comctl32/imagelist.c +++ b/reactos/lib/comctl32/imagelist.c @@ -1581,8 +1581,7 @@ ImageList_GetImageRect (HIMAGELIST himl, INT i, LPRECT lpRect) * * Creates an image list from a bitmap, icon or cursor. * - * SEE - * ImageList_LoadImageW () + * See ImageList_LoadImageW. */ HIMAGELIST WINAPI diff --git a/reactos/lib/comctl32/listview.c b/reactos/lib/comctl32/listview.c index dcad29c45b7..13e6b2c3c23 100644 --- a/reactos/lib/comctl32/listview.c +++ b/reactos/lib/comctl32/listview.c @@ -3274,6 +3274,9 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN { TRACKMOUSEEVENT trackinfo; + if (!(fwKeys & MK_LBUTTON)) + infoPtr->bLButtonDown = FALSE; + if (infoPtr->bLButtonDown && DragDetect(infoPtr->hwndSelf, infoPtr->ptClickPos)) { LVHITTESTINFO lvHitTestInfo; @@ -4189,7 +4192,7 @@ static HIMAGELIST LISTVIEW_CreateDragImage(LISTVIEW_INFO *infoPtr, INT iItem, LP HDC hdc, hdcOrig; HBITMAP hbmp, hOldbmp; HIMAGELIST dragList = 0; - TRACE("iItem=%d Count=%d \n", iItem, infoPtr->nItemCount); + TRACE("iItem=%d Count=%d\n", iItem, infoPtr->nItemCount); if (iItem < 0 || iItem >= infoPtr->nItemCount) return 0; @@ -5137,7 +5140,7 @@ static HIMAGELIST LISTVIEW_GetImageList(LISTVIEW_INFO *infoPtr, INT nImageList) * * NOTE: * This is the internal 'GetItem' interface -- it tries to - * be smart, and avoids text copies, if possible, by modifing + * be smart and avoid text copies, if possible, by modifying * lpLVItem->pszText to point to the text string. Please note * that this is not always possible (e.g. OWNERDATA), so on * entry you *must* supply valid values for pszText, and cchTextMax. @@ -5612,6 +5615,7 @@ static BOOL LISTVIEW_GetSubItemRect(LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lp { POINT Position; LVITEMW lvItem; + INT nColumn = lprc->top; if (!lprc) return FALSE; @@ -5624,9 +5628,11 @@ static BOOL LISTVIEW_GetSubItemRect(LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lp if (!LISTVIEW_GetItemPosition(infoPtr, nItem, &Position)) return FALSE; + if (nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE; + lvItem.mask = 0; lvItem.iItem = nItem; - lvItem.iSubItem = lprc->top; + lvItem.iSubItem = nColumn; if (lvItem.mask && !LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE; switch(lprc->left) diff --git a/reactos/lib/comctl32/monthcal.c b/reactos/lib/comctl32/monthcal.c index 4214eed8d60..340b68142f2 100644 --- a/reactos/lib/comctl32/monthcal.c +++ b/reactos/lib/comctl32/monthcal.c @@ -2007,6 +2007,7 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_LBUTTONUP: return MONTHCAL_LButtonUp(infoPtr, lParam); + case WM_PRINTCLIENT: case WM_PAINT: return MONTHCAL_Paint(infoPtr, wParam); diff --git a/reactos/lib/comctl32/pager.c b/reactos/lib/comctl32/pager.c index 971da4e1b89..cd25159d16e 100644 --- a/reactos/lib/comctl32/pager.c +++ b/reactos/lib/comctl32/pager.c @@ -34,6 +34,8 @@ * PGS_DRAGNDROP * Notifications: * PGN_HOTITEMCHANGE + * Messages: + * WM_PRINT and/or WM_PRINTCLIENT * * TESTING: * Tested primarily with the controlspy Pager application. diff --git a/reactos/lib/comctl32/progress.c b/reactos/lib/comctl32/progress.c index a6e20e5e9cc..eb0b11a4172 100644 --- a/reactos/lib/comctl32/progress.c +++ b/reactos/lib/comctl32/progress.c @@ -627,6 +627,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, case WM_SETFONT: return (LRESULT)PROGRESS_SetFont(infoPtr, (HFONT)wParam, (BOOL)lParam); + case WM_PRINTCLIENT: case WM_PAINT: return PROGRESS_Paint (infoPtr, (HDC)wParam); diff --git a/reactos/lib/comctl32/propsheet.c b/reactos/lib/comctl32/propsheet.c index 783ae3e3a09..08c55b8bfee 100644 --- a/reactos/lib/comctl32/propsheet.c +++ b/reactos/lib/comctl32/propsheet.c @@ -3455,6 +3455,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TRUE; } + case WM_PRINTCLIENT: case WM_PAINT: PROPSHEET_Paint(hwnd, (HDC)wParam); return TRUE; diff --git a/reactos/lib/comctl32/rebar.c b/reactos/lib/comctl32/rebar.c index 3f167baf847..61806f44d98 100644 --- a/reactos/lib/comctl32/rebar.c +++ b/reactos/lib/comctl32/rebar.c @@ -50,7 +50,6 @@ * - WM_LBUTTONDBLCLK * - WM_MEASUREITEM * - WM_PALETTECHANGED - * - WM_PRINTCLIENT * - WM_QUERYNEWPALETTE * - WM_RBUTTONDOWN * - WM_RBUTTONUP @@ -4768,11 +4767,11 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NOTIFYFORMAT: return REBAR_NotifyFormat (infoPtr, wParam, lParam); + case WM_PRINTCLIENT: case WM_PAINT: return REBAR_Paint (infoPtr, wParam, lParam); /* case WM_PALETTECHANGED: supported according to ControlSpy */ -/* case WM_PRINTCLIENT: supported according to ControlSpy */ /* case WM_QUERYNEWPALETTE:supported according to ControlSpy */ /* case WM_RBUTTONDOWN: supported according to ControlSpy */ /* case WM_RBUTTONUP: supported according to ControlSpy */ diff --git a/reactos/lib/comctl32/status.c b/reactos/lib/comctl32/status.c index c730400d344..7c86815a484 100644 --- a/reactos/lib/comctl32/status.c +++ b/reactos/lib/comctl32/status.c @@ -1342,6 +1342,7 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_NOTIFYFORMAT: return STATUSBAR_NotifyFormat(infoPtr, (HWND)wParam, (INT)lParam); + case WM_PRINTCLIENT: case WM_PAINT: return STATUSBAR_WMPaint (infoPtr, (HDC)wParam); diff --git a/reactos/lib/comctl32/string.c b/reactos/lib/comctl32/string.c index 7e7afe0675c..35b05fa7fc3 100644 --- a/reactos/lib/comctl32/string.c +++ b/reactos/lib/comctl32/string.c @@ -22,6 +22,9 @@ * */ +#include "config.h" +#include "wine/port.h" + #include #include #include /* atoi */ @@ -171,13 +174,52 @@ LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch) return NULL; } +/************************************************************************** + * StrCmpNIA [COMCTL32.353] + * + * Compare two strings, up to a maximum length, ignoring case. + * + * PARAMS + * lpszStr [I] First string to compare + * lpszComp [I] Second string to compare + * iLen [I] Maximum number of chars to compare. + * + * RETURNS + * An integer less than, equal to or greater than 0, indicating that + * lpszStr is less than, the same, or greater than lpszComp. + */ +INT WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen) +{ + INT iRet; + + TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen); + + iRet = CompareStringA(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen); + return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0; +} + +/************************************************************************* + * StrCmpNIW [COMCTL32.361] + * + * See StrCmpNIA. + */ +INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen) +{ + INT iRet; + + TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen); + + iRet = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen); + return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0; +} + /************************************************************************* * COMCTL32_StrStrHelperA * * Internal implementation of StrStrA/StrStrIA */ static LPSTR COMCTL32_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch, - int (*pStrCmpFn)(LPCSTR,LPCSTR,size_t)) + INT (WINAPI *pStrCmpFn)(LPCSTR,LPCSTR,INT)) { size_t iLen; @@ -201,7 +243,7 @@ static LPSTR COMCTL32_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch, * Internal implementation of StrStrW/StrStrIW */ static LPWSTR COMCTL32_StrStrHelperW(LPCWSTR lpszStr, LPCWSTR lpszSearch, - int (*pStrCmpFn)(LPCWSTR,LPCWSTR,int)) + INT (WINAPI *pStrCmpFn)(LPCWSTR,LPCWSTR,INT)) { int iLen; @@ -235,7 +277,7 @@ LPSTR WINAPI StrStrIA(LPCSTR lpszStr, LPCSTR lpszSearch) { TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch)); - return COMCTL32_StrStrHelperA(lpszStr, lpszSearch, strncasecmp); + return COMCTL32_StrStrHelperA(lpszStr, lpszSearch, StrCmpNIA); } /************************************************************************** @@ -264,7 +306,7 @@ LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch) { TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch)); - return COMCTL32_StrStrHelperW(lpszStr, lpszSearch, (int (*)(LPCWSTR,LPCWSTR,int)) wcsnicmp); + return COMCTL32_StrStrHelperW(lpszStr, lpszSearch, StrCmpNIW); } /************************************************************************** @@ -364,45 +406,6 @@ INT WINAPI StrCmpNA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen) return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0; } -/************************************************************************** - * StrCmpNIA [COMCTL32.353] - * - * Compare two strings, up to a maximum length, ignoring case. - * - * PARAMS - * lpszStr [I] First string to compare - * lpszComp [I] Second string to compare - * iLen [I] Maximum number of chars to compare. - * - * RETURNS - * An integer less than, equal to or greater than 0, indicating that - * lpszStr is less than, the same, or greater than lpszComp. - */ -int WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, int iLen) -{ - INT iRet; - - TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen); - - iRet = CompareStringA(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen); - return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0; -} - -/************************************************************************* - * StrCmpNIW [COMCTL32.361] - * - * See StrCmpNIA. - */ -INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, int iLen) -{ - INT iRet; - - TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen); - - iRet = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen); - return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0; -} - /************************************************************************** * StrCmpNW [COMCTL32.360] * @@ -501,7 +504,7 @@ LPSTR WINAPI StrStrA(LPCSTR lpszStr, LPCSTR lpszSearch) { TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch)); - return COMCTL32_StrStrHelperA(lpszStr, lpszSearch, strncmp); + return COMCTL32_StrStrHelperA(lpszStr, lpszSearch, StrCmpNA); } /************************************************************************** @@ -513,7 +516,7 @@ LPWSTR WINAPI StrStrW(LPCWSTR lpszStr, LPCWSTR lpszSearch) { TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch)); - return COMCTL32_StrStrHelperW(lpszStr, lpszSearch, (int (*)(LPCWSTR,LPCWSTR,int)) wcsncmp); + return COMCTL32_StrStrHelperW(lpszStr, lpszSearch, StrCmpNW); } /************************************************************************* diff --git a/reactos/lib/comctl32/syslink.c b/reactos/lib/comctl32/syslink.c index 12a06055648..084a56762ed 100644 --- a/reactos/lib/comctl32/syslink.c +++ b/reactos/lib/comctl32/syslink.c @@ -1463,6 +1463,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message, return DefWindowProcW( hwnd, message, wParam, lParam ); switch(message) { + case WM_PRINTCLIENT: case WM_PAINT: return SYSLINK_Paint (infoPtr, (HDC)wParam); diff --git a/reactos/lib/comctl32/tab.c b/reactos/lib/comctl32/tab.c index 91f37254921..dd9dbe51dc2 100644 --- a/reactos/lib/comctl32/tab.c +++ b/reactos/lib/comctl32/tab.c @@ -1079,7 +1079,6 @@ static void TAB_SetItemBounds (TAB_INFO *infoPtr) HFONT hFont, hOldFont; HDC hdc; RECT clientRect; - SIZE size; INT iTemp; RECT* rcItem; INT iIndex; @@ -1192,6 +1191,7 @@ static void TAB_SetItemBounds (TAB_INFO *infoPtr) else { int tabwidth; + SIZE size; /* Calculate how wide the tab is depending on the text it contains */ GetTextExtentPoint32W(hdc, curr->pszText, lstrlenW(curr->pszText), &size); @@ -1231,7 +1231,6 @@ static void TAB_SetItemBounds (TAB_INFO *infoPtr) curr->rect.bottom = 0; curr->rect.top = curItemRowCount - 1; - TRACE("TextSize: %li\n", size.cx); TRACE("Rect: T %li, L %li, B %li, R %li\n", curr->rect.top, curr->rect.left, curr->rect.bottom, curr->rect.right); @@ -3284,6 +3283,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_MOUSEMOVE: return TAB_MouseMove (infoPtr, wParam, lParam); + case WM_PRINTCLIENT: case WM_PAINT: return TAB_Paint (infoPtr, (HDC)wParam); diff --git a/reactos/lib/comctl32/toolbar.c b/reactos/lib/comctl32/toolbar.c index cf6a03bbf48..64be7ec9289 100644 --- a/reactos/lib/comctl32/toolbar.c +++ b/reactos/lib/comctl32/toolbar.c @@ -7234,6 +7234,7 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NOTIFYFORMAT: return TOOLBAR_NotifyFormat (infoPtr, wParam, lParam); + case WM_PRINTCLIENT: case WM_PAINT: return TOOLBAR_Paint (hwnd, wParam); diff --git a/reactos/lib/comctl32/tooltips.c b/reactos/lib/comctl32/tooltips.c index e641aaaba09..b738a4ea011 100644 --- a/reactos/lib/comctl32/tooltips.c +++ b/reactos/lib/comctl32/tooltips.c @@ -2782,6 +2782,7 @@ TOOLTIPS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NOTIFYFORMAT: return TOOLTIPS_NotifyFormat (hwnd, wParam, lParam); + case WM_PRINTCLIENT: case WM_PAINT: return TOOLTIPS_Paint (hwnd, wParam, lParam); diff --git a/reactos/lib/comctl32/trackbar.c b/reactos/lib/comctl32/trackbar.c index 5b113ec1731..7094e049994 100644 --- a/reactos/lib/comctl32/trackbar.c +++ b/reactos/lib/comctl32/trackbar.c @@ -1878,6 +1878,7 @@ TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_MOUSEMOVE: return TRACKBAR_MouseMove (infoPtr, wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); + case WM_PRINTCLIENT: case WM_PAINT: return TRACKBAR_Paint (infoPtr, (HDC)wParam); diff --git a/reactos/lib/comctl32/treeview.c b/reactos/lib/comctl32/treeview.c index 5aab52ff949..189eff592d4 100644 --- a/reactos/lib/comctl32/treeview.c +++ b/reactos/lib/comctl32/treeview.c @@ -1805,7 +1805,7 @@ TREEVIEW_SetItemHeight(TREEVIEW_INFO *infoPtr, INT newHeight) { INT prevHeight = infoPtr->uItemHeight; - TRACE("%d \n", newHeight); + TRACE("%d\n", newHeight); if (newHeight == -1) { infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr); @@ -2847,18 +2847,8 @@ TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, WPARAM wParam) if (wParam) { hdc = (HDC)wParam; - if (!GetUpdateRect(infoPtr->hwnd, &rc, TRUE)) - { - HBITMAP hbitmap; - BITMAP bitmap; - hbitmap = GetCurrentObject(hdc, OBJ_BITMAP); - if (!hbitmap) return 0; - GetObjectW(hbitmap, sizeof(BITMAP), &bitmap); - rc.left = 0; rc.top = 0; - rc.right = bitmap.bmWidth; - rc.bottom = bitmap.bmHeight; - TREEVIEW_EraseBackground(infoPtr, (HDC)wParam); - } + GetClientRect(infoPtr->hwnd, &rc); + TREEVIEW_EraseBackground(infoPtr, hdc); } else { @@ -5628,11 +5618,10 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_NOTIFYFORMAT: return TREEVIEW_NotifyFormat(infoPtr, (HWND)wParam, (UINT)lParam); + case WM_PRINTCLIENT: case WM_PAINT: return TREEVIEW_Paint(infoPtr, wParam); - /* WM_PRINTCLIENT */ - case WM_RBUTTONDOWN: return TREEVIEW_RButtonDown(infoPtr, lParam); diff --git a/reactos/lib/comctl32/updown.c b/reactos/lib/comctl32/updown.c index d8898815f3a..cda2668d953 100644 --- a/reactos/lib/comctl32/updown.c +++ b/reactos/lib/comctl32/updown.c @@ -934,6 +934,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L return UPDOWN_KeyPressed(infoPtr, (int)wParam); break; + case WM_PRINTCLIENT: case WM_PAINT: return UPDOWN_Paint (infoPtr, (HDC)wParam);