Sync to Wine-0_9_1:

Vitaliy Margolen <wine-patch@kievinfo.com>
- Unify HEADER_GetItem[A/W] into one function.
- Unify HEADER_InsertItem[A/W] into one function.
- Unify HEADER_SetItem[A/W] into one function.
Michael Kaufmann <hallo@michael-kaufmann.ch>
- Handle WM_PRINTCLIENT.
  Don't use SelectClipRgn in WM_PRINTCLIENT.
Dimi Paun <dimi@lattica.com>
- Validate the column index passed in by the caller.
Alex Villacís Lasso <a_villacis@palosanto.com>
- Do not issue a GetUpdateRect() to query an update region for
  WM_PAINT(wParam=HDC) case. Instead, use GetClientRect() for a bounding
  rect.
Vincent Béron <vberon@mecano.gme.usherb.ca>
- Move functions in comctl32/string.c to remove function declaration.
Dmitry Timoshkov <dmitry@codeweavers.com>
- Use Win32 APIs for string comparison.
- Avoid printing out a possibly uninitialized variable.
Ulrich Czekalla <ulrich@codeweavers.com>
- Clear bLButtonDown flags if mouse is not down.
Martin Fuchs <martin-fuchs@gmx.net>
- Include config.h and port.h for strncasecmp() in MSVC port.

svn path=/trunk/; revision=19296
This commit is contained in:
Gé van Geldorp 2005-11-17 19:36:54 +00:00
parent 41e7e24a51
commit 565cf7f36d
21 changed files with 267 additions and 399 deletions

View file

@ -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

View file

@ -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;
}
}

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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

View file

@ -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)

View file

@ -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);

View file

@ -34,6 +34,8 @@
* PGS_DRAGNDROP
* Notifications:
* PGN_HOTITEMCHANGE
* Messages:
* WM_PRINT and/or WM_PRINTCLIENT
*
* TESTING:
* Tested primarily with the controlspy Pager application.

View file

@ -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);

View file

@ -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;

View file

@ -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 */

View file

@ -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);

View file

@ -22,6 +22,9 @@
*
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h> /* 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);
}
/*************************************************************************

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);