- Updated COMCTL32 to Wine 20031212 release.

svn path=/trunk/; revision=7126
This commit is contained in:
Filip Navara 2003-12-19 16:41:02 +00:00
parent c5f80947d5
commit 4bfb4ce695
4 changed files with 406 additions and 492 deletions

View file

@ -31,13 +31,21 @@
* TODO: * TODO:
* - Button wrapping (under construction). * - Button wrapping (under construction).
* - Messages. * - Messages.
* - Notifications (under construction). * - Notifications
* - NM_CHAR
* - NM_KEYDOWN
* - NM_LDOWN
* - NM_RCLICK
* - NM_RDBLCLICK
* - TBN_DELETINGBUTTON
* - TBN_DRAGOUT
* - TBN_GETOBJECT
* - TBN_RESTORE
* - TBN_SAVE
* - TBN_TOOLBARCHANGE
* - Fix TB_SETROWS. * - Fix TB_SETROWS.
* - Tooltip support (almost complete). * - Tooltip support (almost complete).
* - Unicode suppport (under construction).
* - Fix TOOLBAR_SetButtonInfo32A/W. * - Fix TOOLBAR_SetButtonInfo32A/W.
* - TBSTYLE_AUTOSIZE for toolbar and buttons.
* - I_IMAGECALLBACK support.
* - iString of -1 is undocumented * - iString of -1 is undocumented
* - Customization dialog: * - Customization dialog:
* - Add flat look. * - Add flat look.
@ -45,7 +53,6 @@
* Buttons are not listed in M$-like order. M$ seems to use a single * Buttons are not listed in M$-like order. M$ seems to use a single
* internal list to store the button information of both listboxes. * internal list to store the button information of both listboxes.
* - Drag list support. * - Drag list support.
* - Help and Reset button support.
* *
* Testing: * Testing:
* - Run tests using Waite Group Windows95 API Bible Volume 2. * - Run tests using Waite Group Windows95 API Bible Volume 2.
@ -189,6 +196,13 @@ typedef enum
#define DDARROW_WIDTH 11 #define DDARROW_WIDTH 11
#define ARROW_HEIGHT 3 #define ARROW_HEIGHT 3
/* gap between edge of button and image with TBSTYLE_LIST */
#define LIST_IMAGE_OFFSET 3
/* gap between bitmap and text (always present) */
#define LIST_TEXT_OFFSET 2
/* how wide to treat the bitmap if it isn't present */
#define LIST_IMAGE_ABSENT_WIDTH 2
#define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0)) #define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0))
#define TOOLBAR_HasText(x, y) (TOOLBAR_GetText(x, y) ? TRUE : FALSE) #define TOOLBAR_HasText(x, y) (TOOLBAR_GetText(x, y) ? TRUE : FALSE)
#define TOOLBAR_HasDropDownArrows(exStyle) ((exStyle & TBSTYLE_EX_DRAWDDARROWS) ? TRUE : FALSE) #define TOOLBAR_HasDropDownArrows(exStyle) ((exStyle & TBSTYLE_EX_DRAWDDARROWS) ? TRUE : FALSE)
@ -693,7 +707,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
/* Center the bitmap horizontally and vertically */ /* Center the bitmap horizontally and vertically */
if (dwStyle & TBSTYLE_LIST) if (dwStyle & TBSTYLE_LIST)
rcBitmap.left += 3; rcBitmap.left += LIST_IMAGE_OFFSET;
else else
rcBitmap.left+=(infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2; rcBitmap.left+=(infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2;
@ -725,7 +739,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
if (dwStyle & TBSTYLE_LIST) { if (dwStyle & TBSTYLE_LIST) {
/* LIST style w/ ICON offset is by matching native. */ /* LIST style w/ ICON offset is by matching native. */
/* Matches IE4 "Links" bar. - GA 8/01 */ /* Matches IE4 "Links" bar. - GA 8/01 */
rcText.left += (infoPtr->nBitmapWidth + 2); rcText.left += (infoPtr->nBitmapWidth + LIST_TEXT_OFFSET);
} }
else { else {
rcText.top += infoPtr->nBitmapHeight + 1; rcText.top += infoPtr->nBitmapHeight + 1;
@ -735,7 +749,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
if (dwStyle & TBSTYLE_LIST) { if (dwStyle & TBSTYLE_LIST) {
/* LIST style w/o ICON offset is by matching native. */ /* LIST style w/o ICON offset is by matching native. */
/* Matches IE4 "menu" bar. - GA 8/01 */ /* Matches IE4 "menu" bar. - GA 8/01 */
rcText.left += 4; rcText.left += LIST_IMAGE_ABSENT_WIDTH + LIST_TEXT_OFFSET;
} }
} }
@ -860,7 +874,8 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
ILD_NORMAL)) ILD_NORMAL))
TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top); TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd); if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
goto FINALNOTIFY; goto FINALNOTIFY;
} }
@ -884,13 +899,14 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
} }
if (hasDropDownArrow) if (hasDropDownArrow)
TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME); TOOLBAR_DrawArrow(hdc, rcArrow.left + offset, rcArrow.top + offset + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT, TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT,
hdc, rcBitmap.left+offset, rcBitmap.top+offset, hdc, rcBitmap.left+offset, rcBitmap.top+offset,
ILD_NORMAL); ILD_NORMAL);
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd); if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
goto FINALNOTIFY; goto FINALNOTIFY;
} }
@ -913,7 +929,8 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
hdc, rcBitmap.left+1, rcBitmap.top+1, hdc, rcBitmap.left+1, rcBitmap.top+1,
ILD_NORMAL); ILD_NORMAL);
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd); if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
goto FINALNOTIFY; goto FINALNOTIFY;
} }
@ -925,7 +942,8 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
TOOLBAR_DrawPattern (hdc, &rc); TOOLBAR_DrawPattern (hdc, &rc);
TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top); TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd); if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
goto FINALNOTIFY; goto FINALNOTIFY;
} }
@ -933,7 +951,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
if (dwStyle & TBSTYLE_FLAT) if (dwStyle & TBSTYLE_FLAT)
{ {
if (hasDropDownArrow) if (hasDropDownArrow)
TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME); TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
if (tbcd.nmcd.uItemState & CDIS_HOT) { if (tbcd.nmcd.uItemState & CDIS_HOT) {
/* if hot, attempt to draw with hot image list, if fails, /* if hot, attempt to draw with hot image list, if fails,
@ -971,7 +989,8 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
} }
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd); if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
FINALNOTIFY: FINALNOTIFY:
if (infoPtr->dwItemCustDraw & CDRF_NOTIFYPOSTPAINT) if (infoPtr->dwItemCustDraw & CDRF_NOTIFYPOSTPAINT)
@ -997,7 +1016,7 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
TBUTTON_INFO *btnPtr; TBUTTON_INFO *btnPtr;
INT i, oldBKmode = 0; INT i, oldBKmode = 0;
RECT rcTemp; RECT rcTemp, rcClient;
NMTBCUSTOMDRAW tbcd; NMTBCUSTOMDRAW tbcd;
DWORD ntfret; DWORD ntfret;
@ -1023,11 +1042,22 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
if (infoPtr->bBtnTranspnt) if (infoPtr->bBtnTranspnt)
oldBKmode = SetBkMode (hdc, TRANSPARENT); oldBKmode = SetBkMode (hdc, TRANSPARENT);
GetClientRect(hwnd, &rcClient);
/* redraw necessary buttons */ /* redraw necessary buttons */
btnPtr = infoPtr->buttons; btnPtr = infoPtr->buttons;
for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++)
{ {
if(IntersectRect(&rcTemp, &(ps->rcPaint), &(btnPtr->rect))) BOOL bDraw;
if (infoPtr->dwExStyle & TBSTYLE_EX_HIDECLIPPEDBUTTONS)
{
IntersectRect(&rcTemp, &rcClient, &btnPtr->rect);
bDraw = EqualRect(&rcTemp, &btnPtr->rect);
}
else
bDraw = TRUE;
bDraw &= IntersectRect(&rcTemp, &(ps->rcPaint), &(btnPtr->rect));
if (bDraw)
TOOLBAR_DrawButton (hwnd, btnPtr, hdc); TOOLBAR_DrawButton (hwnd, btnPtr, hdc);
} }
@ -1065,7 +1095,9 @@ TOOLBAR_MeasureString(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
lpSize->cx = 0; lpSize->cx = 0;
lpSize->cy = 0; lpSize->cy = 0;
if (!(btnPtr->fsState & TBSTATE_HIDDEN) ) if (!(btnPtr->fsState & TBSTATE_HIDDEN) &&
(!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ||
(btnPtr->fsStyle & BTNS_SHOWTEXT)) )
{ {
LPWSTR lpText = TOOLBAR_GetText(infoPtr, btnPtr); LPWSTR lpText = TOOLBAR_GetText(infoPtr, btnPtr);
@ -1444,7 +1476,8 @@ TOOLBAR_CalcToolbar (HWND hwnd)
} }
else else
{ {
if (btnPtr->fsStyle & TBSTYLE_AUTOSIZE) if ((infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ||
(btnPtr->fsStyle & TBSTYLE_AUTOSIZE))
{ {
SIZE sz; SIZE sz;
HDC hdc; HDC hdc;
@ -1458,9 +1491,9 @@ TOOLBAR_CalcToolbar (HWND hwnd)
SelectObject (hdc, hOldFont); SelectObject (hdc, hOldFont);
ReleaseDC (hwnd, hdc); ReleaseDC (hwnd, hdc);
/* Fudge amount measured against IE4 "menu" and "Links" */ if (sz.cx > 0)
/* toolbars with native control (v4.71). - GA 8/01 */ sz.cx += 2*LIST_TEXT_OFFSET;
cx = sz.cx + 6 + 5 + 5; cx = sz.cx + 2*LIST_IMAGE_OFFSET;
if (TOOLBAR_TestImageExist (infoPtr, btnPtr, GETDEFIMAGELIST(infoPtr,0))) if (TOOLBAR_TestImageExist (infoPtr, btnPtr, GETDEFIMAGELIST(infoPtr,0)))
{ {
if (dwStyle & TBSTYLE_LIST) if (dwStyle & TBSTYLE_LIST)
@ -1468,6 +1501,8 @@ TOOLBAR_CalcToolbar (HWND hwnd)
else if (cx < (infoPtr->nBitmapWidth+7)) else if (cx < (infoPtr->nBitmapWidth+7))
cx = infoPtr->nBitmapWidth+7; cx = infoPtr->nBitmapWidth+7;
} }
else if (dwStyle & TBSTYLE_LIST)
cx += LIST_IMAGE_ABSENT_WIDTH;
} }
else else
cx = infoPtr->nButtonWidth; cx = infoPtr->nButtonWidth;
@ -1716,18 +1751,15 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (!TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_QUERYINSERT)) if (!TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_QUERYINSERT))
return FALSE; return FALSE;
/* UNDOCUMENTED: dialog hwnd immediately follows NMHDR */
nmtb.iItem = (int)hwnd;
/* Send TBN_INITCUSTOMIZE notification */ /* Send TBN_INITCUSTOMIZE notification */
if (TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_INITCUSTOMIZE) == if (TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_INITCUSTOMIZE) ==
TBNRF_HIDEHELP) TBNRF_HIDEHELP)
{ {
TRACE("TBNRF_HIDEHELP requested\n"); TRACE("TBNRF_HIDEHELP requested\n");
ShowWindow(GetDlgItem(hwnd, IDC_HELP_BTN), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_HELP_BTN), SW_HIDE);
} }
else
{
FIXME("Help button not implemented\n");
EnableWindow(GetDlgItem(hwnd, IDC_HELP_BTN), FALSE);
}
/* add items to 'toolbar buttons' list and check if removable */ /* add items to 'toolbar buttons' list and check if removable */
for (i = 0; i < custInfo->tbInfo->nNumButtons; i++) for (i = 0; i < custInfo->tbInfo->nNumButtons; i++)
@ -1995,6 +2027,12 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
} }
break; break;
case IDC_HELP_BTN:
TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_CUSTHELP);
break;
case IDC_RESET_BTN:
TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_RESET);
break;
case IDOK: /* Add button */ case IDOK: /* Add button */
{ {
@ -3213,6 +3251,8 @@ TOOLBAR_GetExtendedStyle (HWND hwnd)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
TRACE("\n");
return infoPtr->dwExStyle; return infoPtr->dwExStyle;
} }
@ -3795,7 +3835,8 @@ TOOLBAR_PressButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
} }
/* FIXME: there might still be some confusion her between number of buttons
* and number of bitmaps */
static LRESULT static LRESULT
TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam) TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
@ -3803,6 +3844,7 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
LPTBREPLACEBITMAP lpReplace = (LPTBREPLACEBITMAP) lParam; LPTBREPLACEBITMAP lpReplace = (LPTBREPLACEBITMAP) lParam;
HBITMAP hBitmap; HBITMAP hBitmap;
int i = 0, nOldButtons = 0, pos = 0; int i = 0, nOldButtons = 0, pos = 0;
int nOldBitmaps, nNewBitmaps;
HIMAGELIST himlDef = 0; HIMAGELIST himlDef = 0;
TRACE("hInstOld %p nIDOld %x hInstNew %p nIDNew %x nButtons %x\n", TRACE("hInstOld %p nIDOld %x hInstNew %p nIDNew %x nButtons %x\n",
@ -3847,15 +3889,13 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
return FALSE; return FALSE;
} }
infoPtr->nNumBitmaps = infoPtr->nNumBitmaps - nOldButtons + lpReplace->nButtons; himlDef = GETDEFIMAGELIST(infoPtr, 0); /* fixme: correct? */
nOldBitmaps = ImageList_GetImageCount(himlDef);
/* ImageList_Replace(GETDEFIMAGELIST(), pos, hBitmap, NULL); */ /* ImageList_Replace(GETDEFIMAGELIST(), pos, hBitmap, NULL); */
for (i = pos + nOldBitmaps - 1; i >= pos; i--)
himlDef = GETDEFIMAGELIST(infoPtr, 0);
for (i = pos + nOldButtons - 1; i >= pos; i--) {
ImageList_Remove(himlDef, i); ImageList_Remove(himlDef, i);
}
{ {
BITMAP bmp; BITMAP bmp;
@ -3885,9 +3925,15 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
DeleteDC (hdcBitmap); DeleteDC (hdcBitmap);
ImageList_Add (himlDef, hbmLoad, NULL); ImageList_Add (himlDef, hbmLoad, NULL);
nNewBitmaps = ImageList_GetImageCount(himlDef);
DeleteObject (hbmLoad); DeleteObject (hbmLoad);
} }
infoPtr->nNumBitmaps = infoPtr->nNumBitmaps - nOldBitmaps + nNewBitmaps;
TRACE(" pos %d %d old bitmaps replaced by %d new ones.\n",
pos, nOldBitmaps, nNewBitmaps);
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
return TRUE; return TRUE;
@ -4212,21 +4258,20 @@ TOOLBAR_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
DWORD dwTemp; DWORD dwTemp;
dwTemp = infoPtr->dwExStyle; dwTemp = infoPtr->dwExStyle;
infoPtr->dwExStyle = (DWORD)lParam; infoPtr->dwExStyle |= (DWORD)lParam;
if (infoPtr->dwExStyle & (TBSTYLE_EX_MIXEDBUTTONS | TRACE("new style 0x%08lx\n", infoPtr->dwExStyle);
TBSTYLE_EX_HIDECLIPPEDBUTTONS)) {
FIXME("Extended style not implemented %s %s\n",
(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ?
"TBSTYLE_EX_MIXEDBUTTONS" : "",
(infoPtr->dwExStyle & TBSTYLE_EX_HIDECLIPPEDBUTTONS) ?
"TBSTYLE_EX_HIDECLIPPEDBUTTONS" : "");
}
if (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL) if (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL)
FIXME("Unknown Toolbar Extended Style 0x%08lx. Please report.\n", FIXME("Unknown Toolbar Extended Style 0x%08lx. Please report.\n",
(infoPtr->dwExStyle & ~TBSTYLE_EX_ALL)); (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL));
TOOLBAR_CalcToolbar (hwnd);
TOOLBAR_AutoSize(hwnd);
InvalidateRect(hwnd, NULL, FALSE);
return (LRESULT)dwTemp; return (LRESULT)dwTemp;
} }
@ -4475,27 +4520,7 @@ TOOLBAR_SetState (HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
TOOLBAR_SetStyle (HWND hwnd, WPARAM wParam, LPARAM lParam) TOOLBAR_SetStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); SetWindowLongW(hwnd, GWL_STYLE, lParam);
TBUTTON_INFO *btnPtr;
INT nIndex;
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1)
return FALSE;
btnPtr = &infoPtr->buttons[nIndex];
/* process style change if current style doesn't match new style */
if(btnPtr->fsStyle != LOWORD(lParam))
{
btnPtr->fsStyle = LOWORD(lParam);
InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr,
btnPtr));
if (infoPtr->hwndToolTip) {
FIXME("change tool tip!\n");
}
}
return TRUE; return TRUE;
} }
@ -4697,7 +4722,6 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nBitmapWidth = 16; infoPtr->nBitmapWidth = 16;
infoPtr->nHeight = infoPtr->nButtonHeight + TOP_BORDER + BOTTOM_BORDER; infoPtr->nHeight = infoPtr->nButtonHeight + TOP_BORDER + BOTTOM_BORDER;
infoPtr->nRows = 1;
infoPtr->nMaxTextRows = 1; infoPtr->nMaxTextRows = 1;
infoPtr->cxMin = -1; infoPtr->cxMin = -1;
infoPtr->cxMax = -1; infoPtr->cxMax = -1;
@ -4709,7 +4733,7 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nButtonDown = -1; infoPtr->nButtonDown = -1;
infoPtr->nOldHit = -1; infoPtr->nOldHit = -1;
infoPtr->nHotItem = -2; /* It has to be initially different from nOldHit */ infoPtr->nHotItem = -2; /* It has to be initially different from nOldHit */
infoPtr->hwndNotify = GetParent (hwnd); infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
infoPtr->bTransparent = (dwStyle & TBSTYLE_TRANSPARENT); infoPtr->bTransparent = (dwStyle & TBSTYLE_TRANSPARENT);
infoPtr->bBtnTranspnt = (dwStyle & (TBSTYLE_FLAT | TBSTYLE_LIST)); infoPtr->bBtnTranspnt = (dwStyle & (TBSTYLE_FLAT | TBSTYLE_LIST));
infoPtr->dwDTFlags = (dwStyle & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE : DT_CENTER; infoPtr->dwDTFlags = (dwStyle & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE : DT_CENTER;
@ -5274,6 +5298,7 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* paranoid!! */ /* paranoid!! */
infoPtr->dwStructSize = sizeof(TBBUTTON); infoPtr->dwStructSize = sizeof(TBBUTTON);
infoPtr->nRows = 1;
/* fix instance handle, if the toolbar was created by CreateToolbarEx() */ /* fix instance handle, if the toolbar was created by CreateToolbarEx() */
if (!GetWindowLongA (hwnd, GWL_HINSTANCE)) { if (!GetWindowLongA (hwnd, GWL_HINSTANCE)) {
@ -5447,7 +5472,7 @@ TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
INT i; INT i;
if (lParam == NF_REQUERY) { if (lParam == NF_REQUERY) {
i = SendMessageA(GetParent(infoPtr->hwndSelf), i = SendMessageA(infoPtr->hwndNotify,
WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY); WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
@ -5620,8 +5645,12 @@ TOOLBAR_StyleChanged (HWND hwnd, INT nType, LPSTYLESTRUCT lpStyle)
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);
} }
TOOLBAR_CalcToolbar(hwnd);
TOOLBAR_AutoSize (hwnd); TOOLBAR_AutoSize (hwnd);
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
@ -5643,6 +5672,8 @@ TOOLBAR_SysColorChange (HWND hwnd)
static LRESULT WINAPI static LRESULT WINAPI
ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n",
hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam); hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
@ -5996,13 +6027,7 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_DRAWITEM: case WM_DRAWITEM:
case WM_MEASUREITEM: case WM_MEASUREITEM:
case WM_VKEYTOITEM: case WM_VKEYTOITEM:
{ return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
if(infoPtr != NULL)
return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
else
return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
}
/* We see this in Outlook Express 5.x and just does DefWindowProc */ /* We see this in Outlook Express 5.x and just does DefWindowProc */
case PGM_FORWARDMOUSE: case PGM_FORWARDMOUSE:

View file

@ -1902,12 +1902,11 @@ TOOLTIPS_WindowFromPoint (HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
TOOLTIPS_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) TOOLTIPS_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
{ {
TOOLTIPS_INFO *infoPtr; TOOLTIPS_INFO *infoPtr;
NONCLIENTMETRICSA nclm; NONCLIENTMETRICSA nclm;
INT nResult; INT nResult;
HWND hParent;
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = (TOOLTIPS_INFO *)Alloc (sizeof(TOOLTIPS_INFO)); infoPtr = (TOOLTIPS_INFO *)Alloc (sizeof(TOOLTIPS_INFO));
@ -1930,21 +1929,16 @@ TOOLTIPS_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLTIPS_SetDelayTime(hwnd, TTDT_AUTOMATIC, 0L); TOOLTIPS_SetDelayTime(hwnd, TTDT_AUTOMATIC, 0L);
hParent = GetParent(hwnd); nResult = (INT) SendMessageA (lpcs->hwndParent, WM_NOTIFYFORMAT,
if (hParent) {
nResult = (INT) SendMessageA (hParent, WM_NOTIFYFORMAT,
(WPARAM)hwnd, (LPARAM)NF_QUERY); (WPARAM)hwnd, (LPARAM)NF_QUERY);
if (nResult == NFR_ANSI) { if (nResult == NFR_ANSI) {
infoPtr->bNotifyUnicode = FALSE; infoPtr->bNotifyUnicode = FALSE;
TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n"); TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
} } else if (nResult == NFR_UNICODE) {
else if (nResult == NFR_UNICODE) { infoPtr->bNotifyUnicode = TRUE;
infoPtr->bNotifyUnicode = TRUE; TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n"); } else {
} TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
else {
ERR (" -- WM_NOTIFYFORMAT returns: error!\n");
}
} }
SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE); SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
@ -2371,7 +2365,7 @@ TOOLTIPS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_CREATE: case WM_CREATE:
return TOOLTIPS_Create (hwnd, wParam, lParam); return TOOLTIPS_Create (hwnd, (LPCREATESTRUCTW)lParam);
case WM_DESTROY: case WM_DESTROY:
return TOOLTIPS_Destroy (hwnd, wParam, lParam); return TOOLTIPS_Destroy (hwnd, wParam, lParam);

File diff suppressed because it is too large Load diff

View file

@ -48,6 +48,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(updown);
typedef struct typedef struct
{ {
HWND Self; /* Handle to this up-down control */ HWND Self; /* Handle to this up-down control */
HWND Notify; /* Handle to the parent window */
UINT AccelCount; /* Number of elements in AccelVect */ UINT AccelCount; /* Number of elements in AccelVect */
UDACCEL* AccelVect; /* Vector containing AccelCount elements */ UDACCEL* AccelVect; /* Vector containing AccelCount elements */
INT AccelIndex; /* Current accel index, -1 if not accel'ing */ INT AccelIndex; /* Current accel index, -1 if not accel'ing */
@ -562,8 +563,7 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
ni.hdr.hwndFrom = infoPtr->Self; ni.hdr.hwndFrom = infoPtr->Self;
ni.hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); ni.hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID);
ni.hdr.code = UDN_DELTAPOS; ni.hdr.code = UDN_DELTAPOS;
if (!SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY, if (!SendMessageW(infoPtr->Notify, WM_NOTIFY, (WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) {
(WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) {
/* Parent said: OK to adjust */ /* Parent said: OK to adjust */
/* Now adjust value with (maybe new) delta */ /* Now adjust value with (maybe new) delta */
@ -574,10 +574,8 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
} }
/* Also, notify it. This message is sent in any case. */ /* Also, notify it. This message is sent in any case. */
SendMessageW( GetParent(infoPtr->Self), SendMessageW( infoPtr->Notify, dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal), (LPARAM)infoPtr->Self);
MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal),
(LPARAM)infoPtr->Self);
} }
/*********************************************************************** /***********************************************************************
@ -616,7 +614,7 @@ static BOOL UPDOWN_CancelMode (UPDOWN_INFO *infoPtr)
hdr.hwndFrom = infoPtr->Self; hdr.hwndFrom = infoPtr->Self;
hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID);
hdr.code = NM_RELEASEDCAPTURE; hdr.code = NM_RELEASEDCAPTURE;
SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr); SendMessageW(infoPtr->Notify, WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr);
ReleaseCapture(); ReleaseCapture();
} }
@ -720,6 +718,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
/* initialize the info struct */ /* initialize the info struct */
infoPtr->Self = hwnd; infoPtr->Self = hwnd;
infoPtr->Notify = ((LPCREATESTRUCTA)lParam)->hwndParent;
infoPtr->AccelCount = 0; infoPtr->AccelCount = 0;
infoPtr->AccelVect = 0; infoPtr->AccelVect = 0;
infoPtr->AccelIndex = -1; infoPtr->AccelIndex = -1;
@ -798,7 +797,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
if ( (infoPtr->Flags & FLAG_MOUSEIN) && if ( (infoPtr->Flags & FLAG_MOUSEIN) &&
(infoPtr->Flags & FLAG_ARROW) ) { (infoPtr->Flags & FLAG_ARROW) ) {
SendMessageW( GetParent(hwnd), SendMessageW( infoPtr->Notify,
dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
MAKELONG(SB_ENDSCROLL, infoPtr->CurVal), MAKELONG(SB_ENDSCROLL, infoPtr->CurVal),
(LPARAM)hwnd); (LPARAM)hwnd);