toolbar images
Aric Stewart
aric at codeweavers.com
Thu Jul 14 13:43:33 CDT 2005
when Adding an image copy the full previous buffer.
implement replacing an icon with one from a resouce.
-------------- next part --------------
Index: dlls/comctl32/toolbar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/toolbar.c,v
retrieving revision 1.214
diff -u -r1.214 toolbar.c
--- dlls/comctl32/toolbar.c 25 Jun 2005 17:55:40 -0000 1.214
+++ dlls/comctl32/toolbar.c 14 Jul 2005 18:33:48 -0000
@@ -2731,7 +2731,7 @@
{
TBITMAP_INFO *oldBitmaps = infoPtr->bitmaps;
infoPtr->bitmaps = Alloc((infoPtr->nNumBitmapInfos + 1) * sizeof(TBITMAP_INFO));
- memcpy(&infoPtr->bitmaps[0], &oldBitmaps[0], infoPtr->nNumBitmapInfos);
+ memcpy(&infoPtr->bitmaps[0], &oldBitmaps[0], infoPtr->nNumBitmapInfos * sizeof(TBITMAP_INFO));
}
infoPtr->bitmaps[infoPtr->nNumBitmapInfos].nButtons = nButtons;
@@ -4369,6 +4369,7 @@
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
LPTBREPLACEBITMAP lpReplace = (LPTBREPLACEBITMAP) lParam;
HBITMAP hBitmap;
+ HBITMAP hbmLoad = NULL;
int i = 0, nOldButtons = 0, pos = 0;
int nOldBitmaps, nNewBitmaps = 0;
HIMAGELIST himlDef = 0;
@@ -4383,9 +4384,12 @@
return FALSE;
}
else if (lpReplace->hInstOld != 0)
- {
FIXME("resources not in the current module not implemented\n");
- return FALSE;
+
+ if (lpReplace->hInstNew)
+ {
+ hbmLoad = LoadBitmapW(lpReplace->hInstNew,(LPWSTR)lpReplace->nIDNew);
+ hBitmap = hbmLoad;
}
else
{
@@ -4412,6 +4416,8 @@
if (nOldButtons == 0)
{
WARN("No hinst/bitmap found! hInst %p nID %x\n", lpReplace->hInstOld, lpReplace->nIDOld);
+ if (hbmLoad)
+ DeleteObject (hbmLoad);
return FALSE;
}
@@ -4463,6 +4469,8 @@
InvalidateRect(hwnd, NULL, TRUE);
+ if (hbmLoad)
+ DeleteObject (hbmLoad);
return TRUE;
}
More information about the wine-patches
mailing list