Sync to Wine-20041201

Ulrich Czekalla <ulrich@codeweavers.com>
- Prevent the animation thread from waiting on itself when it stops.
Robert Shearman <rob@codeweavers.com>
- Remove unnecessary WNDPROC casts.
Alexandre Julliard <julliard@winehq.org>
- Avoid using the MAKEPOINTS macro, it's broken on big endian.
- Use correct type instead of void* in item linked list.
Dimitrie O. Paun <dpaun@rogers.com>
- Minor cleanups.
- Implement proper GWL_STYLE handling, proper reaction to style changes.
- Merge {{Inc,Dec}rement,Reset{Up,Down}}Field into one method. Fix a
  bunch of bugs in the process.  Implement DTM_[GS]ETMCFONT. Indentation
  fixes, cleanups.
- Use typesafe signature where possible.
- Use Unicode functions where possible.
- Send notification messages in the format dictated by
  infoPtr->notifyFormat.
- Audit the month calendar.
- Rename STATUSWINDOWINFO to STATUS_INFO, for consistency with other
  controls. Fix some prototypes. Always pass infoPtr around.
- Use only Unicode functions, it makes it easier to see we are fully
  Unicode compliant.
Robert Shearman <rob@codeweavers.com>
- Always remove WS_BORDER style from ComboBoxEx control.
- Correct the date of the completeness audit.
- Store the new style before redrawing and repositioning the control.
- 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.
- bNtfUnicode is a dup' of bUnicode so remove it and fix the few
  places where it was used.
- Remove a load of useless NULL infoPtr checks.
- Hardcode the default padding like native instead of using a wacky formula.
- Replace some tabs with spaces and remove NMHDR casts.
- Implement TBN_RESTORE notification.
- Don't fill in any more information than native does for notifications.
- Store hit code in a signed integer so that we can see whether it is
  less than zero.
- Draw with ILD_TRANSPARENT instead of ILD_NORMAL to draw bitmaps from
  the native shell image list properly (reported by Thorsten Kani).
- Rewrite TOOLBAR_NotifyFormat to avoid side-effects.
James Hawkins <truiken@gmail.com>
- Fixed a few memory leaks.
Zach Gorman <zach@archetypeauction.com>
- Add the DT_NOPREFIX flag when calling DrawText() for single-line
  listview controls.
Dmitry Timoshkov <dmitry@codeweavers.com>
- Pass infoPtr around in month calendar control.
- Add support for WM_SETFONT and WM_GETFONT messages.
- Dimensions of month calendar control should not depend on the client
  window size.
- Convert NativeFont control to unicode, use hbrBackground as in native.
- Do not retrieve infoPtr twice in ToolbarWindowProc entry.
- do not move updown control and buddy if an alignment was not requested
- in UDM_SETACCEL handler do not forget to update number of accelerators
- update arrows info in WM_LBUTTONDOWN as well as in WM_MOUSEMOVE
- use accelerators in WM_LBUTTONDOWN handler
Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
- Monthcal_SetRange: Set proper value for min date.
Thorsten Kani <beebix@gmx.net>
- Use address of tab_item.extra when building drawitemstruct.
- Don't add extra OFFSET_X/Y to the calculation of rcBitmap.top/left,
  just use GetSystemMetrics.
Huw Davies <huw@codeweavers.com>
- The default font for the treeview should be the icon title font.

svn path=/trunk/; revision=11952
This commit is contained in:
Gé van Geldorp 2004-12-05 23:09:27 +00:00
parent a0b99a485e
commit 88f1bf6c5c
23 changed files with 1676 additions and 1855 deletions

View file

