- Set cache bitmap dimensions correctly when a 0x0 image list is used.

- Optimize WM_STYLECHANGED handler to only redraw when a CCS_* style
  is changed, like native.
This commit is contained in:
Robert Shearman 2004-11-10 01:30:47 +00:00 committed by Alexandre Julliard
parent 5f06380b40
commit b98b7dd65d
1 changed files with 30 additions and 19 deletions

View File

@ -160,7 +160,7 @@ typedef struct
BOOL bAnchor; /* anchor highlight enabled */ BOOL bAnchor; /* anchor highlight enabled */
BOOL bDoRedraw; /* Redraw status */ BOOL bDoRedraw; /* Redraw status */
BOOL bDragOutSent; /* has TBN_DRAGOUT notification been sent for this drag? */ BOOL bDragOutSent; /* has TBN_DRAGOUT notification been sent for this drag? */
BOOL bUnicode; /* ASCII (FALSE) or Unicode (TRUE)? */ BOOL bUnicode; /* Notifications are ASCII (FALSE) or Unicode (TRUE)? */
BOOL bCaptured; /* mouse captured? */ BOOL bCaptured; /* mouse captured? */
DWORD dwStyle; /* regular toolbar style */ DWORD dwStyle; /* regular toolbar style */
DWORD dwExStyle; /* extended toolbar style */ DWORD dwExStyle; /* extended toolbar style */
@ -234,6 +234,10 @@ static inline int TOOLBAR_GetListTextOffset(TOOLBAR_INFO *infoPtr, INT iListGap)
TBSTYLE_EX_MIXEDBUTTONS | \ TBSTYLE_EX_MIXEDBUTTONS | \
TBSTYLE_EX_HIDECLIPPEDBUTTONS) TBSTYLE_EX_HIDECLIPPEDBUTTONS)
/* all of the CCS_ styles */
#define COMMON_STYLES (CCS_TOP|CCS_NOMOVEY|CCS_BOTTOM|CCS_NORESIZE| \
CCS_NOPARENTALIGN|CCS_ADJUSTABLE|CCS_NODIVIDER|CCS_VERT)
#define GETIBITMAP(infoPtr, i) (infoPtr->iVersion >= 5 ? LOWORD(i) : i) #define GETIBITMAP(infoPtr, i) (infoPtr->iVersion >= 5 ? LOWORD(i) : i)
#define GETHIMLID(infoPtr, i) (infoPtr->iVersion >= 5 ? HIWORD(i) : 0) #define GETHIMLID(infoPtr, i) (infoPtr->iVersion >= 5 ? HIWORD(i) : 0)
#define GETDEFIMAGELIST(infoPtr, id) TOOLBAR_GetImageList(infoPtr->himlDef, infoPtr->cimlDef, id) #define GETDEFIMAGELIST(infoPtr, id) TOOLBAR_GetImageList(infoPtr->himlDef, infoPtr->cimlDef, id)
@ -4971,10 +4975,15 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
for (i = 0; i < infoPtr->cimlDef; i++) for (i = 0; i < infoPtr->cimlDef; i++)
infoPtr->nNumBitmaps += ImageList_GetImageCount(infoPtr->himlDef[i]->himl); infoPtr->nNumBitmaps += ImageList_GetImageCount(infoPtr->himlDef[i]->himl);
ImageList_GetIconSize(himl, &infoPtr->nBitmapWidth, if (!ImageList_GetIconSize(himl, &infoPtr->nBitmapWidth,
&infoPtr->nBitmapHeight); &infoPtr->nBitmapHeight))
TRACE("hwnd %p, new himl=%08x, count=%d, bitmap w=%d, h=%d\n", {
hwnd, (INT)infoPtr->himlDef, infoPtr->nNumBitmaps, infoPtr->nBitmapWidth = 0;
infoPtr->nBitmapHeight = 0;
}
TRACE("hwnd %p, new himl=%p, id = %d, count=%d, bitmap w=%d, h=%d\n",
hwnd, infoPtr->himlDef, id, infoPtr->nNumBitmaps,
infoPtr->nBitmapWidth, infoPtr->nBitmapHeight); infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
@ -6653,27 +6662,29 @@ TOOLBAR_StyleChanged (HWND hwnd, INT nType, LPSTYLESTRUCT lpStyle)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
if (nType == GWL_STYLE) { if (nType == GWL_STYLE)
if (lpStyle->styleNew & TBSTYLE_LIST) { {
if (lpStyle->styleNew & TBSTYLE_LIST)
infoPtr->dwDTFlags = DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS; infoPtr->dwDTFlags = DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS;
} else
else {
infoPtr->dwDTFlags = DT_CENTER | DT_END_ELLIPSIS; infoPtr->dwDTFlags = DT_CENTER | DT_END_ELLIPSIS;
}
infoPtr->bBtnTranspnt = (lpStyle->styleNew & infoPtr->bBtnTranspnt = (lpStyle->styleNew &
(TBSTYLE_FLAT | TBSTYLE_LIST)); (TBSTYLE_FLAT | TBSTYLE_LIST));
TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew); TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew);
TRACE("new style 0x%08lx\n", lpStyle->styleNew); TRACE("new style 0x%08lx\n", lpStyle->styleNew);
infoPtr->dwStyle = lpStyle->styleNew; /* only resize if one of the CCS_* styles was changed */
} if ((infoPtr->dwStyle ^ lpStyle->styleNew) & COMMON_STYLES)
{
TOOLBAR_CalcToolbar(hwnd);
TOOLBAR_AutoSize (hwnd); TOOLBAR_AutoSize (hwnd);
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
}
infoPtr->dwStyle = lpStyle->styleNew;
}
return 0; return 0;
} }