toolbar: fix text handling
Huw D M Davies
h.davies1 at physics.ox.ac.uk
Mon Feb 9 09:33:03 CST 2004
Huw Davies <huw at codeweavers.com>
TB_ADDBUTTONS can pass a string ptr instead of an index.
TB_GETBUTTONINFO only returns a string if it's not in the
internal string list.
--
Huw Davies
huw at codeweavers.com
Index: dlls/comctl32/toolbar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/toolbar.c,v
retrieving revision 1.150
diff -u -r1.150 toolbar.c
--- dlls/comctl32/toolbar.c 7 Feb 2004 01:28:10 -0000 1.150
+++ dlls/comctl32/toolbar.c 9 Feb 2004 15:29:47 -0000
@@ -2473,7 +2473,10 @@
btnPtr->fsState = lpTbb[nCount].fsState;
btnPtr->fsStyle = lpTbb[nCount].fsStyle;
btnPtr->dwData = lpTbb[nCount].dwData;
- btnPtr->iString = lpTbb[nCount].iString;
+ if(HIWORD(lpTbb[nCount].iString) && lpTbb[nCount].iString != -1)
+ Str_SetPtrAtoW ((LPWSTR*)&btnPtr->iString, (LPSTR)lpTbb[nCount].iString );
+ else
+ btnPtr->iString = lpTbb[nCount].iString;
btnPtr->bHot = FALSE;
if ((infoPtr->hwndToolTip) && !(btnPtr->fsStyle & TBSTYLE_SEP)) {
@@ -2537,7 +2540,10 @@
btnPtr->fsState = lpTbb[nCount].fsState;
btnPtr->fsStyle = lpTbb[nCount].fsStyle;
btnPtr->dwData = lpTbb[nCount].dwData;
- btnPtr->iString = lpTbb[nCount].iString;
+ if(HIWORD(lpTbb[nCount].iString) && lpTbb[nCount].iString != -1)
+ Str_SetPtrW ((LPWSTR*)&btnPtr->iString, (LPWSTR)lpTbb[nCount].iString );
+ else
+ btnPtr->iString = lpTbb[nCount].iString;
btnPtr->bHot = FALSE;
if ((infoPtr->hwndToolTip) && !(btnPtr->fsStyle & TBSTYLE_SEP)) {
@@ -3147,10 +3153,16 @@
lpTbInfo->fsState = btnPtr->fsState;
if (lpTbInfo->dwMask & TBIF_STYLE)
lpTbInfo->fsStyle = btnPtr->fsStyle;
- if (lpTbInfo->dwMask & TBIF_TEXT) {
- LPWSTR lpText = TOOLBAR_GetText(infoPtr,btnPtr);
- Str_GetPtrWtoA (lpText, lpTbInfo->pszText,lpTbInfo->cchText);
- }
+ if (lpTbInfo->dwMask & TBIF_TEXT) {
+ /* TB_GETBUTTONINFO doesn't retrieve text from the string list, so we
+ can't use TOOLBAR_GetText here */
+ LPWSTR lpText;
+ if (HIWORD(btnPtr->iString) && (btnPtr->iString != -1)) {
+ lpText = (LPWSTR)btnPtr->iString;
+ Str_GetPtrWtoA (lpText, lpTbInfo->pszText,lpTbInfo->cchText);
+ } else
+ lpTbInfo->pszText[0] = '\0';
+ }
return nIndex;
}
@@ -3193,8 +3205,14 @@
if (lpTbInfo->dwMask & TBIF_STYLE)
lpTbInfo->fsStyle = btnPtr->fsStyle;
if (lpTbInfo->dwMask & TBIF_TEXT) {
- LPWSTR lpText = TOOLBAR_GetText(infoPtr,btnPtr);
- Str_GetPtrW (lpText,lpTbInfo->pszText,lpTbInfo->cchText);
+ /* TB_GETBUTTONINFO doesn't retrieve text from the string list, so we
+ can't use TOOLBAR_GetText here */
+ LPWSTR lpText;
+ if (HIWORD(btnPtr->iString) && (btnPtr->iString != -1)) {
+ lpText = (LPWSTR)btnPtr->iString;
+ Str_GetPtrW (lpText,lpTbInfo->pszText,lpTbInfo->cchText);
+ } else
+ lpTbInfo->pszText[0] = '\0';
}
return nIndex;
More information about the wine-patches
mailing list