Mikołaj Zalewski : comctl32: header: Mark the callback items in a mask.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon May 15 09:42:30 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 96190f77b9dbc63fb2cafd3a3fa2eabe266d5dce
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=96190f77b9dbc63fb2cafd3a3fa2eabe266d5dce
Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date: Sat May 13 21:22:44 2006 +0200
comctl32: header: Mark the callback items in a mask.
Mark the callback items in the callbackMask HEADER_ITEM field. The
pszText for callback texts is now NULL what simplifies some
checks. Checks for lpItem->pszText==emptyString are also not needed as
emptyString is not stored in lpItem but used as a parameter to
Str_SetPtr (I haven't noticed it).
---
dlls/comctl32/header.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c
index bed77ca..05ec599 100644
--- a/dlls/comctl32/header.c
+++ b/dlls/comctl32/header.c
@@ -61,6 +61,7 @@ typedef struct
BOOL bDown; /* is item pressed? (used for drawing) */
RECT rect; /* bounding rectangle of the item */
+ DWORD callbackMask; /* HDI_* flags for items that are callback */
} HEADER_ITEM;
@@ -103,8 +104,7 @@ static WCHAR emptyString[] = {0};
static void HEADER_DisposeItem(HEADER_ITEM *lpItem)
{
- if (lpItem->pszText && lpItem->pszText != emptyString &&
- lpItem->pszText != LPSTR_TEXTCALLBACKW) /* covers LPSTR_TEXTCALLBACKA too */
+ if (lpItem->pszText)
{
Free(lpItem->pszText);
}
@@ -127,14 +127,17 @@ static void HEADER_StoreHDItemInHeader(H
if (phdi->mask & HDI_IMAGE)
{
lpItem->iImage = phdi->iImage;
+ if (phdi->iImage == I_IMAGECALLBACK)
+ lpItem->callbackMask |= HDI_IMAGE;
+ else
+ lpItem->callbackMask &= ~HDI_IMAGE;
}
if (phdi->mask & HDI_TEXT)
{
if (lpItem->pszText)
{
- if (lpItem->pszText != emptyString && lpItem->pszText != LPSTR_TEXTCALLBACKW)
- Free(lpItem->pszText);
+ Free(lpItem->pszText);
lpItem->pszText = NULL;
}
@@ -145,10 +148,12 @@ static void HEADER_StoreHDItemInHeader(H
Str_SetPtrW(&lpItem->pszText, pszText);
else
Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)pszText);
+ lpItem->callbackMask &= ~HDI_TEXT;
}
else
{
- lpItem->pszText = phdi->pszText;
+ lpItem->pszText = NULL;
+ lpItem->callbackMask |= HDI_TEXT;
}
}
}
@@ -777,6 +782,7 @@ HEADER_SendHeaderDispInfoNotify(HWND hwn
if (dispInfo.mask & HDI_IMAGE)
{
lpItem->iImage = dispInfo.iImage;
+ lpItem->callbackMask &= ~HDI_IMAGE;
}
if (dispInfo.mask & HDI_TEXT)
{
@@ -784,6 +790,7 @@ HEADER_SendHeaderDispInfoNotify(HWND hwn
Str_SetPtrW(&lpItem->pszText, (LPCWSTR)dispInfo.pszText);
else /*if (convertToAnsi || !isW)*/
Str_SetPtrAtoW(&lpItem->pszText, (LPCSTR)dispInfo.pszText);
+ lpItem->callbackMask &= ~HDI_TEXT;
}
FIXME("NMHDDISPINFO returns with flags HDI_DI_SETITEM\n");
@@ -949,7 +956,7 @@ HEADER_GetItemT (HWND hwnd, INT nItem, L
if (phdi->mask & HDI_IMAGE)
{
phdi->iImage = lpItem->iImage;
- if (lpItem->iImage == I_IMAGECALLBACK)
+ if (lpItem->callbackMask & HDI_IMAGE)
{
HEADER_SendHeaderDispInfoNotify(hwnd, nItem, HDI_IMAGE, phdi, lpItem, bUnicode);
}
@@ -960,7 +967,7 @@ HEADER_GetItemT (HWND hwnd, INT nItem, L
if (phdi->mask & HDI_TEXT)
{
- if (lpItem->pszText == LPSTR_TEXTCALLBACKW) /* covers == TEXTCALLBACKA too */
+ if (lpItem->callbackMask & HDI_TEXT)
{
HEADER_SendHeaderDispInfoNotify(hwnd, nItem, HDI_TEXT, phdi, lpItem, bUnicode);
}
More information about the wine-cvs
mailing list