@ -73,6 +73,7 @@ typedef struct
CRITICAL_SECTION cs; CRITICAL_SECTION cs;
HANDLE hStopEvent; HANDLE hStopEvent;
HANDLE hThread; HANDLE hThread;
DWORD threadId;
UINT uTimer; UINT uTimer;
/* data for playing the file */ /* data for playing the file */
int nFromFrame; int nFromFrame;
@ -149,14 +150,20 @@ static LRESULT ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
HANDLE handle = infoPtr->hThread; HANDLE handle = infoPtr->hThread;
TRACE("stopping animation thread\n"); TRACE("stopping animation thread\n");
infoPtr->hThread = 0;
SetEvent( infoPtr->hStopEvent ); SetEvent( infoPtr->hStopEvent );
if (infoPtr->threadId != GetCurrentThreadId())
{
LeaveCriticalSection(&infoPtr->cs); /* leave it a chance to run */ LeaveCriticalSection(&infoPtr->cs); /* leave it a chance to run */
WaitForSingleObject( handle, INFINITE ); WaitForSingleObject( handle, INFINITE );
TRACE("animation thread stopped\n"); TRACE("animation thread stopped\n");
EnterCriticalSection(&infoPtr->cs); EnterCriticalSection(&infoPtr->cs);
CloseHandle( infoPtr->hThread ); }
CloseHandle( handle );
CloseHandle( infoPtr->hStopEvent ); CloseHandle( infoPtr->hStopEvent );
infoPtr->hThread = 0; infoPtr->hStopEvent = 0;
} }
if (infoPtr->uTimer) { if (infoPtr->uTimer) {
KillTimer(infoPtr->hwndSelf, infoPtr->uTimer); KillTimer(infoPtr->hwndSelf, infoPtr->uTimer);
@ -399,7 +406,7 @@ static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
LeaveCriticalSection(&infoPtr->cs); LeaveCriticalSection(&infoPtr->cs);
/* time is in microseconds, we should convert it to milliseconds */ /* time is in microseconds, we should convert it to milliseconds */
if (WaitForSingleObject( event, (timeout+500)/1000) == WAIT_OBJECT_0) if ((event == 0) || WaitForSingleObject( event, (timeout+500)/1000) == WAIT_OBJECT_0)
break; break;
} }
return TRUE; return TRUE;
@ -439,8 +446,6 @@ static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam)
/* create a timer to display AVI */ /* create a timer to display AVI */
infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL); infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);
} else { } else {
DWORD threadID;
if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
{ {
infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
@ -449,7 +454,7 @@ static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam)
TRACE("Using an animation thread\n"); TRACE("Using an animation thread\n");
infoPtr->hStopEvent = CreateEventW( NULL, TRUE, FALSE, NULL ); infoPtr->hStopEvent = CreateEventW( NULL, TRUE, FALSE, NULL );
infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr, 0, &threadID); infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr, 0, &infoPtr->threadId);
if(!infoPtr->hThread) if(!infoPtr->hThread)
{ {
ERR("Could not create animation thread!\n"); ERR("Could not create animation thread!\n");
@ -950,7 +955,7 @@ void ANIMATE_Register(void)
ZeroMemory(&wndClass, sizeof(WNDCLASSA)); ZeroMemory(&wndClass, sizeof(WNDCLASSA));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
wndClass.lpfnWndProc = (WNDPROC)ANIMATE_WindowProc; wndClass.lpfnWndProc = ANIMATE_WindowProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(ANIMATE_INFO *); wndClass.cbWndExtra = sizeof(ANIMATE_INFO *);
wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);

View file

@ -45,9 +45,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(comboex); WINE_DEFAULT_DEBUG_CHANNEL(comboex);
/* Item structure */ /* Item structure */
typedef struct typedef struct _CBE_ITEMDATA
{ {
VOID *next; struct _CBE_ITEMDATA *next;
UINT mask; UINT mask;
LPWSTR pszText; LPWSTR pszText;
LPWSTR pszTemp; LPWSTR pszTemp;
@ -126,10 +126,8 @@ typedef struct
/* Things common to the entire DLL */ /* Things common to the entire DLL */
static LRESULT WINAPI static LRESULT WINAPI COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT WINAPI COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT WINAPI
COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr); static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr);
typedef INT (WINAPI *cmp_func_t)(LPCWSTR, LPCWSTR); typedef INT (WINAPI *cmp_func_t)(LPCWSTR, LPCWSTR);
@ -458,7 +456,7 @@ static CBE_ITEMDATA * COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT index)
/* find the item in the list */ /* find the item in the list */
while (item && (i > index)) { while (item && (i > index)) {
item = (CBE_ITEMDATA *)item->next; item = item->next;
i--; i--;
} }
if (!item || (i != index)) { if (!item || (i != index)) {
@ -579,7 +577,7 @@ static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
CBE_ITEMDATA *moving = infoPtr->items; CBE_ITEMDATA *moving = infoPtr->items;
while ((i > index) && moving) { while ((i > index) && moving) {
moving = (CBE_ITEMDATA *)moving->next; moving = moving->next;
i--; i--;
} }
if (!moving) { if (!moving) {
@ -1252,7 +1250,7 @@ static BOOL COMBOEX_WM_DeleteItem (COMBOEX_INFO *infoPtr, DELETEITEMSTRUCT *dis)
/* find the prior item in the list */ /* find the prior item in the list */
while (item->next && (i > dis->itemID)) { while (item->next && (i > dis->itemID)) {
item = (CBE_ITEMDATA *)item->next; item = item->next;
i--; i--;
} }
if (!item->next || (i != dis->itemID)) { if (!item->next || (i != dis->itemID)) {
@ -1260,7 +1258,7 @@ static BOOL COMBOEX_WM_DeleteItem (COMBOEX_INFO *infoPtr, DELETEITEMSTRUCT *dis)
return FALSE; return FALSE;
} }
olditem = item->next; olditem = item->next;
item->next = (CBE_ITEMDATA *)((CBE_ITEMDATA *)item->next)->next; item->next = item->next->next;
} }
infoPtr->nb_items--; infoPtr->nb_items--;
@ -1529,7 +1527,7 @@ static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr)
item = infoPtr->items; item = infoPtr->items;
while (item) { while (item) {
next = (CBE_ITEMDATA *)item->next; next = item->next;
COMBOEX_FreeText (item); COMBOEX_FreeText (item);
Free (item); Free (item);
item = next; item = next;
@ -1570,7 +1568,7 @@ static LRESULT COMBOEX_NCCreate (HWND hwnd)
DWORD oldstyle, newstyle; DWORD oldstyle, newstyle;
oldstyle = (DWORD)GetWindowLongW (hwnd, GWL_STYLE); oldstyle = (DWORD)GetWindowLongW (hwnd, GWL_STYLE);
newstyle = oldstyle & ~(WS_VSCROLL | WS_HSCROLL); newstyle = oldstyle & ~(WS_VSCROLL | WS_HSCROLL | WS_BORDER);
if (newstyle != oldstyle) { if (newstyle != oldstyle) {
TRACE("req style %08lx, reseting style %08lx\n", TRACE("req style %08lx, reseting style %08lx\n",
oldstyle, newstyle); oldstyle, newstyle);
@ -1912,7 +1910,8 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
rect.bottom = rect.top + SendMessageW(infoPtr->hwndSelf, rect.bottom = rect.top + SendMessageW(infoPtr->hwndSelf,
CB_GETITEMHEIGHT, -1, 0); CB_GETITEMHEIGHT, -1, 0);
rect.left = rect.right - GetSystemMetrics(SM_CXVSCROLL); rect.left = rect.right - GetSystemMetrics(SM_CXVSCROLL);
POINTSTOPOINT(pt, MAKEPOINTS(lParam)); pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
if (PtInRect(&rect, pt)) if (PtInRect(&rect, pt))
return CallWindowProcW (infoPtr->prevComboWndProc, return CallWindowProcW (infoPtr->prevComboWndProc,
hwnd, uMsg, wParam, lParam); hwnd, uMsg, wParam, lParam);
@ -2254,7 +2253,7 @@ void COMBOEX_Register (void)
ZeroMemory (&wndClass, sizeof(WNDCLASSW)); ZeroMemory (&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS; wndClass.style = CS_GLOBALCLASS;
wndClass.lpfnWndProc = (WNDPROC)COMBOEX_WindowProc; wndClass.lpfnWndProc = COMBOEX_WindowProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(COMBOEX_INFO *); wndClass.cbWndExtra = sizeof(COMBOEX_INFO *);
wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);

File diff suppressed because it is too large Load diff

View file

@ -274,7 +274,7 @@ FLATSB_Register (void)
ZeroMemory (&wndClass, sizeof(WNDCLASSA)); ZeroMemory (&wndClass, sizeof(WNDCLASSA));
wndClass.style = CS_GLOBALCLASS; wndClass.style = CS_GLOBALCLASS;
wndClass.lpfnWndProc = (WNDPROC)FlatSB_WindowProc; wndClass.lpfnWndProc = FlatSB_WindowProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(FLATSB_INFO *); wndClass.cbWndExtra = sizeof(FLATSB_INFO *);
wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW); wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW);

View file

@ -1842,7 +1842,7 @@ HEADER_Register (void)
ZeroMemory (&wndClass, sizeof(WNDCLASSA)); ZeroMemory (&wndClass, sizeof(WNDCLASSA));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
wndClass.lpfnWndProc = (WNDPROC)HEADER_WindowProc; wndClass.lpfnWndProc = HEADER_WindowProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(HEADER_INFO *); wndClass.cbWndExtra = sizeof(HEADER_INFO *);
wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW); wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW);

View file

@ -57,10 +57,8 @@ typedef struct tagHOTKEY_INFO
WCHAR strNone[15]; /* hope its long enough ... */ WCHAR strNone[15]; /* hope its long enough ... */
} HOTKEY_INFO; } HOTKEY_INFO;
#define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO *)GetWindowLongPtrA (hwnd, 0))
static const WCHAR HOTKEY_plussep[] = { ' ', '+', ' ' }; static const WCHAR HOTKEY_plussep[] = { ' ', '+', ' ' };
static LRESULT HOTKEY_SetFont (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam); static LRESULT HOTKEY_SetFont (HOTKEY_INFO *infoPtr, HFONT hFont, BOOL redraw);
#define IsOnlySet(flags) (infoPtr->CurrMod == (flags)) #define IsOnlySet(flags) (infoPtr->CurrMod == (flags))
@ -94,7 +92,7 @@ HOTKEY_IsCombInv(HOTKEY_INFO *infoPtr)
#undef IsOnlySet #undef IsOnlySet
static void static void
HOTKEY_DrawHotKey(HOTKEY_INFO *infoPtr, LPCWSTR KeyName, WORD NameLen, HDC hdc) HOTKEY_DrawHotKey(HOTKEY_INFO *infoPtr, HDC hdc, LPCWSTR KeyName, WORD NameLen)
{ {
SIZE TextSize; SIZE TextSize;
INT nXStart, nYStart; INT nXStart, nYStart;
@ -142,7 +140,7 @@ HOTKEY_Refresh(HOTKEY_INFO *infoPtr, HDC hdc)
TRACE("(infoPtr=%p hdc=%p)\n", infoPtr, hdc); TRACE("(infoPtr=%p hdc=%p)\n", infoPtr, hdc);
if(!infoPtr->CurrMod && !infoPtr->HotKey) { if(!infoPtr->CurrMod && !infoPtr->HotKey) {
HOTKEY_DrawHotKey (infoPtr, infoPtr->strNone, 4, hdc); HOTKEY_DrawHotKey (infoPtr, hdc, infoPtr->strNone, 4);
return; return;
} }
@ -182,7 +180,7 @@ HOTKEY_Refresh(HOTKEY_INFO *infoPtr, HDC hdc)
else else
KeyName[NameLen] = 0; KeyName[NameLen] = 0;
HOTKEY_DrawHotKey (infoPtr, KeyName, NameLen, hdc); HOTKEY_DrawHotKey (infoPtr, hdc, KeyName, NameLen);
} }
static void static void
@ -207,39 +205,39 @@ HOTKEY_GetHotKey(HOTKEY_INFO *infoPtr)
} }
static void static void
HOTKEY_SetHotKey(HOTKEY_INFO *infoPtr, WPARAM wParam) HOTKEY_SetHotKey(HOTKEY_INFO *infoPtr, WORD hotKey)
{ {
infoPtr->HotKey = (WORD)wParam; infoPtr->HotKey = hotKey;
infoPtr->ScanCode = infoPtr->ScanCode =
MAKELPARAM(0, MapVirtualKeyW(LOBYTE(infoPtr->HotKey), 0)); MAKELPARAM(0, MapVirtualKeyW(LOBYTE(infoPtr->HotKey), 0));
TRACE("(infoPtr=%p wParam=%x) Modifiers: 0x%x, Virtual Key: %d\n", infoPtr, TRACE("(infoPtr=%p hotKey=%x) Modifiers: 0x%x, Virtual Key: %d\n", infoPtr,
wParam, HIBYTE(infoPtr->HotKey), LOBYTE(infoPtr->HotKey)); hotKey, HIBYTE(infoPtr->HotKey), LOBYTE(infoPtr->HotKey));
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
} }
static void static void
HOTKEY_SetRules(HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam) HOTKEY_SetRules(HOTKEY_INFO *infoPtr, WORD invComb, WORD invMod)
{ {
infoPtr->InvComb = (WORD)wParam; infoPtr->InvComb = invComb;
infoPtr->InvMod = (WORD)lParam; infoPtr->InvMod = invMod;
TRACE("(infoPtr=%p) Invalid Modifers: 0x%x, If Invalid: 0x%x\n", infoPtr, TRACE("(infoPtr=%p) Invalid Modifers: 0x%x, If Invalid: 0x%x\n", infoPtr,
infoPtr->InvComb, infoPtr->InvMod); infoPtr->InvComb, infoPtr->InvMod);
} }
static LRESULT static LRESULT
HOTKEY_Create (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam) HOTKEY_Create (HOTKEY_INFO *infoPtr, LPCREATESTRUCTW lpcs)
{ {
infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; infoPtr->hwndNotify = lpcs->hwndParent;
HOTKEY_SetFont(infoPtr, (WPARAM)GetStockObject(SYSTEM_FONT), 0); HOTKEY_SetFont(infoPtr, GetStockObject(SYSTEM_FONT), 0);
return 0; return 0;
} }
static LRESULT static LRESULT
HOTKEY_Destroy (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam) HOTKEY_Destroy (HOTKEY_INFO *infoPtr)
{ {
HWND hwnd = infoPtr->hwndSelf; HWND hwnd = infoPtr->hwndSelf;
/* free hotkey info data */ /* free hotkey info data */
@ -250,7 +248,7 @@ HOTKEY_Destroy (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
HOTKEY_EraseBackground (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam) HOTKEY_EraseBackground (HOTKEY_INFO *infoPtr, HDC hdc)
{ {
HBRUSH hBrush, hSolidBrush = NULL; HBRUSH hBrush, hSolidBrush = NULL;
RECT rc; RECT rc;
@ -260,14 +258,14 @@ HOTKEY_EraseBackground (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
else else
{ {
hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLOREDIT, hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLOREDIT,
wParam, (LPARAM)infoPtr->hwndSelf); (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
if (!hBrush) if (!hBrush)
hBrush = hSolidBrush = CreateSolidBrush(comctl32_color.clrWindow); hBrush = hSolidBrush = CreateSolidBrush(comctl32_color.clrWindow);
} }
GetClientRect (infoPtr->hwndSelf, &rc); GetClientRect (infoPtr->hwndSelf, &rc);
FillRect ((HDC)wParam, &rc, hBrush); FillRect (hdc, &rc, hBrush);
if (hSolidBrush) if (hSolidBrush)
DeleteObject(hSolidBrush); DeleteObject(hSolidBrush);
@ -277,13 +275,13 @@ HOTKEY_EraseBackground (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
inline static LRESULT inline static LRESULT
HOTKEY_GetFont (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam) HOTKEY_GetFont (HOTKEY_INFO *infoPtr)
{ {
return (LRESULT)infoPtr->hFont; return (LRESULT)infoPtr->hFont;
} }
static LRESULT static LRESULT
HOTKEY_KeyDown (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam) HOTKEY_KeyDown (HOTKEY_INFO *infoPtr, DWORD key, DWORD flags)
{ {
WORD wOldHotKey; WORD wOldHotKey;
BYTE bOldMod; BYTE bOldMod;
@ -291,7 +289,7 @@ HOTKEY_KeyDown (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
if (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & WS_DISABLED) if (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & WS_DISABLED)
return 0; return 0;
TRACE("() Key: %d\n", wParam); TRACE("() Key: %ld\n", key);
wOldHotKey = infoPtr->HotKey; wOldHotKey = infoPtr->HotKey;
bOldMod = infoPtr->CurrMod; bOldMod = infoPtr->CurrMod;
@ -299,7 +297,7 @@ HOTKEY_KeyDown (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
/* If any key is Pressed, we have to reset the hotkey in the control */ /* If any key is Pressed, we have to reset the hotkey in the control */
infoPtr->HotKey = 0; infoPtr->HotKey = 0;
switch (wParam) switch (key)
{ {
case VK_RETURN: case VK_RETURN:
case VK_TAB: case VK_TAB:
@ -308,8 +306,7 @@ HOTKEY_KeyDown (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
case VK_ESCAPE: case VK_ESCAPE:
case VK_BACK: case VK_BACK:
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
return DefWindowProcW (infoPtr->hwndSelf, WM_KEYDOWN, wParam, return DefWindowProcW (infoPtr->hwndSelf, WM_KEYDOWN, key, flags);
lParam);
case VK_SHIFT: case VK_SHIFT:
infoPtr->CurrMod |= HOTKEYF_SHIFT; infoPtr->CurrMod |= HOTKEYF_SHIFT;
@ -323,10 +320,10 @@ HOTKEY_KeyDown (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
default: default:
if(HOTKEY_IsCombInv(infoPtr)) if(HOTKEY_IsCombInv(infoPtr))
infoPtr->HotKey = MAKEWORD(wParam, infoPtr->InvMod); infoPtr->HotKey = MAKEWORD(key, infoPtr->InvMod);
else else
infoPtr->HotKey = MAKEWORD(wParam, infoPtr->CurrMod); infoPtr->HotKey = MAKEWORD(key, infoPtr->CurrMod);
infoPtr->ScanCode = lParam; infoPtr->ScanCode = flags;
break; break;
} }
@ -345,18 +342,18 @@ HOTKEY_KeyDown (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
HOTKEY_KeyUp (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam) HOTKEY_KeyUp (HOTKEY_INFO *infoPtr, DWORD key, DWORD flags)
{ {
BYTE bOldMod; BYTE bOldMod;
if (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & WS_DISABLED) if (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & WS_DISABLED)
return 0; return 0;
TRACE("() Key: %d\n", wParam); TRACE("() Key: %ld\n", key);
bOldMod = infoPtr->CurrMod; bOldMod = infoPtr->CurrMod;
switch (wParam) switch (key)
{ {
case VK_SHIFT: case VK_SHIFT:
infoPtr->CurrMod &= ~HOTKEYF_SHIFT; infoPtr->CurrMod &= ~HOTKEYF_SHIFT;
@ -386,7 +383,7 @@ HOTKEY_KeyUp (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
HOTKEY_KillFocus (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam) HOTKEY_KillFocus (HOTKEY_INFO *infoPtr, HWND receiveFocus)
{ {
infoPtr->bFocus = FALSE; infoPtr->bFocus = FALSE;
DestroyCaret (); DestroyCaret ();
@ -396,7 +393,7 @@ HOTKEY_KillFocus (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
HOTKEY_LButtonDown (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam) HOTKEY_LButtonDown (HOTKEY_INFO *infoPtr)
{ {
if (!(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & WS_DISABLED)) if (!(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & WS_DISABLED))
SetFocus (infoPtr->hwndSelf); SetFocus (infoPtr->hwndSelf);
@ -406,7 +403,7 @@ HOTKEY_LButtonDown (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
inline static LRESULT inline static LRESULT
HOTKEY_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) HOTKEY_NCCreate (HWND hwnd, LPCREATESTRUCTW lpcs)
{ {
HOTKEY_INFO *infoPtr; HOTKEY_INFO *infoPtr;
DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE); DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
@ -423,11 +420,11 @@ HOTKEY_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->hwndSelf = hwnd; infoPtr->hwndSelf = hwnd;
LoadStringW(COMCTL32_hModule, HKY_NONE, infoPtr->strNone, 15); LoadStringW(COMCTL32_hModule, HKY_NONE, infoPtr->strNone, 15);
return DefWindowProcW (infoPtr->hwndSelf, WM_NCCREATE, wParam, lParam); return DefWindowProcW (infoPtr->hwndSelf, WM_NCCREATE, 0, (LPARAM)lpcs);
} }
static LRESULT static LRESULT
HOTKEY_SetFocus (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam) HOTKEY_SetFocus (HOTKEY_INFO *infoPtr, HWND lostFocus)
{ {
infoPtr->bFocus = TRUE; infoPtr->bFocus = TRUE;
@ -440,13 +437,13 @@ HOTKEY_SetFocus (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
HOTKEY_SetFont (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam) HOTKEY_SetFont (HOTKEY_INFO *infoPtr, HFONT hFont, BOOL redraw)
{ {
TEXTMETRICW tm; TEXTMETRICW tm;
HDC hdc; HDC hdc;
HFONT hOldFont = 0; HFONT hOldFont = 0;
infoPtr->hFont = (HFONT)wParam; infoPtr->hFont = hFont;
hdc = GetDC (infoPtr->hwndSelf); hdc = GetDC (infoPtr->hwndSelf);
if (infoPtr->hFont) if (infoPtr->hFont)
@ -459,7 +456,7 @@ HOTKEY_SetFont (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
SelectObject (hdc, hOldFont); SelectObject (hdc, hOldFont);
ReleaseDC (infoPtr->hwndSelf, hdc); ReleaseDC (infoPtr->hwndSelf, hdc);
if (LOWORD(lParam)) if (redraw)
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE); InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
return 0; return 0;
@ -468,7 +465,7 @@ HOTKEY_SetFont (HOTKEY_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
static LRESULT WINAPI static LRESULT WINAPI
HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd); HOTKEY_INFO *infoPtr = (HOTKEY_INFO *)GetWindowLongPtrW (hwnd, 0);
TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hwnd, uMsg, wParam, lParam); TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hwnd, uMsg, wParam, lParam);
if (!infoPtr && (uMsg != WM_NCCREATE)) if (!infoPtr && (uMsg != WM_NCCREATE))
return DefWindowProcW (hwnd, uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam);
@ -477,10 +474,10 @@ HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case HKM_GETHOTKEY: case HKM_GETHOTKEY:
return HOTKEY_GetHotKey (infoPtr); return HOTKEY_GetHotKey (infoPtr);
case HKM_SETHOTKEY: case HKM_SETHOTKEY:
HOTKEY_SetHotKey (infoPtr, wParam); HOTKEY_SetHotKey (infoPtr, (WORD)wParam);
break; break;
case HKM_SETRULES: case HKM_SETRULES:
HOTKEY_SetRules (infoPtr, wParam, lParam); HOTKEY_SetRules (infoPtr, (WORD)wParam, (WORD)lParam);
break; break;
case WM_CHAR: case WM_CHAR:
@ -488,19 +485,19 @@ HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return HOTKEY_KeyDown (infoPtr, MapVirtualKeyW(LOBYTE(HIWORD(lParam)), 1), lParam); return HOTKEY_KeyDown (infoPtr, MapVirtualKeyW(LOBYTE(HIWORD(lParam)), 1), lParam);
case WM_CREATE: case WM_CREATE:
return HOTKEY_Create (infoPtr, wParam, lParam); return HOTKEY_Create (infoPtr, (LPCREATESTRUCTW)lParam);
case WM_DESTROY: case WM_DESTROY:
return HOTKEY_Destroy (infoPtr, wParam, lParam); return HOTKEY_Destroy (infoPtr);
case WM_ERASEBKGND: case WM_ERASEBKGND:
return HOTKEY_EraseBackground (infoPtr, wParam, lParam); return HOTKEY_EraseBackground (infoPtr, (HDC)wParam);
case WM_GETDLGCODE: case WM_GETDLGCODE:
return DLGC_WANTCHARS | DLGC_WANTARROWS; return DLGC_WANTCHARS | DLGC_WANTARROWS;
case WM_GETFONT: case WM_GETFONT:
return HOTKEY_GetFont (infoPtr, wParam, lParam); return HOTKEY_GetFont (infoPtr);
case WM_KEYDOWN: case WM_KEYDOWN:
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
@ -511,23 +508,23 @@ HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return HOTKEY_KeyUp (infoPtr, wParam, lParam); return HOTKEY_KeyUp (infoPtr, wParam, lParam);
case WM_KILLFOCUS: case WM_KILLFOCUS:
return HOTKEY_KillFocus (infoPtr, wParam, lParam); return HOTKEY_KillFocus (infoPtr, (HWND)wParam);
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
return HOTKEY_LButtonDown (infoPtr, wParam, lParam); return HOTKEY_LButtonDown (infoPtr);
case WM_NCCREATE: case WM_NCCREATE:
return HOTKEY_NCCreate (hwnd, wParam, lParam); return HOTKEY_NCCreate (hwnd, (LPCREATESTRUCTW)lParam);
case WM_PAINT: case WM_PAINT:
HOTKEY_Paint(infoPtr, (HDC)wParam); HOTKEY_Paint(infoPtr, (HDC)wParam);
return 0; return 0;
case WM_SETFOCUS: case WM_SETFOCUS:
return HOTKEY_SetFocus (infoPtr, wParam, lParam); return HOTKEY_SetFocus (infoPtr, (HWND)wParam);
case WM_SETFONT: case WM_SETFONT:
return HOTKEY_SetFont (infoPtr, wParam, lParam); return HOTKEY_SetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
default: default:
if ((uMsg >= WM_USER) && (uMsg < WM_APP)) if ((uMsg >= WM_USER) && (uMsg < WM_APP))

View file

@ -2731,6 +2731,7 @@ _write_bitmap(HBITMAP hBitmap, LPSTREAM pstm, int cx, int cy)
failed: failed:
ReleaseDC(0, xdc); ReleaseDC(0, xdc);
LocalFree((HLOCAL)lpBitsOrg); LocalFree((HLOCAL)lpBitsOrg);
LocalFree((HLOCAL)data);
return result; return result;
} }

View file

@ -65,15 +65,14 @@ typedef struct
IPPART_INFO Part[4]; IPPART_INFO Part[4];
} IPADDRESS_INFO; } IPADDRESS_INFO;
static const WCHAR IP_SUBCLASS_PROP[] =
{ 'C', 'C', 'I', 'P', '3', '2', 'S', 'u', 'b', 'c', 'l', 'a', 's', 's', 'I', 'n', 'f', 'o', 0 };
#define POS_DEFAULT 0 #define POS_DEFAULT 0
#define POS_LEFT 1 #define POS_LEFT 1
#define POS_RIGHT 2 #define POS_RIGHT 2
#define POS_SELALL 3 #define POS_SELALL 3
#define IP_SUBCLASS_PROP "CCIP32SubclassInfo"
#define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO *)GetWindowLongPtrW (hwnd, 0))
static LRESULT CALLBACK static LRESULT CALLBACK
IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
@ -125,6 +124,7 @@ static int IPADDRESS_GetPartIndex(IPADDRESS_INFO *infoPtr, HWND hwnd)
static LRESULT IPADDRESS_Draw (IPADDRESS_INFO *infoPtr, HDC hdc) static LRESULT IPADDRESS_Draw (IPADDRESS_INFO *infoPtr, HDC hdc)
{ {
static const WCHAR dotW[] = { '.', 0 };
RECT rect, rcPart; RECT rect, rcPart;
POINT pt; POINT pt;
int i; int i;
@ -143,7 +143,7 @@ static LRESULT IPADDRESS_Draw (IPADDRESS_INFO *infoPtr, HDC hdc)
pt.x = rcPart.left; pt.x = rcPart.left;
ScreenToClient(infoPtr->Self, &pt); ScreenToClient(infoPtr->Self, &pt);
rect.right = pt.x; rect.right = pt.x;
DrawTextA(hdc, ".", 1, &rect, DT_SINGLELINE | DT_CENTER | DT_BOTTOM); DrawTextW(hdc, dotW, 1, &rect, DT_SINGLELINE | DT_CENTER | DT_BOTTOM);
} }
return 0; return 0;
@ -152,10 +152,10 @@ static LRESULT IPADDRESS_Draw (IPADDRESS_INFO *infoPtr, HDC hdc)
static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate) static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate)
{ {
static const WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 };
IPADDRESS_INFO *infoPtr; IPADDRESS_INFO *infoPtr;
RECT rcClient, edit; RECT rcClient, edit;
int i, fieldsize; int i, fieldsize;
static const WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 };
TRACE("\n"); TRACE("\n");
@ -188,7 +188,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate)
edit.left, edit.top, edit.right - edit.left, edit.left, edit.top, edit.right - edit.left,
edit.bottom - edit.top, hwnd, (HMENU) 1, edit.bottom - edit.top, hwnd, (HMENU) 1,
(HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL); (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL);
SetPropA(part->EditHwnd, IP_SUBCLASS_PROP, hwnd); SetPropW(part->EditHwnd, IP_SUBCLASS_PROP, hwnd);
part->OrigProc = (WNDPROC) part->OrigProc = (WNDPROC)
SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC, SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC,
(DWORD_PTR)IPADDRESS_SubclassProc); (DWORD_PTR)IPADDRESS_SubclassProc);
@ -419,8 +419,8 @@ static BOOL IPADDRESS_GotoNextField (IPADDRESS_INFO *infoPtr, int cur, int sel)
LRESULT CALLBACK LRESULT CALLBACK
IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
HWND Self = (HWND)GetPropA (hwnd, IP_SUBCLASS_PROP); HWND Self = (HWND)GetPropW (hwnd, IP_SUBCLASS_PROP);
IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (Self); IPADDRESS_INFO *infoPtr = (IPADDRESS_INFO *)GetWindowLongPtrW (Self, 0);
CHAR c = (CHAR)wParam; CHAR c = (CHAR)wParam;
INT index, len = 0, startsel, endsel; INT index, len = 0, startsel, endsel;
IPPART_INFO *part; IPPART_INFO *part;
@ -502,7 +502,7 @@ IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT WINAPI static LRESULT WINAPI
IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd); IPADDRESS_INFO *infoPtr = (IPADDRESS_INFO *)GetWindowLongPtrW (hwnd, 0);
TRACE("(hwnd=%p msg=0x%x wparam=0x%x lparam=0x%lx)\n", hwnd, uMsg, wParam, lParam); TRACE("(hwnd=%p msg=0x%x wparam=0x%x lparam=0x%lx)\n", hwnd, uMsg, wParam, lParam);

View file

@ -348,7 +348,7 @@ typedef struct tagLISTVIEW_INFO
/* Standard DrawText flags */ /* Standard DrawText flags */
#define LV_ML_DT_FLAGS (DT_TOP | DT_NOPREFIX | DT_EDITCONTROL | DT_CENTER | DT_WORDBREAK | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS) #define LV_ML_DT_FLAGS (DT_TOP | DT_NOPREFIX | DT_EDITCONTROL | DT_CENTER | DT_WORDBREAK | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS)
#define LV_FL_DT_FLAGS (DT_TOP | DT_NOPREFIX | DT_EDITCONTROL | DT_CENTER | DT_WORDBREAK | DT_NOCLIP) #define LV_FL_DT_FLAGS (DT_TOP | DT_NOPREFIX | DT_EDITCONTROL | DT_CENTER | DT_WORDBREAK | DT_NOCLIP)
#define LV_SL_DT_FLAGS (DT_VCENTER | DT_EDITCONTROL | DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS) #define LV_SL_DT_FLAGS (DT_VCENTER | DT_NOPREFIX | DT_EDITCONTROL | DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS)
/* The time in milliseconds to reset the search in the list */ /* The time in milliseconds to reset the search in the list */
#define KEY_DELAY 450 #define KEY_DELAY 450
@ -819,10 +819,8 @@ static int get_ansi_notification(INT unicodeNotificationCode)
} }
/* /*
With testing on Windows 2000 it looks like the notify format Send notification. depends on dispinfoW having same
has nothing to do with this message. It ALWAYS seems to be structure as dispinfoA.
in ansi format.
infoPtr : listview struct infoPtr : listview struct
notificationCode : *Unicode* notification code notificationCode : *Unicode* notification code
pdi : dispinfo structure (can be unicode or ansi) pdi : dispinfo structure (can be unicode or ansi)
@ -831,19 +829,23 @@ static int get_ansi_notification(INT unicodeNotificationCode)
static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNMLVDISPINFOW pdi, BOOL isW) static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNMLVDISPINFOW pdi, BOOL isW)
{ {
BOOL bResult = FALSE; BOOL bResult = FALSE;
BOOL convertToAnsi = FALSE; BOOL convertToAnsi = FALSE, convertToUnicode = FALSE;
INT cchTempBufMax = 0, savCchTextMax = 0; INT cchTempBufMax = 0, savCchTextMax = 0, realNotifCode;
LPWSTR pszTempBuf = NULL, savPszText = NULL; LPWSTR pszTempBuf = NULL, savPszText = NULL;
if ((pdi->item.mask & LVIF_TEXT) && is_textT(pdi->item.pszText, isW)) if ((pdi->item.mask & LVIF_TEXT) && is_textT(pdi->item.pszText, isW))
convertToAnsi = isW; {
convertToAnsi = (isW && infoPtr->notifyFormat == NFR_ANSI);
convertToUnicode = (!isW && infoPtr->notifyFormat == NFR_UNICODE);
}
if (convertToAnsi) if (convertToAnsi || convertToUnicode)
{ {
if (notificationCode != LVN_GETDISPINFOW) if (notificationCode != LVN_GETDISPINFOW)
{ {
cchTempBufMax = WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, cchTempBufMax = convertToUnicode ?
-1, NULL, 0, NULL, NULL); MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pdi->item.pszText, -1, NULL, 0):
WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, NULL, 0, NULL, NULL);
} }
else else
{ {
@ -851,12 +853,16 @@ static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNML
*pdi->item.pszText = 0; /* make sure we don't process garbage */ *pdi->item.pszText = 0; /* make sure we don't process garbage */
} }
pszTempBuf = HeapAlloc(GetProcessHeap(), 0, sizeof(CHAR) * pszTempBuf = HeapAlloc(GetProcessHeap(), 0,
cchTempBufMax); (convertToUnicode ? sizeof(WCHAR) : sizeof(CHAR)) * cchTempBufMax);
if (!pszTempBuf) return FALSE; if (!pszTempBuf) return FALSE;
WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR) if (convertToUnicode)
pszTempBuf, cchTempBufMax, NULL, NULL); MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pdi->item.pszText, -1,
pszTempBuf, cchTempBufMax);
else
WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR) pszTempBuf,
cchTempBufMax, NULL, NULL);
savCchTextMax = pdi->item.cchTextMax; savCchTextMax = pdi->item.cchTextMax;
savPszText = pdi->item.pszText; savPszText = pdi->item.pszText;
@ -864,14 +870,19 @@ static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNML
pdi->item.cchTextMax = cchTempBufMax; pdi->item.cchTextMax = cchTempBufMax;
} }
TRACE(" pdi->item=%s\n", debuglvitem_t(&pdi->item, infoPtr->notifyFormat != if (infoPtr->notifyFormat == NFR_ANSI)
NFR_ANSI)); realNotifCode = get_ansi_notification(notificationCode);
else
realNotifCode = notificationCode;
TRACE(" pdi->item=%s\n", debuglvitem_t(&pdi->item, infoPtr->notifyFormat != NFR_ANSI));
bResult = notify_hdr(infoPtr, realNotifCode, &pdi->hdr);
bResult = notify_hdr(infoPtr, get_ansi_notification(notificationCode), if (convertToUnicode || convertToAnsi)
(LPNMHDR)pdi);
if (convertToAnsi)
{ {
if (convertToUnicode) /* note : pointer can be changed by app ! */
WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR) savPszText,
savCchTextMax, NULL, NULL);
else
MultiByteToWideChar(CP_ACP, 0, (LPSTR) pdi->item.pszText, -1, MultiByteToWideChar(CP_ACP, 0, (LPSTR) pdi->item.pszText, -1,
savPszText, savCchTextMax); savPszText, savCchTextMax);
pdi->item.pszText = savPszText; /* restores our buffer */ pdi->item.pszText = savPszText; /* restores our buffer */
@ -3131,7 +3142,7 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem)
* PARAMETER(S): * PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure * [I] infoPtr : valid pointer to the listview structure
* [I] fwKeys : key indicator * [I] fwKeys : key indicator
* [I] pts : mouse position * [I] x,y : mouse position
* *
* RETURN: * RETURN:
* 0 if the message was processed, non-zero if there was an error * 0 if the message was processed, non-zero if there was an error
@ -3141,7 +3152,7 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem)
* over the item for a certain period of time. * over the item for a certain period of time.
* *
*/ */
static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, WORD fwKyes, POINTS pts) static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, WORD fwKyes, INT x, INT y)
{ {
if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT) if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT)
/* FIXME: select the item!!! */ /* FIXME: select the item!!! */
@ -3157,12 +3168,12 @@ static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, WORD fwKyes, POINTS p
* PARAMETER(S): * PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure * [I] infoPtr : valid pointer to the listview structure
* [I] fwKeys : key indicator * [I] fwKeys : key indicator
* [I] pts : mouse position * [I] x,y : mouse position
* *
* RETURN: * RETURN:
* 0 if the message is processed, non-zero if there was an error * 0 if the message is processed, non-zero if there was an error
*/ */
static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, POINTS pts) static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, INT y)
{ {
TRACKMOUSEEVENT trackinfo; TRACKMOUSEEVENT trackinfo;
@ -7951,22 +7962,22 @@ static LRESULT LISTVIEW_TrackMouse(LISTVIEW_INFO *infoPtr, POINT pt)
* PARAMETER(S): * PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure * [I] infoPtr : valid pointer to the listview structure
* [I] wKey : key flag * [I] wKey : key flag
* [I] pts : mouse coordinate * [I] x,y : mouse coordinate
* *
* RETURN: * RETURN:
* Zero * Zero
*/ */
static LRESULT LISTVIEW_LButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts) static LRESULT LISTVIEW_LButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
{ {
LVHITTESTINFO htInfo; LVHITTESTINFO htInfo;
TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, pts.x, pts.y); TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, x, y);
/* send NM_RELEASEDCAPTURE notification */ /* send NM_RELEASEDCAPTURE notification */
notify(infoPtr, NM_RELEASEDCAPTURE); notify(infoPtr, NM_RELEASEDCAPTURE);
htInfo.pt.x = pts.x; htInfo.pt.x = x;
htInfo.pt.y = pts.y; htInfo.pt.y = y;
/* send NM_DBLCLK notification */ /* send NM_DBLCLK notification */
LISTVIEW_HitTest(infoPtr, &htInfo, TRUE, FALSE); LISTVIEW_HitTest(infoPtr, &htInfo, TRUE, FALSE);
@ -7985,19 +7996,19 @@ static LRESULT LISTVIEW_LButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS
* PARAMETER(S): * PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure * [I] infoPtr : valid pointer to the listview structure
* [I] wKey : key flag * [I] wKey : key flag
* [I] pts : mouse coordinate * [I] x,y : mouse coordinate
* *
* RETURN: * RETURN:
* Zero * Zero
*/ */
static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts) static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
{ {
LVHITTESTINFO lvHitTestInfo; LVHITTESTINFO lvHitTestInfo;
static BOOL bGroupSelect = TRUE; static BOOL bGroupSelect = TRUE;
POINT pt = { pts.x, pts.y }; POINT pt = { x, y };
INT nItem; INT nItem;
TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, pts.x, pts.y); TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, x, y);
/* send NM_RELEASEDCAPTURE notification */ /* send NM_RELEASEDCAPTURE notification */
notify(infoPtr, NM_RELEASEDCAPTURE); notify(infoPtr, NM_RELEASEDCAPTURE);
@ -8007,8 +8018,8 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pt
/* set left button down flag */ /* set left button down flag */
infoPtr->bLButtonDown = TRUE; infoPtr->bLButtonDown = TRUE;
lvHitTestInfo.pt.x = pts.x; lvHitTestInfo.pt.x = x;
lvHitTestInfo.pt.y = pts.y; lvHitTestInfo.pt.y = y;
nItem = LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE); nItem = LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE);
TRACE("at %s, nItem=%d\n", debugpoint(&pt), nItem); TRACE("at %s, nItem=%d\n", debugpoint(&pt), nItem);
@ -8112,21 +8123,21 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pt
* PARAMETER(S): * PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure * [I] infoPtr : valid pointer to the listview structure
* [I] wKey : key flag * [I] wKey : key flag
* [I] pts : mouse coordinate * [I] x,y : mouse coordinate
* *
* RETURN: * RETURN:
* Zero * Zero
*/ */
static LRESULT LISTVIEW_LButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts) static LRESULT LISTVIEW_LButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
{ {
LVHITTESTINFO lvHitTestInfo; LVHITTESTINFO lvHitTestInfo;
TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, pts.x, pts.y); TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, x, y);
if (!infoPtr->bLButtonDown) return 0; if (!infoPtr->bLButtonDown) return 0;
lvHitTestInfo.pt.x = pts.x; lvHitTestInfo.pt.x = x;
lvHitTestInfo.pt.y = pts.y; lvHitTestInfo.pt.y = y;
/* send NM_CLICK notification */ /* send NM_CLICK notification */
LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE); LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
@ -8344,23 +8355,23 @@ static LRESULT LISTVIEW_Paint(LISTVIEW_INFO *infoPtr, HDC hdc)
* PARAMETER(S): * PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure * [I] infoPtr : valid pointer to the listview structure
* [I] wKey : key flag * [I] wKey : key flag
* [I] pts : mouse coordinate * [I] x,y : mouse coordinate
* *
* RETURN: * RETURN:
* Zero * Zero
*/ */
static LRESULT LISTVIEW_RButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts) static LRESULT LISTVIEW_RButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
{ {
LVHITTESTINFO lvHitTestInfo; LVHITTESTINFO lvHitTestInfo;
TRACE("(key=%hu,X=%hu,Y=%hu)\n", wKey, pts.x, pts.y); TRACE("(key=%hu,X=%hu,Y=%hu)\n", wKey, x, y);
/* send NM_RELEASEDCAPTURE notification */ /* send NM_RELEASEDCAPTURE notification */
notify(infoPtr, NM_RELEASEDCAPTURE); notify(infoPtr, NM_RELEASEDCAPTURE);
/* send NM_RDBLCLK notification */ /* send NM_RDBLCLK notification */
lvHitTestInfo.pt.x = pts.x; lvHitTestInfo.pt.x = x;
lvHitTestInfo.pt.y = pts.y; lvHitTestInfo.pt.y = y;
LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE); LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
notify_click(infoPtr, NM_RDBLCLK, &lvHitTestInfo); notify_click(infoPtr, NM_RDBLCLK, &lvHitTestInfo);
@ -8374,17 +8385,17 @@ static LRESULT LISTVIEW_RButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS
* PARAMETER(S): * PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure * [I] infoPtr : valid pointer to the listview structure
* [I] wKey : key flag * [I] wKey : key flag
* [I] pts : mouse coordinate * [I] x,y : mouse coordinate
* *
* RETURN: * RETURN:
* Zero * Zero
*/ */
static LRESULT LISTVIEW_RButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts) static LRESULT LISTVIEW_RButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
{ {
LVHITTESTINFO lvHitTestInfo; LVHITTESTINFO lvHitTestInfo;
INT nItem; INT nItem;
TRACE("(key=%hu,X=%hu,Y=%hu)\n", wKey, pts.x, pts.y); TRACE("(key=%hu,X=%hu,Y=%hu)\n", wKey, x, y);
/* send NM_RELEASEDCAPTURE notification */ /* send NM_RELEASEDCAPTURE notification */
notify(infoPtr, NM_RELEASEDCAPTURE); notify(infoPtr, NM_RELEASEDCAPTURE);
@ -8396,8 +8407,8 @@ static LRESULT LISTVIEW_RButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pt
infoPtr->bRButtonDown = TRUE; infoPtr->bRButtonDown = TRUE;
/* determine the index of the selected item */ /* determine the index of the selected item */
lvHitTestInfo.pt.x = pts.x; lvHitTestInfo.pt.x = x;
lvHitTestInfo.pt.y = pts.y; lvHitTestInfo.pt.y = y;
nItem = LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE); nItem = LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE);
if ((nItem >= 0) && (nItem < infoPtr->nItemCount)) if ((nItem >= 0) && (nItem < infoPtr->nItemCount))
@ -8422,17 +8433,17 @@ static LRESULT LISTVIEW_RButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pt
* PARAMETER(S): * PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure * [I] infoPtr : valid pointer to the listview structure
* [I] wKey : key flag * [I] wKey : key flag
* [I] pts : mouse coordinate * [I] x,y : mouse coordinate
* *
* RETURN: * RETURN:
* Zero * Zero
*/ */
static LRESULT LISTVIEW_RButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts) static LRESULT LISTVIEW_RButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
{ {
LVHITTESTINFO lvHitTestInfo; LVHITTESTINFO lvHitTestInfo;
POINT pt; POINT pt;
TRACE("(key=%hu,X=%hu,Y=%hu)\n", wKey, pts.x, pts.y); TRACE("(key=%hu,X=%hu,Y=%hu)\n", wKey, x, y);
if (!infoPtr->bRButtonDown) return 0; if (!infoPtr->bRButtonDown) return 0;
@ -8440,8 +8451,8 @@ static LRESULT LISTVIEW_RButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, POINTS pts)
infoPtr->bRButtonDown = FALSE; infoPtr->bRButtonDown = FALSE;
/* Send NM_RClICK notification */ /* Send NM_RClICK notification */
lvHitTestInfo.pt.x = pts.x; lvHitTestInfo.pt.x = x;
lvHitTestInfo.pt.y = pts.y; lvHitTestInfo.pt.y = y;
LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE); LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
notify_click(infoPtr, NM_RCLICK, &lvHitTestInfo); notify_click(infoPtr, NM_RCLICK, &lvHitTestInfo);
@ -9159,19 +9170,19 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return LISTVIEW_KillFocus(infoPtr); return LISTVIEW_KillFocus(infoPtr);
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
return LISTVIEW_LButtonDblClk(infoPtr, (WORD)wParam, MAKEPOINTS(lParam)); return LISTVIEW_LButtonDblClk(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
return LISTVIEW_LButtonDown(infoPtr, (WORD)wParam, MAKEPOINTS(lParam)); return LISTVIEW_LButtonDown(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
case WM_LBUTTONUP: case WM_LBUTTONUP:
return LISTVIEW_LButtonUp(infoPtr, (WORD)wParam, MAKEPOINTS(lParam)); return LISTVIEW_LButtonUp(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
return LISTVIEW_MouseMove (infoPtr, (WORD)wParam, MAKEPOINTS(lParam)); return LISTVIEW_MouseMove (infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
case WM_MOUSEHOVER: case WM_MOUSEHOVER:
return LISTVIEW_MouseHover(infoPtr, (WORD)wParam, MAKEPOINTS(lParam)); return LISTVIEW_MouseHover(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
case WM_NCDESTROY: case WM_NCDESTROY:
return LISTVIEW_NCDestroy(infoPtr); return LISTVIEW_NCDestroy(infoPtr);
@ -9188,13 +9199,13 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return LISTVIEW_Paint(infoPtr, (HDC)wParam); return LISTVIEW_Paint(infoPtr, (HDC)wParam);
case WM_RBUTTONDBLCLK: case WM_RBUTTONDBLCLK:
return LISTVIEW_RButtonDblClk(infoPtr, (WORD)wParam, MAKEPOINTS(lParam)); return LISTVIEW_RButtonDblClk(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
return LISTVIEW_RButtonDown(infoPtr, (WORD)wParam, MAKEPOINTS(lParam)); return LISTVIEW_RButtonDown(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
case WM_RBUTTONUP: case WM_RBUTTONUP:
return LISTVIEW_RButtonUp(infoPtr, (WORD)wParam, MAKEPOINTS(lParam)); return LISTVIEW_RButtonUp(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
case WM_SETCURSOR: case WM_SETCURSOR:
if(LISTVIEW_SetCursor(infoPtr, (HWND)wParam, LOWORD(lParam), HIWORD(lParam))) if(LISTVIEW_SetCursor(infoPtr, (HWND)wParam, LOWORD(lParam), HIWORD(lParam)))
@ -9270,7 +9281,7 @@ void LISTVIEW_Register(void)
ZeroMemory(&wndClass, sizeof(WNDCLASSW)); ZeroMemory(&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
wndClass.lpfnWndProc = (WNDPROC)LISTVIEW_WindowProc; wndClass.lpfnWndProc = LISTVIEW_WindowProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *); wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *);
wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);

File diff suppressed because it is too large Load diff

View file

@ -28,12 +28,11 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#include <string.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "winnls.h"
#include "commctrl.h" #include "commctrl.h"
#include "comctl32.h" #include "comctl32.h"
#include "wine/debug.h" #include "wine/debug.h"
@ -42,12 +41,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(nativefont);
typedef struct typedef struct
{ {
DWORD dwDummy; /* just to keep the compiler happy ;-) */ HWND hwndSelf; /* my own handle */
} NATIVEFONT_INFO; } NATIVEFONT_INFO;
#define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongPtrW (hwnd, 0)) #define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongPtrW (hwnd, 0))
static LRESULT static LRESULT
NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
@ -57,45 +55,40 @@ NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr = (NATIVEFONT_INFO *)Alloc (sizeof(NATIVEFONT_INFO)); infoPtr = (NATIVEFONT_INFO *)Alloc (sizeof(NATIVEFONT_INFO));
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize info structure */ /* initialize info structure */
infoPtr->hwndSelf = hwnd;
return 0; return 0;
} }
static LRESULT static LRESULT
NATIVEFONT_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) NATIVEFONT_Destroy (NATIVEFONT_INFO *infoPtr)
{ {
NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr (hwnd); /* free control info data */
SetWindowLongPtrW( infoPtr->hwndSelf, 0, 0 );
/* free comboex info data */
Free (infoPtr); Free (infoPtr);
SetWindowLongPtrW( hwnd, 0, 0 );
return 0; return 0;
} }
static LRESULT WINAPI static LRESULT WINAPI
NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
if (!NATIVEFONT_GetInfoPtr(hwnd) && (uMsg != WM_CREATE)) NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr(hwnd);
return DefWindowProcA( hwnd, uMsg, wParam, lParam );
TRACE("hwnd=%p msg=%04x wparam=%08x lparam=%08lx\n",
hwnd, uMsg, wParam, lParam);
if (!infoPtr && (uMsg != WM_CREATE))
return DefWindowProcW( hwnd, uMsg, wParam, lParam );
switch (uMsg) switch (uMsg)
{ {
case WM_CREATE: case WM_CREATE:
return NATIVEFONT_Create (hwnd, wParam, lParam); return NATIVEFONT_Create (hwnd, wParam, lParam);
case WM_DESTROY: case WM_DESTROY:
return NATIVEFONT_Destroy (hwnd, wParam, lParam); return NATIVEFONT_Destroy (infoPtr);
case WM_MOVE: case WM_MOVE:
case WM_SIZE: case WM_SIZE:
@ -105,12 +98,13 @@ NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_SETFONT: case WM_SETFONT:
case WM_GETDLGCODE: case WM_GETDLGCODE:
/* FIXME("message %04x seen but stubbed\n", uMsg); */ /* FIXME("message %04x seen but stubbed\n", uMsg); */
return DefWindowProcA (hwnd, uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam);
default: default:
if ((uMsg >= WM_USER) && (uMsg < WM_APP))
ERR("unknown msg %04x wp=%08x lp=%08lx\n", ERR("unknown msg %04x wp=%08x lp=%08lx\n",
uMsg, wParam, lParam); uMsg, wParam, lParam);
return DefWindowProcA (hwnd, uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam);
} }
return 0; return 0;
} }
@ -119,23 +113,23 @@ NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID VOID
NATIVEFONT_Register (void) NATIVEFONT_Register (void)
{ {
WNDCLASSA wndClass; WNDCLASSW wndClass;
ZeroMemory (&wndClass, sizeof(WNDCLASSA)); ZeroMemory (&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS; wndClass.style = CS_GLOBALCLASS;
wndClass.lpfnWndProc = (WNDPROC)NATIVEFONT_WindowProc; wndClass.lpfnWndProc = NATIVEFONT_WindowProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(NATIVEFONT_INFO *); wndClass.cbWndExtra = sizeof(NATIVEFONT_INFO *);
wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW); wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndClass.lpszClassName = WC_NATIVEFONTCTLA; wndClass.lpszClassName = WC_NATIVEFONTCTLW;
RegisterClassA (&wndClass); RegisterClassW (&wndClass);
} }
VOID VOID
NATIVEFONT_Unregister (void) NATIVEFONT_Unregister (void)
{ {
UnregisterClassA (WC_NATIVEFONTCTLA, NULL); UnregisterClassW (WC_NATIVEFONTCTLW, NULL);
} }

View file

@ -654,7 +654,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
* *
* Registers the progress bar window class. * Registers the progress bar window class.
*/ */
VOID PROGRESS_Register (void) void PROGRESS_Register (void)
{ {
WNDCLASSW wndClass; WNDCLASSW wndClass;
@ -675,7 +675,7 @@ VOID PROGRESS_Register (void)
* *
* Unregisters the progress bar window class. * Unregisters the progress bar window class.
*/ */
VOID PROGRESS_Unregister (void) void PROGRESS_Unregister (void)
{ {
UnregisterClassW (PROGRESS_CLASSW, NULL); UnregisterClassW (PROGRESS_CLASSW, NULL);
} }

View file

@ -19,7 +19,7 @@
* *
* *
* This code was audited for completeness against the documented features * This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Mar. 14, 2004, by Robert Shearman. * of Comctl32.dll version 6.0 on Oct. 19, 2004, by Robert Shearman.
* *
* Unless otherwise noted, we believe this code to be complete, as per * Unless otherwise noted, we believe this code to be complete, as per
* the specification mentioned above. * the specification mentioned above.
@ -194,8 +194,8 @@ typedef struct
HCURSOR hcurVert; /* handle to the NS cursor */ HCURSOR hcurVert; /* handle to the NS cursor */
HCURSOR hcurDrag; /* handle to the drag cursor */ HCURSOR hcurDrag; /* handle to the drag cursor */
INT iVersion; /* version number */ INT iVersion; /* version number */
POINTS dragStart; /* x,y of button down */ POINT dragStart; /* x,y of button down */
POINTS dragNow; /* x,y of this MouseMove */ POINT dragNow; /* x,y of this MouseMove */
INT iOldBand; /* last band that had the mouse cursor over it */ INT iOldBand; /* last band that had the mouse cursor over it */
INT ihitoffset; /* offset of hotspot from gripper.left */ INT ihitoffset; /* offset of hotspot from gripper.left */
POINT origin; /* left/upper corner of client */ POINT origin; /* left/upper corner of client */
@ -394,7 +394,7 @@ REBAR_DumpBand (REBAR_INFO *iP)
TRACE("hwnd=%p: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n", TRACE("hwnd=%p: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n",
iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows, iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows,
iP->calcSize.cx, iP->calcSize.cy); iP->calcSize.cx, iP->calcSize.cy);
TRACE("hwnd=%p: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, iGrabbedBand=%d\n", TRACE("hwnd=%p: flags=%08x, dragStart=%ld,%ld, dragNow=%ld,%ld, iGrabbedBand=%d\n",
iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y, iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y,
iP->dragNow.x, iP->dragNow.y, iP->dragNow.x, iP->dragNow.y,
iP->iGrabbedBand); iP->iGrabbedBand);
@ -2418,7 +2418,7 @@ REBAR_Shrink (REBAR_INFO *infoPtr, REBAR_BAND *band, INT movement, INT i)
static void static void
REBAR_HandleLRDrag (REBAR_INFO *infoPtr, POINTS *ptsmove) REBAR_HandleLRDrag (REBAR_INFO *infoPtr, const POINT *ptsmove)
/* Function: This will implement the functionality of a */ /* Function: This will implement the functionality of a */
/* Gripper drag within a row. It will not implement "out- */ /* Gripper drag within a row. It will not implement "out- */
/* of-row" drags. (They are detected and handled in */ /* of-row" drags. (They are detected and handled in */
@ -2491,7 +2491,7 @@ REBAR_HandleLRDrag (REBAR_INFO *infoPtr, POINTS *ptsmove)
infoPtr->ihitoffset); infoPtr->ihitoffset);
infoPtr->dragNow = *ptsmove; infoPtr->dragNow = *ptsmove;
TRACE("before: movement=%d (%d,%d), imindBand=%d, ihitBand=%d, imaxdBand=%d, LSum=%d, RSum=%d\n", TRACE("before: movement=%d (%ld,%ld), imindBand=%d, ihitBand=%d, imaxdBand=%d, LSum=%d, RSum=%d\n",
movement, ptsmove->x, ptsmove->y, imindBand, ihitBand, movement, ptsmove->x, ptsmove->y, imindBand, ihitBand,
imaxdBand, LHeaderSum, RHeaderSum); imaxdBand, LHeaderSum, RHeaderSum);
REBAR_DumpBand (infoPtr); REBAR_DumpBand (infoPtr);
@ -3874,7 +3874,8 @@ REBAR_LButtonDown (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
infoPtr->iGrabbedBand = iHitBand; infoPtr->iGrabbedBand = iHitBand;
/* save off the LOWORD and HIWORD of lParam as initial x,y */ /* save off the LOWORD and HIWORD of lParam as initial x,y */
infoPtr->dragStart = MAKEPOINTS(lParam); infoPtr->dragStart.x = (short)LOWORD(lParam);
infoPtr->dragStart.y = (short)HIWORD(lParam);
infoPtr->dragNow = infoPtr->dragStart; infoPtr->dragNow = infoPtr->dragStart;
if (infoPtr->dwStyle & CCS_VERT) if (infoPtr->dwStyle & CCS_VERT)
infoPtr->ihitoffset = infoPtr->dragStart.y - (lpBand->rcBand.top+REBAR_PRE_GRIPPER); infoPtr->ihitoffset = infoPtr->dragStart.y - (lpBand->rcBand.top+REBAR_PRE_GRIPPER);
@ -3935,9 +3936,10 @@ static LRESULT
REBAR_MouseMove (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) REBAR_MouseMove (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{ {
REBAR_BAND *lpChevronBand; REBAR_BAND *lpChevronBand;
POINTS ptsmove; POINT ptMove;
ptsmove = MAKEPOINTS(lParam); ptMove.x = (short)LOWORD(lParam);
ptMove.y = (short)HIWORD(lParam);
/* if we are currently dragging a band */ /* if we are currently dragging a band */
if (infoPtr->iGrabbedBand >= 0) if (infoPtr->iGrabbedBand >= 0)
@ -3951,40 +3953,37 @@ REBAR_MouseMove (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
band2 = &infoPtr->bands[infoPtr->iGrabbedBand]; band2 = &infoPtr->bands[infoPtr->iGrabbedBand];
/* if mouse did not move much, exit */ /* if mouse did not move much, exit */
if ((abs(ptsmove.x - infoPtr->dragNow.x) <= mindragx) && if ((abs(ptMove.x - infoPtr->dragNow.x) <= mindragx) &&
(abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0; (abs(ptMove.y - infoPtr->dragNow.y) <= mindragy)) return 0;
/* Test for valid drag case - must not be first band in row */ /* Test for valid drag case - must not be first band in row */
if (infoPtr->dwStyle & CCS_VERT) { if (infoPtr->dwStyle & CCS_VERT) {
if ((ptsmove.x < band2->rcBand.left) || if ((ptMove.x < band2->rcBand.left) ||
(ptsmove.x > band2->rcBand.right) || (ptMove.x > band2->rcBand.right) ||
((infoPtr->iGrabbedBand > 0) && (band1->iRow != band2->iRow))) { ((infoPtr->iGrabbedBand > 0) && (band1->iRow != band2->iRow))) {
FIXME("Cannot drag to other rows yet!!\n"); FIXME("Cannot drag to other rows yet!!\n");
} }
else { else {
REBAR_HandleLRDrag (infoPtr, &ptsmove); REBAR_HandleLRDrag (infoPtr, &ptMove);
} }
} }
else { else {
if ((ptsmove.y < band2->rcBand.top) || if ((ptMove.y < band2->rcBand.top) ||
(ptsmove.y > band2->rcBand.bottom) || (ptMove.y > band2->rcBand.bottom) ||
((infoPtr->iGrabbedBand > 0) && (band1->iRow != band2->iRow))) { ((infoPtr->iGrabbedBand > 0) && (band1->iRow != band2->iRow))) {
FIXME("Cannot drag to other rows yet!!\n"); FIXME("Cannot drag to other rows yet!!\n");
} }
else { else {
REBAR_HandleLRDrag (infoPtr, &ptsmove); REBAR_HandleLRDrag (infoPtr, &ptMove);
} }
} }
} }
else else
{ {
POINT ptMove;
INT iHitBand; INT iHitBand;
UINT htFlags; UINT htFlags;
TRACKMOUSEEVENT trackinfo; TRACKMOUSEEVENT trackinfo;
ptMove.x = (INT)ptsmove.x;
ptMove.y = (INT)ptsmove.y;
REBAR_InternalHitTest(infoPtr, &ptMove, &htFlags, &iHitBand); REBAR_InternalHitTest(infoPtr, &ptMove, &htFlags, &iHitBand);
if (infoPtr->iOldBand >= 0 && infoPtr->iOldBand == infoPtr->ichevronhotBand) if (infoPtr->iOldBand >= 0 && infoPtr->iOldBand == infoPtr->ichevronhotBand)
@ -4152,8 +4151,7 @@ static LRESULT
REBAR_NCHitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) REBAR_NCHitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{ {
NMMOUSE nmmouse; NMMOUSE nmmouse;
POINTS shortpt; POINT clpt;
POINT clpt, pt;
INT i; INT i;
UINT scrap; UINT scrap;
LRESULT ret = HTCLIENT; LRESULT ret = HTCLIENT;
@ -4166,9 +4164,8 @@ REBAR_NCHitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
* 3. native always seems to return HTCLIENT if notify return is 0. * 3. native always seems to return HTCLIENT if notify return is 0.
*/ */
shortpt = MAKEPOINTS (lParam); clpt.x = (short)LOWORD(lParam);
POINTSTOPOINT(pt, shortpt); clpt.y = (short)HIWORD(lParam);
clpt = pt;
ScreenToClient (infoPtr->hwndSelf, &clpt); ScreenToClient (infoPtr->hwndSelf, &clpt);
REBAR_InternalHitTest (infoPtr, &clpt, &scrap, REBAR_InternalHitTest (infoPtr, &clpt, &scrap,
(INT *)&nmmouse.dwItemSpec); (INT *)&nmmouse.dwItemSpec);
@ -4710,7 +4707,7 @@ REBAR_Register (void)
ZeroMemory (&wndClass, sizeof(WNDCLASSA)); ZeroMemory (&wndClass, sizeof(WNDCLASSA));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
wndClass.lpfnWndProc = (WNDPROC)REBAR_WindowProc; wndClass.lpfnWndProc = REBAR_WindowProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(REBAR_INFO *); wndClass.cbWndExtra = sizeof(REBAR_INFO *);
wndClass.hCursor = 0; wndClass.hCursor = 0;

View file

@ -79,7 +79,7 @@ typedef struct
BOOL NtfUnicode; /* notify format */ BOOL NtfUnicode; /* notify format */
STATUSWINDOWPART part0; /* simple window */ STATUSWINDOWPART part0; /* simple window */
STATUSWINDOWPART* parts; STATUSWINDOWPART* parts;
} STATUSWINDOWINFO; } STATUS_INFO;
/* /*
* Run tests using Waite Group Windows95 API Bible Vol. 1&2 * Run tests using Waite Group Windows95 API Bible Vol. 1&2
@ -91,11 +91,9 @@ typedef struct
#define VERT_BORDER 2 #define VERT_BORDER 2
#define HORZ_GAP 2 #define HORZ_GAP 2
#define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongPtrW (hwnd, 0))
/* prototype */ /* prototype */
static void static void
STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr); STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr);
static inline LPCSTR debugstr_t(LPCWSTR text, BOOL isW) static inline LPCSTR debugstr_t(LPCWSTR text, BOOL isW)
{ {
@ -148,7 +146,7 @@ STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect)
static void static void
STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINFO *infoPtr, int itemID) STATUSBAR_DrawPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, int itemID)
{ {
RECT r = part->bound; RECT r = part->bound;
UINT border = BDR_SUNKENOUTER; UINT border = BDR_SUNKENOUTER;
@ -189,7 +187,7 @@ STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINF
static void static void
STATUSBAR_RefreshPart (const STATUSWINDOWINFO *infoPtr, const STATUSWINDOWPART *part, HDC hdc, int itemID) STATUSBAR_RefreshPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, int itemID)
{ {
HBRUSH hbrBk; HBRUSH hbrBk;
HFONT hOldFont; HFONT hOldFont;
@ -208,7 +206,7 @@ STATUSBAR_RefreshPart (const STATUSWINDOWINFO *infoPtr, const STATUSWINDOWPART *
hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont); hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
STATUSBAR_DrawPart (hdc, part, infoPtr, itemID); STATUSBAR_DrawPart (infoPtr, hdc, part, itemID);
SelectObject (hdc, hOldFont); SelectObject (hdc, hOldFont);
@ -226,7 +224,7 @@ STATUSBAR_RefreshPart (const STATUSWINDOWINFO *infoPtr, const STATUSWINDOWPART *
static LRESULT static LRESULT
STATUSBAR_Refresh (STATUSWINDOWINFO *infoPtr, HDC hdc) STATUSBAR_Refresh (STATUS_INFO *infoPtr, HDC hdc)
{ {
int i; int i;
RECT rect; RECT rect;
@ -250,10 +248,10 @@ STATUSBAR_Refresh (STATUSWINDOWINFO *infoPtr, HDC hdc)
hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont); hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
if (infoPtr->simple) { if (infoPtr->simple) {
STATUSBAR_RefreshPart (infoPtr, &infoPtr->part0, hdc, 0); STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);
} else { } else {
for (i = 0; i < infoPtr->numParts; i++) { for (i = 0; i < infoPtr->numParts; i++) {
STATUSBAR_RefreshPart (infoPtr, &infoPtr->parts[i], hdc, i); STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);
} }
} }
@ -270,7 +268,7 @@ STATUSBAR_Refresh (STATUSWINDOWINFO *infoPtr, HDC hdc)
static void static void
STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr) STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr)
{ {
STATUSWINDOWPART *part; STATUSWINDOWPART *part;
RECT rect, *r; RECT rect, *r;
@ -315,7 +313,7 @@ STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr)
static LRESULT static LRESULT
STATUSBAR_Relay2Tip (STATUSWINDOWINFO *infoPtr, UINT uMsg, STATUSBAR_Relay2Tip (STATUS_INFO *infoPtr, UINT uMsg,
WPARAM wParam, LPARAM lParam) WPARAM wParam, LPARAM lParam)
{ {
MSG msg; MSG msg;
@ -345,7 +343,7 @@ STATUSBAR_GetBorders (INT out[])
static HICON static HICON
STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, INT nPart) STATUSBAR_GetIcon (STATUS_INFO *infoPtr, INT nPart)
{ {
TRACE("%d\n", nPart); TRACE("%d\n", nPart);
/* MSDN says: "simple parts are indexed with -1" */ /* MSDN says: "simple parts are indexed with -1" */
@ -360,7 +358,7 @@ STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, INT nPart)
static INT static INT
STATUSBAR_GetParts (STATUSWINDOWINFO *infoPtr, INT num_parts, INT parts[]) STATUSBAR_GetParts (STATUS_INFO *infoPtr, INT num_parts, INT parts[])
{ {
INT i; INT i;
@ -375,7 +373,7 @@ STATUSBAR_GetParts (STATUSWINDOWINFO *infoPtr, INT num_parts, INT parts[])
static BOOL static BOOL
STATUSBAR_GetRect (STATUSWINDOWINFO *infoPtr, INT nPart, LPRECT rect) STATUSBAR_GetRect (STATUS_INFO *infoPtr, INT nPart, LPRECT rect)
{ {
TRACE("part %d\n", nPart); TRACE("part %d\n", nPart);
if (infoPtr->simple) if (infoPtr->simple)
@ -387,7 +385,7 @@ STATUSBAR_GetRect (STATUSWINDOWINFO *infoPtr, INT nPart, LPRECT rect)
static LRESULT static LRESULT
STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, INT nPart, LPSTR buf) STATUSBAR_GetTextA (STATUS_INFO *infoPtr, INT nPart, LPSTR buf)
{ {
STATUSWINDOWPART *part; STATUSWINDOWPART *part;
LRESULT result; LRESULT result;
@ -416,7 +414,7 @@ STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, INT nPart, LPSTR buf)
static LRESULT static LRESULT
STATUSBAR_GetTextW (STATUSWINDOWINFO *infoPtr, INT nPart, LPWSTR buf) STATUSBAR_GetTextW (STATUS_INFO *infoPtr, INT nPart, LPWSTR buf)
{ {
STATUSWINDOWPART *part; STATUSWINDOWPART *part;
LRESULT result; LRESULT result;
@ -442,7 +440,7 @@ STATUSBAR_GetTextW (STATUSWINDOWINFO *infoPtr, INT nPart, LPWSTR buf)
static LRESULT static LRESULT
STATUSBAR_GetTextLength (STATUSWINDOWINFO *infoPtr, INT nPart) STATUSBAR_GetTextLength (STATUS_INFO *infoPtr, INT nPart)
{ {
STATUSWINDOWPART *part; STATUSWINDOWPART *part;
DWORD result; DWORD result;
@ -467,7 +465,7 @@ STATUSBAR_GetTextLength (STATUSWINDOWINFO *infoPtr, INT nPart)
} }
static LRESULT static LRESULT
STATUSBAR_GetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR tip, INT size) STATUSBAR_GetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR tip, INT size)
{ {
TRACE("\n"); TRACE("\n");
if (tip) { if (tip) {
@ -489,7 +487,7 @@ STATUSBAR_GetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR tip, INT size)
static LRESULT static LRESULT
STATUSBAR_GetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR tip, INT size) STATUSBAR_GetTipTextW (STATUS_INFO *infoPtr, INT id, LPWSTR tip, INT size)
{ {
TRACE("\n"); TRACE("\n");
if (tip) { if (tip) {
@ -512,7 +510,7 @@ STATUSBAR_GetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR tip, INT size)
static COLORREF static COLORREF
STATUSBAR_SetBkColor (STATUSWINDOWINFO *infoPtr, COLORREF color) STATUSBAR_SetBkColor (STATUS_INFO *infoPtr, COLORREF color)
{ {
COLORREF oldBkColor; COLORREF oldBkColor;
@ -526,7 +524,7 @@ STATUSBAR_SetBkColor (STATUSWINDOWINFO *infoPtr, COLORREF color)
static BOOL static BOOL
STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, INT nPart, HICON hIcon) STATUSBAR_SetIcon (STATUS_INFO *infoPtr, INT nPart, HICON hIcon)
{ {
if ((nPart < -1) || (nPart >= infoPtr->numParts)) if ((nPart < -1) || (nPart >= infoPtr->numParts))
return FALSE; return FALSE;
@ -553,7 +551,7 @@ STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, INT nPart, HICON hIcon)
static BOOL static BOOL
STATUSBAR_SetMinHeight (STATUSWINDOWINFO *infoPtr, INT height) STATUSBAR_SetMinHeight (STATUS_INFO *infoPtr, INT height)
{ {
TRACE("(height=%d)\n", height); TRACE("(height=%d)\n", height);
@ -577,7 +575,7 @@ STATUSBAR_SetMinHeight (STATUSWINDOWINFO *infoPtr, INT height)
static BOOL static BOOL
STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, INT count, LPINT parts) STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts)
{ {
STATUSWINDOWPART *tmp; STATUSWINDOWPART *tmp;
int i, oldNumParts; int i, oldNumParts;
@ -647,7 +645,7 @@ STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, INT count, LPINT parts)
static BOOL static BOOL
STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style, STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
LPCWSTR text, BOOL isW) LPCWSTR text, BOOL isW)
{ {
STATUSWINDOWPART *part=NULL; STATUSWINDOWPART *part=NULL;
@ -715,7 +713,7 @@ STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style,
static LRESULT static LRESULT
STATUSBAR_SetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR text) STATUSBAR_SetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR text)
{ {
TRACE("part %d: \"%s\"\n", id, text); TRACE("part %d: \"%s\"\n", id, text);
if (infoPtr->hwndToolTip) { if (infoPtr->hwndToolTip) {
@ -734,7 +732,7 @@ STATUSBAR_SetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR text)
static LRESULT static LRESULT
STATUSBAR_SetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR text) STATUSBAR_SetTipTextW (STATUS_INFO *infoPtr, INT id, LPWSTR text)
{ {
TRACE("part %d: \"%s\"\n", id, debugstr_w(text)); TRACE("part %d: \"%s\"\n", id, debugstr_w(text));
if (infoPtr->hwndToolTip) { if (infoPtr->hwndToolTip) {
@ -753,7 +751,7 @@ STATUSBAR_SetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR text)
inline static LRESULT inline static LRESULT
STATUSBAR_SetUnicodeFormat (STATUSWINDOWINFO *infoPtr, BOOL bUnicode) STATUSBAR_SetUnicodeFormat (STATUS_INFO *infoPtr, BOOL bUnicode)
{ {
BOOL bOld = infoPtr->bUnicode; BOOL bOld = infoPtr->bUnicode;
@ -765,7 +763,7 @@ STATUSBAR_SetUnicodeFormat (STATUSWINDOWINFO *infoPtr, BOOL bUnicode)
static BOOL static BOOL
STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, BOOL simple) STATUSBAR_Simple (STATUS_INFO *infoPtr, BOOL simple)
{ {
NMHDR nmhdr; NMHDR nmhdr;
@ -786,7 +784,7 @@ STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, BOOL simple)
static LRESULT static LRESULT
STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr) STATUSBAR_WMDestroy (STATUS_INFO *infoPtr)
{ {
int i; int i;
@ -816,7 +814,7 @@ STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr)
static LRESULT static LRESULT
STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate) STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
{ {
STATUSWINDOWINFO *infoPtr; STATUS_INFO *infoPtr;
NONCLIENTMETRICSW nclm; NONCLIENTMETRICSW nclm;
DWORD dwStyle; DWORD dwStyle;
RECT rect; RECT rect;
@ -824,7 +822,7 @@ STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
HDC hdc; HDC hdc;
TRACE("\n"); TRACE("\n");
infoPtr = (STATUSWINDOWINFO*)Alloc (sizeof(STATUSWINDOWINFO)); infoPtr = (STATUS_INFO*)Alloc (sizeof(STATUS_INFO));
if (!infoPtr) goto create_fail; if (!infoPtr) goto create_fail;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
@ -944,7 +942,7 @@ create_fail:
/* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text /* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text
* of the first part only (usual behaviour) */ * of the first part only (usual behaviour) */
static INT static INT
STATUSBAR_WMGetText (STATUSWINDOWINFO *infoPtr, INT size, LPWSTR buf) STATUSBAR_WMGetText (STATUS_INFO *infoPtr, INT size, LPWSTR buf)
{ {
INT len; INT len;
@ -970,7 +968,7 @@ STATUSBAR_WMGetText (STATUSWINDOWINFO *infoPtr, INT size, LPWSTR buf)
static BOOL static BOOL
STATUSBAR_WMNCHitTest (STATUSWINDOWINFO *infoPtr, INT x, INT y) STATUSBAR_WMNCHitTest (STATUS_INFO *infoPtr, INT x, INT y)
{ {
if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) { if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) {
RECT rect; RECT rect;
@ -994,7 +992,7 @@ STATUSBAR_WMNCHitTest (STATUSWINDOWINFO *infoPtr, INT x, INT y)
static LRESULT static LRESULT
STATUSBAR_WMPaint (STATUSWINDOWINFO *infoPtr, HDC hdc) STATUSBAR_WMPaint (STATUS_INFO *infoPtr, HDC hdc)
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
@ -1009,7 +1007,7 @@ STATUSBAR_WMPaint (STATUSWINDOWINFO *infoPtr, HDC hdc)
static LRESULT static LRESULT
STATUSBAR_WMSetFont (STATUSWINDOWINFO *infoPtr, HFONT font, BOOL redraw) STATUSBAR_WMSetFont (STATUS_INFO *infoPtr, HFONT font, BOOL redraw)
{ {
infoPtr->hFont = font; infoPtr->hFont = font;
TRACE("%p\n", infoPtr->hFont); TRACE("%p\n", infoPtr->hFont);
@ -1021,7 +1019,7 @@ STATUSBAR_WMSetFont (STATUSWINDOWINFO *infoPtr, HFONT font, BOOL redraw)
static BOOL static BOOL
STATUSBAR_WMSetText (STATUSWINDOWINFO *infoPtr, LPCSTR text) STATUSBAR_WMSetText (STATUS_INFO *infoPtr, LPCSTR text)
{ {
STATUSWINDOWPART *part; STATUSWINDOWPART *part;
int len; int len;
@ -1058,7 +1056,7 @@ STATUSBAR_WMSetText (STATUSWINDOWINFO *infoPtr, LPCSTR text)
static BOOL static BOOL
STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, WORD flags) STATUSBAR_WMSize (STATUS_INFO *infoPtr, WORD flags)
{ {
INT width, x, y; INT width, x, y;
RECT parent_rect; RECT parent_rect;
@ -1088,7 +1086,7 @@ STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, WORD flags)
static LRESULT static LRESULT
STATUSBAR_NotifyFormat (STATUSWINDOWINFO *infoPtr, HWND from, INT cmd) STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd)
{ {
if (cmd == NF_REQUERY) { if (cmd == NF_REQUERY) {
INT i = SendMessageW(from, WM_NOTIFYFORMAT, (WPARAM)infoPtr->Self, NF_QUERY); INT i = SendMessageW(from, WM_NOTIFYFORMAT, (WPARAM)infoPtr->Self, NF_QUERY);
@ -1099,14 +1097,13 @@ STATUSBAR_NotifyFormat (STATUSWINDOWINFO *infoPtr, HWND from, INT cmd)
static LRESULT static LRESULT
STATUSBAR_SendNotify (HWND hwnd, UINT code) STATUSBAR_SendNotify (STATUS_INFO *infoPtr, UINT code)
{ {
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd);
NMHDR nmhdr; NMHDR nmhdr;
TRACE("code %04x\n", code); TRACE("code %04x\n", code);
nmhdr.hwndFrom = hwnd; nmhdr.hwndFrom = infoPtr->Self;
nmhdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); nmhdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
nmhdr.code = code; nmhdr.code = code;
SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr); SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
return 0; return 0;
@ -1117,7 +1114,7 @@ STATUSBAR_SendNotify (HWND hwnd, UINT code)
static LRESULT WINAPI static LRESULT WINAPI
StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd); STATUS_INFO *infoPtr = (STATUS_INFO *)GetWindowLongPtrW (hwnd, 0);
INT nPart = ((INT) wParam) & 0x00ff; INT nPart = ((INT) wParam) & 0x00ff;
LRESULT res; LRESULT res;
@ -1206,10 +1203,10 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return STATUSBAR_GetTextLength (infoPtr, 0); return STATUSBAR_GetTextLength (infoPtr, 0);
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
return STATUSBAR_SendNotify (hwnd, NM_DBLCLK); return STATUSBAR_SendNotify (infoPtr, NM_DBLCLK);
case WM_LBUTTONUP: case WM_LBUTTONUP:
return STATUSBAR_SendNotify (hwnd, NM_CLICK); return STATUSBAR_SendNotify (infoPtr, NM_CLICK);
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam); return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam);
@ -1232,10 +1229,10 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return STATUSBAR_WMPaint (infoPtr, (HDC)wParam); return STATUSBAR_WMPaint (infoPtr, (HDC)wParam);
case WM_RBUTTONDBLCLK: case WM_RBUTTONDBLCLK:
return STATUSBAR_SendNotify (hwnd, NM_RDBLCLK); return STATUSBAR_SendNotify (infoPtr, NM_RDBLCLK);
case WM_RBUTTONUP: case WM_RBUTTONUP:
return STATUSBAR_SendNotify (hwnd, NM_RCLICK); return STATUSBAR_SendNotify (infoPtr, NM_RCLICK);
case WM_SETFONT: case WM_SETFONT:
return STATUSBAR_WMSetFont (infoPtr, (HFONT)wParam, LOWORD(lParam)); return STATUSBAR_WMSetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
@ -1272,7 +1269,7 @@ STATUS_Register (void)
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW; wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW;
wndClass.lpfnWndProc = StatusWindowProc; wndClass.lpfnWndProc = StatusWindowProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(STATUSWINDOWINFO *); wndClass.cbWndExtra = sizeof(STATUS_INFO *);
wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndClass.lpszClassName = STATUSCLASSNAMEW; wndClass.lpszClassName = STATUSCLASSNAMEW;

View file

@ -1478,12 +1478,10 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
case WM_SETCURSOR: case WM_SETCURSOR:
{ {
LHITTESTINFO ht; LHITTESTINFO ht;
POINTS pt;
DWORD mp = GetMessagePos(); DWORD mp = GetMessagePos();
pt = MAKEPOINTS(mp); ht.pt.x = (short)LOWORD(mp);
ht.pt.x = pt.x; ht.pt.y = (short)HIWORD(mp);
ht.pt.y = pt.y;
ScreenToClient(infoPtr->Self, &ht.pt); ScreenToClient(infoPtr->Self, &ht.pt);
if(SYSLINK_HitTest (infoPtr, &ht)) if(SYSLINK_HitTest (infoPtr, &ht))
@ -1662,7 +1660,7 @@ VOID SYSLINK_Register (void)
ZeroMemory (&wndClass, sizeof(wndClass)); ZeroMemory (&wndClass, sizeof(wndClass));
wndClass.style = CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW; wndClass.style = CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW;
wndClass.lpfnWndProc = (WNDPROC)SysLinkWindowProc; wndClass.lpfnWndProc = SysLinkWindowProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof (SYSLINK_INFO *); wndClass.cbWndExtra = sizeof (SYSLINK_INFO *);
wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);

View file

@ -1659,8 +1659,7 @@ TAB_DrawItemInterior
dis.hwndItem = hwnd; /* */ dis.hwndItem = hwnd; /* */
dis.hDC = hdc; dis.hDC = hdc;
CopyRect(&dis.rcItem,drawRect); CopyRect(&dis.rcItem,drawRect);
dis.itemData = 0; dis.itemData = (ULONG_PTR)TAB_GetItem(infoPtr, iItem)->extra;
memcpy( &dis.itemData, TAB_GetItem(infoPtr, iItem)->extra, min(sizeof(dis.itemData),infoPtr->cbInfo) );
/* /*
* send the draw message * send the draw message

View file

@ -47,11 +47,11 @@
* - TB_INSERTMARKHITTEST * - TB_INSERTMARKHITTEST
* - TB_SAVERESTORE * - TB_SAVERESTORE
* - TB_SETMETRICS * - TB_SETMETRICS
* - WM_WININICHANGE
* - Notifications: * - Notifications:
* - NM_CHAR * - NM_CHAR
* - NM_KEYDOWN * - NM_KEYDOWN
* - TBN_GETOBJECT * - TBN_GETOBJECT
* - TBN_RESTORE
* - TBN_SAVE * - TBN_SAVE
* - Button wrapping (under construction). * - Button wrapping (under construction).
* - Fix TB_SETROWS. * - Fix TB_SETROWS.
@ -73,6 +73,7 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winreg.h"
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "wine/unicode.h" #include "wine/unicode.h"
@ -157,10 +158,9 @@ typedef struct
BOOL bBtnTranspnt; /* button transparency flag */ BOOL bBtnTranspnt; /* button transparency flag */
BOOL bAutoSize; /* auto size deadlock indicator */ BOOL bAutoSize; /* auto size deadlock indicator */
BOOL bAnchor; /* anchor highlight enabled */ BOOL bAnchor; /* anchor highlight enabled */
BOOL bNtfUnicode; /* TRUE if NOTIFYs use {W} */
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 */
@ -208,6 +208,9 @@ typedef enum
#define ARROW_HEIGHT 3 #define ARROW_HEIGHT 3
#define INSERTMARK_WIDTH 2 #define INSERTMARK_WIDTH 2
#define DEFPAD_CX 7
#define DEFPAD_CY 6
/* gap between border of button and text/image */ /* gap between border of button and text/image */
#define OFFSET_X 1 #define OFFSET_X 1
#define OFFSET_Y 1 #define OFFSET_Y 1
@ -231,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)
@ -329,14 +336,10 @@ TOOLBAR_SendNotify (NMHDR *nmhdr, TOOLBAR_INFO *infoPtr, UINT code)
nmhdr->code = code; nmhdr->code = code;
TRACE("to window %p, code=%08x, %s\n", infoPtr->hwndNotify, code, TRACE("to window %p, code=%08x, %s\n", infoPtr->hwndNotify, code,
(infoPtr->bNtfUnicode) ? "via Unicode" : "via ANSI"); (infoPtr->bUnicode) ? "via Unicode" : "via ANSI");
if (infoPtr->bNtfUnicode)
return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmhdr->idFrom, (LPARAM)nmhdr); (WPARAM)nmhdr->idFrom, (LPARAM)nmhdr);
else
return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM) nmhdr->idFrom, (LPARAM)nmhdr);
} }
/*********************************************************************** /***********************************************************************
@ -351,19 +354,19 @@ TOOLBAR_GetBitmapIndex(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
{ {
INT ret = btnPtr->iBitmap; INT ret = btnPtr->iBitmap;
if (ret == I_IMAGECALLBACK) { if (ret == I_IMAGECALLBACK)
{
/* issue TBN_GETDISPINFO */ /* issue TBN_GETDISPINFO */
NMTBDISPINFOA nmgd; NMTBDISPINFOA nmgd;
memset(&nmgd, 0, sizeof(nmgd));
nmgd.idCommand = btnPtr->idCommand; nmgd.idCommand = btnPtr->idCommand;
nmgd.lParam = btnPtr->dwData; nmgd.lParam = btnPtr->dwData;
nmgd.dwMask = TBNF_IMAGE; nmgd.dwMask = TBNF_IMAGE;
TOOLBAR_SendNotify ((NMHDR *) &nmgd, infoPtr, TOOLBAR_SendNotify(&nmgd.hdr, infoPtr,
(infoPtr->bNtfUnicode) ? TBN_GETDISPINFOW : infoPtr->bUnicode ? TBN_GETDISPINFOW : TBN_GETDISPINFOA);
TBN_GETDISPINFOA); if (nmgd.dwMask & TBNF_DI_SETITEM)
if (nmgd.dwMask & TBNF_DI_SETITEM) {
btnPtr->iBitmap = nmgd.iImage; btnPtr->iBitmap = nmgd.iImage;
}
ret = nmgd.iImage; ret = nmgd.iImage;
TRACE("TBN_GETDISPINFO returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n", TRACE("TBN_GETDISPINFO returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n",
ret, nmgd.dwMask, infoPtr->nNumBitmaps); ret, nmgd.dwMask, infoPtr->nNumBitmaps);
@ -707,7 +710,7 @@ TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top
BOOL draw_masked = FALSE; BOOL draw_masked = FALSE;
INT index; INT index;
INT offset = 0; INT offset = 0;
UINT draw_flags = ILD_NORMAL; UINT draw_flags = ILD_TRANSPARENT;
if (tbcd->nmcd.uItemState & (CDIS_DISABLED | CDIS_INDETERMINATE)) if (tbcd->nmcd.uItemState & (CDIS_DISABLED | CDIS_INDETERMINATE))
{ {
@ -868,12 +871,12 @@ 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 += GetSystemMetrics(SM_CXEDGE) + OFFSET_X; rcBitmap.left += GetSystemMetrics(SM_CXEDGE);
else else
rcBitmap.left+=(infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2; rcBitmap.left+=(infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2;
if(lpText) if(lpText)
rcBitmap.top+= GetSystemMetrics(SM_CYEDGE) + OFFSET_Y; rcBitmap.top+= GetSystemMetrics(SM_CYEDGE);
else else
rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2; rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2;
@ -942,7 +945,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
tbcd.nmcd.dwDrawStage = CDDS_ITEMPREPAINT; tbcd.nmcd.dwDrawStage = CDDS_ITEMPREPAINT;
tbcd.nmcd.dwItemSpec = btnPtr->idCommand; tbcd.nmcd.dwItemSpec = btnPtr->idCommand;
tbcd.nmcd.lItemlParam = btnPtr->dwData; tbcd.nmcd.lItemlParam = btnPtr->dwData;
ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
/* reset these fields so the user can't alter the behaviour like native */ /* reset these fields so the user can't alter the behaviour like native */
tbcd.nmcd.hdc = hdc; tbcd.nmcd.hdc = hdc;
tbcd.nmcd.rc = rc; tbcd.nmcd.rc = rc;
@ -1032,7 +1035,7 @@ FINALNOTIFY:
tbcd.rcText = rcText; tbcd.rcText = rcText;
tbcd.nStringBkMode = (infoPtr->bBtnTranspnt) ? TRANSPARENT : OPAQUE; tbcd.nStringBkMode = (infoPtr->bBtnTranspnt) ? TRANSPARENT : OPAQUE;
tbcd.nHLStringBkMode = (infoPtr->bBtnTranspnt) ? TRANSPARENT : OPAQUE; tbcd.nHLStringBkMode = (infoPtr->bBtnTranspnt) ? TRANSPARENT : OPAQUE;
ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
} }
} }
@ -1068,7 +1071,7 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
tbcd.nmcd.dwDrawStage = CDDS_PREPAINT; tbcd.nmcd.dwDrawStage = CDDS_PREPAINT;
tbcd.nmcd.hdc = hdc; tbcd.nmcd.hdc = hdc;
tbcd.nmcd.rc = ps->rcPaint; tbcd.nmcd.rc = ps->rcPaint;
ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
infoPtr->dwBaseCustDraw = ntfret & 0xffff; infoPtr->dwBaseCustDraw = ntfret & 0xffff;
if (infoPtr->bBtnTranspnt) if (infoPtr->bBtnTranspnt)
@ -1117,7 +1120,7 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
tbcd.nmcd.dwDrawStage = CDDS_POSTPAINT; tbcd.nmcd.dwDrawStage = CDDS_POSTPAINT;
tbcd.nmcd.hdc = hdc; tbcd.nmcd.hdc = hdc;
tbcd.nmcd.rc = ps->rcPaint; tbcd.nmcd.rc = ps->rcPaint;
ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
} }
} }
@ -1804,7 +1807,7 @@ static void TOOLBAR_Cust_MoveButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT nInde
/* MSDN states that iItem is the index of the button, rather than the /* MSDN states that iItem is the index of the button, rather than the
* command ID as used by every other NMTOOLBAR notification */ * command ID as used by every other NMTOOLBAR notification */
nmtb.iItem = nIndexFrom; nmtb.iItem = nIndexFrom;
if (TOOLBAR_SendNotify((NMHDR *)&nmtb, custInfo->tbInfo, TBN_QUERYINSERT)) if (TOOLBAR_SendNotify(&nmtb.hdr, custInfo->tbInfo, TBN_QUERYINSERT))
{ {
PCUSTOMBUTTON btnInfo; PCUSTOMBUTTON btnInfo;
NMHDR hdr; NMHDR hdr;
@ -1845,7 +1848,7 @@ static void TOOLBAR_Cust_AddButton(PCUSTDLG_INFO custInfo, HWND hwnd, INT nIndex
/* MSDN states that iItem is the index of the button, rather than the /* MSDN states that iItem is the index of the button, rather than the
* command ID as used by every other NMTOOLBAR notification */ * command ID as used by every other NMTOOLBAR notification */
nmtb.iItem = nIndexAvail; nmtb.iItem = nIndexAvail;
if (TOOLBAR_SendNotify((NMHDR *)&nmtb, custInfo->tbInfo, TBN_QUERYINSERT)) if (TOOLBAR_SendNotify(&nmtb.hdr, custInfo->tbInfo, TBN_QUERYINSERT))
{ {
PCUSTOMBUTTON btnInfo; PCUSTOMBUTTON btnInfo;
NMHDR hdr; NMHDR hdr;
@ -2074,10 +2077,11 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* send TBN_QUERYINSERT notification */ /* send TBN_QUERYINSERT notification */
nmtb.iItem = custInfo->tbInfo->nNumButtons; nmtb.iItem = custInfo->tbInfo->nNumButtons;
if (!TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_QUERYINSERT)) if (!TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT))
return FALSE; return FALSE;
/* UNDOCUMENTED: dialog hwnd immediately follows NMHDR */ /* UNDOCUMENTED: dialog hwnd immediately follows NMHDR */
/* FIXME: this hack won't work on 64-bit - we need to declare a structure for this */
nmtb.iItem = (int)hwnd; 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) ==
@ -2222,8 +2226,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* send TBN_QUERYINSERT notification */ /* send TBN_QUERYINSERT notification */
nmtb.iItem = index; nmtb.iItem = index;
TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYINSERT);
TBN_QUERYINSERT);
/* get list box item */ /* get list box item */
btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageW (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageW (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0);
@ -3029,7 +3032,7 @@ TOOLBAR_AutoSize (HWND hwnd)
{ {
x = y = 1; x = y = 1;
cy += GetSystemMetrics(SM_CYEDGE); cy += GetSystemMetrics(SM_CYEDGE);
cx += GetSystemMetrics(SM_CYEDGE); cx += GetSystemMetrics(SM_CXEDGE);
} }
infoPtr->bAutoSize = TRUE; infoPtr->bAutoSize = TRUE;
@ -3056,12 +3059,6 @@ TOOLBAR_ButtonStructSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
if (infoPtr == NULL) {
ERR("(%p, 0x%x, 0x%lx)\n", hwnd, wParam, lParam);
ERR("infoPtr == NULL!\n");
return 0;
}
infoPtr->dwStructSize = (DWORD)wParam; infoPtr->dwStructSize = (DWORD)wParam;
return 0; return 0;
@ -3162,8 +3159,7 @@ TOOLBAR_Customize (HWND hwnd)
custInfo.tbHwnd = hwnd; custInfo.tbHwnd = hwnd;
/* send TBN_BEGINADJUST notification */ /* send TBN_BEGINADJUST notification */
TOOLBAR_SendNotify ((NMHDR *) &nmhdr, infoPtr, TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_BEGINADJUST);
TBN_BEGINADJUST);
if (!(hRes = FindResourceW (COMCTL32_hModule, if (!(hRes = FindResourceW (COMCTL32_hModule,
MAKEINTRESOURCEW(IDD_TBCUSTOMIZE), MAKEINTRESOURCEW(IDD_TBCUSTOMIZE),
@ -3180,8 +3176,7 @@ TOOLBAR_Customize (HWND hwnd)
(LPARAM)&custInfo); (LPARAM)&custInfo);
/* send TBN_ENDADJUST notification */ /* send TBN_ENDADJUST notification */
TOOLBAR_SendNotify ((NMHDR *) &nmhdr, infoPtr, TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_ENDADJUST);
TBN_ENDADJUST);
return ret; return ret;
} }
@ -3206,7 +3201,7 @@ TOOLBAR_DeleteButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
nmtb.tbButton.fsStyle = btnPtr->fsStyle; nmtb.tbButton.fsStyle = btnPtr->fsStyle;
nmtb.tbButton.dwData = btnPtr->dwData; nmtb.tbButton.dwData = btnPtr->dwData;
nmtb.tbButton.iString = btnPtr->iString; nmtb.tbButton.iString = btnPtr->iString;
TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_DELETINGBUTTON); TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_DELETINGBUTTON);
if ((infoPtr->hwndToolTip) && if ((infoPtr->hwndToolTip) &&
!(btnPtr->fsStyle & BTNS_SEP)) { !(btnPtr->fsStyle & BTNS_SEP)) {
@ -3325,9 +3320,6 @@ TOOLBAR_GetButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
INT nIndex = (INT)wParam; INT nIndex = (INT)wParam;
TBUTTON_INFO *btnPtr; TBUTTON_INFO *btnPtr;
if (infoPtr == NULL)
return FALSE;
if (lpTbb == NULL) if (lpTbb == NULL)
return FALSE; return FALSE;
@ -3356,8 +3348,6 @@ TOOLBAR_GetButtonInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
TBUTTON_INFO *btnPtr; TBUTTON_INFO *btnPtr;
INT nIndex; INT nIndex;
if (infoPtr == NULL)
return -1;
if (lpTbInfo == NULL) if (lpTbInfo == NULL)
return -1; return -1;
if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOA)) if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOA))
@ -3404,8 +3394,6 @@ TOOLBAR_GetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
TBUTTON_INFO *btnPtr; TBUTTON_INFO *btnPtr;
INT nIndex; INT nIndex;
if (infoPtr == NULL)
return -1;
if (lpTbInfo == NULL) if (lpTbInfo == NULL)
return -1; return -1;
if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOW)) if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOW))
@ -3594,8 +3582,6 @@ TOOLBAR_GetItemRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
LPRECT lpRect; LPRECT lpRect;
INT nIndex; INT nIndex;
if (infoPtr == NULL)
return FALSE;
nIndex = (INT)wParam; nIndex = (INT)wParam;
btnPtr = &infoPtr->buttons[nIndex]; btnPtr = &infoPtr->buttons[nIndex];
if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
@ -3657,8 +3643,6 @@ TOOLBAR_GetRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
LPRECT lpRect; LPRECT lpRect;
INT nIndex; INT nIndex;
if (infoPtr == NULL)
return FALSE;
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
btnPtr = &infoPtr->buttons[nIndex]; btnPtr = &infoPtr->buttons[nIndex];
if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
@ -3714,9 +3698,6 @@ TOOLBAR_GetTextRows (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
if (infoPtr == NULL)
return 0;
return infoPtr->nMaxTextRows; return infoPtr->nMaxTextRows;
} }
@ -3726,8 +3707,6 @@ TOOLBAR_GetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
if (infoPtr == NULL)
return 0;
return (LRESULT)infoPtr->hwndToolTip; return (LRESULT)infoPtr->hwndToolTip;
} }
@ -4385,64 +4364,184 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
} }
static LRESULT
TOOLBAR_SaveRestoreA (HWND hwnd, WPARAM wParam, LPARAM lParam) /* helper for TOOLBAR_SaveRestoreW */
static BOOL
TOOLBAR_Save(TOOLBAR_INFO *infoPtr, LPTBSAVEPARAMSW lpSave)
{
FIXME("save to %s %s\n", debugstr_w(lpSave->pszSubKey),
debugstr_w(lpSave->pszValueName));
return FALSE;
}
/* helper for TOOLBAR_Restore */
static void
TOOLBAR_DeleteAllButtons(TOOLBAR_INFO *infoPtr)
{
INT i;
TTTOOLINFOW ti;
ZeroMemory(&ti, sizeof(ti));
ti.cbSize = sizeof(ti);
ti.hwnd = infoPtr->hwndSelf;
for (i = 0; i < infoPtr->nNumButtons; i++)
{
if ((infoPtr->hwndToolTip) &&
!(infoPtr->buttons[i].fsStyle & BTNS_SEP))
{
ti.uId = infoPtr->buttons[i].idCommand;
SendMessageW(infoPtr->hwndToolTip, TTM_DELTOOLW, 0, (LPARAM)&ti);
}
}
Free(infoPtr->buttons);
infoPtr->buttons = NULL;
infoPtr->nNumButtons = 0;
}
/* helper for TOOLBAR_SaveRestoreW */
static BOOL
TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, LPTBSAVEPARAMSW lpSave)
{
LONG res;
HKEY hkey = NULL;
BOOL ret = FALSE;
DWORD dwType;
DWORD dwSize = 0;
NMTBRESTORE nmtbr;
/* restore toolbar information */
TRACE("restore from %s %s\n", debugstr_w(lpSave->pszSubKey),
debugstr_w(lpSave->pszValueName));
memset(&nmtbr, 0, sizeof(nmtbr));
res = RegOpenKeyExW(lpSave->hkr, lpSave->pszSubKey, 0,
KEY_QUERY_VALUE, &hkey);
if (!res)
res = RegQueryValueExW(hkey, lpSave->pszValueName, NULL, &dwType,
NULL, &dwSize);
if (!res && dwType != REG_BINARY)
res = ERROR_FILE_NOT_FOUND;
if (!res)
{
nmtbr.pData = HeapAlloc(GetProcessHeap(), 0, dwSize);
nmtbr.cbData = (UINT)dwSize;
if (!nmtbr.pData) res = ERROR_OUTOFMEMORY;
}
if (!res)
res = RegQueryValueExW(hkey, lpSave->pszValueName, NULL, &dwType,
(LPBYTE)nmtbr.pData, &dwSize);
if (!res)
{
nmtbr.pCurrent = nmtbr.pData;
nmtbr.iItem = -1;
nmtbr.cbBytesPerRecord = sizeof(DWORD);
nmtbr.cButtons = nmtbr.cbData / nmtbr.cbBytesPerRecord;
if (!TOOLBAR_SendNotify(&nmtbr.hdr, infoPtr, TBN_RESTORE))
{
INT i;
/* remove all existing buttons as this function is designed to
* restore the toolbar to a previously saved state */
TOOLBAR_DeleteAllButtons(infoPtr);
for (i = 0; i < nmtbr.cButtons; i++)
{
nmtbr.iItem = i;
nmtbr.tbButton.iBitmap = -1;
nmtbr.tbButton.fsState = 0;
nmtbr.tbButton.fsStyle = 0;
nmtbr.tbButton.idCommand = 0;
if (*nmtbr.pCurrent == (DWORD)-1)
{
/* separator */
nmtbr.tbButton.fsStyle = TBSTYLE_SEP;
nmtbr.tbButton.iBitmap = SEPARATOR_WIDTH;
}
else if (*nmtbr.pCurrent == (DWORD)-2)
/* hidden button */
nmtbr.tbButton.fsState = TBSTATE_HIDDEN;
else
nmtbr.tbButton.idCommand = (int)*nmtbr.pCurrent;
nmtbr.pCurrent++;
TOOLBAR_SendNotify(&nmtbr.hdr, infoPtr, TBN_RESTORE);
/* can't contain real string as we don't know whether
* the client put an ANSI or Unicode string in there */
if (HIWORD(nmtbr.tbButton.iString))
nmtbr.tbButton.iString = 0;
TOOLBAR_InsertButtonW(infoPtr->hwndSelf, -1,
(LPARAM)&nmtbr.tbButton);
}
/* do legacy notifications */
if (infoPtr->iVersion < 5)
{
/* FIXME: send TBN_BEGINADJUST */
FIXME("send TBN_GETBUTTONINFO for each button\n");
/* FIXME: send TBN_ENDADJUST */
}
/* remove all uninitialised buttons
* note: loop backwards to avoid having to fixup i on a
* delete */
for (i = infoPtr->nNumButtons - 1; i >= 0; i--)
if (infoPtr->buttons[i].iBitmap == -1)
TOOLBAR_DeleteButton(infoPtr->hwndSelf, i, 0);
/* only indicate success if at least one button survived */
if (infoPtr->nNumButtons > 0) ret = TRUE;
}
}
HeapFree(GetProcessHeap(), 0, nmtbr.pData);
RegCloseKey(hkey);
return ret;
}
static LRESULT
TOOLBAR_SaveRestoreW (HWND hwnd, WPARAM wParam, LPTBSAVEPARAMSW lpSave)
{ {
#if 0
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
LPTBSAVEPARAMSA lpSave = (LPTBSAVEPARAMSA)lParam;
if (lpSave == NULL) return 0; if (lpSave == NULL) return 0;
if ((BOOL)wParam) { if (wParam)
/* save toolbar information */ return TOOLBAR_Save(infoPtr, lpSave);
FIXME("save to \"%s\" \"%s\"\n", else
lpSave->pszSubKey, lpSave->pszValueName); return TOOLBAR_Restore(infoPtr, lpSave);
}
else {
/* restore toolbar information */
FIXME("restore from \"%s\" \"%s\"\n",
lpSave->pszSubKey, lpSave->pszValueName);
}
#endif
return 0;
} }
static LRESULT static LRESULT
TOOLBAR_SaveRestoreW (HWND hwnd, WPARAM wParam, LPARAM lParam) TOOLBAR_SaveRestoreA (HWND hwnd, WPARAM wParam, LPTBSAVEPARAMSA lpSave)
{ {
#if 0 TBSAVEPARAMSW SaveW;
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); int len;
LPTBSAVEPARAMSW lpSave = (LPTBSAVEPARAMSW)lParam;
if (lpSave == NULL) if (lpSave == NULL) return 0;
return 0;
if ((BOOL)wParam) { SaveW.hkr = lpSave->hkr;
/* save toolbar information */
FIXME("save to \"%s\" \"%s\"\n",
lpSave->pszSubKey, lpSave->pszValueName);
len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, NULL, 0);
SaveW.pszSubKey = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, (LPWSTR)SaveW.pszSubKey, len);
} len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, NULL, 0);
else { SaveW.pszValueName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
/* restore toolbar information */ MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, (LPWSTR)SaveW.pszValueName, len);
FIXME("restore from \"%s\" \"%s\"\n", return TOOLBAR_SaveRestoreW(hwnd, wParam, &SaveW);
lpSave->pszSubKey, lpSave->pszValueName);
}
#endif
return 0;
} }
@ -4616,6 +4715,8 @@ TOOLBAR_SetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
return FALSE; return FALSE;
} }
TRACE("%p, cx = %d, cy = %d\n", hwnd, cx, cy);
/* The documentation claims you can only change the button size before /* The documentation claims you can only change the button size before
* any button has been added. But this is wrong. * any button has been added. But this is wrong.
* WINZIP32.EXE (ver 8) calls this on one of its buttons after adding * WINZIP32.EXE (ver 8) calls this on one of its buttons after adding
@ -4638,11 +4739,6 @@ TOOLBAR_SetButtonWidth (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
if (infoPtr == NULL) {
TRACE("Toolbar not initialized yet?????\n");
return FALSE;
}
/* if setting to current values, ignore */ /* if setting to current values, ignore */
if ((infoPtr->cxMin == (INT)LOWORD(lParam)) && if ((infoPtr->cxMin == (INT)LOWORD(lParam)) &&
(infoPtr->cxMax == (INT)HIWORD(lParam))) { (infoPtr->cxMax == (INT)HIWORD(lParam))) {
@ -4824,7 +4920,7 @@ TOOLBAR_SetHotItemEx (TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReason)
else else
nmhotitem.dwFlags |= HICF_LEAVING; nmhotitem.dwFlags |= HICF_LEAVING;
no_highlight = TOOLBAR_SendNotify((NMHDR*)&nmhotitem, infoPtr, TBN_HOTITEMCHANGE); no_highlight = TOOLBAR_SendNotify(&nmhotitem.hdr, infoPtr, TBN_HOTITEMCHANGE);
/* now invalidate the old and new buttons so they will be painted */ /* now invalidate the old and new buttons so they will be painted */
if (oldBtnPtr) if (oldBtnPtr)
@ -4879,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);
@ -4960,9 +5061,6 @@ TOOLBAR_SetMaxTextRows (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
if (infoPtr == NULL)
return FALSE;
infoPtr->nMaxTextRows = (INT)wParam; infoPtr->nMaxTextRows = (INT)wParam;
TOOLBAR_CalcToolbar(hwnd); TOOLBAR_CalcToolbar(hwnd);
@ -5003,8 +5101,6 @@ TOOLBAR_SetParent (HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE("\n"); TRACE("\n");
if (infoPtr == NULL)
return 0;
hwndOldNotify = infoPtr->hwndNotify; hwndOldNotify = infoPtr->hwndNotify;
infoPtr->hwndNotify = (HWND)wParam; infoPtr->hwndNotify = (HWND)wParam;
@ -5095,8 +5191,6 @@ TOOLBAR_SetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE("hwnd=%p, hwndTooltip=%p, lParam=0x%lx\n", hwnd, (HWND)wParam, lParam); TRACE("hwnd=%p, hwndTooltip=%p, lParam=0x%lx\n", hwnd, (HWND)wParam, lParam);
if (infoPtr == NULL)
return 0;
infoPtr->hwndToolTip = (HWND)wParam; infoPtr->hwndToolTip = (HWND)wParam;
return 0; return 0;
} }
@ -5370,7 +5464,6 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nOldHit = -1; infoPtr->nOldHit = -1;
infoPtr->nHotItem = -1; infoPtr->nHotItem = -1;
infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent; infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
infoPtr->bUnicode = IsWindowUnicode (infoPtr->hwndNotify);
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_END_ELLIPSIS: DT_CENTER | DT_END_ELLIPSIS; infoPtr->dwDTFlags = (dwStyle & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS: DT_CENTER | DT_END_ELLIPSIS;
infoPtr->bAnchor = FALSE; /* no anchor highlighting */ infoPtr->bAnchor = FALSE; /* no anchor highlighting */
@ -5380,15 +5473,14 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->bDoRedraw = TRUE; infoPtr->bDoRedraw = TRUE;
infoPtr->clrBtnHighlight = CLR_DEFAULT; infoPtr->clrBtnHighlight = CLR_DEFAULT;
infoPtr->clrBtnShadow = CLR_DEFAULT; infoPtr->clrBtnShadow = CLR_DEFAULT;
/* not sure where the +1 comes from, but this comes to the same value infoPtr->szPadding.cx = DEFPAD_CX;
* as native so this is probably correct */ infoPtr->szPadding.cy = DEFPAD_CY;
infoPtr->szPadding.cx = 2*(GetSystemMetrics(SM_CXEDGE)+OFFSET_X) + 1;
infoPtr->szPadding.cy = 2*(GetSystemMetrics(SM_CYEDGE)+OFFSET_Y);
infoPtr->iListGap = infoPtr->szPadding.cx / 2; infoPtr->iListGap = infoPtr->szPadding.cx / 2;
infoPtr->dwStyle = dwStyle; infoPtr->dwStyle = dwStyle;
infoPtr->tbim.iButton = -1; infoPtr->tbim.iButton = -1;
GetClientRect(hwnd, &infoPtr->client_rect); GetClientRect(hwnd, &infoPtr->client_rect);
TOOLBAR_NotifyFormat(infoPtr, (WPARAM)hwnd, (LPARAM)NF_REQUERY); infoPtr->bUnicode = infoPtr->hwndNotify &&
(NFR_UNICODE == SendMessageW(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_REQUERY));
SystemParametersInfoA (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); SystemParametersInfoA (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectA (&logFont); infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectA (&logFont);
@ -5402,13 +5494,13 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
hwnd, 0, 0, 0); hwnd, 0, 0, 0);
/* Send NM_TOOLTIPSCREATED notification */ /* Send NM_TOOLTIPSCREATED notification */
if (infoPtr->hwndToolTip) { if (infoPtr->hwndToolTip)
{
NMTOOLTIPSCREATED nmttc; NMTOOLTIPSCREATED nmttc;
nmttc.hwndToolTips = infoPtr->hwndToolTip; nmttc.hwndToolTips = infoPtr->hwndToolTip;
TOOLBAR_SendNotify ((NMHDR *) &nmttc, infoPtr, TOOLBAR_SendNotify (&nmttc.hdr, infoPtr, NM_TOOLTIPSCREATED);
NM_TOOLTIPSCREATED);
} }
} }
@ -5483,7 +5575,7 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW)); ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
tbcd.nmcd.dwDrawStage = CDDS_PREERASE; tbcd.nmcd.dwDrawStage = CDDS_PREERASE;
tbcd.nmcd.hdc = (HDC)wParam; tbcd.nmcd.hdc = (HDC)wParam;
ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); ntfret = TOOLBAR_SendNotify (&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
infoPtr->dwBaseCustDraw = ntfret & 0xffff; infoPtr->dwBaseCustDraw = ntfret & 0xffff;
/* FIXME: in general the return flags *can* be or'ed together */ /* FIXME: in general the return flags *can* be or'ed together */
@ -5523,7 +5615,7 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW)); ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
tbcd.nmcd.dwDrawStage = CDDS_POSTERASE; tbcd.nmcd.dwDrawStage = CDDS_POSTERASE;
tbcd.nmcd.hdc = (HDC)wParam; tbcd.nmcd.hdc = (HDC)wParam;
ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); ntfret = TOOLBAR_SendNotify (&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
infoPtr->dwBaseCustDraw = ntfret & 0xffff; infoPtr->dwBaseCustDraw = ntfret & 0xffff;
switch (infoPtr->dwBaseCustDraw) switch (infoPtr->dwBaseCustDraw)
{ {
@ -5632,11 +5724,9 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
RedrawWindow(hwnd,&btnPtr->rect,0, RedrawWindow(hwnd,&btnPtr->rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
memset(&nmtb, 0, sizeof(nmtb));
nmtb.iItem = btnPtr->idCommand; nmtb.iItem = btnPtr->idCommand;
memset(&nmtb.tbButton, 0, sizeof(TBBUTTON)); nmtb.rcButton = btnPtr->rect;
nmtb.cchText = 0;
nmtb.pszText = 0;
CopyRect(&nmtb.rcButton, &btnPtr->rect);
res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
TBN_DROPDOWN); TBN_DROPDOWN);
TRACE("TBN_DROPDOWN responded with %ld\n", res); TRACE("TBN_DROPDOWN responded with %ld\n", res);
@ -5686,22 +5776,15 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (nHit >=0) if (nHit >=0)
{ {
memset(&nmtb, 0, sizeof(nmtb));
nmtb.iItem = btnPtr->idCommand; nmtb.iItem = btnPtr->idCommand;
nmtb.tbButton.iBitmap = btnPtr->iBitmap;
nmtb.tbButton.idCommand = btnPtr->idCommand;
nmtb.tbButton.fsState = btnPtr->fsState;
nmtb.tbButton.fsStyle = btnPtr->fsStyle;
nmtb.tbButton.dwData = btnPtr->dwData;
nmtb.tbButton.iString = btnPtr->iString;
nmtb.cchText = 0; /* !!! not correct */
nmtb.pszText = 0; /* !!! not correct */
TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG); TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG);
} }
nmmouse.dwHitInfo = nHit; nmmouse.dwHitInfo = nHit;
/* !!! Undocumented - sends NM_LDOWN with the NMMOUSE structure. */ /* !!! Undocumented - sends NM_LDOWN with the NMMOUSE structure. */
if (nmmouse.dwHitInfo < 0) if (nHit < 0)
nmmouse.dwItemSpec = -1; nmmouse.dwItemSpec = -1;
else else
{ {
@ -5712,7 +5795,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
ClientToScreen(hwnd, &pt); ClientToScreen(hwnd, &pt);
nmmouse.pt = pt; nmmouse.pt = pt;
if (!TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_LDOWN)) if (!TOOLBAR_SendNotify(&nmmouse.hdr, infoPtr, NM_LDOWN))
return DefWindowProcW(hwnd, WM_LBUTTONDOWN, wParam, lParam); return DefWindowProcW(hwnd, WM_LBUTTONDOWN, wParam, lParam);
return 0; return 0;
@ -5847,15 +5930,8 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* native issues TBN_ENDDRAG here, if _LBUTTONDOWN issued the /* native issues TBN_ENDDRAG here, if _LBUTTONDOWN issued the
* TBN_BEGINDRAG * TBN_BEGINDRAG
*/ */
memset(&nmtb, 0, sizeof(nmtb));
nmtb.iItem = btnPtr->idCommand; nmtb.iItem = btnPtr->idCommand;
nmtb.tbButton.iBitmap = btnPtr->iBitmap;
nmtb.tbButton.idCommand = btnPtr->idCommand;
nmtb.tbButton.fsState = btnPtr->fsState;
nmtb.tbButton.fsStyle = btnPtr->fsStyle;
nmtb.tbButton.dwData = btnPtr->dwData;
nmtb.tbButton.iString = btnPtr->iString;
nmtb.cchText = 0; /* !!! not correct */
nmtb.pszText = 0; /* !!! not correct */
TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
TBN_ENDDRAG); TBN_ENDDRAG);
@ -5891,16 +5967,17 @@ static LRESULT
TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam) TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
INT nHit;
NMMOUSE nmmouse; NMMOUSE nmmouse;
POINT pt; POINT pt;
pt.x = LOWORD(lParam); pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam); pt.y = HIWORD(lParam);
nmmouse.dwHitInfo = TOOLBAR_InternalHitTest(hwnd, &pt); nHit = TOOLBAR_InternalHitTest(hwnd, &pt);
nmmouse.dwHitInfo = nHit;
if (nmmouse.dwHitInfo < 0) { if (nHit < 0) {
nmmouse.dwItemSpec = -1; nmmouse.dwItemSpec = -1;
} else { } else {
nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand; nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand;
@ -6207,7 +6284,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
if (index < 0) if (index < 0)
return 0; return 0;
if (infoPtr->bNtfUnicode) if (infoPtr->bUnicode)
{ {
WCHAR wszBuffer[INFOTIPSIZE+1]; WCHAR wszBuffer[INFOTIPSIZE+1];
NMTBGETINFOTIPW tbgit; NMTBGETINFOTIPW tbgit;
@ -6362,7 +6439,7 @@ TOOLBAR_Notify (HWND hwnd, WPARAM wParam, LPARAM lParam)
return TOOLBAR_TTGetDispInfo(infoPtr, (LPNMTTDISPINFOW)lParam); return TOOLBAR_TTGetDispInfo(infoPtr, (LPNMTTDISPINFOW)lParam);
case TTN_GETDISPINFOA: case TTN_GETDISPINFOA:
FIXME("TTN_GETDISPINFOA - stub\n"); FIXME("TTN_GETDISPINFOA - should not be received; please report\n");
return 0; return 0;
default: default:
@ -6371,39 +6448,27 @@ TOOLBAR_Notify (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT
TOOLBAR_NotifyFormatFake(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
/* remove this routine when Toolbar is improved to pass infoPtr
* around instead of hwnd.
*/
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
return TOOLBAR_NotifyFormat(infoPtr, wParam, lParam);
}
static LRESULT static LRESULT
TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{ {
INT i; LRESULT format;
TRACE("wParam = 0x%x, lParam = 0x%08lx\n", wParam, lParam); TRACE("wParam = 0x%x, lParam = 0x%08lx\n", wParam, lParam);
if ((lParam == NF_QUERY) && ((HWND)wParam == infoPtr->hwndToolTip)) if (lParam == NF_QUERY)
return NFR_UNICODE; return NFR_UNICODE;
if (lParam == NF_REQUERY) { if (lParam == NF_REQUERY) {
i = SendMessageW(infoPtr->hwndNotify, format = SendMessageW(infoPtr->hwndNotify,
WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY); WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { if ((format != NFR_ANSI) && (format != NFR_UNICODE)) {
ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", ERR("wrong response to WM_NOTIFYFORMAT (%ld), assuming ANSI\n",
i); format);
i = NFR_ANSI; format = NFR_ANSI;
} }
infoPtr->bNtfUnicode = (i == NFR_UNICODE) ? 1 : 0; return format;
return (LRESULT)i;
} }
return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI); return 0;
} }
@ -6541,7 +6606,7 @@ TOOLBAR_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
x = y = 1; x = y = 1;
cy += GetSystemMetrics(SM_CYEDGE); cy += GetSystemMetrics(SM_CYEDGE);
cx += GetSystemMetrics(SM_CYEDGE); cx += GetSystemMetrics(SM_CXEDGE);
} }
if(infoPtr->dwExStyle & TBSTYLE_EX_HIDECLIPPEDBUTTONS) if(infoPtr->dwExStyle & TBSTYLE_EX_HIDECLIPPEDBUTTONS)
@ -6597,13 +6662,13 @@ 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);
@ -6611,13 +6676,15 @@ TOOLBAR_StyleChanged (HWND hwnd, INT nType, LPSTYLESTRUCT lpStyle)
TRACE("new style 0x%08lx\n", lpStyle->styleNew); TRACE("new style 0x%08lx\n", lpStyle->styleNew);
infoPtr->dwStyle = lpStyle->styleNew; infoPtr->dwStyle = lpStyle->styleNew;
}
TOOLBAR_CalcToolbar(hwnd);
/* only resize if one of the CCS_* styles was changed */
if ((infoPtr->dwStyle ^ lpStyle->styleNew) & COMMON_STYLES)
{
TOOLBAR_AutoSize (hwnd); TOOLBAR_AutoSize (hwnd);
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
}
}
return 0; return 0;
} }
@ -6641,7 +6708,7 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
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);
if (!TOOLBAR_GetInfoPtr(hwnd) && (uMsg != WM_NCCREATE)) if (!infoPtr && (uMsg != WM_NCCREATE))
return DefWindowProcW( hwnd, uMsg, wParam, lParam ); return DefWindowProcW( hwnd, uMsg, wParam, lParam );
switch (uMsg) switch (uMsg)
@ -6829,10 +6896,10 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TOOLBAR_ReplaceBitmap (hwnd, wParam, lParam); return TOOLBAR_ReplaceBitmap (hwnd, wParam, lParam);
case TB_SAVERESTOREA: case TB_SAVERESTOREA:
return TOOLBAR_SaveRestoreA (hwnd, wParam, lParam); return TOOLBAR_SaveRestoreA (hwnd, wParam, (LPTBSAVEPARAMSA)lParam);
case TB_SAVERESTOREW: case TB_SAVERESTOREW:
return TOOLBAR_SaveRestoreW (hwnd, wParam, lParam); return TOOLBAR_SaveRestoreW (hwnd, wParam, (LPTBSAVEPARAMSW)lParam);
case TB_SETANCHORHIGHLIGHT: case TB_SETANCHORHIGHLIGHT:
return TOOLBAR_SetAnchorHighlight (hwnd, wParam); return TOOLBAR_SetAnchorHighlight (hwnd, wParam);
@ -6998,7 +7065,7 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TOOLBAR_Notify (hwnd, wParam, lParam); return TOOLBAR_Notify (hwnd, wParam, lParam);
case WM_NOTIFYFORMAT: case WM_NOTIFYFORMAT:
return TOOLBAR_NotifyFormatFake (hwnd, wParam, lParam); return TOOLBAR_NotifyFormat (infoPtr, wParam, lParam);
case WM_PAINT: case WM_PAINT:
return TOOLBAR_Paint (hwnd, wParam); return TOOLBAR_Paint (hwnd, wParam);
@ -7145,7 +7212,7 @@ static HIMAGELIST TOOLBAR_GetImageList(PIMLENTRY *pies, INT cies, INT id)
static BOOL TOOLBAR_GetButtonInfo(TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb) static BOOL TOOLBAR_GetButtonInfo(TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
{ {
if (infoPtr->bUnicode) if (infoPtr->bUnicode)
return TOOLBAR_SendNotify ((NMHDR *) nmtb, infoPtr, TBN_GETBUTTONINFOW); return TOOLBAR_SendNotify(&nmtb->hdr, infoPtr, TBN_GETBUTTONINFOW);
else else
{ {
CHAR Buffer[256]; CHAR Buffer[256];
@ -7157,7 +7224,7 @@ static BOOL TOOLBAR_GetButtonInfo(TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
nmtba.cchText = 256; nmtba.cchText = 256;
ZeroMemory(nmtba.pszText, nmtba.cchText); ZeroMemory(nmtba.pszText, nmtba.cchText);
if (TOOLBAR_SendNotify ((NMHDR *) &nmtba, infoPtr, TBN_GETBUTTONINFOA)) if (TOOLBAR_SendNotify(&nmtba.hdr, infoPtr, TBN_GETBUTTONINFOA))
{ {
int ccht = strlen(nmtba.pszText); int ccht = strlen(nmtba.pszText);
if (ccht) if (ccht)

View file

@ -1927,16 +1927,25 @@ TOOLTIPS_SetTitleA (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd); TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
LPCSTR pszTitle = (LPCSTR)lParam; LPCSTR pszTitle = (LPCSTR)lParam;
UINT uTitleIcon = (UINT)wParam; UINT_PTR uTitleIcon = (UINT_PTR)wParam;
UINT size; UINT size;
TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, pszTitle, (void*)uTitleIcon); TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, debugstr_a(pszTitle),
(void*)uTitleIcon);
Free(infoPtr->pszTitle);
if (pszTitle)
{
size = sizeof(WCHAR)*MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, NULL, 0); size = sizeof(WCHAR)*MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, NULL, 0);
infoPtr->pszTitle = Alloc(size); infoPtr->pszTitle = Alloc(size);
if (!infoPtr->pszTitle) if (!infoPtr->pszTitle)
return FALSE; return FALSE;
MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, infoPtr->pszTitle, size/sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, pszTitle, -1, infoPtr->pszTitle, size/sizeof(WCHAR));
}
else
infoPtr->pszTitle = NULL;
if (uTitleIcon <= TTI_ERROR) if (uTitleIcon <= TTI_ERROR)
infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon]; infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon];
else else
@ -1951,16 +1960,25 @@ TOOLTIPS_SetTitleW (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd); TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
LPCWSTR pszTitle = (LPCWSTR)lParam; LPCWSTR pszTitle = (LPCWSTR)lParam;
UINT uTitleIcon = (UINT)wParam; UINT_PTR uTitleIcon = (UINT_PTR)wParam;
UINT size; UINT size;
TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, debugstr_w(pszTitle), (void*)uTitleIcon); TRACE("hwnd = %p, title = %s, icon = %p\n", hwnd, debugstr_w(pszTitle),
(void*)uTitleIcon);
Free(infoPtr->pszTitle);
if (pszTitle)
{
size = (strlenW(pszTitle)+1)*sizeof(WCHAR); size = (strlenW(pszTitle)+1)*sizeof(WCHAR);
infoPtr->pszTitle = Alloc(size); infoPtr->pszTitle = Alloc(size);
if (!infoPtr->pszTitle) if (!infoPtr->pszTitle)
return FALSE; return FALSE;
memcpy(infoPtr->pszTitle, pszTitle, size); memcpy(infoPtr->pszTitle, pszTitle, size);
}
else
infoPtr->pszTitle = NULL;
if (uTitleIcon <= TTI_ERROR) if (uTitleIcon <= TTI_ERROR)
infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon]; infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon];
else else

View file

@ -1418,9 +1418,12 @@ TRACKBAR_KillFocus (TRACKBAR_INFO *infoPtr, HWND hwndGetFocus)
} }
static LRESULT static LRESULT
TRACKBAR_LButtonDown (TRACKBAR_INFO *infoPtr, DWORD fwKeys, POINTS pts) TRACKBAR_LButtonDown (TRACKBAR_INFO *infoPtr, DWORD fwKeys, INT x, INT y)
{ {
POINT clickPoint = { pts.x, pts.y }; POINT clickPoint;
clickPoint.x = x;
clickPoint.y = y;
SetFocus(infoPtr->hwndSelf); SetFocus(infoPtr->hwndSelf);
@ -1444,7 +1447,7 @@ TRACKBAR_LButtonDown (TRACKBAR_INFO *infoPtr, DWORD fwKeys, POINTS pts)
static LRESULT static LRESULT
TRACKBAR_LButtonUp (TRACKBAR_INFO *infoPtr, DWORD fwKeys, POINTS pts) TRACKBAR_LButtonUp (TRACKBAR_INFO *infoPtr, DWORD fwKeys, INT x, INT y)
{ {
if (infoPtr->flags & TB_DRAG_MODE) { if (infoPtr->flags & TB_DRAG_MODE) {
notify_with_scroll (infoPtr, TB_THUMBPOSITION | (infoPtr->lPos<<16)); notify_with_scroll (infoPtr, TB_THUMBPOSITION | (infoPtr->lPos<<16));
@ -1526,17 +1529,18 @@ TRACKBAR_Timer (TRACKBAR_INFO *infoPtr, INT wTimerID, TIMERPROC *tmrpc)
static LRESULT static LRESULT
TRACKBAR_MouseMove (TRACKBAR_INFO *infoPtr, DWORD fwKeys, POINTS pts) TRACKBAR_MouseMove (TRACKBAR_INFO *infoPtr, DWORD fwKeys, INT x, INT y)
{ {
DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE); DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
INT clickPlace = (dwStyle & TBS_VERT) ? pts.y : pts.x; INT clickPlace = (dwStyle & TBS_VERT) ? y : x;
LONG dragPos, oldPos = infoPtr->lPos; LONG dragPos, oldPos = infoPtr->lPos;
TRACE("(x=%d. y=%d)\n", pts.x, pts.y); TRACE("(x=%d. y=%d)\n", x, y);
if (infoPtr->flags & TB_AUTO_PAGE) { if (infoPtr->flags & TB_AUTO_PAGE) {
POINT pt; POINT pt;
POINTSTOPOINT(pt, pts); pt.x = x;
pt.y = y;
TRACKBAR_AutoPage (infoPtr, pt); TRACKBAR_AutoPage (infoPtr, pt);
return TRUE; return TRUE;
} }
@ -1778,13 +1782,13 @@ TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TRACKBAR_KillFocus (infoPtr, (HWND)wParam); return TRACKBAR_KillFocus (infoPtr, (HWND)wParam);
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
return TRACKBAR_LButtonDown (infoPtr, wParam, MAKEPOINTS(lParam)); return TRACKBAR_LButtonDown (infoPtr, wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
case WM_LBUTTONUP: case WM_LBUTTONUP:
return TRACKBAR_LButtonUp (infoPtr, wParam, MAKEPOINTS(lParam)); return TRACKBAR_LButtonUp (infoPtr, wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
return TRACKBAR_MouseMove (infoPtr, wParam, MAKEPOINTS(lParam)); return TRACKBAR_MouseMove (infoPtr, wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
case WM_PAINT: case WM_PAINT:
return TRACKBAR_Paint (infoPtr, (HDC)wParam); return TRACKBAR_Paint (infoPtr, (HDC)wParam);

View file

@ -130,6 +130,7 @@ typedef struct tagTREEVIEW_INFO
COLORREF clrLine; COLORREF clrLine;
COLORREF clrInsertMark; COLORREF clrInsertMark;
HFONT hFont; HFONT hFont;
HFONT hDefaultFont;
HFONT hBoldFont; HFONT hBoldFont;
HWND hwndToolTip; HWND hwndToolTip;
@ -255,11 +256,11 @@ TREEVIEW_ValidItem(TREEVIEW_INFO *infoPtr, HTREEITEM handle)
static HFONT static HFONT
TREEVIEW_CreateBoldFont(HFONT hOrigFont) TREEVIEW_CreateBoldFont(HFONT hOrigFont)
{ {
LOGFONTA font; LOGFONTW font;
GetObjectA(hOrigFont, sizeof(font), &font); GetObjectW(hOrigFont, sizeof(font), &font);
font.lfWeight = FW_BOLD; font.lfWeight = FW_BOLD;
return CreateFontIndirectA(&font); return CreateFontIndirectW(&font);
} }
static inline HFONT static inline HFONT
@ -1809,7 +1810,7 @@ TREEVIEW_SetFont(TREEVIEW_INFO *infoPtr, HFONT hFont, BOOL bRedraw)
TRACE("%p %i\n", hFont, bRedraw); TRACE("%p %i\n", hFont, bRedraw);
infoPtr->hFont = hFont ? hFont : GetStockObject(SYSTEM_FONT); infoPtr->hFont = hFont ? hFont : infoPtr->hDefaultFont;
DeleteObject(infoPtr->hBoldFont); DeleteObject(infoPtr->hBoldFont);
infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont); infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
@ -2328,7 +2329,7 @@ TREEVIEW_DrawItemLines(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item)
SelectObject(hdc, hOldPen); SelectObject(hdc, hOldPen);
DeleteObject(hNewPen); DeleteObject(hNewPen);
if (height < 32 || width < 32) if (height < 18 || width < 18)
{ {
MoveToEx(hdc, centerx - plussize + 1, centery, NULL); MoveToEx(hdc, centerx - plussize + 1, centery, NULL);
LineTo(hdc, centerx + plussize, centery); LineTo(hdc, centerx + plussize, centery);
@ -4684,6 +4685,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
static const WCHAR szDisplayW[] = { 'D','I','S','P','L','A','Y','\0' }; static const WCHAR szDisplayW[] = { 'D','I','S','P','L','A','Y','\0' };
RECT rcClient; RECT rcClient;
TREEVIEW_INFO *infoPtr; TREEVIEW_INFO *infoPtr;
LOGFONTW lf;
TRACE("wnd %p, style %lx\n", hwnd, GetWindowLongW(hwnd, GWL_STYLE)); TRACE("wnd %p, style %lx\n", hwnd, GetWindowLongW(hwnd, GWL_STYLE));
@ -4749,7 +4751,8 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr->items = DPA_Create(16); infoPtr->items = DPA_Create(16);
infoPtr->hFont = GetStockObject(DEFAULT_GUI_FONT); SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0);
infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW(&lf);
infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont); infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr); infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr);
@ -4839,6 +4842,7 @@ TREEVIEW_Destroy(TREEVIEW_INFO *infoPtr)
/* Deassociate treeview from the window before doing anything drastic. */ /* Deassociate treeview from the window before doing anything drastic. */
SetWindowLongPtrW(infoPtr->hwnd, 0, (DWORD_PTR)NULL); SetWindowLongPtrW(infoPtr->hwnd, 0, (DWORD_PTR)NULL);
DeleteObject(infoPtr->hDefaultFont);
DeleteObject(infoPtr->hBoldFont); DeleteObject(infoPtr->hBoldFont);
Free(infoPtr); Free(infoPtr);
@ -5399,7 +5403,7 @@ TREEVIEW_Register(void)
ZeroMemory(&wndClass, sizeof(WNDCLASSA)); ZeroMemory(&wndClass, sizeof(WNDCLASSA));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
wndClass.lpfnWndProc = (WNDPROC)TREEVIEW_WindowProc; wndClass.lpfnWndProc = TREEVIEW_WindowProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(TREEVIEW_INFO *); wndClass.cbWndExtra = sizeof(TREEVIEW_INFO *);

View file

@ -92,12 +92,12 @@ typedef struct
#define TIMER_ACCEL 2 #define TIMER_ACCEL 2
#define TIMER_AUTOPRESS 3 #define TIMER_AUTOPRESS 3
#define BUDDY_UPDOWN_HWND "buddyUpDownHWND"
#define BUDDY_SUPERCLASS_WNDPROC "buddySupperClassWndProc"
#define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO *)GetWindowLongPtrW (hwnd,0)) #define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO *)GetWindowLongPtrW (hwnd,0))
#define COUNT_OF(a) (sizeof(a)/sizeof(a[0])) #define COUNT_OF(a) (sizeof(a)/sizeof(a[0]))
static const WCHAR BUDDY_UPDOWN_HWND[] = { 'b', 'u', 'd', 'd', 'y', 'U', 'p', 'D', 'o', 'w', 'n', 'H', 'W', 'N', 'D', 0 };
static const WCHAR BUDDY_SUPERCLASS_WNDPROC[] = { 'b', 'u', 'd', 'd', 'y', 'S', 'u', 'p', 'p', 'e', 'r',
'C', 'l', 'a', 's', 's', 'W', 'n', 'd', 'P', 'r', 'o', 'c', 0 };
static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action); static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action);
/*********************************************************************** /***********************************************************************
@ -427,12 +427,13 @@ static LRESULT UPDOWN_KeyPressed(UPDOWN_INFO *infoPtr, int key)
static LRESULT CALLBACK static LRESULT CALLBACK
UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WNDPROC superClassWndProc = (WNDPROC)GetPropA(hwnd, BUDDY_SUPERCLASS_WNDPROC); WNDPROC superClassWndProc = (WNDPROC)GetPropW(hwnd, BUDDY_SUPERCLASS_WNDPROC);
TRACE("hwnd=%p, wndProc=%d, uMsg=%04x, wParam=%d, lParam=%d\n",
hwnd, (INT)superClassWndProc, uMsg, wParam, (UINT)lParam); TRACE("hwnd=%p, wndProc=%p, uMsg=%04x, wParam=%08x, lParam=%08lx\n",
hwnd, superClassWndProc, uMsg, wParam, lParam);
if (uMsg == WM_KEYDOWN) { if (uMsg == WM_KEYDOWN) {
HWND upDownHwnd = GetPropA(hwnd, BUDDY_UPDOWN_HWND); HWND upDownHwnd = GetPropW(hwnd, BUDDY_UPDOWN_HWND);
UPDOWN_KeyPressed(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam); UPDOWN_KeyPressed(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam);
} }
@ -452,11 +453,13 @@ UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
*/ */
static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud) static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
{ {
static const WCHAR editW[] = { 'E', 'd', 'i', 't', 0 };
static const WCHAR listboxW[] = { 'L', 'i', 's', 't', 'b', 'o', 'x', 0 };
DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
RECT budRect; /* new coord for the buddy */ RECT budRect; /* new coord for the buddy */
int x, width; /* new x position and width for the up-down */ int x, width; /* new x position and width for the up-down */
WNDPROC baseWndProc; WNDPROC baseWndProc;
CHAR buddyClass[40]; WCHAR buddyClass[40];
HWND ret; HWND ret;
TRACE("(hwnd=%p, bud=%p)\n", infoPtr->Self, bud); TRACE("(hwnd=%p, bud=%p)\n", infoPtr->Self, bud);
@ -464,7 +467,7 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
ret = infoPtr->Buddy; ret = infoPtr->Buddy;
/* there is already a body assigned */ /* there is already a body assigned */
if (infoPtr->Buddy) RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND); if (infoPtr->Buddy) RemovePropW(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
if(!IsWindow(bud)) if(!IsWindow(bud))
bud = 0; bud = 0;
@ -475,14 +478,14 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
if(bud) { if(bud) {
/* keep upDown ctrl hwnd in a buddy property */ /* keep upDown ctrl hwnd in a buddy property */
SetPropA( bud, BUDDY_UPDOWN_HWND, infoPtr->Self); SetPropW( bud, BUDDY_UPDOWN_HWND, infoPtr->Self);
/* Store buddy window class type */ /* Store buddy window class type */
infoPtr->BuddyType = BUDDY_TYPE_UNKNOWN; infoPtr->BuddyType = BUDDY_TYPE_UNKNOWN;
if (GetClassNameA(bud, buddyClass, COUNT_OF(buddyClass))) { if (GetClassNameW(bud, buddyClass, COUNT_OF(buddyClass))) {
if (lstrcmpiA(buddyClass, "Edit") == 0) if (lstrcmpiW(buddyClass, editW) == 0)
infoPtr->BuddyType = BUDDY_TYPE_EDIT; infoPtr->BuddyType = BUDDY_TYPE_EDIT;
else if (lstrcmpiA(buddyClass, "Listbox") == 0) else if (lstrcmpiW(buddyClass, listboxW) == 0)
infoPtr->BuddyType = BUDDY_TYPE_LISTBOX; infoPtr->BuddyType = BUDDY_TYPE_LISTBOX;
} }
@ -490,9 +493,9 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
/* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property /* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property
when we reset the upDown ctrl buddy to another buddy because it is not when we reset the upDown ctrl buddy to another buddy because it is not
good to break the window proc chain. */ good to break the window proc chain. */
if (!GetPropA(bud, BUDDY_SUPERCLASS_WNDPROC)) { if (!GetPropW(bud, BUDDY_SUPERCLASS_WNDPROC)) {
baseWndProc = (WNDPROC)SetWindowLongPtrW(bud, GWLP_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc); baseWndProc = (WNDPROC)SetWindowLongPtrW(bud, GWLP_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc);
SetPropA(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc); SetPropW(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc);
} }
} }
@ -508,7 +511,8 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
budRect.right -= DEFAULT_WIDTH + DEFAULT_XSEP; budRect.right -= DEFAULT_WIDTH + DEFAULT_XSEP;
x = budRect.right+DEFAULT_XSEP; x = budRect.right+DEFAULT_XSEP;
} else { } else {
x = budRect.right+DEFAULT_XSEP; /* nothing to do */
return ret;
} }
/* first adjust the buddy to accommodate the up/down */ /* first adjust the buddy to accommodate the up/down */
@ -533,7 +537,7 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
x -= DEFAULT_BUDDYBORDER; x -= DEFAULT_BUDDYBORDER;
} }
SetWindowPos(infoPtr->Self, infoPtr->Buddy, x, SetWindowPos(infoPtr->Self, 0, x,
budRect.top - DEFAULT_ADDTOP, width, budRect.top - DEFAULT_ADDTOP, width,
budRect.bottom - budRect.top + DEFAULT_ADDTOP + DEFAULT_ADDBOT, budRect.bottom - budRect.top + DEFAULT_ADDTOP + DEFAULT_ADDBOT,
SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOZORDER); SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOZORDER);
@ -568,6 +572,8 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
delta *= (action & FLAG_INCR ? 1 : -1) * (infoPtr->MaxVal < infoPtr->MinVal ? -1 : 1); delta *= (action & FLAG_INCR ? 1 : -1) * (infoPtr->MaxVal < infoPtr->MinVal ? -1 : 1);
if ( (action & FLAG_INCR) && (action & FLAG_DECR) ) delta = 0; if ( (action & FLAG_INCR) && (action & FLAG_DECR) ) delta = 0;
TRACE("current %d, delta: %d\n", infoPtr->CurVal, delta);
/* We must notify parent now to obtain permission */ /* We must notify parent now to obtain permission */
ni.iPos = infoPtr->CurVal; ni.iPos = infoPtr->CurVal;
ni.iDelta = delta; ni.iDelta = delta;
@ -579,6 +585,8 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
/* Now adjust value with (maybe new) delta */ /* Now adjust value with (maybe new) delta */
if (UPDOWN_OffsetVal (infoPtr, ni.iDelta)) { if (UPDOWN_OffsetVal (infoPtr, ni.iDelta)) {
TRACE("new %d, delta: %d\n", infoPtr->CurVal, ni.iDelta);
/* Now take care about our buddy */ /* Now take care about our buddy */
if (dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr); if (dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr);
} }
@ -597,7 +605,7 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
*/ */
static BOOL UPDOWN_IsEnabled (UPDOWN_INFO *infoPtr) static BOOL UPDOWN_IsEnabled (UPDOWN_INFO *infoPtr)
{ {
if(GetWindowLongW (infoPtr->Self, GWL_STYLE) & WS_DISABLED) if (!IsWindowEnabled(infoPtr->Self))
return FALSE; return FALSE;
if(infoPtr->Buddy) if(infoPtr->Buddy)
return IsWindowEnabled(infoPtr->Buddy); return IsWindowEnabled(infoPtr->Buddy);
@ -642,23 +650,32 @@ static BOOL UPDOWN_CancelMode (UPDOWN_INFO *infoPtr)
* 'pt' is the location of the mouse event in client or * 'pt' is the location of the mouse event in client or
* windows coordinates. * windows coordinates.
*/ */
static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, POINTS pts) static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT y)
{ {
DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
POINT pt = { pts.x, pts.y }; POINT pt = { x, y };
RECT rect; RECT rect;
int temp, arrow; int temp, arrow;
TRACE("msg %04x point %s\n", msg, wine_dbgstr_point(&pt));
switch(msg) switch(msg)
{ {
case WM_LBUTTONDOWN: /* Initialise mouse tracking */ case WM_LBUTTONDOWN: /* Initialise mouse tracking */
/* If we are inside an arrow, then nothing to do */
if(!(infoPtr->Flags & FLAG_MOUSEIN)) return;
/* If the buddy is an edit, will set focus to it */ /* If the buddy is an edit, will set focus to it */
if (UPDOWN_IsBuddyEdit(infoPtr)) SetFocus(infoPtr->Buddy); if (UPDOWN_IsBuddyEdit(infoPtr)) SetFocus(infoPtr->Buddy);
/* Now see which one is the 'active' arrow */ /* Now see which one is the 'active' arrow */
arrow = UPDOWN_GetArrowFromPoint (infoPtr, &rect, pt);
/* Update the flags if we are in/out */
infoPtr->Flags &= ~(FLAG_MOUSEIN | FLAG_ARROW);
if (arrow)
infoPtr->Flags |= FLAG_MOUSEIN | arrow;
else
if (infoPtr->AccelIndex != -1) infoPtr->AccelIndex = 0;
if (infoPtr->Flags & FLAG_ARROW) { if (infoPtr->Flags & FLAG_ARROW) {
/* Update the CurVal if necessary */ /* Update the CurVal if necessary */
@ -671,7 +688,8 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, POINTS pts)
InvalidateRect (infoPtr->Self, NULL, FALSE); InvalidateRect (infoPtr->Self, NULL, FALSE);
/* process the click */ /* process the click */
UPDOWN_DoAction (infoPtr, 1, infoPtr->Flags & FLAG_ARROW); temp = (infoPtr->AccelCount && infoPtr->AccelVect) ? infoPtr->AccelVect[0].nInc : 1;
UPDOWN_DoAction (infoPtr, temp, infoPtr->Flags & FLAG_ARROW);
/* now capture all mouse messages */ /* now capture all mouse messages */
SetCapture (infoPtr->Self); SetCapture (infoPtr->Self);
@ -710,13 +728,14 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, POINTS pts)
/*********************************************************************** /***********************************************************************
* UpDownWndProc * UpDownWndProc
*/ */
static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LPARAM lParam)
{ {
UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd); UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
int temp; int temp;
TRACE("hwnd=%p msg=%04x wparam=%08x lparam=%08lx\n", hwnd, message, wParam, lParam);
if (!infoPtr && (message != WM_CREATE)) if (!infoPtr && (message != WM_CREATE))
return DefWindowProcW (hwnd, message, wParam, lParam); return DefWindowProcW (hwnd, message, wParam, lParam);
@ -750,7 +769,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
case WM_DESTROY: case WM_DESTROY:
if(infoPtr->AccelVect) Free (infoPtr->AccelVect); if(infoPtr->AccelVect) Free (infoPtr->AccelVect);
if(infoPtr->Buddy) RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND); if(infoPtr->Buddy) RemovePropW(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
Free (infoPtr); Free (infoPtr);
SetWindowLongPtrW (hwnd, 0, 0); SetWindowLongPtrW (hwnd, 0, 0);
@ -821,7 +840,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if(UPDOWN_IsEnabled(infoPtr)) if(UPDOWN_IsEnabled(infoPtr))
UPDOWN_HandleMouseEvent (infoPtr, message, MAKEPOINTS(lParam)); UPDOWN_HandleMouseEvent (infoPtr, message, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
break; break;
case WM_KEYDOWN: case WM_KEYDOWN:
@ -842,7 +861,8 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
return 0; return 0;
case UDM_SETACCEL: case UDM_SETACCEL:
TRACE("UpDown Ctrl new accel info, hwnd=%p\n", hwnd); TRACE("UDM_SETACCEL\n");
if(infoPtr->AccelVect) { if(infoPtr->AccelVect) {
Free (infoPtr->AccelVect); Free (infoPtr->AccelVect);
infoPtr->AccelCount = 0; infoPtr->AccelCount = 0;
@ -852,6 +872,11 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
infoPtr->AccelVect = Alloc (wParam*sizeof(UDACCEL)); infoPtr->AccelVect = Alloc (wParam*sizeof(UDACCEL));
if(infoPtr->AccelVect == 0) return FALSE; if(infoPtr->AccelVect == 0) return FALSE;
memcpy(infoPtr->AccelVect, (void*)lParam, wParam*sizeof(UDACCEL)); memcpy(infoPtr->AccelVect, (void*)lParam, wParam*sizeof(UDACCEL));
infoPtr->AccelCount = wParam;
for (temp = 0; temp < wParam; temp++)
TRACE("%d: nSec %u nInc %u\n", temp, infoPtr->AccelVect[temp].nSec, infoPtr->AccelVect[temp].nInc);
return TRUE; return TRUE;
case UDM_GETBASE: case UDM_GETBASE:

View file

@ -4,7 +4,7 @@ RCS file: /home/wine/wine/dlls/comctl32/comctl32.spec,v
retrieving revision 1.46 retrieving revision 1.46
diff -u -r1.46 comctl32.spec diff -u -r1.46 comctl32.spec
--- comctl32.spec 19 Oct 2004 22:59:59 -0000 1.46 --- comctl32.spec 19 Oct 2004 22:59:59 -0000 1.46
+++ comctl32.spec 21 Oct 2004 08:50:24 -0000 +++ comctl32.spec 5 Dec 2004 22:48:09 -0000
@@ -106,13 +106,13 @@ @@ -106,13 +106,13 @@
412 stdcall RemoveWindowSubclass(long ptr long) 412 stdcall RemoveWindowSubclass(long ptr long)
413 stdcall DefSubclassProc(long long long long) 413 stdcall DefSubclassProc(long long long long)
@ -26,13 +26,49 @@ diff -u -r1.46 comctl32.spec
# Functions imported by name # Functions imported by name
Index: commctrl.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/commctrl.c,v
retrieving revision 1.88
diff -u -r1.88 commctrl.c
--- commctrl.c 19 Oct 2004 22:59:59 -0000 1.88
+++ commctrl.c 5 Dec 2004 22:48:09 -0000
@@ -482,7 +482,7 @@
r.left += 3;
if (style & SBT_RTLREADING)
FIXME("Unsupported RTL style!\n");
- DrawTextW (hdc, text, -1, &r, align|DT_VCENTER|DT_SINGLELINE);
+ DrawTextW (hdc, text, -1, &r, align|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX);
SetBkMode(hdc, oldbkmode);
}
}
Index: datetime.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/datetime.c,v
retrieving revision 1.49
diff -u -r1.49 datetime.c
--- datetime.c 24 Nov 2004 18:28:31 -0000 1.49
+++ datetime.c 5 Dec 2004 22:48:10 -0000
@@ -814,10 +814,10 @@
TRACE("Height=%ld, Width=%ld\n", infoPtr->rcClient.bottom, infoPtr->rcClient.right);
- /* use DrawEdge to adjust the size of rcEdge to get rcDraw */
memcpy((&infoPtr->rcDraw), (&infoPtr->rcClient), sizeof(infoPtr->rcDraw));
- DrawEdge(NULL, &(infoPtr->rcDraw), EDGE_SUNKEN, BF_RECT | BF_ADJUST);
+ /* subract the size of the edge drawn by DrawEdge */
+ InflateRect(&infoPtr->rcDraw, -2, -2);
/* set the size of the button that drops the calendar down */
/* FIXME: account for style that allows button on left side */
Index: listview.c Index: listview.c
=================================================================== ===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.394 retrieving revision 1.398
diff -u -r1.394 listview.c diff -u -r1.398 listview.c
--- listview.c 2 Sep 2004 23:00:53 -0000 1.394 --- listview.c 24 Nov 2004 18:28:31 -0000 1.398
+++ listview.c 21 Oct 2004 08:50:32 -0000 +++ listview.c 5 Dec 2004 22:48:13 -0000
@@ -146,6 +146,7 @@ @@ -146,6 +146,7 @@
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
@ -41,7 +77,7 @@ diff -u -r1.394 listview.c
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@@ -2022,7 +2023,8 @@ @@ -2033,7 +2034,8 @@
infoPtr->iconSize.cy + ICON_BOTTOM_PADDING; infoPtr->iconSize.cy + ICON_BOTTOM_PADDING;
Label.right = Label.left + labelSize.cx; Label.right = Label.left + labelSize.cx;
Label.bottom = Label.top + infoPtr->nItemHeight; Label.bottom = Label.top + infoPtr->nItemHeight;
@ -51,7 +87,7 @@ diff -u -r1.394 listview.c
{ {
labelSize.cy = min(Box.bottom - Label.top, labelSize.cy); labelSize.cy = min(Box.bottom - Label.top, labelSize.cy);
labelSize.cy /= infoPtr->ntmHeight; labelSize.cy /= infoPtr->ntmHeight;
@@ -9511,7 +9513,8 @@ @@ -9522,7 +9524,8 @@
hOldFont = SelectObject(hdc, infoPtr->hFont); hOldFont = SelectObject(hdc, infoPtr->hFont);
/*Get String Length in pixels */ /*Get String Length in pixels */
@ -61,13 +97,35 @@ diff -u -r1.394 listview.c
/*Add Extra spacing for the next character */ /*Add Extra spacing for the next character */
GetTextMetricsW(hdc, &textMetric); GetTextMetricsW(hdc, &textMetric);
Index: rebar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/rebar.c,v
retrieving revision 1.100
diff -u -r1.100 rebar.c
--- rebar.c 24 Nov 2004 18:28:31 -0000 1.100
+++ rebar.c 5 Dec 2004 22:48:14 -0000
@@ -3786,10 +3786,10 @@
infoPtr->bands = NULL;
}
- DeleteObject (infoPtr->hcurArrow);
- DeleteObject (infoPtr->hcurHorz);
- DeleteObject (infoPtr->hcurVert);
- DeleteObject (infoPtr->hcurDrag);
+ DestroyCursor (infoPtr->hcurArrow);
+ DestroyCursor (infoPtr->hcurHorz);
+ DestroyCursor (infoPtr->hcurVert);
+ DestroyCursor (infoPtr->hcurDrag);
if(infoPtr->hDefaultFont) DeleteObject (infoPtr->hDefaultFont);
SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
Index: string.c Index: string.c
=================================================================== ===================================================================
RCS file: /home/wine/wine/dlls/comctl32/string.c,v RCS file: /home/wine/wine/dlls/comctl32/string.c,v
retrieving revision 1.5 retrieving revision 1.5
diff -u -r1.5 string.c diff -u -r1.5 string.c
--- string.c 22 Sep 2004 19:10:27 -0000 1.5 --- string.c 22 Sep 2004 19:10:27 -0000 1.5
+++ string.c 21 Oct 2004 08:50:38 -0000 +++ string.c 5 Dec 2004 22:48:15 -0000
@@ -264,7 +264,7 @@ @@ -264,7 +264,7 @@
{ {
TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch)); TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
@ -86,19 +144,36 @@ diff -u -r1.5 string.c
} }
/************************************************************************* /*************************************************************************
Index: tooltips.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/tooltips.c,v
retrieving revision 1.74
diff -u -r1.74 tooltips.c
--- tooltips.c 25 Oct 2004 21:44:50 -0000 1.74
+++ tooltips.c 5 Dec 2004 22:48:16 -0000
@@ -2836,7 +2836,7 @@
TOOLTIPS_Unregister (void)
{
int i;
- for (i = 0; i < TTI_ERROR+1; i++)
- DeleteObject(hTooltipIcons[i]);
+ for (i = TTI_INFO; i <= TTI_ERROR; i++)
+ DestroyIcon(hTooltipIcons[i]);
UnregisterClassW (TOOLTIPS_CLASSW, NULL);
}
Index: treeview.c Index: treeview.c
=================================================================== ===================================================================
RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v
retrieving revision 1.156 retrieving revision 1.158
diff -u -r1.156 treeview.c diff -u -r1.158 treeview.c
--- treeview.c 7 Oct 2004 17:34:31 -0000 1.156 --- treeview.c 21 Nov 2004 15:41:08 -0000 1.158
+++ treeview.c 21 Oct 2004 08:50:45 -0000 +++ treeview.c 5 Dec 2004 22:48:18 -0000
@@ -2328,7 +2328,7 @@ @@ -2329,7 +2329,7 @@
SelectObject(hdc, hOldPen); SelectObject(hdc, hOldPen);
DeleteObject(hNewPen); DeleteObject(hNewPen);
- if (height < 16 || width < 16) - if (height < 16 || width < 16)
+ if (height < 32 || width < 32) + if (height < 18 || width < 18)
{ {
MoveToEx(hdc, centerx - plussize + 1, centery, NULL); MoveToEx(hdc, centerx - plussize + 1, centery, NULL);
LineTo(hdc, centerx + plussize, centery); LineTo(hdc, centerx + plussize, centery);

View file

@ -1992,6 +1992,17 @@ typedef struct _TBBUTTON {
int iString; int iString;
} TBBUTTON,*PTBBUTTON,*LPTBBUTTON; } TBBUTTON,*PTBBUTTON,*LPTBBUTTON;
typedef const TBBUTTON *LPCTBBUTTON; typedef const TBBUTTON *LPCTBBUTTON;
typedef struct tagNMTBRESTORE
{
NMHDR hdr;
DWORD* pData;
DWORD* pCurrent;
UINT cbData;
int iItem;
int cButtons;
int cbBytesPerRecord;
TBBUTTON tbButton;
} NMTBRESTORE, *LPNMTBRESTORE;
#if _WIN32_IE >= 0x400 #if _WIN32_IE >= 0x400
typedef struct { typedef struct {
UINT cbSize; UINT cbSize;
@ -2045,11 +2056,6 @@ typedef struct {
int cchText; int cchText;
LPTSTR pszText; LPTSTR pszText;
} TBNOTIFY,*LPTBNOTIFY; } TBNOTIFY,*LPTBNOTIFY;
typedef struct {
HKEY hkr;
LPCTSTR pszSubKey;
LPCTSTR pszValueName;
} TBSAVEPARAMS;
typedef struct _IMAGEINFO { typedef struct _IMAGEINFO {
HBITMAP hbmImage; HBITMAP hbmImage;
HBITMAP hbmMask; HBITMAP hbmMask;
@ -2246,12 +2252,12 @@ typedef struct tagTBSAVEPARAMSA {
HKEY hkr; HKEY hkr;
LPCSTR pszSubKey; LPCSTR pszSubKey;
LPCSTR pszValueName; LPCSTR pszValueName;
} TBSAVEPARAMSA; } TBSAVEPARAMSA, *LPTBSAVEPARAMSA;
typedef struct tagTBSAVEPARAMSW { typedef struct tagTBSAVEPARAMSW {
HKEY hkr; HKEY hkr;
LPCWSTR pszSubKey; LPCWSTR pszSubKey;
LPCWSTR pszValueName; LPCWSTR pszValueName;
} TBSAVEPARAMSW; } TBSAVEPARAMSW, *LPTBSAVEPARAMSW, *LPTBSAVEPARAMW;
typedef struct { typedef struct {
HINSTANCE hInstOld; HINSTANCE hInstOld;
UINT nIDOld; UINT nIDOld;