Changeset 6644 for trunk/src/comctl32
- Timestamp:
- Sep 5, 2001, 2:05:03 PM (24 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 16 edited
-
animate.c (modified) (38 diffs)
-
comboex.c (modified) (75 diffs)
-
comctl32.c (modified) (33 diffs)
-
comctl32undoc.c (modified) (73 diffs)
-
datetime.c (modified) (42 diffs)
-
flatsb.c (modified) (15 diffs)
-
imagelist.c (modified) (109 diffs)
-
initcomctl32.cpp (modified) (4 diffs)
-
initterm.cpp (modified) (2 diffs)
-
listview.c (modified) (1 diff)
-
monthcal.c (modified) (94 diffs)
-
pager.c (modified) (43 diffs)
-
rebar.c (modified) (123 diffs)
-
status.c (modified) (51 diffs)
-
tab.c (modified) (105 diffs)
-
toolbar.c (modified) (144 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/animate.c
r5630 r6644 1 1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */ 2 /* $Id: animate.c,v 1.14 2001-09-05 12:04:56 bird Exp $ */ 2 3 /* 3 4 * Animation control 4 5 * 5 6 * Copyright 1998, 1999 Eric Kohl 6 * 1999 Eric Pouech7 * 1999 Eric Pouech 7 8 * 8 9 * NOTES … … 33 34 #endif 34 35 /* reference to input stream (file or resource) */ 35 HGLOBAL hRes;36 HMMIO hMMio;/* handle to mmio stream */37 HWND hWnd;36 HGLOBAL hRes; 37 HMMIO hMMio; /* handle to mmio stream */ 38 HWND hWnd; 38 39 /* information on the loaded AVI file */ 39 MainAVIHeader mah;40 AVIStreamHeader ash;41 LPBITMAPINFOHEADER inbih;42 LPDWORD lpIndex;40 MainAVIHeader mah; 41 AVIStreamHeader ash; 42 LPBITMAPINFOHEADER inbih; 43 LPDWORD lpIndex; 43 44 /* data for the decompressor */ 44 HIC hic;45 LPBITMAPINFOHEADER outbih;46 LPVOID indata;47 LPVOID outdata;45 HIC hic; 46 LPBITMAPINFOHEADER outbih; 47 LPVOID indata; 48 LPVOID outdata; 48 49 /* data for the background mechanism */ 49 CRITICAL_SECTION cs;50 HANDLE hThread;51 UINT uTimer;50 CRITICAL_SECTION cs; 51 HANDLE hThread; 52 UINT uTimer; 52 53 /* data for playing the file */ 53 int nFromFrame;54 int nToFrame;55 int nLoop;56 int currFrame;54 int nFromFrame; 55 int nToFrame; 56 int nLoop; 57 int currFrame; 57 58 /* tranparency info*/ 58 COLORREF transparentColor;59 HBRUSH hbrushBG;60 HBITMAP hbmPrevFrame;59 COLORREF transparentColor; 60 HBRUSH hbrushBG; 61 HBITMAP hbmPrevFrame; 61 62 } ANIMATE_INFO; 62 63 63 64 #define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongA(hWnd, 0)) 64 #define ANIMATE_COLOR_NONE 0xffffffff65 #define ANIMATE_COLOR_NONE 0xffffffff 65 66 66 67 static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif) 67 68 { 68 SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND, 69 MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif), 70 (LPARAM)infoPtr->hWnd);69 SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND, 70 MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif), 71 (LPARAM)infoPtr->hWnd); 71 72 } 72 73 … … 77 78 #endif 78 79 { 79 HRSRC hrsrc;80 MMIOINFO mminfo;81 LPVOID lpAvi;82 80 HRSRC hrsrc; 81 MMIOINFO mminfo; 82 LPVOID lpAvi; 83 83 84 #ifdef __WIN32OS2__ 84 85 if (unicode) … … 90 91 #endif 91 92 if (!hrsrc) 92 return FALSE;93 93 return FALSE; 94 94 95 infoPtr->hRes = LoadResource(hInst, hrsrc); 95 96 if (!infoPtr->hRes) 96 return FALSE;97 97 return FALSE; 98 98 99 lpAvi = LockResource(infoPtr->hRes); 99 100 if (!lpAvi) 100 return FALSE;101 101 return FALSE; 102 102 103 memset(&mminfo, 0, sizeof(mminfo)); 103 104 mminfo.fccIOProc = FOURCC_MEM; … … 106 107 infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ); 107 108 if (!infoPtr->hMMio) { 108 GlobalFree((HGLOBAL)lpAvi);109 return FALSE;109 GlobalFree((HGLOBAL)lpAvi); 110 return FALSE; 110 111 } 111 112 … … 127 128 #else 128 129 infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL, 129 MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);130 MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); 130 131 #endif 131 132 if (!infoPtr->hMMio) 132 return FALSE;133 133 return FALSE; 134 134 135 return TRUE; 135 136 } … … 141 142 142 143 /* should stop playing */ 143 if (infoPtr->hThread) 144 if (infoPtr->hThread) 144 145 { 145 146 if (!TerminateThread(infoPtr->hThread,0)) 146 147 WARN("could not destroy animation thread!\n"); 147 infoPtr->hThread = 0;148 infoPtr->hThread = 0; 148 149 } 149 150 if (infoPtr->uTimer) { 150 KillTimer(infoPtr->hWnd, infoPtr->uTimer);151 infoPtr->uTimer = 0;151 KillTimer(infoPtr->hWnd, infoPtr->uTimer); 152 infoPtr->uTimer = 0; 152 153 } 153 154 … … 163 164 { 164 165 if (infoPtr->hMMio) { 165 ANIMATE_DoStop(infoPtr);166 mmioClose(infoPtr->hMMio, 0);167 if (infoPtr->hRes) {168 FreeResource(infoPtr->hRes);169 infoPtr->hRes = 0;170 }171 if (infoPtr->lpIndex) {172 HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex);173 infoPtr->lpIndex = NULL;174 }175 if (infoPtr->hic) {176 ICClose(infoPtr->hic);177 infoPtr->hic = 0;178 }179 if (infoPtr->inbih) {180 HeapFree(GetProcessHeap(), 0, infoPtr->inbih);181 infoPtr->inbih = NULL;182 }183 if (infoPtr->outbih) {184 HeapFree(GetProcessHeap(), 0, infoPtr->outbih);185 infoPtr->outbih = NULL;186 }166 ANIMATE_DoStop(infoPtr); 167 mmioClose(infoPtr->hMMio, 0); 168 if (infoPtr->hRes) { 169 FreeResource(infoPtr->hRes); 170 infoPtr->hRes = 0; 171 } 172 if (infoPtr->lpIndex) { 173 HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex); 174 infoPtr->lpIndex = NULL; 175 } 176 if (infoPtr->hic) { 177 ICClose(infoPtr->hic); 178 infoPtr->hic = 0; 179 } 180 if (infoPtr->inbih) { 181 HeapFree(GetProcessHeap(), 0, infoPtr->inbih); 182 infoPtr->inbih = NULL; 183 } 184 if (infoPtr->outbih) { 185 HeapFree(GetProcessHeap(), 0, infoPtr->outbih); 186 infoPtr->outbih = NULL; 187 } 187 188 if( infoPtr->indata ) 188 189 { 189 HeapFree(GetProcessHeap(), 0, infoPtr->indata);190 HeapFree(GetProcessHeap(), 0, infoPtr->indata); 190 191 infoPtr->indata = NULL; 191 192 } 192 if( infoPtr->outdata )193 if( infoPtr->outdata ) 193 194 { 194 HeapFree(GetProcessHeap(), 0, infoPtr->outdata);195 HeapFree(GetProcessHeap(), 0, infoPtr->outdata); 195 196 infoPtr->outdata = NULL; 196 197 } 197 if( infoPtr->hbmPrevFrame )198 if( infoPtr->hbmPrevFrame ) 198 199 { 199 DeleteObject(infoPtr->hbmPrevFrame);200 DeleteObject(infoPtr->hbmPrevFrame); 200 201 infoPtr->hbmPrevFrame = 0; 201 202 } 202 infoPtr->indata = infoPtr->outdata = NULL;203 infoPtr->hWnd = 0;204 infoPtr->hMMio = 0;205 206 memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));207 memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));208 infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;209 } 210 infoPtr->transparentColor = ANIMATE_COLOR_NONE; 203 infoPtr->indata = infoPtr->outdata = NULL; 204 infoPtr->hWnd = 0; 205 infoPtr->hMMio = 0; 206 207 memset(&infoPtr->mah, 0, sizeof(infoPtr->mah)); 208 memset(&infoPtr->ash, 0, sizeof(infoPtr->ash)); 209 infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0; 210 } 211 infoPtr->transparentColor = ANIMATE_COLOR_NONE; 211 212 } 212 213 213 214 static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource) 214 { 215 { 215 216 HDC hdcMask; 216 217 HBITMAP hbmMask; 217 HBITMAP hbmOld; 218 218 HBITMAP hbmOld; 219 219 220 /* create a transparency mask */ 220 221 hdcMask = CreateCompatibleDC(hdcDest); 221 hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL); 222 hbmOld = SelectObject(hdcMask, hbmMask); 222 hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL); 223 hbmOld = SelectObject(hdcMask, hbmMask); 223 224 224 225 SetBkColor(hdcSource,infoPtr->transparentColor); 225 226 BitBlt(hdcMask,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCCOPY); 226 227 227 228 /* mask the source bitmap */ 228 SetBkColor(hdcSource, RGB(0,0,0)); 229 SetTextColor(hdcSource, RGB(255,255,255)); 229 SetBkColor(hdcSource, RGB(0,0,0)); 230 SetTextColor(hdcSource, RGB(255,255,255)); 230 231 BitBlt(hdcSource, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND); 231 232 232 233 /* mask the destination bitmap */ 233 SetBkColor(hdcDest, RGB(255,255,255)); 234 SetTextColor(hdcDest, RGB(0,0,0)); 234 SetBkColor(hdcDest, RGB(255,255,255)); 235 SetTextColor(hdcDest, RGB(0,0,0)); 235 236 BitBlt(hdcDest, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND); 236 237 … … 258 259 259 260 if (!hDC || !infoPtr->inbih) 260 return TRUE;261 return TRUE; 261 262 262 263 if (infoPtr->hic ) … … 266 267 267 268 nWidth = infoPtr->outbih->biWidth; 268 nHeight = infoPtr->outbih->biHeight; 269 nHeight = infoPtr->outbih->biHeight; 269 270 } else 270 { 271 { 271 272 pBitmapData = infoPtr->indata; 272 273 pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih; 273 274 274 275 nWidth = infoPtr->inbih->biWidth; 275 nHeight = infoPtr->inbih->biHeight; 276 } 276 nHeight = infoPtr->inbih->biHeight; 277 } 277 278 278 279 if(!infoPtr->hbmPrevFrame) … … 281 282 } 282 283 283 SetDIBits(hDC, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, (LPBITMAPINFO)pBitmapInfo, DIB_RGB_COLORS); 284 284 SetDIBits(hDC, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, (LPBITMAPINFO)pBitmapInfo, DIB_RGB_COLORS); 285 285 286 hdcMem = CreateCompatibleDC(hDC); 286 287 hbmOld = SelectObject(hdcMem, infoPtr->hbmPrevFrame); 287 288 288 /* 289 * we need to get the transparent color even without ACS_TRANSPARENT, 289 /* 290 * we need to get the transparent color even without ACS_TRANSPARENT, 290 291 * because the style can be changed later on and the color should always 291 * be obtained in the first frame 292 * be obtained in the first frame 292 293 */ 293 294 if(infoPtr->transparentColor == ANIMATE_COLOR_NONE) 294 295 { 295 296 infoPtr->transparentColor = GetPixel(hdcMem,0,0); 296 } 297 298 if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 299 { 297 } 298 299 if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 300 { 300 301 HDC hdcFinal = CreateCompatibleDC(hDC); 301 302 HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight); 302 303 HBITMAP hbmOld2 = SelectObject(hdcFinal, hbmFinal); 303 304 RECT rect; 304 305 305 306 rect.left = 0; 306 307 rect.top = 0; 307 308 rect.right = nWidth; 308 309 rect.bottom = nHeight; 309 310 310 311 if(!infoPtr->hbrushBG) 311 312 infoPtr->hbrushBG = GetCurrentObject(hDC, OBJ_BRUSH); … … 320 321 infoPtr->hbmPrevFrame = hbmFinal; 321 322 } 322 323 if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER) 324 { 325 RECT rect; 323 324 if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER) 325 { 326 RECT rect; 326 327 327 328 GetWindowRect(infoPtr->hWnd, &rect); 328 nOffsetX = ((rect.right - rect.left) - nWidth)/2; 329 nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; 330 } 331 BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY); 329 nOffsetX = ((rect.right - rect.left) - nWidth)/2; 330 nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; 331 } 332 BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY); 332 333 333 334 SelectObject(hdcMem, hbmOld); … … 338 339 static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr) 339 340 { 340 HDC hDC;341 HDC hDC; 341 342 342 343 TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop); … … 346 347 mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET); 347 348 mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize); 348 349 349 350 if (infoPtr->hic && 350 ICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata, 351 infoPtr->outbih, infoPtr->outdata) != ICERR_OK) {352 LeaveCriticalSection(&infoPtr->cs);353 WARN("Decompression error\n");354 return FALSE;351 ICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata, 352 infoPtr->outbih, infoPtr->outdata) != ICERR_OK) { 353 LeaveCriticalSection(&infoPtr->cs); 354 WARN("Decompression error\n"); 355 return FALSE; 355 356 } 356 357 357 358 if ((hDC = GetDC(infoPtr->hWnd)) != 0) { 358 ANIMATE_PaintFrame(infoPtr, hDC);359 ReleaseDC(infoPtr->hWnd, hDC);359 ANIMATE_PaintFrame(infoPtr, hDC); 360 ReleaseDC(infoPtr->hWnd, hDC); 360 361 } 361 362 362 363 if (infoPtr->currFrame++ >= infoPtr->nToFrame) { 363 infoPtr->currFrame = infoPtr->nFromFrame;364 if (infoPtr->nLoop != -1) {365 if (--infoPtr->nLoop == 0) {366 ANIMATE_DoStop(infoPtr);367 }368 }364 infoPtr->currFrame = infoPtr->nFromFrame; 365 if (infoPtr->nLoop != -1) { 366 if (--infoPtr->nLoop == 0) { 367 ANIMATE_DoStop(infoPtr); 368 } 369 } 369 370 } 370 371 LeaveCriticalSection(&infoPtr->cs); … … 375 376 static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_) 376 377 { 377 ANIMATE_INFO* infoPtr = (ANIMATE_INFO*)ptr_;378 ANIMATE_INFO* infoPtr = (ANIMATE_INFO*)ptr_; 378 379 HDC hDC; 379 380 380 381 if(!infoPtr) 381 382 { … … 385 386 386 387 while(1) 387 { 388 if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 388 { 389 if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) 389 390 { 390 391 hDC = GetDC(infoPtr->hWnd); 391 /* sometimes the animation window will be destroyed in between392 * by the main program, so a ReleaseDC() error msg is possible */392 /* sometimes the animation window will be destroyed in between 393 * by the main program, so a ReleaseDC() error msg is possible */ 393 394 infoPtr->hbrushBG = SendMessageA(GetParent(infoPtr->hWnd),WM_CTLCOLORSTATIC,hDC, infoPtr->hWnd); 394 395 ReleaseDC(infoPtr->hWnd,hDC); 395 396 } 396 397 397 398 EnterCriticalSection(&infoPtr->cs); 398 399 ANIMATE_DrawFrame(infoPtr); 399 400 LeaveCriticalSection(&infoPtr->cs); 400 401 401 402 /* time is in microseconds, we should convert it to milliseconds */ 402 403 Sleep((infoPtr->mah.dwMicroSecPerFrame+500)/1000); … … 411 412 /* nothing opened */ 412 413 if (!infoPtr->hMMio) 413 return FALSE;414 return FALSE; 414 415 415 416 if (infoPtr->hThread || infoPtr->uTimer) { 416 FIXME("Already playing ? what should I do ??\n");417 ANIMATE_DoStop(infoPtr);417 FIXME("Already playing ? what should I do ??\n"); 418 ANIMATE_DoStop(infoPtr); 418 419 } 419 420 … … 423 424 424 425 if (infoPtr->nToFrame == 0xFFFF) 425 infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1;426 427 TRACE("(repeat=%d from=%d to=%d);\n", 428 infoPtr->nLoop, infoPtr->nFromFrame, infoPtr->nToFrame);426 infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1; 427 428 TRACE("(repeat=%d from=%d to=%d);\n", 429 infoPtr->nLoop, infoPtr->nFromFrame, infoPtr->nToFrame); 429 430 430 431 if (infoPtr->nFromFrame >= infoPtr->nToFrame || 431 infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames)432 return FALSE;432 infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames) 433 return FALSE; 433 434 434 435 infoPtr->currFrame = infoPtr->nFromFrame; 435 436 436 437 if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TIMER) { 437 TRACE("Using a timer\n");438 /* create a timer to display AVI */439 infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);438 TRACE("Using a timer\n"); 439 /* create a timer to display AVI */ 440 infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL); 440 441 } else { 441 442 DWORD threadID; 442 443 443 TRACE("Using an animation thread\n");444 TRACE("Using an animation thread\n"); 444 445 infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr,0,0 &threadID); 445 446 if(!infoPtr->hThread) … … 448 449 return FALSE; 449 450 } 450 451 } 452 451 452 } 453 453 454 ANIMATE_Notify(infoPtr, ACN_START); 454 455 … … 459 460 static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr) 460 461 { 461 MMCKINFO ckMainRIFF;462 MMCKINFO mmckHead;463 MMCKINFO mmckList;464 MMCKINFO mmckInfo;465 DWORD numFrame;466 DWORD insize;462 MMCKINFO ckMainRIFF; 463 MMCKINFO mmckHead; 464 MMCKINFO mmckList; 465 MMCKINFO mmckInfo; 466 DWORD numFrame; 467 DWORD insize; 467 468 468 469 if (mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) { 469 WARN("Can't find 'RIFF' chunk\n");470 return FALSE;470 WARN("Can't find 'RIFF' chunk\n"); 471 return FALSE; 471 472 } 472 473 473 474 if ((ckMainRIFF.ckid != FOURCC_RIFF) || 474 (ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) {475 WARN("Can't find 'AVI ' chunk\n");476 return FALSE;475 (ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) { 476 WARN("Can't find 'AVI ' chunk\n"); 477 return FALSE; 477 478 } 478 479 479 480 mmckHead.fccType = mmioFOURCC('h', 'd', 'r', 'l'); 480 481 if (mmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0) { 481 WARN("Can't find 'hdrl' list\n");482 return FALSE;482 WARN("Can't find 'hdrl' list\n"); 483 return FALSE; 483 484 } 484 485 485 486 mmckInfo.ckid = mmioFOURCC('a', 'v', 'i', 'h'); 486 487 if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) { 487 WARN("Can't find 'avih' chunk\n");488 return FALSE;488 WARN("Can't find 'avih' chunk\n"); 489 return FALSE; 489 490 } 490 491 491 492 mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah)); 492 493 493 TRACE("mah.dwMicroSecPerFrame=%ld\n", infoPtr->mah.dwMicroSecPerFrame);494 TRACE("mah.dwMaxBytesPerSec=%ld\n", infoPtr->mah.dwMaxBytesPerSec);495 TRACE("mah.dwPaddingGranularity=%ld\n", infoPtr->mah.dwPaddingGranularity);496 TRACE("mah.dwFlags=%ld\n", infoPtr->mah.dwFlags);497 TRACE("mah.dwTotalFrames=%ld\n", infoPtr->mah.dwTotalFrames);498 TRACE("mah.dwInitialFrames=%ld\n", infoPtr->mah.dwInitialFrames);499 TRACE("mah.dwStreams=%ld\n", infoPtr->mah.dwStreams);500 TRACE("mah.dwSuggestedBufferSize=%ld\n", infoPtr->mah.dwSuggestedBufferSize);501 TRACE("mah.dwWidth=%ld\n", infoPtr->mah.dwWidth);502 TRACE("mah.dwHeight=%ld\n", infoPtr->mah.dwHeight);494 TRACE("mah.dwMicroSecPerFrame=%ld\n", infoPtr->mah.dwMicroSecPerFrame); 495 TRACE("mah.dwMaxBytesPerSec=%ld\n", infoPtr->mah.dwMaxBytesPerSec); 496 TRACE("mah.dwPaddingGranularity=%ld\n", infoPtr->mah.dwPaddingGranularity); 497 TRACE("mah.dwFlags=%ld\n", infoPtr->mah.dwFlags); 498 TRACE("mah.dwTotalFrames=%ld\n", infoPtr->mah.dwTotalFrames); 499 TRACE("mah.dwInitialFrames=%ld\n", infoPtr->mah.dwInitialFrames); 500 TRACE("mah.dwStreams=%ld\n", infoPtr->mah.dwStreams); 501 TRACE("mah.dwSuggestedBufferSize=%ld\n", infoPtr->mah.dwSuggestedBufferSize); 502 TRACE("mah.dwWidth=%ld\n", infoPtr->mah.dwWidth); 503 TRACE("mah.dwHeight=%ld\n", infoPtr->mah.dwHeight); 503 504 504 505 mmioAscend(infoPtr->hMMio, &mmckInfo, 0); … … 506 507 mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l'); 507 508 if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) { 508 WARN("Can't find 'strl' list\n");509 return FALSE;509 WARN("Can't find 'strl' list\n"); 510 return FALSE; 510 511 } 511 512 512 513 mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'h'); 513 514 if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) { 514 WARN("Can't find 'strh' chunk\n");515 return FALSE;515 WARN("Can't find 'strh' chunk\n"); 516 return FALSE; 516 517 } 517 518 518 519 mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash)); 519 520 520 TRACE("ash.fccType='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccType)),521 HIBYTE(LOWORD(infoPtr->ash.fccType)), 522 LOBYTE(HIWORD(infoPtr->ash.fccType)), 523 HIBYTE(HIWORD(infoPtr->ash.fccType)));524 TRACE("ash.fccHandler='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccHandler)),525 HIBYTE(LOWORD(infoPtr->ash.fccHandler)), 526 LOBYTE(HIWORD(infoPtr->ash.fccHandler)), 527 HIBYTE(HIWORD(infoPtr->ash.fccHandler)));528 TRACE("ash.dwFlags=%ld\n", infoPtr->ash.dwFlags);529 TRACE("ash.wPriority=%d\n", infoPtr->ash.wPriority);530 TRACE("ash.wLanguage=%d\n", infoPtr->ash.wLanguage);531 TRACE("ash.dwInitialFrames=%ld\n", infoPtr->ash.dwInitialFrames);532 TRACE("ash.dwScale=%ld\n", infoPtr->ash.dwScale);533 TRACE("ash.dwRate=%ld\n", infoPtr->ash.dwRate);534 TRACE("ash.dwStart=%ld\n", infoPtr->ash.dwStart);535 TRACE("ash.dwLength=%ld\n", infoPtr->ash.dwLength);536 TRACE("ash.dwSuggestedBufferSize=%ld\n", infoPtr->ash.dwSuggestedBufferSize);537 TRACE("ash.dwQuality=%ld\n", infoPtr->ash.dwQuality);538 TRACE("ash.dwSampleSize=%ld\n", infoPtr->ash.dwSampleSize);539 TRACE("ash.rcFrame=(%d,%d,%d,%d)\n", infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left,540 infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right);521 TRACE("ash.fccType='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccType)), 522 HIBYTE(LOWORD(infoPtr->ash.fccType)), 523 LOBYTE(HIWORD(infoPtr->ash.fccType)), 524 HIBYTE(HIWORD(infoPtr->ash.fccType))); 525 TRACE("ash.fccHandler='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccHandler)), 526 HIBYTE(LOWORD(infoPtr->ash.fccHandler)), 527 LOBYTE(HIWORD(infoPtr->ash.fccHandler)), 528 HIBYTE(HIWORD(infoPtr->ash.fccHandler))); 529 TRACE("ash.dwFlags=%ld\n", infoPtr->ash.dwFlags); 530 TRACE("ash.wPriority=%d\n", infoPtr->ash.wPriority); 531 TRACE("ash.wLanguage=%d\n", infoPtr->ash.wLanguage); 532 TRACE("ash.dwInitialFrames=%ld\n", infoPtr->ash.dwInitialFrames); 533 TRACE("ash.dwScale=%ld\n", infoPtr->ash.dwScale); 534 TRACE("ash.dwRate=%ld\n", infoPtr->ash.dwRate); 535 TRACE("ash.dwStart=%ld\n", infoPtr->ash.dwStart); 536 TRACE("ash.dwLength=%ld\n", infoPtr->ash.dwLength); 537 TRACE("ash.dwSuggestedBufferSize=%ld\n", infoPtr->ash.dwSuggestedBufferSize); 538 TRACE("ash.dwQuality=%ld\n", infoPtr->ash.dwQuality); 539 TRACE("ash.dwSampleSize=%ld\n", infoPtr->ash.dwSampleSize); 540 TRACE("ash.rcFrame=(%d,%d,%d,%d)\n", infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left, 541 infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right); 541 542 542 543 mmioAscend(infoPtr->hMMio, &mmckInfo, 0); … … 544 545 mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'f'); 545 546 if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) { 546 WARN("Can't find 'strh' chunk\n");547 return FALSE;547 WARN("Can't find 'strh' chunk\n"); 548 return FALSE; 548 549 } 549 550 550 551 infoPtr->inbih = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize); 551 552 if (!infoPtr->inbih) { 552 WARN("Can't alloc input BIH\n");553 return FALSE;553 WARN("Can't alloc input BIH\n"); 554 return FALSE; 554 555 } 555 556 556 557 mmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize); 557 558 558 TRACE("bih.biSize=%ld\n", infoPtr->inbih->biSize);559 TRACE("bih.biWidth=%ld\n", infoPtr->inbih->biWidth);560 TRACE("bih.biHeight=%ld\n", infoPtr->inbih->biHeight);561 TRACE("bih.biPlanes=%d\n", infoPtr->inbih->biPlanes);562 TRACE("bih.biBitCount=%d\n", infoPtr->inbih->biBitCount);563 TRACE("bih.biCompression=%ld\n", infoPtr->inbih->biCompression);564 TRACE("bih.biSizeImage=%ld\n", infoPtr->inbih->biSizeImage);565 TRACE("bih.biXPelsPerMeter=%ld\n", infoPtr->inbih->biXPelsPerMeter);566 TRACE("bih.biYPelsPerMeter=%ld\n", infoPtr->inbih->biYPelsPerMeter);567 TRACE("bih.biClrUsed=%ld\n", infoPtr->inbih->biClrUsed);568 TRACE("bih.biClrImportant=%ld\n", infoPtr->inbih->biClrImportant);559 TRACE("bih.biSize=%ld\n", infoPtr->inbih->biSize); 560 TRACE("bih.biWidth=%ld\n", infoPtr->inbih->biWidth); 561 TRACE("bih.biHeight=%ld\n", infoPtr->inbih->biHeight); 562 TRACE("bih.biPlanes=%d\n", infoPtr->inbih->biPlanes); 563 TRACE("bih.biBitCount=%d\n", infoPtr->inbih->biBitCount); 564 TRACE("bih.biCompression=%ld\n", infoPtr->inbih->biCompression); 565 TRACE("bih.biSizeImage=%ld\n", infoPtr->inbih->biSizeImage); 566 TRACE("bih.biXPelsPerMeter=%ld\n", infoPtr->inbih->biXPelsPerMeter); 567 TRACE("bih.biYPelsPerMeter=%ld\n", infoPtr->inbih->biYPelsPerMeter); 568 TRACE("bih.biClrUsed=%ld\n", infoPtr->inbih->biClrUsed); 569 TRACE("bih.biClrImportant=%ld\n", infoPtr->inbih->biClrImportant); 569 570 570 571 mmioAscend(infoPtr->hMMio, &mmckInfo, 0); 571 572 572 573 mmioAscend(infoPtr->hMMio, &mmckList, 0); 573 574 574 575 #if 0 575 576 /* an AVI has 0 or 1 video stream, and to be animated should not contain 576 * an audio stream, so only one strl is allowed 577 * an audio stream, so only one strl is allowed 577 578 */ 578 579 mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l'); 579 580 if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) { 580 WARN("There should be a single 'strl' list\n");581 return FALSE;581 WARN("There should be a single 'strl' list\n"); 582 return FALSE; 582 583 } 583 584 #endif … … 589 590 mmckList.fccType = mmioFOURCC('m', 'o', 'v', 'i'); 590 591 if (mmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0) { 591 WARN("Can't find 'movi' list\n");592 return FALSE;592 WARN("Can't find 'movi' list\n"); 593 return FALSE; 593 594 } 594 595 595 596 /* FIXME: should handle the 'rec ' LIST when present */ 596 597 597 infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 598 infoPtr->mah.dwTotalFrames * sizeof(DWORD));598 infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 599 infoPtr->mah.dwTotalFrames * sizeof(DWORD)); 599 600 if (!infoPtr->lpIndex) { 600 WARN("Can't alloc index array\n");601 return FALSE;601 WARN("Can't alloc index array\n"); 602 return FALSE; 602 603 } 603 604 604 605 numFrame = insize = 0; 605 while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 && 606 numFrame < infoPtr->mah.dwTotalFrames) {607 infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset;608 if (insize < mmckInfo.cksize)609 insize = mmckInfo.cksize;610 numFrame++;611 mmioAscend(infoPtr->hMMio, &mmckInfo, 0);606 while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 && 607 numFrame < infoPtr->mah.dwTotalFrames) { 608 infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset; 609 if (insize < mmckInfo.cksize) 610 insize = mmckInfo.cksize; 611 numFrame++; 612 mmioAscend(infoPtr->hMMio, &mmckInfo, 0); 612 613 } 613 614 if (numFrame != infoPtr->mah.dwTotalFrames) { 614 WARN("Found %ld frames (/%ld)\n", numFrame, infoPtr->mah.dwTotalFrames);615 return FALSE;615 WARN("Found %ld frames (/%ld)\n", numFrame, infoPtr->mah.dwTotalFrames); 616 return FALSE; 616 617 } 617 618 if (insize > infoPtr->ash.dwSuggestedBufferSize) { 618 WARN("insize=%ld suggestedSize=%ld\n", insize, infoPtr->ash.dwSuggestedBufferSize);619 infoPtr->ash.dwSuggestedBufferSize = insize;619 WARN("insize=%ld suggestedSize=%ld\n", insize, infoPtr->ash.dwSuggestedBufferSize); 620 infoPtr->ash.dwSuggestedBufferSize = insize; 620 621 } 621 622 622 623 infoPtr->indata = HeapAlloc(GetProcessHeap(), 0, infoPtr->ash.dwSuggestedBufferSize); 623 624 if (!infoPtr->indata) { 624 WARN("Can't alloc input buffer\n");625 return FALSE;625 WARN("Can't alloc input buffer\n"); 626 return FALSE; 626 627 } 627 628 … … 632 633 static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) 633 634 { 634 DWORD outSize;635 DWORD outSize; 635 636 636 637 /* check uncompressed AVI */ … … 638 639 (infoPtr->ash.fccHandler == mmioFOURCC('R', 'L', 'E', ' '))) 639 640 { 640 infoPtr->hic = 0; 641 return TRUE;641 infoPtr->hic = 0; 642 return TRUE; 642 643 } 643 644 … … 645 646 infoPtr->hic = ICOpen(ICTYPE_VIDEO, infoPtr->ash.fccHandler, ICMODE_DECOMPRESS); 646 647 if (!infoPtr->hic) { 647 WARN("Can't load codec for the file\n");648 return FALSE;649 } 650 651 outSize = ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, 652 (DWORD)infoPtr->inbih, 0L);648 WARN("Can't load codec for the file\n"); 649 return FALSE; 650 } 651 652 outSize = ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, 653 (DWORD)infoPtr->inbih, 0L); 653 654 654 655 infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize); 655 656 if (!infoPtr->outbih) { 656 WARN("Can't alloc output BIH\n");657 return FALSE;658 } 659 660 if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, 661 (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {662 WARN("Can't get output BIH\n");663 return FALSE;657 WARN("Can't alloc output BIH\n"); 658 return FALSE; 659 } 660 661 if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, 662 (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { 663 WARN("Can't get output BIH\n"); 664 return FALSE; 664 665 } 665 666 666 667 infoPtr->outdata = HeapAlloc(GetProcessHeap(), 0, infoPtr->outbih->biSizeImage); 667 668 if (!infoPtr->outdata) { 668 WARN("Can't alloc output buffer\n");669 return FALSE;670 } 671 672 if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN, 673 (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {674 WARN("Can't begin decompression\n");675 return FALSE;669 WARN("Can't alloc output buffer\n"); 670 return FALSE; 671 } 672 673 if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN, 674 (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { 675 WARN("Can't begin decompression\n"); 676 return FALSE; 676 677 } 677 678 … … 691 692 692 693 if (!lParam) { 693 TRACE("Closing avi!\n");694 return TRUE;695 } 696 694 TRACE("Closing avi!\n"); 695 return TRUE; 696 } 697 697 698 if (!hInstance) 698 699 hInstance = GetWindowLongA(hWnd, GWL_HINSTANCE); … … 719 720 #else 720 721 if (HIWORD(lParam)) { 721 TRACE("(\"%s\");\n", (LPSTR)lParam);722 723 if (!ANIMATE_LoadResA(infoPtr, hInstance, (LPSTR)lParam)) {724 TRACE("No AVI resource found!\n");725 if (!ANIMATE_LoadFileA(infoPtr, (LPSTR)lParam)) {726 WARN("No AVI file found!\n");727 return FALSE;728 }729 }722 TRACE("(\"%s\");\n", (LPSTR)lParam); 723 724 if (!ANIMATE_LoadResA(infoPtr, hInstance, (LPSTR)lParam)) { 725 TRACE("No AVI resource found!\n"); 726 if (!ANIMATE_LoadFileA(infoPtr, (LPSTR)lParam)) { 727 WARN("No AVI file found!\n"); 728 return FALSE; 729 } 730 } 730 731 } else { 731 TRACE("(%u);\n", (WORD)LOWORD(lParam));732 733 if (!ANIMATE_LoadResA(infoPtr, hInstance,734 MAKEINTRESOURCEA((INT)lParam))) {735 WARN("No AVI resource found!\n");736 return FALSE;737 }732 TRACE("(%u);\n", (WORD)LOWORD(lParam)); 733 734 if (!ANIMATE_LoadResA(infoPtr, hInstance, 735 MAKEINTRESOURCEA((INT)lParam))) { 736 WARN("No AVI resource found!\n"); 737 return FALSE; 738 } 738 739 } 739 740 #endif 740 741 if (!ANIMATE_GetAviInfo(infoPtr)) { 741 WARN("Can't get AVI information\n");742 ANIMATE_Free(infoPtr);743 return FALSE;742 WARN("Can't get AVI information\n"); 743 ANIMATE_Free(infoPtr); 744 return FALSE; 744 745 } 745 746 746 747 if (!ANIMATE_GetAviCodec(infoPtr)) { 747 WARN("Can't get AVI Codec\n");748 ANIMATE_Free(infoPtr);749 return FALSE;748 WARN("Can't get AVI Codec\n"); 749 ANIMATE_Free(infoPtr); 750 return FALSE; 750 751 } 751 752 752 753 if (!GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) { 753 SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,754 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);754 SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight, 755 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER); 755 756 } 756 757 757 758 if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_AUTOPLAY) { 758 return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1));759 return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1)); 759 760 } 760 761 … … 771 772 /* nothing opened */ 772 773 if (!infoPtr->hMMio) 773 return FALSE;774 return FALSE; 774 775 775 776 ANIMATE_DoStop(infoPtr); … … 780 781 static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam) 781 782 { 782 ANIMATE_INFO* infoPtr;783 ANIMATE_INFO* infoPtr; 783 784 784 785 /* allocate memory for info structure */ … … 789 790 #endif 790 791 if (!infoPtr) { 791 ERR("could not allocate info memory!\n");792 return 0;792 ERR("could not allocate info memory!\n"); 793 return 0; 793 794 } 794 795 … … 802 803 803 804 InitializeCriticalSection(&infoPtr->cs); 804 805 805 806 return 0; 806 807 } … … 826 827 { 827 828 RECT rect; 828 HBRUSH hBrush = 0; 829 830 if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) 831 { 832 hBrush = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd); 829 HBRUSH hBrush = 0; 830 831 if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) 832 { 833 hBrush = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd); 833 834 } 834 835 … … 842 843 { 843 844 if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) { 844 InvalidateRect(hWnd, NULL, TRUE);845 InvalidateRect(hWnd, NULL, TRUE); 845 846 } 846 847 return TRUE; … … 851 852 TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", hWnd, uMsg, wParam, lParam); 852 853 if (!ANIMATE_GetInfoPtr(hWnd) && (uMsg != WM_NCCREATE)) 853 return DefWindowProcA(hWnd, uMsg, wParam, lParam);854 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 854 855 switch (uMsg) 855 856 { … … 862 863 #else 863 864 case ACM_OPENA: 864 return ANIMATE_OpenA(hWnd, wParam, lParam);865 866 /*case ACM_OPEN32W: FIXME!! */867 /*return ANIMATE_Open32W(hWnd, wParam, lParam); */868 #endif 869 865 return ANIMATE_OpenA(hWnd, wParam, lParam); 866 867 /* case ACM_OPEN32W: FIXME!! */ 868 /* return ANIMATE_Open32W(hWnd, wParam, lParam); */ 869 #endif 870 870 871 case ACM_PLAY: 871 return ANIMATE_Play(hWnd, wParam, lParam);872 872 return ANIMATE_Play(hWnd, wParam, lParam); 873 873 874 case ACM_STOP: 874 return ANIMATE_Stop(hWnd, wParam, lParam);875 875 return ANIMATE_Stop(hWnd, wParam, lParam); 876 876 877 case WM_NCCREATE: 877 ANIMATE_Create(hWnd, wParam, lParam);878 return DefWindowProcA(hWnd, uMsg, wParam, lParam);879 878 ANIMATE_Create(hWnd, wParam, lParam); 879 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 880 880 881 case WM_NCHITTEST: 881 return HTTRANSPARENT;882 return HTTRANSPARENT; 882 883 883 884 case WM_DESTROY: 884 ANIMATE_Destroy(hWnd, wParam, lParam);885 return DefWindowProcA(hWnd, uMsg, wParam, lParam);886 885 ANIMATE_Destroy(hWnd, wParam, lParam); 886 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 887 887 888 case WM_ERASEBKGND: 888 ANIMATE_EraseBackground(hWnd, wParam, lParam);889 break;890 891 /* case WM_STYLECHANGED: FIXME shall we do something ?? */889 ANIMATE_EraseBackground(hWnd, wParam, lParam); 890 break; 891 892 /* case WM_STYLECHANGED: FIXME shall we do something ?? */ 892 893 893 894 case WM_TIMER: 894 if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)895 if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) 895 896 { 896 897 ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd); 897 898 infoPtr->hbrushBG = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd); 898 899 } 899 return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd));900 900 return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd)); 901 901 902 case WM_CLOSE: 902 ANIMATE_Free(ANIMATE_GetInfoPtr(hWnd));903 return TRUE;903 ANIMATE_Free(ANIMATE_GetInfoPtr(hWnd)); 904 return TRUE; 904 905 905 906 case WM_PAINT: 906 907 { 907 908 ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd); 908 909 909 910 /* the animation isn't playing, don't paint */ 910 if(!infoPtr->uTimer && !infoPtr->hThread)911 /* default paint handling */912 return DefWindowProcA(hWnd, uMsg, wParam, lParam);913 911 if(!infoPtr->uTimer && !infoPtr->hThread) 912 /* default paint handling */ 913 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 914 914 915 if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) 915 916 infoPtr->hbrushBG = SendMessageA(GetParent(hWnd), WM_CTLCOLORSTATIC, 916 (HDC)wParam, hWnd);917 917 (HDC)wParam, hWnd); 918 918 919 if (wParam) 919 920 { … … 924 925 else 925 926 { 926 PAINTSTRUCT ps;927 HDC hDC = BeginPaint(hWnd, &ps);927 PAINTSTRUCT ps; 928 HDC hDC = BeginPaint(hWnd, &ps); 928 929 929 930 EnterCriticalSection(&infoPtr->cs); 930 931 ANIMATE_PaintFrame(infoPtr, hDC); 931 932 LeaveCriticalSection(&infoPtr->cs); 932 933 EndPaint(hWnd, &ps);934 }935 } 936 break;933 934 EndPaint(hWnd, &ps); 935 } 936 } 937 break; 937 938 938 939 case WM_SIZE: 939 ANIMATE_Size(hWnd, wParam, lParam);940 return DefWindowProcA(hWnd, uMsg, wParam, lParam);940 ANIMATE_Size(hWnd, wParam, lParam); 941 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 941 942 942 943 default: 943 if (uMsg >= WM_USER)944 ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);945 944 if (uMsg >= WM_USER) 945 ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); 946 946 947 #ifdef __WIN32OS2__ 947 948 return defComCtl32ProcA (hWnd, uMsg, wParam, lParam); 948 949 #else 949 return DefWindowProcA(hWnd, uMsg, wParam, lParam);950 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 950 951 #endif 951 952 } … … 966 967 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); 967 968 wndClass.lpszClassName = ANIMATE_CLASSA; 968 969 969 970 RegisterClassA(&wndClass); 970 971 } -
trunk/src/comctl32/comboex.c
r6380 r6644 1 /* $Id: comboex.c,v 1.12 2001-09-05 12:04:56 bird Exp $ */ 1 2 /* 2 3 * TODO <------------- … … 4 5 * result in a FIXME: 5 6 * CBES_EX_NOEDITIMAGEINDENT 6 * CBES_EX_PATHWORDBREAKPROC7 * CBES_EX_NOSIZELIMIT8 * CBES_EX_CASESENSITIVE7 * CBES_EX_PATHWORDBREAKPROC 8 * CBES_EX_NOSIZELIMIT 9 * CBES_EX_CASESENSITIVE 9 10 * 2. None of the following callback items are implemented. Therefor 10 11 * no CBEN_GETDISPINFO notifies are issued. Use in either CBEM_INSERTITEM … … 37 38 * generate message sequence similar to native DLL. 38 39 * 2. Handle case where CBEM_SETITEM is called to display data in EDIT 39 * Control. 40 * Control. 40 41 * 3. Add override for WNDPROC for the EDIT control (reqed for VK_RETURN). 41 42 * 4. Dump input data for things using COMBOBOXEXITEM{A|W}. … … 55 56 * 3. Lock image selected status to focus state of edit control if 56 57 * edit control exists. Mimics native actions. 57 * 4. Implemented WM_SETFOCUS in EditWndProc to track status of 58 * 4. Implemented WM_SETFOCUS in EditWndProc to track status of 58 59 * focus for 3 above. 59 60 * 5. The LBN_SELCHANGE is just for documentation purposes. … … 70 71 * 71 72 * mod 6 72 * 1. Add support for WM_NOTIFYFORMAT (both incoming and outgoing) and do 73 * 1. Add support for WM_NOTIFYFORMAT (both incoming and outgoing) and do 73 74 * WM_NOTIFY correctly based on results. 74 75 * 2. Fix memory leaks of text strings in COMBOEX_WM_DELETEITEM. 75 76 * 3. Add routines to handle special cases of NMCBEENDEDIT and NMCOMBOXEX 76 * so translation to ANSI is done correctly. 77 * so translation to ANSI is done correctly. 77 78 * 4. Fix some issues with COMBOEX_DrawItem. 78 79 * … … 150 151 /* 151 152 * Special flag set in DRAWITEMSTRUCT itemState field. It is set by 152 * the ComboEx version of the Combo Window Proc so that when the 153 * WM_DRAWITEM message is then passed to ComboEx, we know that this 153 * the ComboEx version of the Combo Window Proc so that when the 154 * WM_DRAWITEM message is then passed to ComboEx, we know that this 154 155 * particular WM_DRAWITEM message is for listbox only items. Any messasges 155 156 * without this flag is then for the Edit control field. 156 157 * 157 * We really cannot use the ODS_COMBOBOXEDIT flag because MSDN states that 158 * We really cannot use the ODS_COMBOBOXEDIT flag because MSDN states that 158 159 * only version 4.0 applications will have ODS_COMBOBOXEDIT set. 159 160 */ … … 189 190 if (TRACE_ON(comboex)){ 190 191 TRACE("item %p - mask=%08x, pszText=%p, cchTM=%d, iImage=%d\n", 191 item, item->mask, item->pszText, item->cchTextMax,192 item->iImage);192 item, item->mask, item->pszText, item->cchTextMax, 193 item->iImage); 193 194 TRACE("item %p - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n", 194 item, item->iSelectedImage, item->iOverlay, item->iIndent, item->lParam);195 item, item->iSelectedImage, item->iOverlay, item->iIndent, item->lParam); 195 196 if ((item->mask & CBEIF_TEXT) && item->pszText) 196 TRACE("item %p - pszText=%s\n",197 item, debugstr_w((const WCHAR *)item->pszText));197 TRACE("item %p - pszText=%s\n", 198 item, debugstr_w((const WCHAR *)item->pszText)); 198 199 } 199 200 } … … 205 206 if (TRACE_ON(comboex)){ 206 207 TRACE("input - mask=%08x, iItem=%d, pszText=%p, cchTM=%d, iImage=%d\n", 207 input->mask, input->iItem, input->pszText, input->cchTextMax,208 input->iImage);208 input->mask, input->iItem, input->pszText, input->cchTextMax, 209 input->iImage); 209 210 if ((input->mask & CBEIF_TEXT) && input->pszText) { 210 if (true_for_w)211 TRACE("input - pszText=<%s>\n", 212 debugstr_w((const WCHAR *)input->pszText));213 else 214 TRACE("input - pszText=<%s>\n", 215 debugstr_a((const char *)input->pszText));211 if (true_for_w) 212 TRACE("input - pszText=<%s>\n", 213 debugstr_w((const WCHAR *)input->pszText)); 214 else 215 TRACE("input - pszText=<%s>\n", 216 debugstr_a((const char *)input->pszText)); 216 217 } 217 218 TRACE("input - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n", 218 input->iSelectedImage, input->iOverlay, input->iIndent, input->lParam);219 input->iSelectedImage, input->iOverlay, input->iIndent, input->lParam); 219 220 } 220 221 } … … 226 227 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 227 228 228 if (infoPtr->hwndCombo) 229 return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam);229 if (infoPtr->hwndCombo) 230 return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam); 230 231 231 232 return 0; … … 241 242 hdr->code = code; 242 243 if (infoPtr->NtfUnicode) 243 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,244 (LPARAM)hdr);244 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 245 (LPARAM)hdr); 245 246 else 246 return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,247 (LPARAM)hdr);247 return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 248 (LPARAM)hdr); 248 249 } 249 250 … … 259 260 hdr->hdr.code = code; 260 261 if (infoPtr->NtfUnicode) 261 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,262 (LPARAM)hdr);262 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 263 (LPARAM)hdr); 263 264 else { 264 LPWSTR str, ostr = NULL;265 INT ret, len = 0;266 267 if (hdr->ceItem.mask & CBEIF_TEXT) {268 ostr = hdr->ceItem.pszText;269 str = ostr;270 if (!str) str = (LPWSTR)L"";271 len = WideCharToMultiByte (CP_ACP, 0, str, -1, 0, 0, NULL, NULL);272 if (len > 0) {273 hdr->ceItem.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(CHAR));274 WideCharToMultiByte (CP_ACP, 0, str, -1, (LPSTR)hdr->ceItem.pszText,275 len, NULL, NULL);276 }277 }278 279 ret = SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,280 (LPARAM)hdr);281 if (hdr->ceItem.mask & CBEIF_TEXT) {282 if (len > 0)283 COMCTL32_Free (hdr->ceItem.pszText);284 hdr->ceItem.pszText = ostr;285 }286 return ret;265 LPWSTR str, ostr = NULL; 266 INT ret, len = 0; 267 268 if (hdr->ceItem.mask & CBEIF_TEXT) { 269 ostr = hdr->ceItem.pszText; 270 str = ostr; 271 if (!str) str = (LPWSTR)L""; 272 len = WideCharToMultiByte (CP_ACP, 0, str, -1, 0, 0, NULL, NULL); 273 if (len > 0) { 274 hdr->ceItem.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(CHAR)); 275 WideCharToMultiByte (CP_ACP, 0, str, -1, (LPSTR)hdr->ceItem.pszText, 276 len, NULL, NULL); 277 } 278 } 279 280 ret = SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 281 (LPARAM)hdr); 282 if (hdr->ceItem.mask & CBEIF_TEXT) { 283 if (len > 0) 284 COMCTL32_Free (hdr->ceItem.pszText); 285 hdr->ceItem.pszText = ostr; 286 } 287 return ret; 287 288 } 288 289 } … … 299 300 hdr->hdr.code = (infoPtr->NtfUnicode) ? CBEN_ENDEDITW : CBEN_ENDEDITA; 300 301 if (infoPtr->NtfUnicode) 301 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,302 (LPARAM)hdr);302 return SendMessageW (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 303 (LPARAM)hdr); 303 304 else { 304 NMCBEENDEDITA ansi;305 306 memcpy (&ansi.hdr, &hdr->hdr, sizeof(NMHDR));307 ansi.fChanged = hdr->fChanged;308 ansi.iNewSelection = hdr->iNewSelection;309 WideCharToMultiByte (CP_ACP, 0, itemText, -1,310 (LPSTR)&ansi.szText, CBEMAXSTRLEN, NULL, NULL);311 ansi.iWhy = hdr->iWhy;312 return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0,313 (LPARAM)&ansi);305 NMCBEENDEDITA ansi; 306 307 memcpy (&ansi.hdr, &hdr->hdr, sizeof(NMHDR)); 308 ansi.fChanged = hdr->fChanged; 309 ansi.iNewSelection = hdr->iNewSelection; 310 WideCharToMultiByte (CP_ACP, 0, itemText, -1, 311 (LPSTR)&ansi.szText, CBEMAXSTRLEN, NULL, NULL); 312 ansi.iWhy = hdr->iWhy; 313 return SendMessageA (GetParent(infoPtr->hwndSelf), WM_NOTIFY, 0, 314 (LPARAM)&ansi); 314 315 } 315 316 } … … 340 341 } 341 342 if (cit->mask & CBEIF_IMAGE) 342 cit->iImage = item->iImage;343 cit->iImage = item->iImage; 343 344 if (cit->mask & CBEIF_SELECTEDIMAGE) 344 cit->iSelectedImage = item->iSelectedImage;345 cit->iSelectedImage = item->iSelectedImage; 345 346 if (cit->mask & CBEIF_OVERLAY) 346 cit->iOverlay = item->iOverlay;347 cit->iOverlay = item->iOverlay; 347 348 if (cit->mask & CBEIF_INDENT) 348 cit->iIndent = item->iIndent;349 cit->iIndent = item->iIndent; 349 350 if (cit->mask & CBEIF_LPARAM) 350 cit->lParam = item->lParam;351 cit->lParam = item->lParam; 351 352 352 353 } … … 364 365 iinfo.rcImage.left = iinfo.rcImage.right = 0; 365 366 if (infoPtr->himl) { 366 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);367 xoff = iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP;367 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo); 368 xoff = iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP; 368 369 } 369 370 GetClientRect (infoPtr->hwndCombo, &rect); … … 380 381 381 382 TRACE("Combo client (%d,%d)-(%d,%d), setting Edit to (%d,%d)-(%d,%d)\n", 382 rect.left, rect.top, rect.right, rect.bottom,383 x, y, x + w, y + h);383 rect.left, rect.top, rect.right, rect.bottom, 384 x, y, x + w, y + h); 384 385 SetWindowPos(infoPtr->hwndEdit, HWND_TOP, 385 x, y,386 w, h,387 SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER);386 x, y, 387 w, h, 388 SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER); 388 389 } 389 390 … … 399 400 cy = mysize.cy + CBE_EXTRA; 400 401 if (infoPtr->himl) { 401 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);402 cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy);403 TRACE("upgraded height due to image: height=%d\n", cy);402 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo); 403 cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy); 404 TRACE("upgraded height due to image: height=%d\n", cy); 404 405 } 405 406 SendMessageW (hwnd, CB_SETITEMHEIGHT, (WPARAM) -1, (LPARAM) cy); 406 407 if (infoPtr->hwndCombo) 407 408 SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, 408 (WPARAM) 0, (LPARAM) cy);409 (WPARAM) 0, (LPARAM) cy); 409 410 } 410 411 … … 419 420 /* EM_SETSEL32 (0,-1) */ 420 421 if (item->mask & CBEIF_TEXT) { 421 SendMessageW (infoPtr->hwndEdit, WM_SETTEXT, 0, (LPARAM)item->pszText);422 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);423 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1);424 } 425 } 426 427 422 SendMessageW (infoPtr->hwndEdit, WM_SETTEXT, 0, (LPARAM)item->pszText); 423 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0); 424 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1); 425 } 426 } 427 428 428 429 static CBE_ITEMDATA * 429 430 COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT index) … … 433 434 434 435 if ((index > infoPtr->nb_items) || (index < -1)) 435 return 0;436 return 0; 436 437 if (index == -1) 437 return infoPtr->edit;438 return infoPtr->edit; 438 439 item = infoPtr->items; 439 440 i = infoPtr->nb_items - 1; … … 441 442 /* find the item in the list */ 442 443 while (item && (i > index)) { 443 item = (CBE_ITEMDATA *)item->next;444 i--;444 item = (CBE_ITEMDATA *)item->next; 445 i--; 445 446 } 446 447 if (!item || (i != index)) { 447 FIXME("COMBOBOXEX item structures broken. Please report!\n");448 return 0;448 FIXME("COMBOBOXEX item structures broken. Please report!\n"); 449 return 0; 449 450 } 450 451 return item; … … 456 457 { 457 458 if (item->pszText == LPSTR_TEXTCALLBACKW) 458 FIXME("Callback not implemented yet for pszText\n");459 FIXME("Callback not implemented yet for pszText\n"); 459 460 if (item->iImage == I_IMAGECALLBACK) 460 FIXME("Callback not implemented yet for iImage\n");461 FIXME("Callback not implemented yet for iImage\n"); 461 462 if (item->iSelectedImage == I_IMAGECALLBACK) 462 FIXME("Callback not implemented yet for iSelectedImage\n");463 FIXME("Callback not implemented yet for iSelectedImage\n"); 463 464 if (item->iOverlay == I_IMAGECALLBACK) 464 FIXME("Callback not implemented yet for iOverlay\n");465 FIXME("Callback not implemented yet for iOverlay\n"); 465 466 if (item->iIndent == I_INDENTCALLBACK) 466 FIXME("Callback not implemented yet for iIndent\n");467 FIXME("Callback not implemented yet for iIndent\n"); 467 468 } 468 469 … … 482 483 /* if item number requested does not exist then return failure */ 483 484 if ((index > infoPtr->nb_items) || (index < 0)) { 484 ERR("attempt to delete item that does not exist\n");485 return CB_ERR;485 ERR("attempt to delete item that does not exist\n"); 486 return CB_ERR; 486 487 } 487 488 488 489 if (!(item = COMBOEX_FindItem(infoPtr, index))) { 489 ERR("attempt to delete item that was not found!\n");490 return CB_ERR;490 ERR("attempt to delete item that was not found!\n"); 491 return CB_ERR; 491 492 } 492 493 … … 515 516 516 517 if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN) 517 return 0;518 return 0; 518 519 519 520 TRACE("-- 0x%x\n", infoPtr->hwndEdit); … … 560 561 /* if item number requested does not exist then return failure */ 561 562 if ((index > infoPtr->nb_items) || (index < -1)) { 562 ERR("attempt to get item that does not exist\n");563 return 0;563 ERR("attempt to get item that does not exist\n"); 564 return 0; 564 565 } 565 566 566 567 /* if the item is the edit control and there is no edit control, skip */ 567 if ((index == -1) && 568 if ((index == -1) && 568 569 ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)) 569 return 0;570 return 0; 570 571 571 572 if (!(item = COMBOEX_FindItem(infoPtr, index))) { 572 ERR("attempt to get item that was not found!\n");573 return 0;573 ERR("attempt to get item that was not found!\n"); 574 return 0; 574 575 } 575 576 … … 594 595 595 596 len = WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 0, 0, NULL, NULL); 596 if (len > 0) 597 WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 598 cit->pszText, cit->cchTextMax, NULL, NULL);597 if (len > 0) 598 WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, 599 cit->pszText, cit->cchTextMax, NULL, NULL); 599 600 600 601 cit->iImage = tmpcit.iImage; … … 613 614 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 614 615 615 TRACE("%s hwnd=0x%x\n", 616 infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd);616 TRACE("%s hwnd=0x%x\n", 617 infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd); 617 618 618 619 return infoPtr->bUnicode; … … 626 627 627 628 if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN) 628 return FALSE;629 if ((infoPtr->flags & (WCBE_ACTEDIT | WCBE_EDITCHG)) == 630 (WCBE_ACTEDIT | WCBE_EDITCHG))631 return TRUE;629 return FALSE; 630 if ((infoPtr->flags & (WCBE_ACTEDIT | WCBE_EDITCHG)) == 631 (WCBE_ACTEDIT | WCBE_EDITCHG)) 632 return TRUE; 632 633 return FALSE; 633 634 } … … 661 662 /* fast path for iItem = -1 */ 662 663 item->next = infoPtr->items; 663 infoPtr->items = item;664 infoPtr->items = item; 664 665 } 665 666 else { 666 667 INT i = infoPtr->nb_items-1; 667 CBE_ITEMDATA *moving = infoPtr->items;668 669 while ((i > index) && moving) {670 moving = (CBE_ITEMDATA *)moving->next;671 i--;672 }673 if (!moving) {674 FIXME("COMBOBOXEX item structures broken. Please report!\n");675 COMCTL32_Free(item);676 return -1;677 }678 item->next = moving->next;679 moving->next = item;668 CBE_ITEMDATA *moving = infoPtr->items; 669 670 while ((i > index) && moving) { 671 moving = (CBE_ITEMDATA *)moving->next; 672 i--; 673 } 674 if (!moving) { 675 FIXME("COMBOBOXEX item structures broken. Please report!\n"); 676 COMCTL32_Free(item); 677 return -1; 678 } 679 item->next = moving->next; 680 moving->next = item; 680 681 } 681 682 … … 684 685 if (item->mask & CBEIF_TEXT) { 685 686 LPWSTR str; 686 INT len;687 INT len; 687 688 688 689 str = cit->pszText; 689 690 if (!str) str = (LPWSTR) L""; 690 len = strlenW (str);691 if (len > 0) {692 item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));693 strcpyW (item->pszText, str);694 }695 else696 item->pszText = NULL;691 len = strlenW (str); 692 if (len > 0) { 693 item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 694 strcpyW (item->pszText, str); 695 } 696 else 697 item->pszText = NULL; 697 698 item->cchTextMax = cit->cchTextMax; 698 699 } … … 713 714 COMBOEX_DumpItem (item); 714 715 715 SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING, 716 (WPARAM)cit->iItem, (LPARAM)item);716 SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING, 717 (WPARAM)cit->iItem, (LPARAM)item); 717 718 718 719 COMBOEX_CopyItem (infoPtr, item, &nmcit.ceItem); … … 727 728 COMBOEX_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 728 729 { 729 COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam;730 COMBOBOXEXITEMW citW;731 LRESULT ret;730 COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam; 731 COMBOBOXEXITEMW citW; 732 LRESULT ret; 732 733 733 734 memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA)); 734 735 if (cit->mask & CBEIF_TEXT) { 735 736 LPSTR str; 736 INT len;737 INT len; 737 738 738 739 str = cit->pszText; 739 740 if (!str) str=""; 740 len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);741 if (len > 0) {742 citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));743 MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len);744 }741 len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0); 742 if (len > 0) { 743 citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 744 MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len); 745 } 745 746 } 746 747 ret = COMBOEX_InsertItemW(hwnd,wParam,(LPARAM)&citW);; 747 748 748 749 if (cit->mask & CBEIF_TEXT) 749 COMCTL32_Free(citW.pszText);750 COMCTL32_Free(citW.pszText); 750 751 return ret; 751 752 } … … 763 764 764 765 if (lParam & (CBES_EX_NOEDITIMAGEINDENT | 765 CBES_EX_PATHWORDBREAKPROC |766 CBES_EX_NOSIZELIMIT |767 CBES_EX_CASESENSITIVE))768 FIXME("Extended style not implemented %08lx\n", lParam);766 CBES_EX_PATHWORDBREAKPROC | 767 CBES_EX_NOSIZELIMIT | 768 CBES_EX_CASESENSITIVE)) 769 FIXME("Extended style not implemented %08lx\n", lParam); 769 770 770 771 if ((DWORD)wParam) { 771 infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam;772 infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam; 772 773 } 773 774 else 774 infoPtr->dwExtStyle = (DWORD)lParam;775 infoPtr->dwExtStyle = (DWORD)lParam; 775 776 776 777 /* … … 778 779 */ 779 780 if ((infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE) ^ 780 (dwTemp & CBES_EX_NOEDITIMAGE)) {781 /* if state of EX_NOEDITIMAGE changes, invalidate all */782 TRACE("EX_NOEDITIMAGE state changed to %ld\n",783 infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE);784 InvalidateRect (hwnd, NULL, TRUE);785 COMBOEX_AdjustEditPos (infoPtr);786 if (infoPtr->hwndEdit)787 InvalidateRect (infoPtr->hwndEdit, NULL, TRUE);781 (dwTemp & CBES_EX_NOEDITIMAGE)) { 782 /* if state of EX_NOEDITIMAGE changes, invalidate all */ 783 TRACE("EX_NOEDITIMAGE state changed to %ld\n", 784 infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE); 785 InvalidateRect (hwnd, NULL, TRUE); 786 COMBOEX_AdjustEditPos (infoPtr); 787 if (infoPtr->hwndEdit) 788 InvalidateRect (infoPtr->hwndEdit, NULL, TRUE); 788 789 } 789 790 … … 826 827 /* if item number requested does not exist then return failure */ 827 828 if ((index > infoPtr->nb_items) || (index < -1)) { 828 ERR("attempt to set item that does not exist yet!\n");829 return 0;829 ERR("attempt to set item that does not exist yet!\n"); 830 return 0; 830 831 } 831 832 832 833 /* if the item is the edit control and there is no edit control, skip */ 833 if ((index == -1) && 834 if ((index == -1) && 834 835 ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)) 835 return 0;836 return 0; 836 837 837 838 if (!(item = COMBOEX_FindItem(infoPtr, index))) { 838 ERR("attempt to set item that was not found!\n");839 return 0;840 } 841 842 /* add/change stuff to the internal item structure */ 839 ERR("attempt to set item that was not found!\n"); 840 return 0; 841 } 842 843 /* add/change stuff to the internal item structure */ 843 844 item->mask |= cit->mask; 844 845 if (cit->mask & CBEIF_TEXT) { 845 846 LPWSTR str; 846 INT len;847 WCHAR emptystr[1] = {0};847 INT len; 848 WCHAR emptystr[1] = {0}; 848 849 849 850 str = cit->pszText; 850 851 if (!str) str=emptystr; 851 len = strlenW(str);852 if (len > 0) {853 item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));854 strcpyW(item->pszText,str);855 }852 len = strlenW(str); 853 if (len > 0) { 854 item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 855 strcpyW(item->pszText,str); 856 } 856 857 item->cchTextMax = cit->cchTextMax; 857 858 } … … 873 874 /* if original request was to update edit control, do some fast foot work */ 874 875 if (cit->iItem == -1) { 875 COMBOEX_SetEditText (infoPtr, item);876 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | RDW_INVALIDATE);876 COMBOEX_SetEditText (infoPtr, item); 877 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | RDW_INVALIDATE); 877 878 } 878 879 return TRUE; … … 882 883 COMBOEX_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 883 884 { 884 COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam;885 COMBOBOXEXITEMW citW;886 LRESULT ret;885 COMBOBOXEXITEMA *cit = (COMBOBOXEXITEMA *) lParam; 886 COMBOBOXEXITEMW citW; 887 LRESULT ret; 887 888 888 889 memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA)); 889 890 if (cit->mask & CBEIF_TEXT) { 890 891 LPSTR str; 891 INT len;892 INT len; 892 893 893 894 str = cit->pszText; 894 895 if (!str) str=""; 895 len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);896 if (len > 0) {897 citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));898 MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len);899 }896 len = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0); 897 if (len > 0) { 898 citW.pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 899 MultiByteToWideChar (CP_ACP, 0, str, -1, citW.pszText, len); 900 } 900 901 } 901 902 ret = COMBOEX_SetItemW(hwnd,wParam,(LPARAM)&citW);; 902 903 903 904 if (cit->mask & CBEIF_TEXT) 904 COMCTL32_Free(citW.pszText);905 COMCTL32_Free(citW.pszText); 905 906 return ret; 906 907 } … … 913 914 BOOL bTemp = infoPtr->bUnicode; 914 915 915 TRACE("to %s hwnd=0x%04x, was %s\n", 916 ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd,917 (bTemp) ? "TRUE" : "FALSE");916 TRACE("to %s hwnd=0x%04x, was %s\n", 917 ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd, 918 (bTemp) ? "TRUE" : "FALSE"); 918 919 919 920 infoPtr->bUnicode = (BOOL)wParam; … … 937 938 i = MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, NULL, 0); 938 939 if (i > 0) { 939 desired = (LPWSTR)COMCTL32_Alloc ((i + 1)*sizeof(WCHAR));940 MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, desired, i);940 desired = (LPWSTR)COMCTL32_Alloc ((i + 1)*sizeof(WCHAR)); 941 MultiByteToWideChar (CP_ACP, 0, (LPSTR)lParam, -1, desired, i); 941 942 } 942 943 … … 945 946 /* now search from after starting loc and wrapping back to start */ 946 947 for(i=start+1; i<count; i++) { 947 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 948 CB_GETITEMDATA, (WPARAM)i, 0);949 TRACE("desired=%s, item=%s\n", 950 debugstr_w(desired), debugstr_w(item->pszText));951 if (lstrcmpiW(item->pszText, desired) == 0) {952 COMCTL32_Free (desired);953 return i;954 }948 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 949 CB_GETITEMDATA, (WPARAM)i, 0); 950 TRACE("desired=%s, item=%s\n", 951 debugstr_w(desired), debugstr_w(item->pszText)); 952 if (lstrcmpiW(item->pszText, desired) == 0) { 953 COMCTL32_Free (desired); 954 return i; 955 } 955 956 } 956 957 for(i=0; i<=start; i++) { 957 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 958 CB_GETITEMDATA, (WPARAM)i, 0);959 TRACE("desired=%s, item=%s\n", 960 debugstr_w(desired), debugstr_w(item->pszText));961 if (lstrcmpiW(item->pszText, desired) == 0) {962 COMCTL32_Free (desired);963 return i;964 }958 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 959 CB_GETITEMDATA, (WPARAM)i, 0); 960 TRACE("desired=%s, item=%s\n", 961 debugstr_w(desired), debugstr_w(item->pszText)); 962 if (lstrcmpiW(item->pszText, desired) == 0) { 963 COMCTL32_Free (desired); 964 return i; 965 } 965 966 } 966 967 COMCTL32_Free(desired); … … 977 978 LRESULT lret = 0; 978 979 979 item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA, 980 wParam, lParam);980 item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA, 981 wParam, lParam); 981 982 if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) { 982 item2 = COMBOEX_FindItem (infoPtr, index);983 if (item2 != item1) {984 ERR("data structures damaged!\n");985 return CB_ERR;986 }987 if (item1->mask & CBEIF_LPARAM)988 lret = (LRESULT) item1->lParam;989 TRACE("returning 0x%08lx\n", lret);990 return lret;983 item2 = COMBOEX_FindItem (infoPtr, index); 984 if (item2 != item1) { 985 ERR("data structures damaged!\n"); 986 return CB_ERR; 987 } 988 if (item1->mask & CBEIF_LPARAM) 989 lret = (LRESULT) item1->lParam; 990 TRACE("returning 0x%08lx\n", lret); 991 return lret; 991 992 } 992 993 lret = (LRESULT)item1; … … 1005 1006 1006 1007 if (!(item = COMBOEX_FindItem(infoPtr, index))) { 1007 /* FIXME: need to clear selection */1008 return CB_ERR;1008 /* FIXME: need to clear selection */ 1009 return CB_ERR; 1009 1010 } 1010 1011 1011 1012 TRACE("selecting item %d text=%s\n", index, (item->pszText) ? 1012 debugstr_w(item->pszText) : "<null>");1013 debugstr_w(item->pszText) : "<null>"); 1013 1014 infoPtr->selected = index; 1014 1015 … … 1026 1027 CBE_ITEMDATA *item1, *item2; 1027 1028 1028 item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA, 1029 wParam, lParam);1029 item1 = (CBE_ITEMDATA *)COMBOEX_Forward (hwnd, CB_GETITEMDATA, 1030 wParam, lParam); 1030 1031 if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) { 1031 item2 = COMBOEX_FindItem (infoPtr, index);1032 if (item2 != item1) {1033 ERR("data structures damaged!\n");1034 return CB_ERR;1035 }1036 item1->mask |= CBEIF_LPARAM;1037 item1->lParam = lParam;1038 TRACE("setting lparam to 0x%08lx\n", lParam);1039 return 0;1032 item2 = COMBOEX_FindItem (infoPtr, index); 1033 if (item2 != item1) { 1034 ERR("data structures damaged!\n"); 1035 return CB_ERR; 1036 } 1037 item1->mask |= CBEIF_LPARAM; 1038 item1->lParam = lParam; 1039 TRACE("setting lparam to 0x%08lx\n", lParam); 1040 return 0; 1040 1041 } 1041 1042 TRACE("non-valid result from combo 0x%08lx\n", (DWORD)item1); … … 1054 1055 /* First, lets forward the message to the normal combo control 1055 1056 just like Windows. */ 1056 if (infoPtr->hwndCombo) 1057 if (infoPtr->hwndCombo) 1057 1058 SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, wParam, lParam); 1058 1059 … … 1060 1061 GetWindowRect (hwnd, &cbx_wrect); 1061 1062 GetClientRect (hwnd, &cbx_crect); 1062 /* the height of comboex as height of the combo + comboex border */ 1063 /* the height of comboex as height of the combo + comboex border */ 1063 1064 height = cb_wrect.bottom-cb_wrect.top 1064 1065 + cbx_wrect.bottom-cbx_wrect.top 1065 1066 - (cbx_crect.bottom-cbx_crect.top); 1066 1067 TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n", 1067 cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,1068 cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);1068 cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom, 1069 cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom); 1069 1070 TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n", 1070 cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,1071 cbx_wrect.right-cbx_wrect.left, height);1071 cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom, 1072 cbx_wrect.right-cbx_wrect.left, height); 1072 1073 SetWindowPos (hwnd, HWND_TOP, 0, 0, 1073 cbx_wrect.right-cbx_wrect.left,1074 height,1075 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);1074 cbx_wrect.right-cbx_wrect.left, 1075 height, 1076 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); 1076 1077 1077 1078 return ret; … … 1101 1102 #endif 1102 1103 if (infoPtr == NULL) { 1103 ERR("could not allocate info memory!\n");1104 return 0;1104 ERR("could not allocate info memory!\n"); 1105 return 0; 1105 1106 } 1106 1107 … … 1115 1116 1116 1117 i = SendMessageA(GetParent (hwnd), 1117 WM_NOTIFYFORMAT, hwnd, NF_QUERY);1118 WM_NOTIFYFORMAT, hwnd, NF_QUERY); 1118 1119 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 1119 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",1120 i);1121 i = NFR_ANSI;1120 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", 1121 i); 1122 i = NFR_ANSI; 1122 1123 } 1123 1124 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; … … 1127 1128 /* create combo box */ 1128 1129 dwComboStyle = GetWindowLongA (hwnd, GWL_STYLE) & 1129 (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD);1130 (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD); 1130 1131 1131 1132 GetWindowRect(hwnd, &wnrc1); 1132 1133 GetClientRect(hwnd, &clrc1); 1133 1134 TRACE("EX window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d)\n", 1134 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,1135 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom);1135 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 1136 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom); 1136 1137 TRACE("combo style=%08lx, adding style=%08lx\n", dwComboStyle, 1137 1138 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | 1138 1139 CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 1139 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED);1140 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED); 1140 1141 1141 1142 /* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */ … … 1147 1148 1148 1149 infoPtr->hwndCombo = CreateWindowA ("ComboBox", "", 1149 /* following line added to match native */1150 /* following line added to match native */ 1150 1151 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | 1151 CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 1152 /* was base and is necessary */1153 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle,1154 cs->y, cs->x, cs->cx, cs->cy, hwnd,1155 (HMENU) GetWindowLongA (hwnd, GWL_ID),1156 GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);1157 1158 /* 1152 CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | 1153 /* was base and is necessary */ 1154 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle, 1155 cs->y, cs->x, cs->cx, cs->cy, hwnd, 1156 (HMENU) GetWindowLongA (hwnd, GWL_ID), 1157 GetWindowLongA (hwnd, GWL_HINSTANCE), NULL); 1158 1159 /* 1159 1160 * native does the following at this point according to trace: 1160 1161 * GetWindowThreadProcessId(hwndCombo,0) … … 1165 1166 1166 1167 /* 1167 * Setup a property to hold the pointer to the COMBOBOXEX 1168 * Setup a property to hold the pointer to the COMBOBOXEX 1168 1169 * data structure. 1169 1170 */ 1170 1171 test = GetPropA(infoPtr->hwndCombo, (LPCSTR)(LONG)ComboExInfo); 1171 1172 if (!test || ((COMBOEX_INFO *)test != infoPtr)) { 1172 SetPropA(infoPtr->hwndCombo, "CC32SubclassInfo", (LONG)infoPtr);1173 } 1174 infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndCombo, 1175 GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc);1173 SetPropA(infoPtr->hwndCombo, "CC32SubclassInfo", (LONG)infoPtr); 1174 } 1175 infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndCombo, 1176 GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc); 1176 1177 infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); 1177 1178 … … 1182 1183 */ 1183 1184 if ((cs->style & CBS_DROPDOWNLIST) == CBS_DROPDOWN) { 1184 infoPtr->hwndEdit = CreateWindowExA (0, "EDIT", "",1185 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL,1186 0, 0, 0, 0, /* will set later */1187 infoPtr->hwndCombo, 1188 (HMENU) GetWindowLongA (hwnd, GWL_ID),1189 GetWindowLongA (hwnd, GWL_HINSTANCE),1190 NULL);1191 1192 /* native does the following at this point according to trace:1193 * GetWindowThreadProcessId(hwndEdit,0)1194 * GetCurrentThreadId()1195 * GetWindowThreadProcessId(hwndEdit, &???)1196 * GetCurrentProcessId()1197 */1198 1199 /*1200 * Setup a property to hold the pointer to the COMBOBOXEX 1201 * data structure.1202 */1203 test = GetPropA(infoPtr->hwndEdit, (LPCSTR)(LONG)ComboExInfo);1204 if (!test || ((COMBOEX_INFO *)test != infoPtr)) {1205 SetPropA(infoPtr->hwndEdit, "CC32SubclassInfo", (LONG)infoPtr);1206 }1207 infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndEdit, 1208 GWL_WNDPROC, (LONG)COMBOEX_EditWndProc);1209 infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);1185 infoPtr->hwndEdit = CreateWindowExA (0, "EDIT", "", 1186 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL, 1187 0, 0, 0, 0, /* will set later */ 1188 infoPtr->hwndCombo, 1189 (HMENU) GetWindowLongA (hwnd, GWL_ID), 1190 GetWindowLongA (hwnd, GWL_HINSTANCE), 1191 NULL); 1192 1193 /* native does the following at this point according to trace: 1194 * GetWindowThreadProcessId(hwndEdit,0) 1195 * GetCurrentThreadId() 1196 * GetWindowThreadProcessId(hwndEdit, &???) 1197 * GetCurrentProcessId() 1198 */ 1199 1200 /* 1201 * Setup a property to hold the pointer to the COMBOBOXEX 1202 * data structure. 1203 */ 1204 test = GetPropA(infoPtr->hwndEdit, (LPCSTR)(LONG)ComboExInfo); 1205 if (!test || ((COMBOEX_INFO *)test != infoPtr)) { 1206 SetPropA(infoPtr->hwndEdit, "CC32SubclassInfo", (LONG)infoPtr); 1207 } 1208 infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongA(infoPtr->hwndEdit, 1209 GWL_WNDPROC, (LONG)COMBOEX_EditWndProc); 1210 infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); 1210 1211 } 1211 1212 else { 1212 infoPtr->hwndEdit = 0;1213 infoPtr->font = 0;1213 infoPtr->hwndEdit = 0; 1214 infoPtr->font = 0; 1214 1215 } 1215 1216 … … 1219 1220 */ 1220 1221 if (!infoPtr->font) { 1221 SystemParametersInfoA (SPI_GETICONTITLELOGFONT, sizeof(mylogfont), 1222 &mylogfont, 0);1223 infoPtr->font = CreateFontIndirectA (&mylogfont);1222 SystemParametersInfoA (SPI_GETICONTITLELOGFONT, sizeof(mylogfont), 1223 &mylogfont, 0); 1224 infoPtr->font = CreateFontIndirectA (&mylogfont); 1224 1225 } 1225 1226 SendMessageW (infoPtr->hwndCombo, WM_SETFONT, (WPARAM)infoPtr->font, 0); 1226 1227 if (infoPtr->hwndEdit) { 1227 SendMessageW (infoPtr->hwndEdit, WM_SETFONT, (WPARAM)infoPtr->font, 0);1228 SendMessageW (infoPtr->hwndEdit, EM_SETMARGINS, (WPARAM)EC_USEFONTINFO, 0);1228 SendMessageW (infoPtr->hwndEdit, WM_SETFONT, (WPARAM)infoPtr->font, 0); 1229 SendMessageW (infoPtr->hwndEdit, EM_SETMARGINS, (WPARAM)EC_USEFONTINFO, 0); 1229 1230 } 1230 1231 … … 1237 1238 GetWindowRect(infoPtr->hwndCombo, &cmbwrc); 1238 1239 TRACE("EX window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) CB wnd=(%d,%d)-(%d,%d)\n", 1239 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,1240 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,1241 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);1242 SetWindowPos(infoPtr->hwndCombo, HWND_TOP, 1243 0, 0, wnrc1.right-wnrc1.left, wnrc1.bottom-wnrc1.top,1244 SWP_NOACTIVATE | SWP_NOREDRAW);1240 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 1241 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom, 1242 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom); 1243 SetWindowPos(infoPtr->hwndCombo, HWND_TOP, 1244 0, 0, wnrc1.right-wnrc1.left, wnrc1.bottom-wnrc1.top, 1245 SWP_NOACTIVATE | SWP_NOREDRAW); 1245 1246 1246 1247 GetWindowRect(infoPtr->hwndCombo, &cmbwrc); 1247 1248 TRACE("CB window=(%d,%d)-(%d,%d)\n", 1248 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);1249 SetWindowPos(hwnd, HWND_TOP, 1250 0, 0, cmbwrc.right-cmbwrc.left, cmbwrc.bottom-cmbwrc.top,1251 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);1249 cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom); 1250 SetWindowPos(hwnd, HWND_TOP, 1251 0, 0, cmbwrc.right-cmbwrc.left, cmbwrc.bottom-cmbwrc.top, 1252 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); 1252 1253 1253 1254 COMBOEX_AdjustEditPos (infoPtr); 1254 1255 1255 1256 /* 1256 * Create an item structure to represent the data in the 1257 * Create an item structure to represent the data in the 1257 1258 * EDIT control. 1258 1259 */ … … 1284 1285 { 1285 1286 case CBN_DROPDOWN: 1286 SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1287 (LPARAM)hwnd);1288 /*1289 * from native trace of first dropdown after typing in URL in IE4 1290 * CB_GETCURSEL(Combo)1291 * GetWindowText(Edit)1292 * CB_GETCURSEL(Combo)1293 * CB_GETCOUNT(Combo)1294 * CB_GETITEMDATA(Combo, n)1295 * WM_NOTIFY(parent, CBEN_ENDEDITA|W)1296 * CB_GETCURSEL(Combo)1297 * CB_SETCURSEL(COMBOEX, n)1298 * SetFocus(Combo)1299 * the rest is supposition 1300 */1301 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);1302 if (cursel == -1) {1303 /* find match from edit against those in Combobox */1304 GetWindowTextW (infoPtr->hwndEdit, wintext, 520);1305 n = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0);1306 for (cursel = 0; cursel < n; cursel++){1307 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1308 CB_GETITEMDATA, 1309 cursel, 0);1310 if ((INT)item == CB_ERR) break;1311 if (lstrcmpiW(item->pszText, wintext) == 0) break;1312 }1313 if ((cursel == n) || ((INT)item == CB_ERR)) {1314 TRACE("failed to find match??? item=%p cursel=%d\n",1315 item, cursel);1316 if (infoPtr->hwndEdit)1317 SetFocus(infoPtr->hwndEdit);1318 return 0;1319 }1320 }1321 else {1322 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1323 CB_GETITEMDATA, 1324 cursel, 0);1325 if ((INT)item == CB_ERR) {1326 TRACE("failed to find match??? item=%p cursel=%d\n",1327 item, cursel);1328 if (infoPtr->hwndEdit)1329 SetFocus(infoPtr->hwndEdit);1330 return 0;1331 }1332 }1333 1334 /* Save flags for testing and reset them */1335 oldflags = infoPtr->flags;1336 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);1337 1338 if (oldflags & WCBE_ACTEDIT) {1339 cbeend.fChanged = (oldflags & WCBE_EDITCHG);1340 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,1341 CB_GETCURSEL, 0, 0);1342 cbeend.iWhy = CBENF_DROPDOWN;1343 1344 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, item->pszText)) {1345 /* abort the change */1346 TRACE("Notify requested abort of change\n");1347 return 0;1348 }1349 }1350 1351 /* if selection has changed the set the new current selection */1352 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);1353 if ((oldflags & WCBE_EDITCHG) || (cursel != infoPtr->selected)) {1354 infoPtr->selected = cursel;1355 SendMessageW (hwnd, CB_SETCURSEL, cursel, 0);1356 SetFocus(infoPtr->hwndCombo);1357 }1358 return 0;1287 SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1288 (LPARAM)hwnd); 1289 /* 1290 * from native trace of first dropdown after typing in URL in IE4 1291 * CB_GETCURSEL(Combo) 1292 * GetWindowText(Edit) 1293 * CB_GETCURSEL(Combo) 1294 * CB_GETCOUNT(Combo) 1295 * CB_GETITEMDATA(Combo, n) 1296 * WM_NOTIFY(parent, CBEN_ENDEDITA|W) 1297 * CB_GETCURSEL(Combo) 1298 * CB_SETCURSEL(COMBOEX, n) 1299 * SetFocus(Combo) 1300 * the rest is supposition 1301 */ 1302 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); 1303 if (cursel == -1) { 1304 /* find match from edit against those in Combobox */ 1305 GetWindowTextW (infoPtr->hwndEdit, wintext, 520); 1306 n = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0); 1307 for (cursel = 0; cursel < n; cursel++){ 1308 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1309 CB_GETITEMDATA, 1310 cursel, 0); 1311 if ((INT)item == CB_ERR) break; 1312 if (lstrcmpiW(item->pszText, wintext) == 0) break; 1313 } 1314 if ((cursel == n) || ((INT)item == CB_ERR)) { 1315 TRACE("failed to find match??? item=%p cursel=%d\n", 1316 item, cursel); 1317 if (infoPtr->hwndEdit) 1318 SetFocus(infoPtr->hwndEdit); 1319 return 0; 1320 } 1321 } 1322 else { 1323 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1324 CB_GETITEMDATA, 1325 cursel, 0); 1326 if ((INT)item == CB_ERR) { 1327 TRACE("failed to find match??? item=%p cursel=%d\n", 1328 item, cursel); 1329 if (infoPtr->hwndEdit) 1330 SetFocus(infoPtr->hwndEdit); 1331 return 0; 1332 } 1333 } 1334 1335 /* Save flags for testing and reset them */ 1336 oldflags = infoPtr->flags; 1337 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1338 1339 if (oldflags & WCBE_ACTEDIT) { 1340 cbeend.fChanged = (oldflags & WCBE_EDITCHG); 1341 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1342 CB_GETCURSEL, 0, 0); 1343 cbeend.iWhy = CBENF_DROPDOWN; 1344 1345 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, item->pszText)) { 1346 /* abort the change */ 1347 TRACE("Notify requested abort of change\n"); 1348 return 0; 1349 } 1350 } 1351 1352 /* if selection has changed the set the new current selection */ 1353 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); 1354 if ((oldflags & WCBE_EDITCHG) || (cursel != infoPtr->selected)) { 1355 infoPtr->selected = cursel; 1356 SendMessageW (hwnd, CB_SETCURSEL, cursel, 0); 1357 SetFocus(infoPtr->hwndCombo); 1358 } 1359 return 0; 1359 1360 1360 1361 case CBN_SELCHANGE: 1361 /*1362 * CB_GETCURSEL(Combo)1363 * CB_GETITEMDATA(Combo) < simulated by COMBOEX_FindItem1364 * lstrlenA1365 * WM_SETTEXT(Edit)1366 * WM_GETTEXTLENGTH(Edit)1367 * WM_GETTEXT(Edit)1368 * EM_SETSEL(Edit, 0,0)1369 * WM_GETTEXTLENGTH(Edit)1370 * WM_GETTEXT(Edit)1371 * EM_SETSEL(Edit, 0,len)1372 * return WM_COMMAND to parent1373 */1374 oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);1375 if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) {1376 ERR("item %d not found. Problem!\n", oldItem);1377 break;1378 }1379 infoPtr->selected = oldItem;1380 COMBOEX_SetEditText (infoPtr, item);1381 return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1382 (LPARAM)hwnd);1362 /* 1363 * CB_GETCURSEL(Combo) 1364 * CB_GETITEMDATA(Combo) < simulated by COMBOEX_FindItem 1365 * lstrlenA 1366 * WM_SETTEXT(Edit) 1367 * WM_GETTEXTLENGTH(Edit) 1368 * WM_GETTEXT(Edit) 1369 * EM_SETSEL(Edit, 0,0) 1370 * WM_GETTEXTLENGTH(Edit) 1371 * WM_GETTEXT(Edit) 1372 * EM_SETSEL(Edit, 0,len) 1373 * return WM_COMMAND to parent 1374 */ 1375 oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); 1376 if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) { 1377 ERR("item %d not found. Problem!\n", oldItem); 1378 break; 1379 } 1380 infoPtr->selected = oldItem; 1381 COMBOEX_SetEditText (infoPtr, item); 1382 return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1383 (LPARAM)hwnd); 1383 1384 1384 1385 case CBN_SELENDOK: 1385 /* 1386 * We have to change the handle since we are the control1387 * issuing the message. IE4 depends on this.1388 */1389 return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1390 (LPARAM)hwnd);1386 /* 1387 * We have to change the handle since we are the control 1388 * issuing the message. IE4 depends on this. 1389 */ 1390 return SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1391 (LPARAM)hwnd); 1391 1392 1392 1393 case CBN_KILLFOCUS: 1393 /*1394 * from native trace:1395 *1396 * pass to parent1397 * WM_GETTEXT(Edit, 104)1398 * CB_GETCURSEL(Combo) rets -11399 * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS1400 * CB_GETCURSEL(Combo)1401 * InvalidateRect(Combo, 0, 0)1402 * return 01403 */1404 SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1405 (LPARAM)hwnd);1406 if (infoPtr->flags & WCBE_ACTEDIT) {1407 GetWindowTextW (infoPtr->hwndEdit, wintext, 260);1408 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);1409 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,1410 CB_GETCURSEL, 0, 0);1411 cbeend.iWhy = CBENF_KILLFOCUS;1412 1413 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);1414 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, wintext)) {1415 /* abort the change */1416 TRACE("Notify requested abort of change\n");1417 return 0;1418 }1419 }1420 /* possible CB_GETCURSEL */1421 InvalidateRect (infoPtr->hwndCombo, 0, 0);1422 return 0;1394 /* 1395 * from native trace: 1396 * 1397 * pass to parent 1398 * WM_GETTEXT(Edit, 104) 1399 * CB_GETCURSEL(Combo) rets -1 1400 * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS 1401 * CB_GETCURSEL(Combo) 1402 * InvalidateRect(Combo, 0, 0) 1403 * return 0 1404 */ 1405 SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1406 (LPARAM)hwnd); 1407 if (infoPtr->flags & WCBE_ACTEDIT) { 1408 GetWindowTextW (infoPtr->hwndEdit, wintext, 260); 1409 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG); 1410 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1411 CB_GETCURSEL, 0, 0); 1412 cbeend.iWhy = CBENF_KILLFOCUS; 1413 1414 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1415 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, wintext)) { 1416 /* abort the change */ 1417 TRACE("Notify requested abort of change\n"); 1418 return 0; 1419 } 1420 } 1421 /* possible CB_GETCURSEL */ 1422 InvalidateRect (infoPtr->hwndCombo, 0, 0); 1423 return 0; 1423 1424 1424 1425 case CBN_CLOSEUP: 1425 1426 default: 1426 /* 1427 * We have to change the handle since we are the control1428 * issuing the message. IE4 depends on this.1429 * We also need to set the focus back to the Edit control1430 * after passing the command to the parent of the ComboEx.1431 */1432 lret = SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1433 (LPARAM)hwnd);1434 if (infoPtr->hwndEdit)1435 SetFocus(infoPtr->hwndEdit);1436 return lret;1427 /* 1428 * We have to change the handle since we are the control 1429 * issuing the message. IE4 depends on this. 1430 * We also need to set the focus back to the Edit control 1431 * after passing the command to the parent of the ComboEx. 1432 */ 1433 lret = SendMessageW (GetParent (hwnd), WM_COMMAND, wParam, 1434 (LPARAM)hwnd); 1435 if (infoPtr->hwndEdit) 1436 SetFocus(infoPtr->hwndEdit); 1437 return lret; 1437 1438 } 1438 1439 return 0; … … 1450 1451 1451 1452 TRACE("CtlType=%08x, CtlID=%08x, itemID=%08x, hwnd=%x, data=%08lx\n", 1452 dis->CtlType, dis->CtlID, dis->itemID, dis->hwndItem, dis->itemData);1453 dis->CtlType, dis->CtlID, dis->itemID, dis->hwndItem, dis->itemData); 1453 1454 1454 1455 if ((dis->itemID >= infoPtr->nb_items) || (dis->itemID < 0)) return FALSE; … … 1458 1459 1459 1460 if (i == dis->itemID) { 1460 infoPtr->items = infoPtr->items->next;1461 infoPtr->items = infoPtr->items->next; 1461 1462 } 1462 1463 else { 1463 item = olditem;1464 i--;1465 1466 /* find the prior item in the list */1467 while (item->next && (i > dis->itemID)) {1468 item = (CBE_ITEMDATA *)item->next;1469 i--;1470 }1471 if (!item->next || (i != dis->itemID)) {1472 FIXME("COMBOBOXEX item structures broken. Please report!\n");1473 return FALSE;1474 }1475 olditem = item->next;1476 item->next = (CBE_ITEMDATA *)((CBE_ITEMDATA *)item->next)->next;1464 item = olditem; 1465 i--; 1466 1467 /* find the prior item in the list */ 1468 while (item->next && (i > dis->itemID)) { 1469 item = (CBE_ITEMDATA *)item->next; 1470 i--; 1471 } 1472 if (!item->next || (i != dis->itemID)) { 1473 FIXME("COMBOBOXEX item structures broken. Please report!\n"); 1474 return FALSE; 1475 } 1476 olditem = item->next; 1477 item->next = (CBE_ITEMDATA *)((CBE_ITEMDATA *)item->next)->next; 1477 1478 } 1478 1479 infoPtr->nb_items--; … … 1482 1483 1483 1484 if (olditem->pszText) 1484 COMCTL32_Free(olditem->pszText);1485 COMCTL32_Free(olditem->pszText); 1485 1486 COMCTL32_Free(olditem); 1486 1487 … … 1510 1511 /* dump the DRAWITEMSTRUCT if tracing "comboex" but not "message" */ 1511 1512 if (!TRACE_ON(message)) { 1512 TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n", 1513 dis->CtlType, dis->CtlID);1514 TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n", 1515 dis->itemID, dis->itemAction, dis->itemState);1516 TRACE("hWnd=0x%04x hDC=0x%04x (%d,%d)-(%d,%d) itemData=0x%08lx\n",1517 dis->hwndItem, dis->hDC, dis->rcItem.left, 1518 dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom, 1519 dis->itemData);1513 TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n", 1514 dis->CtlType, dis->CtlID); 1515 TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n", 1516 dis->itemID, dis->itemAction, dis->itemState); 1517 TRACE("hWnd=0x%04x hDC=0x%04x (%d,%d)-(%d,%d) itemData=0x%08lx\n", 1518 dis->hwndItem, dis->hDC, dis->rcItem.left, 1519 dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom, 1520 dis->itemData); 1520 1521 } 1521 1522 … … 1532 1533 /* though the list box or combo box has the focus. */ 1533 1534 if (dis->itemID == 0xffffffff) { 1534 if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) ||1535 ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) { 1536 1537 TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n",1538 dis->rcItem.left, dis->rcItem.top,1539 dis->rcItem.right, dis->rcItem.bottom);1540 }1541 else if ((dis->CtlType == ODT_COMBOBOX) && 1542 (dis->itemAction == ODA_DRAWENTIRE)) {1543 /* draw of edit control data */1544 1545 /* testing */1546 {1547 RECT exrc, cbrc, edrc;1548 GetWindowRect (hwnd, &exrc);1549 GetWindowRect (infoPtr->hwndCombo, &cbrc);1550 edrc.left=edrc.top=edrc.right=edrc.bottom=-1;1551 if (infoPtr->hwndEdit)1552 GetWindowRect (infoPtr->hwndEdit, &edrc);1553 TRACE("window rects ex=(%d,%d)-(%d,%d), cb=(%d,%d)-(%d,%d), ed=(%d,%d)-(%d,%d)\n",1554 exrc.left, exrc.top, exrc.right, exrc.bottom,1555 cbrc.left, cbrc.top, cbrc.right, cbrc.bottom,1556 edrc.left, edrc.top, edrc.right, edrc.bottom);1557 }1558 }1559 else {1560 ERR("NOT drawing item -1 special focus, rect=(%d,%d)-(%d,%d), action=%08x, state=%08x\n",1561 dis->rcItem.left, dis->rcItem.top,1562 dis->rcItem.right, dis->rcItem.bottom,1563 dis->itemAction, dis->itemState);1564 return 0;1565 }1535 if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) || 1536 ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) { 1537 1538 TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n", 1539 dis->rcItem.left, dis->rcItem.top, 1540 dis->rcItem.right, dis->rcItem.bottom); 1541 } 1542 else if ((dis->CtlType == ODT_COMBOBOX) && 1543 (dis->itemAction == ODA_DRAWENTIRE)) { 1544 /* draw of edit control data */ 1545 1546 /* testing */ 1547 { 1548 RECT exrc, cbrc, edrc; 1549 GetWindowRect (hwnd, &exrc); 1550 GetWindowRect (infoPtr->hwndCombo, &cbrc); 1551 edrc.left=edrc.top=edrc.right=edrc.bottom=-1; 1552 if (infoPtr->hwndEdit) 1553 GetWindowRect (infoPtr->hwndEdit, &edrc); 1554 TRACE("window rects ex=(%d,%d)-(%d,%d), cb=(%d,%d)-(%d,%d), ed=(%d,%d)-(%d,%d)\n", 1555 exrc.left, exrc.top, exrc.right, exrc.bottom, 1556 cbrc.left, cbrc.top, cbrc.right, cbrc.bottom, 1557 edrc.left, edrc.top, edrc.right, edrc.bottom); 1558 } 1559 } 1560 else { 1561 ERR("NOT drawing item -1 special focus, rect=(%d,%d)-(%d,%d), action=%08x, state=%08x\n", 1562 dis->rcItem.left, dis->rcItem.top, 1563 dis->rcItem.right, dis->rcItem.bottom, 1564 dis->itemAction, dis->itemState); 1565 return 0; 1566 } 1566 1567 } 1567 1568 1568 1569 /* If draw item is -1 (edit control) setup the item pointer */ 1569 1570 if (dis->itemID == 0xffffffff) { 1570 CHAR str[260];1571 INT wlen, alen;1572 1573 item = infoPtr->edit;1574 1575 if (infoPtr->hwndEdit) {1576 1577 /* free previous text of edit item */1578 if (item->pszText) {1579 COMCTL32_Free(item->pszText);1580 item->pszText = 0;1581 item->mask &= ~CBEIF_TEXT;1582 }1583 alen = SendMessageA (infoPtr->hwndEdit, WM_GETTEXT, 260, (LPARAM)&str);1584 TRACE("edit control hwndEdit=%0x, text len=%d str=<%s>\n",1585 infoPtr->hwndEdit, alen, str);1586 if (alen > 0) {1587 item->mask |= CBEIF_TEXT;1588 wlen = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0);1589 if (wlen > 0) {1590 item->pszText = (LPWSTR)COMCTL32_Alloc ((wlen + 1)*sizeof(WCHAR));1591 MultiByteToWideChar (CP_ACP, 0, str, -1, item->pszText, wlen);1592 }1593 }1594 }1571 CHAR str[260]; 1572 INT wlen, alen; 1573 1574 item = infoPtr->edit; 1575 1576 if (infoPtr->hwndEdit) { 1577 1578 /* free previous text of edit item */ 1579 if (item->pszText) { 1580 COMCTL32_Free(item->pszText); 1581 item->pszText = 0; 1582 item->mask &= ~CBEIF_TEXT; 1583 } 1584 alen = SendMessageA (infoPtr->hwndEdit, WM_GETTEXT, 260, (LPARAM)&str); 1585 TRACE("edit control hwndEdit=%0x, text len=%d str=<%s>\n", 1586 infoPtr->hwndEdit, alen, str); 1587 if (alen > 0) { 1588 item->mask |= CBEIF_TEXT; 1589 wlen = MultiByteToWideChar (CP_ACP, 0, str, -1, NULL, 0); 1590 if (wlen > 0) { 1591 item->pszText = (LPWSTR)COMCTL32_Alloc ((wlen + 1)*sizeof(WCHAR)); 1592 MultiByteToWideChar (CP_ACP, 0, str, -1, item->pszText, wlen); 1593 } 1594 } 1595 } 1595 1596 } 1596 1597 1597 1598 /* if the item pointer is not set, then get the data and locate it */ 1598 1599 if (!item) { 1599 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo,1600 CB_GETITEMDATA, (WPARAM)dis->itemID, 0);1601 if (item == (CBE_ITEMDATA *)CB_ERR)1602 {1603 FIXME("invalid item for id %d \n",dis->itemID);1604 return 0;1605 }1600 item = (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, 1601 CB_GETITEMDATA, (WPARAM)dis->itemID, 0); 1602 if (item == (CBE_ITEMDATA *)CB_ERR) 1603 { 1604 FIXME("invalid item for id %d \n",dis->itemID); 1605 return 0; 1606 } 1606 1607 } 1607 1608 … … 1612 1613 xbase += (item->iIndent * CBE_INDENT); 1613 1614 if (item->mask & CBEIF_IMAGE) { 1614 ImageList_GetImageInfo(infoPtr->himl, item->iImage, &iinfo);1615 xioff = (iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP);1615 ImageList_GetImageInfo(infoPtr->himl, item->iImage, &iinfo); 1616 xioff = (iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP); 1616 1617 } 1617 1618 … … 1619 1620 case ODA_FOCUS: 1620 1621 if (dis->itemState & ODS_SELECTED /*1*/) { 1621 if ((item->mask & CBEIF_TEXT) && item->pszText) {1622 RECT rect2;1623 1624 len = strlenW (item->pszText);1625 GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize);1626 rect.left = xbase + xioff - 1;1627 rect.right = rect.left + txtsize.cx + 2;1628 rect.top = dis->rcItem.top;1629 rect.bottom = dis->rcItem.bottom;1630 GetClipBox (dis->hDC, &rect2);1631 TRACE("drawing item %d focus, rect=(%d,%d)-(%d,%d)\n",1632 dis->itemID, rect.left, rect.top,1633 rect.right, rect.bottom);1634 TRACE(" clip=(%d,%d)-(%d,%d)\n",1635 rect2.left, rect2.top,1636 rect2.right, rect2.bottom);1637 1638 DrawFocusRect(dis->hDC, &rect);1639 }1640 else {1641 FIXME("ODA_FOCUS and ODS_SELECTED but no text\n");1642 }1643 }1644 else {1645 FIXME("ODA_FOCUS but not ODS_SELECTED\n");1646 }1622 if ((item->mask & CBEIF_TEXT) && item->pszText) { 1623 RECT rect2; 1624 1625 len = strlenW (item->pszText); 1626 GetTextExtentPointW (dis->hDC, item->pszText, len, &txtsize); 1627 rect.left = xbase + xioff - 1; 1628 rect.right = rect.left + txtsize.cx + 2; 1629 rect.top = dis->rcItem.top; 1630 rect.bottom = dis->rcItem.bottom; 1631 GetClipBox (dis->hDC, &rect2); 1632 TRACE("drawing item %d focus, rect=(%d,%d)-(%d,%d)\n", 1633 dis->itemID, rect.left, rect.top, 1634 rect.right, rect.bottom); 1635 TRACE(" clip=(%d,%d)-(%d,%d)\n", 1636 rect2.left, rect2.top, 1637 rect2.right, rect2.bottom); 1638 1639 DrawFocusRect(dis->hDC, &rect); 1640 } 1641 else { 1642 FIXME("ODA_FOCUS and ODS_SELECTED but no text\n"); 1643 } 1644 } 1645 else { 1646 FIXME("ODA_FOCUS but not ODS_SELECTED\n"); 1647 } 1647 1648 break; 1648 1649 case ODA_SELECT: 1649 1650 case ODA_DRAWENTIRE: 1650 1651 drawimage = -1; 1651 drawstate = ILD_NORMAL;1652 if (!(infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE)) {1653 if (item->mask & CBEIF_IMAGE) 1654 drawimage = item->iImage;1655 if (dis->itemState & ODS_COMBOEXLBOX) {1656 /* drawing listbox entry */1657 if (dis->itemState & ODS_SELECTED) {1658 if (item->mask & CBEIF_SELECTEDIMAGE)1659 drawimage = item->iSelectedImage;1660 drawstate = ILD_SELECTED;1661 }1662 }1663 else {1664 /* drawing combo/edit entry */1665 if (infoPtr->hwndEdit) {1666 /* if we have an edit control, the slave the 1667 * selection state to the Edit focus state 1668 */1669 if (infoPtr->flags & WCBE_EDITFOCUSED) {1670 if (item->mask & CBEIF_SELECTEDIMAGE)1671 drawimage = item->iSelectedImage;1672 drawstate = ILD_SELECTED;1673 }1674 }1675 else {1676 /* if we don't have an edit control, use 1677 * the requested state.1678 */1679 if (dis->itemState & ODS_SELECTED) {1680 if (item->mask & CBEIF_SELECTEDIMAGE)1681 drawimage = item->iSelectedImage;1682 drawstate = ILD_SELECTED;1683 }1684 }1685 }1686 }1687 if (drawimage != -1) {1688 TRACE("drawing image state=%d\n", dis->itemState & ODS_SELECTED);1689 ImageList_Draw (infoPtr->himl, drawimage, dis->hDC, 1690 xbase, dis->rcItem.top, drawstate);1691 }1692 1693 /* setup pointer to text to be drawn */1694 if ((item->mask & CBEIF_TEXT) && item->pszText)1695 str = item->pszText;1696 else1697 str = (LPWSTR) L"";1698 1699 /* now draw the text */1700 len = lstrlenW (str);1701 GetTextExtentPointW (dis->hDC, str, len, &txtsize);1702 nbkc = GetSysColor ((dis->itemState & ODS_SELECTED) ?1703 COLOR_HIGHLIGHT : COLOR_WINDOW);1704 SetBkColor (dis->hDC, nbkc);1705 ntxc = GetSysColor ((dis->itemState & ODS_SELECTED) ?1706 COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT);1707 SetTextColor (dis->hDC, ntxc);1708 x = xbase + xioff;1709 y = dis->rcItem.top +1710 (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2;1711 rect.left = x;1712 rect.right = x + txtsize.cx;1713 rect.top = dis->rcItem.top + 1;1714 rect.bottom = dis->rcItem.bottom - 1;1715 TRACE("drawing item %d text, rect=(%d,%d)-(%d,%d)\n",1716 dis->itemID, rect.left, rect.top, rect.right, rect.bottom);1717 ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED,1718 &rect, str, len, 0);1719 if (dis->itemState & ODS_FOCUS) {1720 rect.top -= 1;1721 rect.bottom += 1;1722 rect.left -= 1;1723 rect.right += 1;1724 TRACE("drawing item %d focus after text, rect=(%d,%d)-(%d,%d)\n",1725 dis->itemID, rect.left, rect.top, rect.right, rect.bottom);1726 DrawFocusRect (dis->hDC, &rect);1727 }1728 break;1652 drawstate = ILD_NORMAL; 1653 if (!(infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGE)) { 1654 if (item->mask & CBEIF_IMAGE) 1655 drawimage = item->iImage; 1656 if (dis->itemState & ODS_COMBOEXLBOX) { 1657 /* drawing listbox entry */ 1658 if (dis->itemState & ODS_SELECTED) { 1659 if (item->mask & CBEIF_SELECTEDIMAGE) 1660 drawimage = item->iSelectedImage; 1661 drawstate = ILD_SELECTED; 1662 } 1663 } 1664 else { 1665 /* drawing combo/edit entry */ 1666 if (infoPtr->hwndEdit) { 1667 /* if we have an edit control, the slave the 1668 * selection state to the Edit focus state 1669 */ 1670 if (infoPtr->flags & WCBE_EDITFOCUSED) { 1671 if (item->mask & CBEIF_SELECTEDIMAGE) 1672 drawimage = item->iSelectedImage; 1673 drawstate = ILD_SELECTED; 1674 } 1675 } 1676 else { 1677 /* if we don't have an edit control, use 1678 * the requested state. 1679 */ 1680 if (dis->itemState & ODS_SELECTED) { 1681 if (item->mask & CBEIF_SELECTEDIMAGE) 1682 drawimage = item->iSelectedImage; 1683 drawstate = ILD_SELECTED; 1684 } 1685 } 1686 } 1687 } 1688 if (drawimage != -1) { 1689 TRACE("drawing image state=%d\n", dis->itemState & ODS_SELECTED); 1690 ImageList_Draw (infoPtr->himl, drawimage, dis->hDC, 1691 xbase, dis->rcItem.top, drawstate); 1692 } 1693 1694 /* setup pointer to text to be drawn */ 1695 if ((item->mask & CBEIF_TEXT) && item->pszText) 1696 str = item->pszText; 1697 else 1698 str = (LPWSTR) L""; 1699 1700 /* now draw the text */ 1701 len = lstrlenW (str); 1702 GetTextExtentPointW (dis->hDC, str, len, &txtsize); 1703 nbkc = GetSysColor ((dis->itemState & ODS_SELECTED) ? 1704 COLOR_HIGHLIGHT : COLOR_WINDOW); 1705 SetBkColor (dis->hDC, nbkc); 1706 ntxc = GetSysColor ((dis->itemState & ODS_SELECTED) ? 1707 COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT); 1708 SetTextColor (dis->hDC, ntxc); 1709 x = xbase + xioff; 1710 y = dis->rcItem.top + 1711 (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2; 1712 rect.left = x; 1713 rect.right = x + txtsize.cx; 1714 rect.top = dis->rcItem.top + 1; 1715 rect.bottom = dis->rcItem.bottom - 1; 1716 TRACE("drawing item %d text, rect=(%d,%d)-(%d,%d)\n", 1717 dis->itemID, rect.left, rect.top, rect.right, rect.bottom); 1718 ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED, 1719 &rect, str, len, 0); 1720 if (dis->itemState & ODS_FOCUS) { 1721 rect.top -= 1; 1722 rect.bottom += 1; 1723 rect.left -= 1; 1724 rect.right += 1; 1725 TRACE("drawing item %d focus after text, rect=(%d,%d)-(%d,%d)\n", 1726 dis->itemID, rect.left, rect.top, rect.right, rect.bottom); 1727 DrawFocusRect (dis->hDC, &rect); 1728 } 1729 break; 1729 1730 default: 1730 FIXME("unknown action hwnd=%08x, wparam=%08x, lparam=%08lx, action=%d\n", 1731 hwnd, wParam, lParam, dis->itemAction);1731 FIXME("unknown action hwnd=%08x, wparam=%08x, lparam=%08lx, action=%d\n", 1732 hwnd, wParam, lParam, dis->itemAction); 1732 1733 } 1733 1734 … … 1742 1743 1743 1744 if (infoPtr->hwndCombo) 1744 DestroyWindow (infoPtr->hwndCombo);1745 DestroyWindow (infoPtr->hwndCombo); 1745 1746 1746 1747 if (infoPtr->edit) { 1747 COMCTL32_Free (infoPtr->edit);1748 infoPtr->edit = 0;1748 COMCTL32_Free (infoPtr->edit); 1749 infoPtr->edit = 0; 1749 1750 } 1750 1751 … … 1752 1753 CBE_ITEMDATA *this, *next; 1753 1754 1754 this = infoPtr->items;1755 while (this) {1756 next = (CBE_ITEMDATA *)this->next;1757 if ((this->mask & CBEIF_TEXT) && this->pszText)1758 COMCTL32_Free (this->pszText);1759 COMCTL32_Free (this);1760 this = next;1761 }1755 this = infoPtr->items; 1756 while (this) { 1757 next = (CBE_ITEMDATA *)this->next; 1758 if ((this->mask & CBEIF_TEXT) && this->pszText) 1759 COMCTL32_Free (this->pszText); 1760 COMCTL32_Free (this); 1761 this = next; 1762 } 1762 1763 } 1763 1764 … … 1785 1786 1786 1787 TRACE("adjusted height hwnd=%08x, height=%d\n", 1787 hwnd, mis->itemHeight);1788 hwnd, mis->itemHeight); 1788 1789 1789 1790 return 0; … … 1800 1801 newstyle = oldstyle & ~(WS_VSCROLL | WS_HSCROLL); 1801 1802 if (newstyle != oldstyle) { 1802 TRACE("req style %08lx, reseting style %08lx\n",1803 oldstyle, newstyle);1804 SetWindowLongA (hwnd, GWL_STYLE, newstyle);1803 TRACE("req style %08lx, reseting style %08lx\n", 1804 oldstyle, newstyle); 1805 SetWindowLongA (hwnd, GWL_STYLE, newstyle); 1805 1806 } 1806 1807 return 1; … … 1815 1816 1816 1817 if (lParam == NF_REQUERY) { 1817 i = SendMessageA(GetParent (hwnd),1818 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);1819 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {1820 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",1821 i);1822 i = NFR_ANSI;1823 }1824 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;1825 return (LRESULT)i;1818 i = SendMessageA(GetParent (hwnd), 1819 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY); 1820 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 1821 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", 1822 i); 1823 i = NFR_ANSI; 1824 } 1825 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; 1826 return (LRESULT)i; 1826 1827 } 1827 1828 return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI); … … 1837 1838 GetWindowRect (hwnd, &rect); 1838 1839 TRACE("my rect (%d,%d)-(%d,%d)\n", 1839 rect.left, rect.top, rect.right, rect.bottom);1840 rect.left, rect.top, rect.right, rect.bottom); 1840 1841 1841 1842 MoveWindow (infoPtr->hwndCombo, 0, 0, rect.right -rect.left, 1842 rect.bottom - rect.top, TRUE);1843 rect.bottom - rect.top, TRUE); 1843 1844 1844 1845 COMBOEX_AdjustEditPos (infoPtr); … … 1862 1863 /* width is winpos value + border width of comboex */ 1863 1864 width = wp->cx 1864 + (cbx_wrect.right-cbx_wrect.left) 1865 - (cbx_crect.right-cbx_crect.left); 1865 + (cbx_wrect.right-cbx_wrect.left) 1866 - (cbx_crect.right-cbx_crect.left); 1866 1867 1867 1868 TRACE("winpos=(%d,%d %dx%d) flags=0x%08x\n", 1868 wp->x, wp->y, wp->cx, wp->cy, wp->flags);1869 wp->x, wp->y, wp->cx, wp->cy, wp->flags); 1869 1870 TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n", 1870 cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,1871 cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);1871 cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom, 1872 cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom); 1872 1873 TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n", 1873 cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,1874 width, cb_wrect.bottom-cb_wrect.top);1874 cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom, 1875 width, cb_wrect.bottom-cb_wrect.top); 1875 1876 1876 1877 if (width) SetWindowPos (infoPtr->hwndCombo, HWND_TOP, 0, 0, 1877 width,1878 cb_wrect.bottom-cb_wrect.top,1879 SWP_NOACTIVATE);1878 width, 1879 cb_wrect.bottom-cb_wrect.top, 1880 SWP_NOACTIVATE); 1880 1881 1881 1882 GetWindowRect (infoPtr->hwndCombo, &cb_wrect); … … 1883 1884 /* height is combo window height plus border width of comboex */ 1884 1885 height = (cb_wrect.bottom-cb_wrect.top) 1885 + (cbx_wrect.bottom-cbx_wrect.top)1886 + (cbx_wrect.bottom-cbx_wrect.top) 1886 1887 - (cbx_crect.bottom-cbx_crect.top); 1887 1888 if (wp->cy < height) wp->cy = height; 1888 1889 if (infoPtr->hwndEdit) { 1889 COMBOEX_AdjustEditPos (infoPtr);1890 InvalidateRect (infoPtr->hwndCombo, 0, TRUE);1890 COMBOEX_AdjustEditPos (infoPtr); 1891 InvalidateRect (infoPtr->hwndCombo, 0, TRUE); 1891 1892 } 1892 1893 … … 1906 1907 LRESULT lret; 1907 1908 1908 TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 1909 hwnd, uMsg, wParam, lParam, infoPtr);1909 TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 1910 hwnd, uMsg, wParam, lParam, infoPtr); 1910 1911 1911 1912 if (!infoPtr) return 0; … … 1915 1916 1916 1917 case WM_CHAR: 1917 /* handle (ignore) the return character */1918 if (wParam == VK_RETURN) return 0;1919 /* all other characters pass into the real Edit */1920 return CallWindowProcA (infoPtr->prevEditWndProc, 1921 hwnd, uMsg, wParam, lParam);1918 /* handle (ignore) the return character */ 1919 if (wParam == VK_RETURN) return 0; 1920 /* all other characters pass into the real Edit */ 1921 return CallWindowProcA (infoPtr->prevEditWndProc, 1922 hwnd, uMsg, wParam, lParam); 1922 1923 1923 1924 case WM_ERASEBKGND: 1924 /*1925 * The following was determined by traces of the native 1926 */1925 /* 1926 * The following was determined by traces of the native 1927 */ 1927 1928 hDC = (HDC) wParam; 1928 nbkc = GetSysColor (COLOR_WINDOW);1929 obkc = SetBkColor (hDC, nbkc);1929 nbkc = GetSysColor (COLOR_WINDOW); 1930 obkc = SetBkColor (hDC, nbkc); 1930 1931 GetClientRect (hwnd, &rect); 1931 TRACE("erasing (%d,%d)-(%d,%d)\n",1932 rect.left, rect.top, rect.right, rect.bottom);1933 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);1932 TRACE("erasing (%d,%d)-(%d,%d)\n", 1933 rect.left, rect.top, rect.right, rect.bottom); 1934 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0); 1934 1935 SetBkColor (hDC, obkc); 1935 return CallWindowProcA (infoPtr->prevEditWndProc, 1936 hwnd, uMsg, wParam, lParam);1936 return CallWindowProcA (infoPtr->prevEditWndProc, 1937 hwnd, uMsg, wParam, lParam); 1937 1938 1938 1939 case WM_KEYDOWN: { 1939 INT oldItem, selected; 1940 CBE_ITEMDATA *item; 1941 1942 switch ((INT)wParam) 1943 { 1944 case VK_ESCAPE: 1945 /* native version seems to do following for COMBOEX */ 1946 /* 1947 * GetWindowTextA(Edit,&?, 0x104) x 1948 * CB_GETCURSEL to Combo rets -1 x 1949 * WM_NOTIFY to COMBOEX parent (rebar) x 1950 * (CBEN_ENDEDIT{A|W} 1951 * fChanged = FALSE x 1952 * inewSelection = -1 x 1953 * txt="www.hoho" x 1954 * iWhy = 3 x 1955 * CB_GETCURSEL to Combo rets -1 x 1956 * InvalidateRect(Combo, 0) x 1957 * WM_SETTEXT to Edit x 1958 * EM_SETSEL to Edit (0,0) x 1959 * EM_SETSEL to Edit (0,-1) x 1960 * RedrawWindow(Combo, 0, 0, 5) x 1961 */ 1962 TRACE("special code for VK_ESCAPE\n"); 1963 1964 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 1965 1966 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1967 cbeend.fChanged = FALSE; 1968 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1969 CB_GETCURSEL, 0, 0); 1970 cbeend.iWhy = CBENF_ESCAPE; 1971 1972 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) { 1973 /* abort the change */ 1974 TRACE("Notify requested abort of change\n"); 1975 return 0; 1976 } 1977 oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0); 1978 InvalidateRect (infoPtr->hwndCombo, 0, 0); 1979 if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) { 1980 ERR("item %d not found. Problem!\n", oldItem); 1981 break; 1982 } 1983 infoPtr->selected = oldItem; 1984 COMBOEX_SetEditText (infoPtr, item); 1985 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 1986 RDW_INVALIDATE); 1987 break; 1988 1989 case VK_RETURN: 1990 /* native version seems to do following for COMBOEX */ 1991 /* 1992 * GetWindowTextA(Edit,&?, 0x104) x 1993 * CB_GETCURSEL to Combo rets -1 x 1994 * CB_GETCOUNT to Combo rets 0 1995 * if >0 loop 1996 * CB_GETITEMDATA to match 1997 * *** above 3 lines simulated by FindItem x 1998 * WM_NOTIFY to COMBOEX parent (rebar) x 1999 * (CBEN_ENDEDIT{A|W} x 2000 * fChanged = TRUE (-1) x 2001 * iNewSelection = -1 or selected x 2002 * txt= x 2003 * iWhy = 2 (CBENF_RETURN) x 2004 * CB_GETCURSEL to Combo rets -1 x 2005 * if -1 send CB_SETCURSEL to Combo -1 x 2006 * InvalidateRect(Combo, 0, 0) x 2007 * SetFocus(Edit) x 2008 * CallWindowProc(406615a8, Edit, 0x100, 0xd, 0x1c0001) 2009 */ 2010 2011 TRACE("special code for VK_RETURN\n"); 2012 2013 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 2014 2015 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 2016 selected = SendMessageW (infoPtr->hwndCombo, 2017 CB_GETCURSEL, 0, 0); 2018 2019 if (selected != -1) { 2020 item = COMBOEX_FindItem (infoPtr, selected); 2021 TRACE("handling VK_RETURN, selected = %d, selected_text=%s\n", 2022 selected, debugstr_w(item->pszText)); 2023 TRACE("handling VK_RETURN, edittext=%s\n", 2024 debugstr_w(edit_text)); 2025 if (lstrcmpiW (item->pszText, edit_text)) { 2026 /* strings not equal -- indicate edit has changed */ 2027 selected = -1; 2028 } 2029 } 2030 2031 cbeend.iNewSelection = selected; 2032 cbeend.fChanged = TRUE; 2033 cbeend.iWhy = CBENF_RETURN; 2034 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) { 2035 /* abort the change, restore previous */ 2036 TRACE("Notify requested abort of change\n"); 2037 COMBOEX_SetEditText (infoPtr, infoPtr->edit); 2038 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 2039 RDW_INVALIDATE); 2040 return 0; 2041 } 2042 oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0); 2043 if (oldItem != -1) { 2044 /* if something is selected, then deselect it */ 2045 SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, 2046 (WPARAM)-1, 0); 2047 } 2048 InvalidateRect (infoPtr->hwndCombo, 0, 0); 2049 SetFocus(infoPtr->hwndEdit); 2050 break; 2051 2052 default: 2053 return CallWindowProcA (infoPtr->prevEditWndProc, 2054 hwnd, uMsg, wParam, lParam); 2055 } 2056 return 0; 1940 INT oldItem, selected; 1941 CBE_ITEMDATA *item; 1942 1943 switch ((INT)wParam) 1944 { 1945 case VK_ESCAPE: 1946 /* native version seems to do following for COMBOEX */ 1947 /* 1948 * GetWindowTextA(Edit,&?, 0x104) x 1949 * CB_GETCURSEL to Combo rets -1 x 1950 * WM_NOTIFY to COMBOEX parent (rebar) x 1951 * (CBEN_ENDEDIT{A|W} 1952 * fChanged = FALSE x 1953 * inewSelection = -1 x 1954 * txt="www.hoho" x 1955 * iWhy = 3 x 1956 * CB_GETCURSEL to Combo rets -1 x 1957 * InvalidateRect(Combo, 0) x 1958 * WM_SETTEXT to Edit x 1959 * EM_SETSEL to Edit (0,0) x 1960 * EM_SETSEL to Edit (0,-1) x 1961 * RedrawWindow(Combo, 0, 0, 5) x 1962 */ 1963 TRACE("special code for VK_ESCAPE\n"); 1964 1965 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 1966 1967 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 1968 cbeend.fChanged = FALSE; 1969 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 1970 CB_GETCURSEL, 0, 0); 1971 cbeend.iWhy = CBENF_ESCAPE; 1972 1973 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) { 1974 /* abort the change */ 1975 TRACE("Notify requested abort of change\n"); 1976 return 0; 1977 } 1978 oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0); 1979 InvalidateRect (infoPtr->hwndCombo, 0, 0); 1980 if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) { 1981 ERR("item %d not found. Problem!\n", oldItem); 1982 break; 1983 } 1984 infoPtr->selected = oldItem; 1985 COMBOEX_SetEditText (infoPtr, item); 1986 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 1987 RDW_INVALIDATE); 1988 break; 1989 1990 case VK_RETURN: 1991 /* native version seems to do following for COMBOEX */ 1992 /* 1993 * GetWindowTextA(Edit,&?, 0x104) x 1994 * CB_GETCURSEL to Combo rets -1 x 1995 * CB_GETCOUNT to Combo rets 0 1996 * if >0 loop 1997 * CB_GETITEMDATA to match 1998 * *** above 3 lines simulated by FindItem x 1999 * WM_NOTIFY to COMBOEX parent (rebar) x 2000 * (CBEN_ENDEDIT{A|W} x 2001 * fChanged = TRUE (-1) x 2002 * iNewSelection = -1 or selected x 2003 * txt= x 2004 * iWhy = 2 (CBENF_RETURN) x 2005 * CB_GETCURSEL to Combo rets -1 x 2006 * if -1 send CB_SETCURSEL to Combo -1 x 2007 * InvalidateRect(Combo, 0, 0) x 2008 * SetFocus(Edit) x 2009 * CallWindowProc(406615a8, Edit, 0x100, 0xd, 0x1c0001) 2010 */ 2011 2012 TRACE("special code for VK_RETURN\n"); 2013 2014 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 2015 2016 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 2017 selected = SendMessageW (infoPtr->hwndCombo, 2018 CB_GETCURSEL, 0, 0); 2019 2020 if (selected != -1) { 2021 item = COMBOEX_FindItem (infoPtr, selected); 2022 TRACE("handling VK_RETURN, selected = %d, selected_text=%s\n", 2023 selected, debugstr_w(item->pszText)); 2024 TRACE("handling VK_RETURN, edittext=%s\n", 2025 debugstr_w(edit_text)); 2026 if (lstrcmpiW (item->pszText, edit_text)) { 2027 /* strings not equal -- indicate edit has changed */ 2028 selected = -1; 2057 2029 } 2030 } 2031 2032 cbeend.iNewSelection = selected; 2033 cbeend.fChanged = TRUE; 2034 cbeend.iWhy = CBENF_RETURN; 2035 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) { 2036 /* abort the change, restore previous */ 2037 TRACE("Notify requested abort of change\n"); 2038 COMBOEX_SetEditText (infoPtr, infoPtr->edit); 2039 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | 2040 RDW_INVALIDATE); 2041 return 0; 2042 } 2043 oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0); 2044 if (oldItem != -1) { 2045 /* if something is selected, then deselect it */ 2046 SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, 2047 (WPARAM)-1, 0); 2048 } 2049 InvalidateRect (infoPtr->hwndCombo, 0, 0); 2050 SetFocus(infoPtr->hwndEdit); 2051 break; 2052 2053 default: 2054 return CallWindowProcA (infoPtr->prevEditWndProc, 2055 hwnd, uMsg, wParam, lParam); 2056 } 2057 return 0; 2058 } 2058 2059 2059 2060 case WM_SETFOCUS: 2060 /* remember the focus to set state of icon */2061 lret = CallWindowProcA (infoPtr->prevEditWndProc, 2062 hwnd, uMsg, wParam, lParam);2063 infoPtr->flags |= WCBE_EDITFOCUSED;2064 return lret;2061 /* remember the focus to set state of icon */ 2062 lret = CallWindowProcA (infoPtr->prevEditWndProc, 2063 hwnd, uMsg, wParam, lParam); 2064 infoPtr->flags |= WCBE_EDITFOCUSED; 2065 return lret; 2065 2066 2066 2067 case WM_KILLFOCUS: 2067 /* 2068 * do NOTIFY CBEN_ENDEDIT with CBENF_KILLFOCUS2069 */2070 infoPtr->flags &= ~WCBE_EDITFOCUSED;2071 if (infoPtr->flags & WCBE_ACTEDIT) {2072 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);2073 2074 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);2075 cbeend.fChanged = FALSE;2076 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,2077 CB_GETCURSEL, 0, 0);2078 cbeend.iWhy = CBENF_KILLFOCUS;2079 2080 COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text);2081 }2082 /* fall through */2068 /* 2069 * do NOTIFY CBEN_ENDEDIT with CBENF_KILLFOCUS 2070 */ 2071 infoPtr->flags &= ~WCBE_EDITFOCUSED; 2072 if (infoPtr->flags & WCBE_ACTEDIT) { 2073 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 2074 2075 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 2076 cbeend.fChanged = FALSE; 2077 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 2078 CB_GETCURSEL, 0, 0); 2079 cbeend.iWhy = CBENF_KILLFOCUS; 2080 2081 COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text); 2082 } 2083 /* fall through */ 2083 2084 2084 2085 default: 2085 return CallWindowProcA (infoPtr->prevEditWndProc, 2086 hwnd, uMsg, wParam, lParam);2086 return CallWindowProcA (infoPtr->prevEditWndProc, 2087 hwnd, uMsg, wParam, lParam); 2087 2088 } 2088 2089 return 0; … … 2102 2103 WCHAR edit_text[260]; 2103 2104 2104 TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 2105 hwnd, uMsg, wParam, lParam, infoPtr);2105 TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", 2106 hwnd, uMsg, wParam, lParam, infoPtr); 2106 2107 2107 2108 if (!infoPtr) return 0; … … 2111 2112 2112 2113 case CB_FINDSTRINGEXACT: 2113 return COMBOEX_FindStringExact (infoPtr, wParam, lParam);2114 return COMBOEX_FindStringExact (infoPtr, wParam, lParam); 2114 2115 2115 2116 case WM_DRAWITEM: 2116 /*2117 * The only way this message should come is from the2118 * child Listbox issuing the message. Flag this so2119 * that ComboEx knows this is listbox.2120 */2121 ((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX;2122 return CallWindowProcA (infoPtr->prevComboWndProc, 2123 hwnd, uMsg, wParam, lParam);2117 /* 2118 * The only way this message should come is from the 2119 * child Listbox issuing the message. Flag this so 2120 * that ComboEx knows this is listbox. 2121 */ 2122 ((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX; 2123 return CallWindowProcA (infoPtr->prevComboWndProc, 2124 hwnd, uMsg, wParam, lParam); 2124 2125 2125 2126 case WM_ERASEBKGND: 2126 /*2127 * The following was determined by traces of the native 2128 */2127 /* 2128 * The following was determined by traces of the native 2129 */ 2129 2130 hDC = (HDC) wParam; 2130 nbkc = GetSysColor (COLOR_WINDOW);2131 obkc = SetBkColor (hDC, nbkc);2131 nbkc = GetSysColor (COLOR_WINDOW); 2132 obkc = SetBkColor (hDC, nbkc); 2132 2133 GetClientRect (hwnd, &rect); 2133 TRACE("erasing (%d,%d)-(%d,%d)\n",2134 rect.left, rect.top, rect.right, rect.bottom);2135 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);2134 TRACE("erasing (%d,%d)-(%d,%d)\n", 2135 rect.left, rect.top, rect.right, rect.bottom); 2136 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0); 2136 2137 SetBkColor (hDC, obkc); 2137 return CallWindowProcA (infoPtr->prevComboWndProc, 2138 hwnd, uMsg, wParam, lParam);2138 return CallWindowProcA (infoPtr->prevComboWndProc, 2139 hwnd, uMsg, wParam, lParam); 2139 2140 2140 2141 case WM_SETCURSOR: 2141 /*2142 * WM_NOTIFY to comboex parent (rebar)2143 * with NM_SETCURSOR with extra words of 0,0,0,0,0x020100012144 * CallWindowProc (previous)2145 */2146 nmmse.dwItemSpec = 0;2147 nmmse.dwItemData = 0;2148 nmmse.pt.x = 0;2149 nmmse.pt.y = 0;2150 nmmse.dwHitInfo = lParam;2151 COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse);2152 return CallWindowProcA (infoPtr->prevComboWndProc, 2153 hwnd, uMsg, wParam, lParam);2142 /* 2143 * WM_NOTIFY to comboex parent (rebar) 2144 * with NM_SETCURSOR with extra words of 0,0,0,0,0x02010001 2145 * CallWindowProc (previous) 2146 */ 2147 nmmse.dwItemSpec = 0; 2148 nmmse.dwItemData = 0; 2149 nmmse.pt.x = 0; 2150 nmmse.pt.y = 0; 2151 nmmse.dwHitInfo = lParam; 2152 COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse); 2153 return CallWindowProcA (infoPtr->prevComboWndProc, 2154 hwnd, uMsg, wParam, lParam); 2154 2155 2155 2156 case WM_COMMAND: 2156 switch (HIWORD(wParam)) {2157 2158 case EN_UPDATE:2159 /* traces show that COMBOEX does not issue CBN_EDITUPDATE2160 * on the EN_UPDATE2161 */2162 return 0;2163 2164 case EN_KILLFOCUS:2165 /*2166 * Native does:2167 *2168 * GetFocus() retns AA2169 * GetWindowTextA(Edit)2170 * CB_GETCURSEL(Combo) (got -1)2171 * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS2172 * CB_GETCURSEL(Combo) (got -1)2173 * InvalidateRect(Combo, 0, 0)2174 * WM_KILLFOCUS(Combo, AA)2175 * return 0;2176 */2177 focusedhwnd = GetFocus();2178 if (infoPtr->flags & WCBE_ACTEDIT) {2179 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);2180 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);2181 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,2182 CB_GETCURSEL, 0, 0);2183 cbeend.iWhy = CBENF_KILLFOCUS;2184 2185 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);2186 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) {2187 /* abort the change */2188 TRACE("Notify requested abort of change\n");2189 return 0;2190 }2191 }2192 /* possible CB_GETCURSEL */2193 InvalidateRect (infoPtr->hwndCombo, 0, 0);2194 if (focusedhwnd)2195 SendMessageW (infoPtr->hwndCombo, WM_KILLFOCUS,2196 (WPARAM)focusedhwnd, 0); 2197 return 0;2198 2199 case EN_SETFOCUS: {2200 /* 2201 * For EN_SETFOCUS this issues the same calls and messages2202 * as the native seems to do.2203 *2204 * for some cases however native does the following:2205 * (noticed after SetFocus during LBUTTONDOWN on2206 * on dropdown arrow)2207 * WM_GETTEXTLENGTH (Edit);2208 * WM_GETTEXT (Edit, len+1, str);2209 * EM_SETSEL (Edit, 0, 0);2210 * WM_GETTEXTLENGTH (Edit);2211 * WM_GETTEXT (Edit, len+1, str);2212 * EM_SETSEL (Edit, 0, len);2213 * WM_NOTIFY (parent, CBEN_BEGINEDIT)2214 */2215 NMHDR hdr;2216 2217 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);2218 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1);2219 COMBOEX_Notify (infoPtr, CBEN_BEGINEDIT, &hdr);2220 infoPtr->flags |= WCBE_ACTEDIT;2221 infoPtr->flags &= ~WCBE_EDITCHG; /* no change yet */2222 return 0;2223 }2224 2225 case EN_CHANGE: {2226 /* 2227 * For EN_CHANGE this issues the same calls and messages2228 * as the native seems to do.2229 */2230 WCHAR edit_text[260];2231 WCHAR *lastwrk;2232 INT selected, cnt;2233 CBE_ITEMDATA *item;2234 2235 selected = SendMessageW (infoPtr->hwndCombo,2236 CB_GETCURSEL, 0, 0);2237 2238 /* lstrlenA( lastworkingURL ) */2239 2240 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);2241 if (selected == -1) {2242 lastwrk = infoPtr->edit->pszText;2243 cnt = lstrlenW (lastwrk);2244 if (cnt >= 259) cnt = 259;2245 }2246 else {2247 item = COMBOEX_FindItem (infoPtr, selected);2248 cnt = lstrlenW (item->pszText);2249 lastwrk = item->pszText;2250 if (cnt >= 259) cnt = 259;2251 }2252 2253 TRACE("handling EN_CHANGE, selected = %d, selected_text=%s\n",2254 selected, debugstr_w(lastwrk));2255 TRACE("handling EN_CHANGE, edittext=%s\n",2256 debugstr_w(edit_text));2257 2258 /* lstrcmpiW is between lastworkingURL and GetWindowText */2259 2260 if (lstrcmpiW (lastwrk, edit_text)) {2261 /* strings not equal -- indicate edit has changed */2262 infoPtr->flags |= WCBE_EDITCHG;2263 }2264 SendMessageW ( GetParent(infoPtr->hwndSelf), WM_COMMAND,2265 MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf),2266 CBN_EDITCHANGE),2267 infoPtr->hwndSelf);2268 return 0;2269 }2270 2271 case LBN_SELCHANGE:2272 /*2273 * Therefore from traces there is no additional code here2274 */2275 2276 /*2277 * Using native COMCTL32 gets the following:2278 * 1 == SHDOCVW.DLL issues call/message2279 * 2 == COMCTL32.DLL issues call/message2280 * 3 == WINE issues call/message2281 *2282 *2283 * for LBN_SELCHANGE:2284 * 1 CB_GETCURSEL(ComboEx)2285 * 1 CB_GETDROPPEDSTATE(ComboEx)2286 * 1 CallWindowProc( *2* for WM_COMMAND(LBN_SELCHANGE)2287 * 2 CallWindowProc( *3* for WM_COMMAND(LBN_SELCHANGE)2288 ** call CBRollUp( xxx, TRUE for LBN_SELCHANGE, TRUE)2289 * 3 WM_COMMAND(ComboEx, CBN_SELENDOK)2290 * WM_USER+49(ComboLB, 1,0) <=============!!!!!!!!!!!2291 * 3 ShowWindow(ComboLB, SW_HIDE)2292 * 3 RedrawWindow(Combo, RDW_UPDATENOW)2293 * 3 WM_COMMAND(ComboEX, CBN_CLOSEUP)2294 ** end of CBRollUp2295 * 3 WM_COMMAND(ComboEx, CBN_SELCHANGE) (echo to parent)2296 * ? LB_GETCURSEL <==|2297 * ? LB_GETTEXTLEN |2298 * ? LB_GETTEXT | Needs to be added to2299 * ? WM_CTLCOLOREDIT(ComboEx) | Combo processing2300 * ? LB_GETITEMDATA |2301 * ? WM_DRAWITEM(ComboEx) <==|2302 */2303 default:2304 break;2305 }/* fall through */2157 switch (HIWORD(wParam)) { 2158 2159 case EN_UPDATE: 2160 /* traces show that COMBOEX does not issue CBN_EDITUPDATE 2161 * on the EN_UPDATE 2162 */ 2163 return 0; 2164 2165 case EN_KILLFOCUS: 2166 /* 2167 * Native does: 2168 * 2169 * GetFocus() retns AA 2170 * GetWindowTextA(Edit) 2171 * CB_GETCURSEL(Combo) (got -1) 2172 * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS 2173 * CB_GETCURSEL(Combo) (got -1) 2174 * InvalidateRect(Combo, 0, 0) 2175 * WM_KILLFOCUS(Combo, AA) 2176 * return 0; 2177 */ 2178 focusedhwnd = GetFocus(); 2179 if (infoPtr->flags & WCBE_ACTEDIT) { 2180 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 2181 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG); 2182 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo, 2183 CB_GETCURSEL, 0, 0); 2184 cbeend.iWhy = CBENF_KILLFOCUS; 2185 2186 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG); 2187 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) { 2188 /* abort the change */ 2189 TRACE("Notify requested abort of change\n"); 2190 return 0; 2191 } 2192 } 2193 /* possible CB_GETCURSEL */ 2194 InvalidateRect (infoPtr->hwndCombo, 0, 0); 2195 if (focusedhwnd) 2196 SendMessageW (infoPtr->hwndCombo, WM_KILLFOCUS, 2197 (WPARAM)focusedhwnd, 0); 2198 return 0; 2199 2200 case EN_SETFOCUS: { 2201 /* 2202 * For EN_SETFOCUS this issues the same calls and messages 2203 * as the native seems to do. 2204 * 2205 * for some cases however native does the following: 2206 * (noticed after SetFocus during LBUTTONDOWN on 2207 * on dropdown arrow) 2208 * WM_GETTEXTLENGTH (Edit); 2209 * WM_GETTEXT (Edit, len+1, str); 2210 * EM_SETSEL (Edit, 0, 0); 2211 * WM_GETTEXTLENGTH (Edit); 2212 * WM_GETTEXT (Edit, len+1, str); 2213 * EM_SETSEL (Edit, 0, len); 2214 * WM_NOTIFY (parent, CBEN_BEGINEDIT) 2215 */ 2216 NMHDR hdr; 2217 2218 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0); 2219 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1); 2220 COMBOEX_Notify (infoPtr, CBEN_BEGINEDIT, &hdr); 2221 infoPtr->flags |= WCBE_ACTEDIT; 2222 infoPtr->flags &= ~WCBE_EDITCHG; /* no change yet */ 2223 return 0; 2224 } 2225 2226 case EN_CHANGE: { 2227 /* 2228 * For EN_CHANGE this issues the same calls and messages 2229 * as the native seems to do. 2230 */ 2231 WCHAR edit_text[260]; 2232 WCHAR *lastwrk; 2233 INT selected, cnt; 2234 CBE_ITEMDATA *item; 2235 2236 selected = SendMessageW (infoPtr->hwndCombo, 2237 CB_GETCURSEL, 0, 0); 2238 2239 /* lstrlenA( lastworkingURL ) */ 2240 2241 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); 2242 if (selected == -1) { 2243 lastwrk = infoPtr->edit->pszText; 2244 cnt = lstrlenW (lastwrk); 2245 if (cnt >= 259) cnt = 259; 2246 } 2247 else { 2248 item = COMBOEX_FindItem (infoPtr, selected); 2249 cnt = lstrlenW (item->pszText); 2250 lastwrk = item->pszText; 2251 if (cnt >= 259) cnt = 259; 2252 } 2253 2254 TRACE("handling EN_CHANGE, selected = %d, selected_text=%s\n", 2255 selected, debugstr_w(lastwrk)); 2256 TRACE("handling EN_CHANGE, edittext=%s\n", 2257 debugstr_w(edit_text)); 2258 2259 /* lstrcmpiW is between lastworkingURL and GetWindowText */ 2260 2261 if (lstrcmpiW (lastwrk, edit_text)) { 2262 /* strings not equal -- indicate edit has changed */ 2263 infoPtr->flags |= WCBE_EDITCHG; 2264 } 2265 SendMessageW ( GetParent(infoPtr->hwndSelf), WM_COMMAND, 2266 MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf), 2267 CBN_EDITCHANGE), 2268 infoPtr->hwndSelf); 2269 return 0; 2270 } 2271 2272 case LBN_SELCHANGE: 2273 /* 2274 * Therefore from traces there is no additional code here 2275 */ 2276 2277 /* 2278 * Using native COMCTL32 gets the following: 2279 * 1 == SHDOCVW.DLL issues call/message 2280 * 2 == COMCTL32.DLL issues call/message 2281 * 3 == WINE issues call/message 2282 * 2283 * 2284 * for LBN_SELCHANGE: 2285 * 1 CB_GETCURSEL(ComboEx) 2286 * 1 CB_GETDROPPEDSTATE(ComboEx) 2287 * 1 CallWindowProc( *2* for WM_COMMAND(LBN_SELCHANGE) 2288 * 2 CallWindowProc( *3* for WM_COMMAND(LBN_SELCHANGE) 2289 ** call CBRollUp( xxx, TRUE for LBN_SELCHANGE, TRUE) 2290 * 3 WM_COMMAND(ComboEx, CBN_SELENDOK) 2291 * WM_USER+49(ComboLB, 1,0) <=============!!!!!!!!!!! 2292 * 3 ShowWindow(ComboLB, SW_HIDE) 2293 * 3 RedrawWindow(Combo, RDW_UPDATENOW) 2294 * 3 WM_COMMAND(ComboEX, CBN_CLOSEUP) 2295 ** end of CBRollUp 2296 * 3 WM_COMMAND(ComboEx, CBN_SELCHANGE) (echo to parent) 2297 * ? LB_GETCURSEL <==| 2298 * ? LB_GETTEXTLEN | 2299 * ? LB_GETTEXT | Needs to be added to 2300 * ? WM_CTLCOLOREDIT(ComboEx) | Combo processing 2301 * ? LB_GETITEMDATA | 2302 * ? WM_DRAWITEM(ComboEx) <==| 2303 */ 2304 default: 2305 break; 2306 }/* fall through */ 2306 2307 default: 2307 return CallWindowProcA (infoPtr->prevComboWndProc, 2308 hwnd, uMsg, wParam, lParam);2308 return CallWindowProcA (infoPtr->prevComboWndProc, 2309 hwnd, uMsg, wParam, lParam); 2309 2310 } 2310 2311 return 0; … … 2320 2321 2321 2322 if (!COMBOEX_GetInfoPtr (hwnd)) { 2322 if (uMsg == WM_CREATE)2323 return COMBOEX_Create (hwnd, wParam, lParam);2324 if (uMsg == WM_NCCREATE)2325 COMBOEX_NCCreate (hwnd, wParam, lParam);2323 if (uMsg == WM_CREATE) 2324 return COMBOEX_Create (hwnd, wParam, lParam); 2325 if (uMsg == WM_NCCREATE) 2326 COMBOEX_NCCreate (hwnd, wParam, lParam); 2326 2327 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 2327 2328 } … … 2330 2331 { 2331 2332 case CBEM_DELETEITEM: /* maps to CB_DELETESTRING */ 2332 return COMBOEX_DeleteItem (hwnd, wParam, lParam);2333 2334 case CBEM_GETCOMBOCONTROL:2335 return COMBOEX_GetComboControl (hwnd, wParam, lParam);2336 2337 case CBEM_GETEDITCONTROL:2338 return COMBOEX_GetEditControl (hwnd, wParam, lParam);2339 2340 case CBEM_GETEXTENDEDSTYLE:2341 return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam);2342 2343 case CBEM_GETIMAGELIST:2344 return COMBOEX_GetImageList (hwnd, wParam, lParam);2345 2346 case CBEM_GETITEMA:2347 return COMBOEX_GetItemA (hwnd, wParam, lParam);2348 2349 case CBEM_GETITEMW:2350 return COMBOEX_GetItemW (hwnd, wParam, lParam);2351 2352 case CBEM_GETUNICODEFORMAT:2353 return COMBOEX_GetUnicodeFormat (hwnd, wParam, lParam);2354 2355 case CBEM_HASEDITCHANGED:2356 return COMBOEX_HasEditChanged (hwnd, wParam, lParam);2357 2358 case CBEM_INSERTITEMA:2359 return COMBOEX_InsertItemA (hwnd, wParam, lParam);2360 2361 case CBEM_INSERTITEMW:2362 return COMBOEX_InsertItemW (hwnd, wParam, lParam);2363 2364 case CBEM_SETEXSTYLE:/* FIXME: obsoleted, should be the same as: */2365 case CBEM_SETEXTENDEDSTYLE:2366 return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam);2367 2368 case CBEM_SETIMAGELIST:2369 return COMBOEX_SetImageList (hwnd, wParam, lParam);2370 2371 case CBEM_SETITEMA:2372 return COMBOEX_SetItemA (hwnd, wParam, lParam);2373 2374 case CBEM_SETITEMW:2375 return COMBOEX_SetItemW (hwnd, wParam, lParam);2376 2377 case CBEM_SETUNICODEFORMAT:2378 return COMBOEX_SetUnicodeFormat (hwnd, wParam, lParam);2333 return COMBOEX_DeleteItem (hwnd, wParam, lParam); 2334 2335 case CBEM_GETCOMBOCONTROL: 2336 return COMBOEX_GetComboControl (hwnd, wParam, lParam); 2337 2338 case CBEM_GETEDITCONTROL: 2339 return COMBOEX_GetEditControl (hwnd, wParam, lParam); 2340 2341 case CBEM_GETEXTENDEDSTYLE: 2342 return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam); 2343 2344 case CBEM_GETIMAGELIST: 2345 return COMBOEX_GetImageList (hwnd, wParam, lParam); 2346 2347 case CBEM_GETITEMA: 2348 return COMBOEX_GetItemA (hwnd, wParam, lParam); 2349 2350 case CBEM_GETITEMW: 2351 return COMBOEX_GetItemW (hwnd, wParam, lParam); 2352 2353 case CBEM_GETUNICODEFORMAT: 2354 return COMBOEX_GetUnicodeFormat (hwnd, wParam, lParam); 2355 2356 case CBEM_HASEDITCHANGED: 2357 return COMBOEX_HasEditChanged (hwnd, wParam, lParam); 2358 2359 case CBEM_INSERTITEMA: 2360 return COMBOEX_InsertItemA (hwnd, wParam, lParam); 2361 2362 case CBEM_INSERTITEMW: 2363 return COMBOEX_InsertItemW (hwnd, wParam, lParam); 2364 2365 case CBEM_SETEXSTYLE: /* FIXME: obsoleted, should be the same as: */ 2366 case CBEM_SETEXTENDEDSTYLE: 2367 return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam); 2368 2369 case CBEM_SETIMAGELIST: 2370 return COMBOEX_SetImageList (hwnd, wParam, lParam); 2371 2372 case CBEM_SETITEMA: 2373 return COMBOEX_SetItemA (hwnd, wParam, lParam); 2374 2375 case CBEM_SETITEMW: 2376 return COMBOEX_SetItemW (hwnd, wParam, lParam); 2377 2378 case CBEM_SETUNICODEFORMAT: 2379 return COMBOEX_SetUnicodeFormat (hwnd, wParam, lParam); 2379 2380 2380 2381 2381 2382 /* Combo messages we are not sure if we need to process or just forward */ 2382 case CB_GETDROPPEDCONTROLRECT:2383 case CB_GETITEMHEIGHT:2384 case CB_GETLBTEXT:2385 case CB_GETLBTEXTLEN:2386 case CB_GETEXTENDEDUI:2387 case CB_LIMITTEXT:2388 case CB_RESETCONTENT:2389 case CB_SELECTSTRING:2390 case WM_SETTEXT:2391 case WM_GETTEXT:2392 FIXME("(0x%x 0x%x 0x%lx): possibly missing function\n",2393 uMsg, wParam, lParam);2394 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);2383 case CB_GETDROPPEDCONTROLRECT: 2384 case CB_GETITEMHEIGHT: 2385 case CB_GETLBTEXT: 2386 case CB_GETLBTEXTLEN: 2387 case CB_GETEXTENDEDUI: 2388 case CB_LIMITTEXT: 2389 case CB_RESETCONTENT: 2390 case CB_SELECTSTRING: 2391 case WM_SETTEXT: 2392 case WM_GETTEXT: 2393 FIXME("(0x%x 0x%x 0x%lx): possibly missing function\n", 2394 uMsg, wParam, lParam); 2395 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam); 2395 2396 2396 2397 /* Combo messages OK to just forward to the regular COMBO */ 2397 case CB_GETCOUNT: 2398 case CB_GETCURSEL:2399 case CB_GETDROPPEDSTATE:2398 case CB_GETCOUNT: 2399 case CB_GETCURSEL: 2400 case CB_GETDROPPEDSTATE: 2400 2401 case CB_SETDROPPEDWIDTH: 2401 2402 case CB_SETEXTENDEDUI: 2402 2403 case CB_SHOWDROPDOWN: 2403 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);2404 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam); 2404 2405 2405 2406 /* Combo messages we need to process specially */ 2406 2407 case CB_FINDSTRINGEXACT: 2407 return COMBOEX_FindStringExact (COMBOEX_GetInfoPtr (hwnd), 2408 wParam, lParam);2409 2410 case CB_GETITEMDATA:2411 return COMBOEX_GetItemData (hwnd, wParam, lParam);2412 2413 case CB_SETCURSEL:2414 return COMBOEX_SetCursel (hwnd, wParam, lParam);2415 2416 case CB_SETITEMDATA:2417 return COMBOEX_SetItemData (hwnd, wParam, lParam);2418 2419 case CB_SETITEMHEIGHT:2420 return COMBOEX_SetItemHeight (hwnd, wParam, lParam);2408 return COMBOEX_FindStringExact (COMBOEX_GetInfoPtr (hwnd), 2409 wParam, lParam); 2410 2411 case CB_GETITEMDATA: 2412 return COMBOEX_GetItemData (hwnd, wParam, lParam); 2413 2414 case CB_SETCURSEL: 2415 return COMBOEX_SetCursel (hwnd, wParam, lParam); 2416 2417 case CB_SETITEMDATA: 2418 return COMBOEX_SetItemData (hwnd, wParam, lParam); 2419 2420 case CB_SETITEMHEIGHT: 2421 return COMBOEX_SetItemHeight (hwnd, wParam, lParam); 2421 2422 2422 2423 2423 2424 2424 2425 /* Window messages passed to parent */ 2425 case WM_COMMAND:2426 return COMBOEX_Command (hwnd, wParam, lParam);2427 2428 case WM_NOTIFY:2429 if (infoPtr->NtfUnicode)2430 return SendMessageW (GetParent (hwnd),2431 uMsg, wParam, lParam);2432 else2433 return SendMessageA (GetParent (hwnd),2434 uMsg, wParam, lParam);2426 case WM_COMMAND: 2427 return COMBOEX_Command (hwnd, wParam, lParam); 2428 2429 case WM_NOTIFY: 2430 if (infoPtr->NtfUnicode) 2431 return SendMessageW (GetParent (hwnd), 2432 uMsg, wParam, lParam); 2433 else 2434 return SendMessageA (GetParent (hwnd), 2435 uMsg, wParam, lParam); 2435 2436 2436 2437 2437 2438 /* Window messages we need to process */ 2438 2439 case WM_DELETEITEM: 2439 return COMBOEX_WM_DeleteItem (hwnd, wParam, lParam);2440 return COMBOEX_WM_DeleteItem (hwnd, wParam, lParam); 2440 2441 2441 2442 case WM_DRAWITEM: 2442 2443 return COMBOEX_DrawItem (hwnd, wParam, lParam); 2443 2444 2444 case WM_DESTROY:2445 return COMBOEX_Destroy (hwnd, wParam, lParam);2445 case WM_DESTROY: 2446 return COMBOEX_Destroy (hwnd, wParam, lParam); 2446 2447 2447 2448 case WM_MEASUREITEM: … … 2449 2450 2450 2451 case WM_NOTIFYFORMAT: 2451 return COMBOEX_NotifyFormat (hwnd, wParam, lParam);2452 2453 case WM_SIZE:2454 return COMBOEX_Size (hwnd, wParam, lParam);2452 return COMBOEX_NotifyFormat (hwnd, wParam, lParam); 2453 2454 case WM_SIZE: 2455 return COMBOEX_Size (hwnd, wParam, lParam); 2455 2456 2456 2457 case WM_WINDOWPOSCHANGING: 2457 return COMBOEX_WindowPosChanging (hwnd, wParam, lParam);2458 2459 default:2460 if (uMsg >= WM_USER)2461 ERR("unknown msg %04x wp=%08x lp=%08lx\n",2462 uMsg, wParam, lParam);2458 return COMBOEX_WindowPosChanging (hwnd, wParam, lParam); 2459 2460 default: 2461 if (uMsg >= WM_USER) 2462 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 2463 uMsg, wParam, lParam); 2463 2464 #ifdef __WIN32OS2__ 2464 2465 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 2465 2466 #else 2466 return DefWindowProcA (hwnd, uMsg, wParam, lParam);2467 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 2467 2468 #endif 2468 2469 } … … 2484 2485 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 2485 2486 wndClass.lpszClassName = WC_COMBOBOXEXA; 2486 2487 2487 2488 RegisterClassA (&wndClass); 2488 2489 -
trunk/src/comctl32/comctl32.c
r5416 r6644 1 /* 1 /* $Id: comctl32.c,v 1.18 2001-09-05 12:04:56 bird Exp $ */ 2 /* 2 3 * Common controls functions 3 4 * … … 99 100 100 101 switch (fdwReason) { 101 case DLL_PROCESS_ATTACH:102 case DLL_PROCESS_ATTACH: 102 103 COMCTL32_hModule = (HMODULE)hinstDLL; 103 104 … … 130 131 break; 131 132 132 case DLL_PROCESS_DETACH:133 case DLL_PROCESS_DETACH: 133 134 /* unregister all common control classes */ 134 135 ANIMATE_Unregister (); … … 204 205 VOID WINAPI 205 206 MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu, 206 HINSTANCE hInst, HWND hwndStatus, LPUINT lpwIDs)207 HINSTANCE hInst, HWND hwndStatus, LPUINT lpwIDs) 207 208 { 208 209 UINT uMenuID = 0; 209 210 210 211 if (!IsWindow (hwndStatus)) 211 return;212 return; 212 213 213 214 switch (uMsg) { 214 case WM_MENUSELECT:215 TRACE("WM_MENUSELECT wParam=0x%X lParam=0x%lX\n",216 wParam, lParam);215 case WM_MENUSELECT: 216 TRACE("WM_MENUSELECT wParam=0x%X lParam=0x%lX\n", 217 wParam, lParam); 217 218 218 219 if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) { 219 220 /* menu was closed */ 220 TRACE("menu was closed!\n");221 TRACE("menu was closed!\n"); 221 222 SendMessageA (hwndStatus, SB_SIMPLE, FALSE, 0); 222 223 } 223 else {224 /* menu item was selected */225 if (HIWORD(wParam) & MF_POPUP)226 uMenuID = (UINT)*(lpwIDs+1);227 else228 uMenuID = (UINT)LOWORD(wParam);229 TRACE("uMenuID = %u\n", uMenuID);230 231 if (uMenuID) {232 CHAR szText[256];233 234 if (!LoadStringA (hInst, uMenuID, szText, 256))235 szText[0] = '\0';236 237 SendMessageA (hwndStatus, SB_SETTEXTA,238 255 | SBT_NOBORDERS, (LPARAM)szText);239 SendMessageA (hwndStatus, SB_SIMPLE, TRUE, 0);240 }241 }242 break;224 else { 225 /* menu item was selected */ 226 if (HIWORD(wParam) & MF_POPUP) 227 uMenuID = (UINT)*(lpwIDs+1); 228 else 229 uMenuID = (UINT)LOWORD(wParam); 230 TRACE("uMenuID = %u\n", uMenuID); 231 232 if (uMenuID) { 233 CHAR szText[256]; 234 235 if (!LoadStringA (hInst, uMenuID, szText, 256)) 236 szText[0] = '\0'; 237 238 SendMessageA (hwndStatus, SB_SETTEXTA, 239 255 | SBT_NOBORDERS, (LPARAM)szText); 240 SendMessageA (hwndStatus, SB_SIMPLE, TRUE, 0); 241 } 242 } 243 break; 243 244 244 245 case WM_COMMAND : 245 TRACE("WM_COMMAND wParam=0x%X lParam=0x%lX\n",246 wParam, lParam);247 /* WM_COMMAND is not invalid since it is documented248 * in the windows api reference. So don't output246 TRACE("WM_COMMAND wParam=0x%X lParam=0x%lX\n", 247 wParam, lParam); 248 /* WM_COMMAND is not invalid since it is documented 249 * in the windows api reference. So don't output 249 250 * any FIXME for WM_COMMAND 250 251 */ 251 WARN("We don't care about the WM_COMMAND\n");252 break;253 254 default:255 FIXME("Invalid Message 0x%x!\n", uMsg);256 break;257 } 258 } 259 260 261 /*********************************************************************** 262 * ShowHideMenuCtl [COMCTL32.3] 252 WARN("We don't care about the WM_COMMAND\n"); 253 break; 254 255 default: 256 FIXME("Invalid Message 0x%x!\n", uMsg); 257 break; 258 } 259 } 260 261 262 /*********************************************************************** 263 * ShowHideMenuCtl [COMCTL32.3] 263 264 * 264 265 * Shows or hides controls and updates the corresponding menu item. … … 297 298 298 299 if (lpInfo == NULL) 299 return FALSE;300 return FALSE; 300 301 301 302 if (!(lpInfo[0]) || !(lpInfo[1])) 302 return FALSE;303 return FALSE; 303 304 304 305 /* search for control */ 305 306 lpMenuId = &lpInfo[2]; 306 307 while (*lpMenuId != uFlags) 307 lpMenuId += 2;308 lpMenuId += 2; 308 309 309 310 if (GetMenuState (lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) { 310 /* uncheck menu item */311 CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED);312 313 /* hide control */314 lpMenuId++;315 SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,316 SWP_HIDEWINDOW);311 /* uncheck menu item */ 312 CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED); 313 314 /* hide control */ 315 lpMenuId++; 316 SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0, 317 SWP_HIDEWINDOW); 317 318 } 318 319 else { 319 /* check menu item */320 CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED);321 322 /* show control */323 lpMenuId++;324 SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,325 SWP_SHOWWINDOW);320 /* check menu item */ 321 CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED); 322 323 /* show control */ 324 lpMenuId++; 325 SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0, 326 SWP_SHOWWINDOW); 326 327 } 327 328 … … 357 358 358 359 TRACE("(0x%08lx 0x%08lx 0x%08lx)\n", 359 (DWORD)hwnd, (DWORD)lpRect, (DWORD)lpInfo);360 (DWORD)hwnd, (DWORD)lpRect, (DWORD)lpInfo); 360 361 361 362 GetClientRect (hwnd, lpRect); … … 363 364 364 365 do { 365 lpRun += 2;366 if (*lpRun == 0)367 return;368 lpRun++;369 hwndCtrl = GetDlgItem (hwnd, *lpRun);370 if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {371 TRACE("control id 0x%x\n", *lpRun);372 GetWindowRect (hwndCtrl, &rcCtrl);373 MapWindowPoints ((HWND)0, hwnd, (LPPOINT)&rcCtrl, 2);374 SubtractRect (lpRect, lpRect, &rcCtrl);375 }376 lpRun++;366 lpRun += 2; 367 if (*lpRun == 0) 368 return; 369 lpRun++; 370 hwndCtrl = GetDlgItem (hwnd, *lpRun); 371 if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) { 372 TRACE("control id 0x%x\n", *lpRun); 373 GetWindowRect (hwndCtrl, &rcCtrl); 374 MapWindowPoints ((HWND)0, hwnd, (LPPOINT)&rcCtrl, 2); 375 SubtractRect (lpRect, lpRect, &rcCtrl); 376 } 377 lpRun++; 377 378 } while (*lpRun); 378 379 } … … 416 417 r.left += 3; 417 418 DrawTextA (hdc, text, lstrlenA(text), 418 &r, DT_LEFT|DT_VCENTER|DT_SINGLELINE); 419 &r, DT_LEFT|DT_VCENTER|DT_SINGLELINE); 419 420 if (oldbkmode != TRANSPARENT) 420 SetBkMode(hdc, oldbkmode);421 SetBkMode(hdc, oldbkmode); 421 422 } 422 423 } … … 466 467 CreateStatusWindowA (INT style, LPCSTR text, HWND parent, UINT wid) 467 468 { 468 return CreateWindowA(STATUSCLASSNAMEA, text, style, 469 CW_USEDEFAULT, CW_USEDEFAULT,470 CW_USEDEFAULT, CW_USEDEFAULT, 471 parent, wid, 0, 0);469 return CreateWindowA(STATUSCLASSNAMEA, text, style, 470 CW_USEDEFAULT, CW_USEDEFAULT, 471 CW_USEDEFAULT, CW_USEDEFAULT, 472 parent, wid, 0, 0); 472 473 } 473 474 … … 491 492 { 492 493 return CreateWindowW(STATUSCLASSNAMEW, text, style, 493 CW_USEDEFAULT, CW_USEDEFAULT,494 CW_USEDEFAULT, CW_USEDEFAULT,495 parent, wid, 0, 0);494 CW_USEDEFAULT, CW_USEDEFAULT, 495 CW_USEDEFAULT, CW_USEDEFAULT, 496 parent, wid, 0, 0); 496 497 } 497 498 … … 521 522 HWND WINAPI 522 523 CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy, 523 HWND parent, INT id, HINSTANCE inst,524 HWND buddy, INT maxVal, INT minVal, INT curVal)524 HWND parent, INT id, HINSTANCE inst, 525 HWND buddy, INT maxVal, INT minVal, INT curVal) 525 526 { 526 527 HWND hUD = 527 CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy,528 parent, id, inst, 0);528 CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy, 529 parent, id, inst, 0); 529 530 if (hUD) { 530 SendMessageA (hUD, UDM_SETBUDDY, buddy, 0);531 SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));532 SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0)); 531 SendMessageA (hUD, UDM_SETBUDDY, buddy, 0); 532 SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal)); 533 SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0)); 533 534 } 534 535 … … 584 585 585 586 if (!lpInitCtrls) 586 return FALSE;587 return FALSE; 587 588 if (lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX)) 588 return FALSE;589 return FALSE; 589 590 590 591 TRACE("(0x%08lx)\n", lpInitCtrls->dwICC); 591 592 592 593 for (cCount = 0; cCount < 32; cCount++) { 593 dwMask = 1 << cCount;594 if (!(lpInitCtrls->dwICC & dwMask))595 continue;596 597 switch (lpInitCtrls->dwICC & dwMask) {598 /* dummy initialization */599 case ICC_ANIMATE_CLASS:600 case ICC_BAR_CLASSES:601 case ICC_LISTVIEW_CLASSES:602 case ICC_TREEVIEW_CLASSES:603 case ICC_TAB_CLASSES:604 case ICC_UPDOWN_CLASS:605 case ICC_PROGRESS_CLASS:606 case ICC_HOTKEY_CLASS:607 break;608 609 /* advanced classes - not included in Win95 */610 case ICC_DATE_CLASSES:611 MONTHCAL_Register ();612 DATETIME_Register ();613 break;614 615 case ICC_USEREX_CLASSES:616 COMBOEX_Register ();617 break;618 619 case ICC_COOL_CLASSES:620 REBAR_Register ();621 break;622 623 case ICC_INTERNET_CLASSES:624 IPADDRESS_Register ();625 break;626 627 case ICC_PAGESCROLLER_CLASS:628 PAGER_Register ();629 break;630 631 case ICC_NATIVEFNTCTL_CLASS:632 NATIVEFONT_Register ();633 break;634 635 default:636 FIXME("Unknown class! dwICC=0x%lX\n", dwMask);637 break;638 }594 dwMask = 1 << cCount; 595 if (!(lpInitCtrls->dwICC & dwMask)) 596 continue; 597 598 switch (lpInitCtrls->dwICC & dwMask) { 599 /* dummy initialization */ 600 case ICC_ANIMATE_CLASS: 601 case ICC_BAR_CLASSES: 602 case ICC_LISTVIEW_CLASSES: 603 case ICC_TREEVIEW_CLASSES: 604 case ICC_TAB_CLASSES: 605 case ICC_UPDOWN_CLASS: 606 case ICC_PROGRESS_CLASS: 607 case ICC_HOTKEY_CLASS: 608 break; 609 610 /* advanced classes - not included in Win95 */ 611 case ICC_DATE_CLASSES: 612 MONTHCAL_Register (); 613 DATETIME_Register (); 614 break; 615 616 case ICC_USEREX_CLASSES: 617 COMBOEX_Register (); 618 break; 619 620 case ICC_COOL_CLASSES: 621 REBAR_Register (); 622 break; 623 624 case ICC_INTERNET_CLASSES: 625 IPADDRESS_Register (); 626 break; 627 628 case ICC_PAGESCROLLER_CLASS: 629 PAGER_Register (); 630 break; 631 632 case ICC_NATIVEFNTCTL_CLASS: 633 NATIVEFONT_Register (); 634 break; 635 636 default: 637 FIXME("Unknown class! dwICC=0x%lX\n", dwMask); 638 break; 639 } 639 640 } 640 641 … … 681 682 hwndTB = 682 683 CreateWindowExA (0, TOOLBARCLASSNAMEA, "", style|WS_CHILD, 0, 0, 0, 0, 683 hwnd, (HMENU)wID, 0, NULL);684 hwnd, (HMENU)wID, 0, NULL); 684 685 if(hwndTB) { 685 TBADDBITMAP tbab;686 TBADDBITMAP tbab; 686 687 687 688 SendMessageA (hwndTB, TB_BUTTONSTRUCTSIZE, 688 (WPARAM)uStructSize, 0);689 (WPARAM)uStructSize, 0); 689 690 690 691 /* set bitmap and button size */ … … 705 706 706 707 707 /* add bitmaps */708 if (nBitmaps > 0)709 {710 tbab.hInst = hBMInst;711 tbab.nID = wBMID;712 713 SendMessageA (hwndTB, TB_ADDBITMAP,714 (WPARAM)nBitmaps, (LPARAM)&tbab);715 }716 /* add buttons */717 if(iNumButtons > 0)718 SendMessageA (hwndTB, TB_ADDBUTTONSA,719 (WPARAM)iNumButtons, (LPARAM)lpButtons);708 /* add bitmaps */ 709 if (nBitmaps > 0) 710 { 711 tbab.hInst = hBMInst; 712 tbab.nID = wBMID; 713 714 SendMessageA (hwndTB, TB_ADDBITMAP, 715 (WPARAM)nBitmaps, (LPARAM)&tbab); 716 } 717 /* add buttons */ 718 if(iNumButtons > 0) 719 SendMessageA (hwndTB, TB_ADDBUTTONSA, 720 (WPARAM)iNumButtons, (LPARAM)lpButtons); 720 721 } 721 722 … … 741 742 HBITMAP WINAPI 742 743 CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, UINT wFlags, 743 LPCOLORMAP lpColorMap, INT iNumMaps)744 LPCOLORMAP lpColorMap, INT iNumMaps) 744 745 { 745 746 HGLOBAL hglb; … … 754 755 COLORREF cRef; 755 756 COLORMAP internalColorMap[4] = 756 {{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}};757 {{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}}; 757 758 758 759 /* initialize pointer to colortable and default color table */ 759 760 if (lpColorMap) { 760 iMaps = iNumMaps;761 sysColorMap = lpColorMap;761 iMaps = iNumMaps; 762 sysColorMap = lpColorMap; 762 763 } 763 764 else { 764 internalColorMap[0].to = GetSysColor (COLOR_BTNTEXT);765 internalColorMap[1].to = GetSysColor (COLOR_BTNSHADOW);766 internalColorMap[2].to = GetSysColor (COLOR_BTNFACE);767 internalColorMap[3].to = GetSysColor (COLOR_BTNHIGHLIGHT);768 iMaps = 4;769 sysColorMap = (LPCOLORMAP)internalColorMap;765 internalColorMap[0].to = GetSysColor (COLOR_BTNTEXT); 766 internalColorMap[1].to = GetSysColor (COLOR_BTNSHADOW); 767 internalColorMap[2].to = GetSysColor (COLOR_BTNFACE); 768 internalColorMap[3].to = GetSysColor (COLOR_BTNHIGHLIGHT); 769 iMaps = 4; 770 sysColorMap = (LPCOLORMAP)internalColorMap; 770 771 } 771 772 772 773 hRsrc = FindResourceA (hInstance, (LPSTR)idBitmap, RT_BITMAPA); 773 774 if (hRsrc == 0) 774 return 0;775 return 0; 775 776 hglb = LoadResource (hInstance, hRsrc); 776 777 if (hglb == 0) 777 return 0;778 return 0; 778 779 lpBitmap = (LPBITMAPINFOHEADER)LockResource (hglb); 779 780 if (lpBitmap == NULL) 780 return 0;781 return 0; 781 782 782 783 nColorTableSize = (1 << lpBitmap->biBitCount); … … 784 785 lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalAlloc (GMEM_FIXED, nSize); 785 786 if (lpBitmapInfo == NULL) 786 return 0;787 return 0; 787 788 RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize); 788 789 … … 790 791 791 792 for (iColor = 0; iColor < nColorTableSize; iColor++) { 792 for (i = 0; i < iMaps; i++) {793 for (i = 0; i < iMaps; i++) { 793 794 cRef = RGB(pColorTable[iColor].rgbRed, 794 795 pColorTable[iColor].rgbGreen, 795 796 pColorTable[iColor].rgbBlue); 796 if ( cRef == sysColorMap[i].from) {797 if ( cRef == sysColorMap[i].from) { 797 798 #if 0 798 if (wFlags & CBS_MASKED) {799 if (sysColorMap[i].to != COLOR_BTNTEXT)800 pColorTable[iColor] = RGB(255, 255, 255);801 }802 else799 if (wFlags & CBS_MASKED) { 800 if (sysColorMap[i].to != COLOR_BTNTEXT) 801 pColorTable[iColor] = RGB(255, 255, 255); 802 } 803 else 803 804 #endif 804 805 pColorTable[iColor].rgbBlue = GetBValue(sysColorMap[i].to); 805 806 pColorTable[iColor].rgbGreen = GetGValue(sysColorMap[i].to); 806 807 pColorTable[iColor].rgbRed = GetRValue(sysColorMap[i].to); 807 break;808 }809 }808 break; 809 } 810 } 810 811 } 811 812 nWidth = (INT)lpBitmapInfo->biWidth; … … 814 815 hbm = CreateCompatibleBitmap (hdcScreen, nWidth, nHeight); 815 816 if (hbm) { 816 HDC hdcDst = CreateCompatibleDC (hdcScreen);817 HBITMAP hbmOld = SelectObject (hdcDst, hbm);818 LPBYTE lpBits = (LPBYTE)(lpBitmap + 1);819 lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);820 StretchDIBits (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,821 lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS,822 SRCCOPY);823 SelectObject (hdcDst, hbmOld);824 DeleteDC (hdcDst);817 HDC hdcDst = CreateCompatibleDC (hdcScreen); 818 HBITMAP hbmOld = SelectObject (hdcDst, hbm); 819 LPBYTE lpBits = (LPBYTE)(lpBitmap + 1); 820 lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD); 821 StretchDIBits (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight, 822 lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS, 823 SRCCOPY); 824 SelectObject (hdcDst, hbmOld); 825 DeleteDC (hdcDst); 825 826 } 826 827 ReleaseDC ((HWND)0, hdcScreen); … … 855 856 HWND WINAPI 856 857 CreateToolbar (HWND hwnd, DWORD style, UINT wID, INT nBitmaps, 857 HINSTANCE hBMInst, UINT wBMID,858 LPCOLDTBBUTTON lpButtons,INT iNumButtons)858 HINSTANCE hBMInst, UINT wBMID, 859 LPCOLDTBBUTTON lpButtons,INT iNumButtons) 859 860 { 860 861 return CreateToolbarEx (hwnd, style | CCS_NODIVIDER, wID, nBitmaps, 861 hBMInst, wBMID, (LPCTBBUTTON)lpButtons,862 iNumButtons, 0, 0, 0, 0, sizeof (OLDTBBUTTON));862 hBMInst, wBMID, (LPCTBBUTTON)lpButtons, 863 iNumButtons, 0, 0, 0, 0, sizeof (OLDTBBUTTON)); 863 864 } 864 865 … … 885 886 if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) { 886 887 WARN("wrong DLLVERSIONINFO size from app"); 887 return E_INVALIDARG;888 return E_INVALIDARG; 888 889 } 889 890 … … 894 895 895 896 TRACE("%lu.%lu.%lu.%lu\n", 896 pdvi->dwMajorVersion, pdvi->dwMinorVersion,897 pdvi->dwBuildNumber, pdvi->dwPlatformID);897 pdvi->dwMajorVersion, pdvi->dwMinorVersion, 898 pdvi->dwBuildNumber, pdvi->dwPlatformID); 898 899 899 900 return S_OK; … … 901 902 902 903 /*********************************************************************** 903 * DllInstall (COMCTL32.@)904 * DllInstall (COMCTL32.@) 904 905 */ 905 906 HRESULT WINAPI COMCTL32_DllInstall(BOOL bInstall, LPCWSTR cmdline) 906 907 { 907 FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE", 908 debugstr_w(cmdline));908 FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE", 909 debugstr_w(cmdline)); 909 910 910 911 return S_OK; … … 916 917 POINT pos; /* center of hover rectangle */ 917 918 INT iHoverTime; /* elapsed time the cursor has been inside of the hover rect */ 918 } _TRACKINGLIST; 919 } _TRACKINGLIST; 919 920 920 921 static _TRACKINGLIST TrackingList[10]; … … 955 956 if(TrackingList[i].tme.dwFlags & TME_HOVER) { 956 957 /* add the timer interval to the hovering time */ 957 TrackingList[i].iHoverTime+=iTimerInterval; 958 958 TrackingList[i].iHoverTime+=iTimerInterval; 959 959 960 /* has the cursor moved outside the rectangle centered around pos? */ 960 961 if((abs(pos.x - TrackingList[i].pos.x) > (hoverwidth / 2.0)) … … 985 986 } 986 987 } 987 988 988 989 /* stop the timer if the tracking list is empty */ 989 990 if(iTrackMax == 0) { … … 1036 1037 1037 1038 flags = ptme->dwFlags; 1038 1039 1039 1040 /* if HOVER_DEFAULT was specified replace this with the systems current value */ 1040 1041 if(ptme->dwHoverTime == HOVER_DEFAULT) … … 1042 1043 1043 1044 GetCursorPos(&pos); 1044 hwnd = WindowFromPoint(pos); 1045 hwnd = WindowFromPoint(pos); 1045 1046 1046 1047 if ( flags & TME_CANCEL ) { … … 1048 1049 cancel = 1; 1049 1050 } 1050 1051 1051 1052 if ( flags & TME_HOVER ) { 1052 1053 flags &= ~ TME_HOVER; 1053 1054 hover = 1; 1054 1055 } 1055 1056 1056 1057 if ( flags & TME_LEAVE ) { 1057 1058 flags &= ~ TME_LEAVE; … … 1075 1076 else 1076 1077 ptme->dwFlags = 0; 1077 1078 1078 1079 return TRUE; /* return here, TME_QUERY is retrieving information */ 1079 1080 } … … 1098 1099 { 1099 1100 TrackingList[i] = TrackingList[--iTrackMax]; 1100 1101 1101 1102 if(iTrackMax == 0) { 1102 1103 KillTimer(0, timer); … … 1119 1120 TrackingList[i].tme.dwHoverTime = ptme->dwHoverTime; 1120 1121 } 1121 1122 1122 1123 if(leave) 1123 1124 TrackingList[i].tme.dwFlags |= TME_LEAVE; 1124 1125 1125 1126 /* reset iHoverTime as per winapi specs */ 1126 TrackingList[i].iHoverTime = 0; 1127 1127 TrackingList[i].iHoverTime = 0; 1128 1128 1129 return TRUE; 1129 1130 } 1130 } 1131 } 1131 1132 1132 1133 /* if the tracking list is full return FALSE */ … … 1198 1199 1199 1200 hwndToolTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0, 1200 CW_USEDEFAULT, CW_USEDEFAULT,1201 CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner,1202 0, 0, 0);1201 CW_USEDEFAULT, CW_USEDEFAULT, 1202 CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner, 1203 0, 0, 0); 1203 1204 1204 1205 /* Send NM_TOOLTIPSCREATED notification */ 1205 1206 if (hwndToolTip) 1206 1207 { 1207 NMTOOLTIPSCREATED nmttc;1208 NMTOOLTIPSCREATED nmttc; 1208 1209 /* true owner can be different if hwndOwner is a child window */ 1209 1210 HWND hwndTrueOwner = GetWindow(hwndToolTip, GW_OWNER); 1210 1211 nmttc.hdr.hwndFrom = hwndTrueOwner; 1211 1212 nmttc.hdr.idFrom = GetWindowLongA(hwndTrueOwner, GWL_ID); 1212 nmttc.hdr.code = NM_TOOLTIPSCREATED;1213 nmttc.hwndToolTips = hwndToolTip;1213 nmttc.hdr.code = NM_TOOLTIPSCREATED; 1214 nmttc.hwndToolTips = hwndToolTip; 1214 1215 1215 1216 SendMessageA(GetParent(hwndTrueOwner), WM_NOTIFY, 1216 1217 (WPARAM)GetWindowLongA(hwndTrueOwner, GWL_ID), 1217 (LPARAM)&nmttc);1218 (LPARAM)&nmttc); 1218 1219 } 1219 1220 -
trunk/src/comctl32/comctl32undoc.c
r6380 r6644 1 /* $Id: comctl32undoc.c,v 1.22 2001-09-05 12:04:57 bird Exp $ */ 1 2 /* 2 3 * Undocumented functions from COMCTL32.DLL … … 98 99 99 100 FIXME ("phDpa=%p loadProc=%p pStream=%p lParam=%lx\n", 100 phDpa, loadProc, pStream, lParam);101 phDpa, loadProc, pStream, lParam); 101 102 102 103 if (!phDpa || !loadProc || !pStream) 103 return E_INVALIDARG;104 return E_INVALIDARG; 104 105 105 106 *phDpa = (HDPA)NULL; … … 110 111 errCode = IStream_Seek (pStream, position, STREAM_SEEK_CUR, &newPosition); 111 112 if (errCode != S_OK) 112 return errCode;113 return errCode; 113 114 114 115 errCode = IStream_Read (pStream, &streamData, sizeof(STREAMDATA), &ulRead); 115 116 if (errCode != S_OK) 116 return errCode;117 return errCode; 117 118 118 119 FIXME ("dwSize=%lu dwData2=%lu dwItems=%lu\n", 119 streamData.dwSize, streamData.dwData2, streamData.dwItems);120 streamData.dwSize, streamData.dwData2, streamData.dwItems); 120 121 121 122 if (lParam < sizeof(STREAMDATA) || 122 streamData.dwSize < sizeof(STREAMDATA) ||123 streamData.dwData2 < 1) {124 errCode = E_FAIL;123 streamData.dwSize < sizeof(STREAMDATA) || 124 streamData.dwData2 < 1) { 125 errCode = E_FAIL; 125 126 } 126 127 … … 128 129 hDpa = DPA_Create (streamData.dwItems); 129 130 if (!hDpa) 130 return E_OUTOFMEMORY;131 return E_OUTOFMEMORY; 131 132 132 133 if (!DPA_Grow (hDpa, streamData.dwItems)) 133 return E_OUTOFMEMORY;134 return E_OUTOFMEMORY; 134 135 135 136 /* load data from the stream into the dpa */ … … 137 138 for (loadData.nCount = 0; loadData.nCount < streamData.dwItems; loadData.nCount++) { 138 139 errCode = (loadProc)(&loadData, pStream, lParam); 139 if (errCode != S_OK) {140 errCode = S_FALSE;141 break;142 }143 144 *ptr = loadData.ptr;145 ptr++;140 if (errCode != S_OK) { 141 errCode = S_FALSE; 142 break; 143 } 144 145 *ptr = loadData.ptr; 146 ptr++; 146 147 } 147 148 … … 177 178 178 179 FIXME ("hDpa=%p loadProc=%p pStream=%p lParam=%lx\n", 179 hDpa, loadProc, pStream, lParam);180 hDpa, loadProc, pStream, lParam); 180 181 181 182 return E_FAIL; … … 200 201 BOOL WINAPI 201 202 DPA_Merge (const HDPA hdpa1, const HDPA hdpa2, DWORD dwFlags, 202 PFNDPACOMPARE pfnCompare, PFNDPAMERGE pfnMerge, LPARAM lParam)203 PFNDPACOMPARE pfnCompare, PFNDPAMERGE pfnMerge, LPARAM lParam) 203 204 { 204 205 INT nCount; … … 208 209 209 210 TRACE("%p %p %08lx %p %p %08lx)\n", 210 hdpa1, hdpa2, dwFlags, pfnCompare, pfnMerge, lParam);211 hdpa1, hdpa2, dwFlags, pfnCompare, pfnMerge, lParam); 211 212 212 213 if (IsBadWritePtr (hdpa1, sizeof(DPA))) 213 return FALSE;214 return FALSE; 214 215 215 216 if (IsBadWritePtr (hdpa2, sizeof(DPA))) 216 return FALSE;217 return FALSE; 217 218 218 219 if (IsBadCodePtr ((FARPROC)pfnCompare)) 219 return FALSE;220 return FALSE; 220 221 221 222 if (IsBadCodePtr ((FARPROC)pfnMerge)) 222 return FALSE;223 return FALSE; 223 224 224 225 if (dwFlags & DPAM_SORT) { 225 TRACE("sorting dpa's!\n");226 if (hdpa1->nItemCount > 0)227 DPA_Sort (hdpa1, pfnCompare, lParam);228 TRACE ("dpa 1 sorted!\n");229 if (hdpa2->nItemCount > 0)230 DPA_Sort (hdpa2, pfnCompare, lParam);231 TRACE ("dpa 2 sorted!\n");226 TRACE("sorting dpa's!\n"); 227 if (hdpa1->nItemCount > 0) 228 DPA_Sort (hdpa1, pfnCompare, lParam); 229 TRACE ("dpa 1 sorted!\n"); 230 if (hdpa2->nItemCount > 0) 231 DPA_Sort (hdpa2, pfnCompare, lParam); 232 TRACE ("dpa 2 sorted!\n"); 232 233 } 233 234 234 235 if (hdpa2->nItemCount < 1) 235 return TRUE;236 return TRUE; 236 237 237 238 TRACE("hdpa1->nItemCount=%d hdpa2->nItemCount=%d\n", 238 hdpa1->nItemCount, hdpa2->nItemCount);239 hdpa1->nItemCount, hdpa2->nItemCount); 239 240 240 241 … … 250 251 { 251 252 if (nIndex < 0) break; 252 nResult = (pfnCompare)(*pWork1, *pWork2, lParam);253 TRACE("compare result=%d, dpa1.cnt=%d, dpa2.cnt=%d\n", 254 nResult, nIndex, nCount);255 256 if (nResult == 0)257 {258 PVOID ptr;259 260 ptr = (pfnMerge)(1, *pWork1, *pWork2, lParam);261 if (!ptr)262 return FALSE;263 264 nCount--;265 pWork2--;266 *pWork1 = ptr;267 nIndex--;268 pWork1--;269 }270 else if (nResult < 0)271 {272 if (!dwFlags & 8)273 {274 PVOID ptr;275 276 ptr = DPA_DeletePtr (hdpa1, hdpa1->nItemCount - 1);277 278 (pfnMerge)(2, ptr, NULL, lParam);279 }280 nIndex--;281 pWork1--;282 }283 else284 {285 if (!dwFlags & 4)286 {287 PVOID ptr;288 289 ptr = (pfnMerge)(3, *pWork2, NULL, lParam);290 if (!ptr)291 return FALSE;292 DPA_InsertPtr (hdpa1, nIndex, ptr);293 }294 nCount--;295 pWork2--;296 }253 nResult = (pfnCompare)(*pWork1, *pWork2, lParam); 254 TRACE("compare result=%d, dpa1.cnt=%d, dpa2.cnt=%d\n", 255 nResult, nIndex, nCount); 256 257 if (nResult == 0) 258 { 259 PVOID ptr; 260 261 ptr = (pfnMerge)(1, *pWork1, *pWork2, lParam); 262 if (!ptr) 263 return FALSE; 264 265 nCount--; 266 pWork2--; 267 *pWork1 = ptr; 268 nIndex--; 269 pWork1--; 270 } 271 else if (nResult < 0) 272 { 273 if (!dwFlags & 8) 274 { 275 PVOID ptr; 276 277 ptr = DPA_DeletePtr (hdpa1, hdpa1->nItemCount - 1); 278 279 (pfnMerge)(2, ptr, NULL, lParam); 280 } 281 nIndex--; 282 pWork1--; 283 } 284 else 285 { 286 if (!dwFlags & 4) 287 { 288 PVOID ptr; 289 290 ptr = (pfnMerge)(3, *pWork2, NULL, lParam); 291 if (!ptr) 292 return FALSE; 293 DPA_InsertPtr (hdpa1, nIndex, ptr); 294 } 295 nCount--; 296 pWork2--; 297 } 297 298 298 299 } … … 358 359 359 360 if (lpSrc) 360 lpDest = HeapReAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, lpSrc, dwSize);361 lpDest = HeapReAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, lpSrc, dwSize); 361 362 else 362 lpDest = HeapAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, dwSize);363 lpDest = HeapAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, dwSize); 363 364 364 365 TRACE("-- ret=%p\n", lpDest); … … 458 459 HANDLE WINAPI 459 460 CreateMRUListLazyA (LPCREATEMRULIST lpcml, DWORD dwParam2, 460 DWORD dwParam3, DWORD dwParam4);461 DWORD dwParam3, DWORD dwParam4); 461 462 462 463 … … 490 491 #if 0 491 492 if (!(hmru->dwParam1 & 1001)) { 492 RegSetValueExA (hmru->hKeyMRU, "MRUList", 0, REG_SZ,493 hmru->lpszMRUString,494 strlen (hmru->lpszMRUString));493 RegSetValueExA (hmru->hKeyMRU, "MRUList", 0, REG_SZ, 494 hmru->lpszMRUString, 495 strlen (hmru->lpszMRUString)); 495 496 } 496 497 … … 506 507 /************************************************************************** 507 508 * AddMRUData [COMCTL32.167] 508 * 509 * 509 510 * Add item to MRU binary list. If item already exists in list then it is 510 511 * simply moved up to the top of the list and not added again. If list is … … 530 531 /************************************************************************** 531 532 * AddMRUStringA [COMCTL32.153] 532 * 533 * 533 534 * Add item to MRU string list. If item already exists in list them it is 534 535 * simply moved up to the top of the list and not added again. If list is … … 572 573 /************************************************************************** 573 574 * FindMRUData [COMCTL32.169] 574 * 575 * 575 576 * Searches binary list for item that matches lpData of length cbData. 576 577 * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value … … 590 591 { 591 592 FIXME("(%08x, %p, %ld, %p) empty stub!\n", 592 hList, lpData, cbData, lpRegNum);593 hList, lpData, cbData, lpRegNum); 593 594 594 595 return 0; … … 597 598 /************************************************************************** 598 599 * FindMRUStringA [COMCTL32.155] 599 * 600 * 600 601 * Searches string list for item that matches lpszString. 601 602 * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value … … 614 615 { 615 616 FIXME("(%08x, %s, %p) empty stub!\n", hList, debugstr_a(lpszString), 616 lpRegNum);617 lpRegNum); 617 618 618 619 return 0; … … 640 641 641 642 if (lpcml == NULL) 642 return 0;643 return 0; 643 644 644 645 if (lpcml->cbSize < sizeof(CREATEMRULIST)) 645 return 0;646 return 0; 646 647 647 648 FIXME("(%lu %lu %lx %lx \"%s\" %p)\n", 648 lpcml->cbSize, lpcml->nMaxItems, lpcml->dwFlags,649 (DWORD)lpcml->hKey, lpcml->lpszSubKey, lpcml->lpfnCompare);649 lpcml->cbSize, lpcml->nMaxItems, lpcml->dwFlags, 650 (DWORD)lpcml->hKey, lpcml->lpszSubKey, lpcml->lpfnCompare); 650 651 651 652 /* dummy pointer creation */ … … 659 660 /************************************************************************** 660 661 * EnumMRUListA [COMCTL32.154] 661 * 662 * 662 663 * Enumerate item in a list 663 664 * … … 673 674 * of list returns -1. 674 675 * If lpBuffer == NULL or nItemPos is -ve return value is no. of items in 675 * the list. 676 * the list. 676 677 */ 677 678 INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, … … 679 680 { 680 681 FIXME("(%08x, %d, %p, %ld): stub\n", hList, nItemPos, lpBuffer, 681 nBufferSize);682 nBufferSize); 682 683 return 0; 683 684 } … … 702 703 703 704 if (!lpDest && lpSrc) 704 return strlen (lpSrc);705 return strlen (lpSrc); 705 706 706 707 if (nMaxLen == 0) 707 return 0;708 return 0; 708 709 709 710 if (lpSrc == NULL) { 710 lpDest[0] = '\0';711 return 0;711 lpDest[0] = '\0'; 712 return 0; 712 713 } 713 714 714 715 len = strlen (lpSrc); 715 716 if (len >= nMaxLen) 716 len = nMaxLen - 1;717 len = nMaxLen - 1; 717 718 718 719 RtlMoveMemory (lpDest, lpSrc, len); … … 737 738 { 738 739 TRACE("(%p %p)\n", lppDest, lpSrc); 739 740 740 741 if (lpSrc) { 741 LPSTR ptr = COMCTL32_ReAlloc (*lppDest, strlen (lpSrc) + 1);742 if (!ptr)743 return FALSE;744 strcpy (ptr, lpSrc);745 *lppDest = ptr;742 LPSTR ptr = COMCTL32_ReAlloc (*lppDest, strlen (lpSrc) + 1); 743 if (!ptr) 744 return FALSE; 745 strcpy (ptr, lpSrc); 746 *lppDest = ptr; 746 747 } 747 748 else { 748 if (*lppDest) {749 COMCTL32_Free (*lppDest);750 *lppDest = NULL;751 }749 if (*lppDest) { 750 COMCTL32_Free (*lppDest); 751 *lppDest = NULL; 752 } 752 753 } 753 754 … … 775 776 776 777 if (!lpDest && lpSrc) 777 return strlenW (lpSrc);778 return strlenW (lpSrc); 778 779 779 780 if (nMaxLen == 0) 780 return 0;781 return 0; 781 782 782 783 if (lpSrc == NULL) { 783 lpDest[0] = L'\0';784 return 0;784 lpDest[0] = L'\0'; 785 return 0; 785 786 } 786 787 787 788 len = strlenW (lpSrc); 788 789 if (len >= nMaxLen) 789 len = nMaxLen - 1;790 len = nMaxLen - 1; 790 791 791 792 RtlMoveMemory (lpDest, lpSrc, len*sizeof(WCHAR)); … … 810 811 { 811 812 TRACE("(%p %p)\n", lppDest, lpSrc); 812 813 813 814 if (lpSrc) { 814 INT len = strlenW (lpSrc) + 1;815 LPWSTR ptr = COMCTL32_ReAlloc (*lppDest, len * sizeof(WCHAR));816 if (!ptr)817 return FALSE;818 strcpyW (ptr, lpSrc);819 *lppDest = ptr;815 INT len = strlenW (lpSrc) + 1; 816 LPWSTR ptr = COMCTL32_ReAlloc (*lppDest, len * sizeof(WCHAR)); 817 if (!ptr) 818 return FALSE; 819 strcpyW (ptr, lpSrc); 820 *lppDest = ptr; 820 821 } 821 822 else { 822 if (*lppDest) {823 COMCTL32_Free (*lppDest);824 *lppDest = NULL;825 }823 if (*lppDest) { 824 COMCTL32_Free (*lppDest); 825 *lppDest = NULL; 826 } 826 827 } 827 828 … … 852 853 853 854 if (!lpDest && lpSrc) 854 return WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, 0, 0, NULL, NULL);855 return WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, 0, 0, NULL, NULL); 855 856 856 857 if (nMaxLen == 0) 857 return 0;858 return 0; 858 859 859 860 if (lpSrc == NULL) { 860 lpDest[0] = '\0';861 return 0;861 lpDest[0] = '\0'; 862 return 0; 862 863 } 863 864 864 865 len = WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, 0, 0, NULL, NULL); 865 866 if (len >= nMaxLen) 866 len = nMaxLen - 1;867 len = nMaxLen - 1; 867 868 868 869 WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, lpDest, len, NULL, NULL); … … 897 898 898 899 if (lpSrc) { 899 INT len = MultiByteToWideChar(CP_ACP,0,lpSrc,-1,NULL,0);900 LPWSTR ptr = COMCTL32_ReAlloc (*lppDest, len*sizeof(WCHAR));901 902 if (!ptr)903 return FALSE;904 MultiByteToWideChar(CP_ACP,0,lpSrc,-1,ptr,len);905 *lppDest = ptr;900 INT len = MultiByteToWideChar(CP_ACP,0,lpSrc,-1,NULL,0); 901 LPWSTR ptr = COMCTL32_ReAlloc (*lppDest, len*sizeof(WCHAR)); 902 903 if (!ptr) 904 return FALSE; 905 MultiByteToWideChar(CP_ACP,0,lpSrc,-1,ptr,len); 906 *lppDest = ptr; 906 907 } 907 908 else { 908 if (*lppDest) {909 COMCTL32_Free (*lppDest);910 *lppDest = NULL;911 }909 if (*lppDest) { 910 COMCTL32_Free (*lppDest); 911 *lppDest = NULL; 912 } 912 913 } 913 914 … … 944 945 if (hdsa) 945 946 { 946 hdsa->nItemCount = 0;947 hdsa->nItemCount = 0; 947 948 hdsa->pData = NULL; 948 hdsa->nMaxCount = 0;949 hdsa->nItemSize = nSize;950 hdsa->nGrow = max(1, nGrow);949 hdsa->nMaxCount = 0; 950 hdsa->nItemSize = nSize; 951 hdsa->nGrow = max(1, nGrow); 951 952 } 952 953 … … 972 973 973 974 if (!hdsa) 974 return FALSE;975 return FALSE; 975 976 976 977 if (hdsa->pData && (!COMCTL32_Free (hdsa->pData))) 977 return FALSE;978 return FALSE; 978 979 979 980 return COMCTL32_Free (hdsa); … … 982 983 983 984 /************************************************************************** 984 * DSA_GetItem [COMCTL32.322] 985 * DSA_GetItem [COMCTL32.322] 985 986 * 986 987 * PARAMS … … 1000 1001 1001 1002 TRACE("(%p %d %p)\n", hdsa, nIndex, pDest); 1002 1003 1003 1004 if (!hdsa) 1004 return FALSE;1005 return FALSE; 1005 1006 if ((nIndex < 0) || (nIndex >= hdsa->nItemCount)) 1006 return FALSE;1007 return FALSE; 1007 1008 1008 1009 pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); … … 1014 1015 1015 1016 /************************************************************************** 1016 * DSA_GetItemPtr [COMCTL32.323] 1017 * DSA_GetItemPtr [COMCTL32.323] 1017 1018 * 1018 1019 * Retrieves a pointer to the specified item. … … 1035 1036 1036 1037 if (!hdsa) 1037 return NULL;1038 return NULL; 1038 1039 if ((nIndex < 0) || (nIndex >= hdsa->nItemCount)) 1039 return NULL;1040 return NULL; 1040 1041 1041 1042 pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); 1042 1043 1043 1044 TRACE("-- ret=%p\n", pSrc); 1044 1045 … … 1048 1049 1049 1050 /************************************************************************** 1050 * DSA_SetItem [COMCTL32.325] 1051 * DSA_SetItem [COMCTL32.325] 1051 1052 * 1052 1053 * Sets the contents of an item in the array. … … 1067 1068 INT nSize, nNewItems; 1068 1069 LPVOID pDest, lpTemp; 1069 1070 1070 1071 TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc); 1071 1072 1072 1073 if ((!hdsa) || nIndex < 0) 1073 return FALSE;1074 1074 return FALSE; 1075 1075 1076 if (hdsa->nItemCount <= nIndex) { 1076 /* within the old array */1077 if (hdsa->nMaxCount > nIndex) {1078 /* within the allocated space, set a new boundary */1079 hdsa->nItemCount = nIndex + 1;1080 }1081 else {1082 /* resize the block of memory */1083 nNewItems =1084 hdsa->nGrow * ((INT)(((nIndex + 1) - 1) / hdsa->nGrow) + 1);1085 nSize = hdsa->nItemSize * nNewItems;1086 1087 lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);1088 if (!lpTemp)1089 return FALSE;1090 1091 hdsa->nMaxCount = nNewItems;1092 hdsa->nItemCount = nIndex + 1;1093 hdsa->pData = lpTemp;1094 } 1077 /* within the old array */ 1078 if (hdsa->nMaxCount > nIndex) { 1079 /* within the allocated space, set a new boundary */ 1080 hdsa->nItemCount = nIndex + 1; 1081 } 1082 else { 1083 /* resize the block of memory */ 1084 nNewItems = 1085 hdsa->nGrow * ((INT)(((nIndex + 1) - 1) / hdsa->nGrow) + 1); 1086 nSize = hdsa->nItemSize * nNewItems; 1087 1088 lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); 1089 if (!lpTemp) 1090 return FALSE; 1091 1092 hdsa->nMaxCount = nNewItems; 1093 hdsa->nItemCount = nIndex + 1; 1094 hdsa->pData = lpTemp; 1095 } 1095 1096 } 1096 1097 … … 1098 1099 pDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); 1099 1100 TRACE("-- move dest=%p src=%p size=%d\n", 1100 pDest, pSrc, hdsa->nItemSize);1101 pDest, pSrc, hdsa->nItemSize); 1101 1102 memmove (pDest, pSrc, hdsa->nItemSize); 1102 1103 … … 1106 1107 1107 1108 /************************************************************************** 1108 * DSA_InsertItem [COMCTL32.324] 1109 * DSA_InsertItem [COMCTL32.324] 1109 1110 * 1110 1111 * PARAMS … … 1124 1125 LPVOID lpTemp, lpDest; 1125 1126 LPDWORD p; 1126 1127 1127 1128 TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc); 1128 1129 1129 1130 if ((!hdsa) || nIndex < 0) 1130 return -1;1131 return -1; 1131 1132 1132 1133 for (i = 0; i < hdsa->nItemSize; i += 4) { 1133 p = *(DWORD**)((char *) pSrc + i);1134 if (IsBadStringPtrA ((char*)p, 256))1135 TRACE("-- %d=%p\n", i, (DWORD*)p);1136 else1137 TRACE("-- %d=%p [%s]\n", i, p, debugstr_a((char*)p));1138 } 1139 1134 p = *(DWORD**)((char *) pSrc + i); 1135 if (IsBadStringPtrA ((char*)p, 256)) 1136 TRACE("-- %d=%p\n", i, (DWORD*)p); 1137 else 1138 TRACE("-- %d=%p [%s]\n", i, p, debugstr_a((char*)p)); 1139 } 1140 1140 1141 /* when nIndex >= nItemCount then append */ 1141 1142 if (nIndex >= hdsa->nItemCount) 1142 nIndex = hdsa->nItemCount;1143 nIndex = hdsa->nItemCount; 1143 1144 1144 1145 /* do we need to resize ? */ 1145 1146 if (hdsa->nItemCount >= hdsa->nMaxCount) { 1146 nNewItems = hdsa->nMaxCount + hdsa->nGrow;1147 nSize = hdsa->nItemSize * nNewItems;1148 1149 lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);1150 if (!lpTemp)1151 return -1;1152 1153 hdsa->nMaxCount = nNewItems;1154 hdsa->pData = lpTemp; 1147 nNewItems = hdsa->nMaxCount + hdsa->nGrow; 1148 nSize = hdsa->nItemSize * nNewItems; 1149 1150 lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); 1151 if (!lpTemp) 1152 return -1; 1153 1154 hdsa->nMaxCount = nNewItems; 1155 hdsa->pData = lpTemp; 1155 1156 } 1156 1157 1157 1158 /* do we need to move elements ? */ 1158 1159 if (nIndex < hdsa->nItemCount) { 1159 lpTemp = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);1160 lpDest = (char *) lpTemp + hdsa->nItemSize;1161 nSize = (hdsa->nItemCount - nIndex) * hdsa->nItemSize;1162 TRACE("-- move dest=%p src=%p size=%d\n",1163 lpDest, lpTemp, nSize);1164 memmove (lpDest, lpTemp, nSize);1160 lpTemp = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); 1161 lpDest = (char *) lpTemp + hdsa->nItemSize; 1162 nSize = (hdsa->nItemCount - nIndex) * hdsa->nItemSize; 1163 TRACE("-- move dest=%p src=%p size=%d\n", 1164 lpDest, lpTemp, nSize); 1165 memmove (lpDest, lpTemp, nSize); 1165 1166 } 1166 1167 … … 1169 1170 lpDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); 1170 1171 TRACE("-- move dest=%p src=%p size=%d\n", 1171 lpDest, pSrc, hdsa->nItemSize);1172 lpDest, pSrc, hdsa->nItemSize); 1172 1173 memmove (lpDest, pSrc, hdsa->nItemSize); 1173 1174 … … 1177 1178 1178 1179 /************************************************************************** 1179 * DSA_DeleteItem [COMCTL32.326] 1180 * DSA_DeleteItem [COMCTL32.326] 1180 1181 * 1181 1182 * PARAMS … … 1193 1194 LPVOID lpDest,lpSrc; 1194 1195 INT nSize; 1195 1196 1196 1197 TRACE("(%p %d)\n", hdsa, nIndex); 1197 1198 1198 1199 if (!hdsa) 1199 return -1;1200 return -1; 1200 1201 if (nIndex < 0 || nIndex >= hdsa->nItemCount) 1201 return -1;1202 return -1; 1202 1203 1203 1204 /* do we need to move ? */ 1204 1205 if (nIndex < hdsa->nItemCount - 1) { 1205 lpDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);1206 lpSrc = (char *) lpDest + hdsa->nItemSize;1207 nSize = hdsa->nItemSize * (hdsa->nItemCount - nIndex - 1);1208 TRACE("-- move dest=%p src=%p size=%d\n",1209 lpDest, lpSrc, nSize);1210 memmove (lpDest, lpSrc, nSize);1211 } 1212 1206 lpDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); 1207 lpSrc = (char *) lpDest + hdsa->nItemSize; 1208 nSize = hdsa->nItemSize * (hdsa->nItemCount - nIndex - 1); 1209 TRACE("-- move dest=%p src=%p size=%d\n", 1210 lpDest, lpSrc, nSize); 1211 memmove (lpDest, lpSrc, nSize); 1212 } 1213 1213 1214 hdsa->nItemCount--; 1214 1215 1215 1216 /* free memory ? */ 1216 1217 if ((hdsa->nMaxCount - hdsa->nItemCount) >= hdsa->nGrow) { 1217 nSize = hdsa->nItemSize * hdsa->nItemCount;1218 1219 lpDest = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);1220 if (!lpDest)1221 return -1;1222 1223 hdsa->nMaxCount = hdsa->nItemCount;1224 hdsa->pData = lpDest;1218 nSize = hdsa->nItemSize * hdsa->nItemCount; 1219 1220 lpDest = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); 1221 if (!lpDest) 1222 return -1; 1223 1224 hdsa->nMaxCount = hdsa->nItemCount; 1225 hdsa->pData = lpDest; 1225 1226 } 1226 1227 … … 1247 1248 TRACE("(%p)\n", hdsa); 1248 1249 1249 if (!hdsa) 1250 return FALSE;1250 if (!hdsa) 1251 return FALSE; 1251 1252 if (hdsa->pData && (!COMCTL32_Free (hdsa->pData))) 1252 return FALSE;1253 return FALSE; 1253 1254 1254 1255 hdsa->nItemCount = 0; … … 1285 1286 hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA)); 1286 1287 if (hdpa) { 1287 hdpa->nGrow = max(8, nGrow);1288 hdpa->hHeap = COMCTL32_hHeap;1289 hdpa->nMaxCount = hdpa->nGrow * 2;1290 hdpa->ptrs =1291 (LPVOID*)COMCTL32_Alloc (hdpa->nMaxCount * sizeof(LPVOID));1288 hdpa->nGrow = max(8, nGrow); 1289 hdpa->hHeap = COMCTL32_hHeap; 1290 hdpa->nMaxCount = hdpa->nGrow * 2; 1291 hdpa->ptrs = 1292 (LPVOID*)COMCTL32_Alloc (hdpa->nMaxCount * sizeof(LPVOID)); 1292 1293 } 1293 1294 … … 1315 1316 1316 1317 if (!hdpa) 1317 return FALSE;1318 return FALSE; 1318 1319 1319 1320 if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs))) 1320 return FALSE;1321 return FALSE; 1321 1322 1322 1323 return HeapFree (hdpa->hHeap, 0, hdpa); … … 1344 1345 1345 1346 if (!hdpa) 1346 return FALSE;1347 return FALSE; 1347 1348 1348 1349 hdpa->nGrow = max(8, nGrow); … … 1379 1380 1380 1381 if (!hdpa) 1381 return NULL;1382 return NULL; 1382 1383 1383 1384 TRACE("(%p %p)\n", hdpa, hdpaNew); 1384 1385 1385 1386 if (!hdpaNew) { 1386 /* create a new DPA */1387 hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,1388 sizeof(DPA));1389 hdpaTemp->hHeap = hdpa->hHeap;1390 hdpaTemp->nGrow = hdpa->nGrow;1387 /* create a new DPA */ 1388 hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1389 sizeof(DPA)); 1390 hdpaTemp->hHeap = hdpa->hHeap; 1391 hdpaTemp->nGrow = hdpa->nGrow; 1391 1392 } 1392 1393 else 1393 hdpaTemp = hdpaNew;1394 hdpaTemp = hdpaNew; 1394 1395 1395 1396 if (hdpaTemp->ptrs) { 1396 /* remove old pointer array */1397 HeapFree (hdpaTemp->hHeap, 0, hdpaTemp->ptrs);1398 hdpaTemp->ptrs = NULL;1399 hdpaTemp->nItemCount = 0;1400 hdpaTemp->nMaxCount = 0;1397 /* remove old pointer array */ 1398 HeapFree (hdpaTemp->hHeap, 0, hdpaTemp->ptrs); 1399 hdpaTemp->ptrs = NULL; 1400 hdpaTemp->nItemCount = 0; 1401 hdpaTemp->nMaxCount = 0; 1401 1402 } 1402 1403 1403 1404 /* create a new pointer array */ 1404 1405 nNewItems = hdpaTemp->nGrow * 1405 ((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1);1406 ((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1); 1406 1407 nSize = nNewItems * sizeof(LPVOID); 1407 1408 hdpaTemp->ptrs = 1408 (LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize);1409 (LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize); 1409 1410 hdpaTemp->nMaxCount = nNewItems; 1410 1411 … … 1412 1413 hdpaTemp->nItemCount = hdpa->nItemCount; 1413 1414 memmove (hdpaTemp->ptrs, hdpa->ptrs, 1414 hdpaTemp->nItemCount * sizeof(LPVOID));1415 hdpaTemp->nItemCount * sizeof(LPVOID)); 1415 1416 1416 1417 return hdpaTemp; … … 1438 1439 1439 1440 if (!hdpa) 1440 return NULL;1441 return NULL; 1441 1442 if (!hdpa->ptrs) { 1442 WARN("no pointer array.\n");1443 return NULL;1443 WARN("no pointer array.\n"); 1444 return NULL; 1444 1445 } 1445 1446 if ((i < 0) || (i >= hdpa->nItemCount)) { 1446 WARN("not enough pointers in array (%d vs %d).\n",i,hdpa->nItemCount);1447 return NULL;1447 WARN("not enough pointers in array (%d vs %d).\n",i,hdpa->nItemCount); 1448 return NULL; 1448 1449 } 1449 1450 … … 1474 1475 1475 1476 if (!hdpa->ptrs) 1476 return -1;1477 return -1; 1477 1478 1478 1479 for (i = 0; i < hdpa->nItemCount; i++) { 1479 if (hdpa->ptrs[i] == p)1480 return i;1480 if (hdpa->ptrs[i] == p) 1481 return i; 1481 1482 } 1482 1483 … … 1509 1510 1510 1511 if ((!hdpa) || (i < 0)) 1511 return -1;1512 return -1; 1512 1513 1513 1514 if (!hdpa->ptrs) { 1514 hdpa->ptrs =1515 (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,1516 2 * hdpa->nGrow * sizeof(LPVOID));1517 if (!hdpa->ptrs)1518 return -1;1519 hdpa->nMaxCount = hdpa->nGrow * 2;1515 hdpa->ptrs = 1516 (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1517 2 * hdpa->nGrow * sizeof(LPVOID)); 1518 if (!hdpa->ptrs) 1519 return -1; 1520 hdpa->nMaxCount = hdpa->nGrow * 2; 1520 1521 nIndex = 0; 1521 1522 } 1522 1523 else { 1523 if (hdpa->nItemCount >= hdpa->nMaxCount) {1524 TRACE("-- resizing\n");1525 nNewItems = hdpa->nMaxCount + hdpa->nGrow;1526 nSize = nNewItems * sizeof(LPVOID);1527 1528 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,1529 hdpa->ptrs, nSize);1530 if (!lpTemp)1531 return -1;1532 hdpa->nMaxCount = nNewItems;1533 hdpa->ptrs = lpTemp;1534 }1535 1536 if (i >= hdpa->nItemCount) {1537 nIndex = hdpa->nItemCount;1538 TRACE("-- appending at %d\n", nIndex);1539 }1540 else {1541 TRACE("-- inserting at %d\n", i);1542 lpTemp = hdpa->ptrs + i;1543 lpDest = lpTemp + 1;1544 nSize = (hdpa->nItemCount - i) * sizeof(LPVOID);1545 TRACE("-- move dest=%p src=%p size=%x\n",1546 lpDest, lpTemp, nSize);1547 memmove (lpDest, lpTemp, nSize);1548 nIndex = i;1549 }1524 if (hdpa->nItemCount >= hdpa->nMaxCount) { 1525 TRACE("-- resizing\n"); 1526 nNewItems = hdpa->nMaxCount + hdpa->nGrow; 1527 nSize = nNewItems * sizeof(LPVOID); 1528 1529 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1530 hdpa->ptrs, nSize); 1531 if (!lpTemp) 1532 return -1; 1533 hdpa->nMaxCount = nNewItems; 1534 hdpa->ptrs = lpTemp; 1535 } 1536 1537 if (i >= hdpa->nItemCount) { 1538 nIndex = hdpa->nItemCount; 1539 TRACE("-- appending at %d\n", nIndex); 1540 } 1541 else { 1542 TRACE("-- inserting at %d\n", i); 1543 lpTemp = hdpa->ptrs + i; 1544 lpDest = lpTemp + 1; 1545 nSize = (hdpa->nItemCount - i) * sizeof(LPVOID); 1546 TRACE("-- move dest=%p src=%p size=%x\n", 1547 lpDest, lpTemp, nSize); 1548 memmove (lpDest, lpTemp, nSize); 1549 nIndex = i; 1550 } 1550 1551 } 1551 1552 … … 1577 1578 { 1578 1579 LPVOID *lpTemp; 1579 1580 1580 1581 TRACE("(%p %d %p)\n", hdpa, i, p); 1581 1582 1582 1583 if ((!hdpa) || i < 0) 1583 return FALSE;1584 1584 return FALSE; 1585 1585 1586 if (hdpa->nItemCount <= i) { 1586 /* within the old array */1587 if (hdpa->nMaxCount > i) {1588 /* within the allocated space, set a new boundary */1589 hdpa->nItemCount = i+1;1590 }1591 else {1592 /* resize the block of memory */1593 INT nNewItems =1594 hdpa->nGrow * ((INT)(((i+1) - 1) / hdpa->nGrow) + 1);1595 INT nSize = nNewItems * sizeof(LPVOID);1596 1597 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,1598 hdpa->ptrs, nSize);1599 if (!lpTemp)1600 return FALSE;1601 1602 hdpa->nItemCount = nNewItems;1603 hdpa->ptrs = lpTemp; 1604 } 1587 /* within the old array */ 1588 if (hdpa->nMaxCount > i) { 1589 /* within the allocated space, set a new boundary */ 1590 hdpa->nItemCount = i+1; 1591 } 1592 else { 1593 /* resize the block of memory */ 1594 INT nNewItems = 1595 hdpa->nGrow * ((INT)(((i+1) - 1) / hdpa->nGrow) + 1); 1596 INT nSize = nNewItems * sizeof(LPVOID); 1597 1598 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1599 hdpa->ptrs, nSize); 1600 if (!lpTemp) 1601 return FALSE; 1602 1603 hdpa->nItemCount = nNewItems; 1604 hdpa->ptrs = lpTemp; 1605 } 1605 1606 } 1606 1607 … … 1631 1632 LPVOID *lpDest, *lpSrc, lpTemp = NULL; 1632 1633 INT nSize; 1633 1634 1634 1635 TRACE("(%p %d)\n", hdpa, i); 1635 1636 1636 1637 if ((!hdpa) || i < 0 || i >= hdpa->nItemCount) 1637 return NULL;1638 return NULL; 1638 1639 1639 1640 lpTemp = hdpa->ptrs[i]; … … 1641 1642 /* do we need to move ?*/ 1642 1643 if (i < hdpa->nItemCount - 1) { 1643 lpDest = hdpa->ptrs + i;1644 lpSrc = lpDest + 1;1645 nSize = (hdpa->nItemCount - i - 1) * sizeof(LPVOID);1646 TRACE("-- move dest=%p src=%p size=%x\n",1647 lpDest, lpSrc, nSize);1648 memmove (lpDest, lpSrc, nSize);1649 } 1650 1644 lpDest = hdpa->ptrs + i; 1645 lpSrc = lpDest + 1; 1646 nSize = (hdpa->nItemCount - i - 1) * sizeof(LPVOID); 1647 TRACE("-- move dest=%p src=%p size=%x\n", 1648 lpDest, lpSrc, nSize); 1649 memmove (lpDest, lpSrc, nSize); 1650 } 1651 1651 1652 hdpa->nItemCount --; 1652 1653 1653 1654 /* free memory ?*/ 1654 1655 if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) { 1655 INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount);1656 nSize = nNewItems * sizeof(LPVOID);1657 lpDest = (LPVOID)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,1658 hdpa->ptrs, nSize);1659 if (!lpDest)1660 return NULL;1661 1662 hdpa->nMaxCount = nNewItems;1663 hdpa->ptrs = (LPVOID*)lpDest; 1656 INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount); 1657 nSize = nNewItems * sizeof(LPVOID); 1658 lpDest = (LPVOID)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1659 hdpa->ptrs, nSize); 1660 if (!lpDest) 1661 return NULL; 1662 1663 hdpa->nMaxCount = nNewItems; 1664 hdpa->ptrs = (LPVOID*)lpDest; 1664 1665 } 1665 1666 … … 1686 1687 TRACE("(%p)\n", hdpa); 1687 1688 1688 if (!hdpa) 1689 return FALSE;1689 if (!hdpa) 1690 return FALSE; 1690 1691 1691 1692 if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs))) 1692 return FALSE;1693 return FALSE; 1693 1694 1694 1695 hdpa->nItemCount = 0; 1695 1696 hdpa->nMaxCount = hdpa->nGrow * 2; 1696 1697 hdpa->ptrs = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1697 hdpa->nMaxCount * sizeof(LPVOID));1698 hdpa->nMaxCount * sizeof(LPVOID)); 1698 1699 1699 1700 return TRUE; … … 1719 1720 static VOID 1720 1721 DPA_QuickSort (LPVOID *lpPtrs, INT l, INT r, 1721 PFNDPACOMPARE pfnCompare, LPARAM lParam)1722 PFNDPACOMPARE pfnCompare, LPARAM lParam) 1722 1723 { 1723 1724 INT m; … … 1725 1726 1726 1727 TRACE("l=%i r=%i\n", l, r); 1727 1728 1728 1729 if (l==r) /* one element is always sorted */ 1729 1730 return; 1730 1731 if (r<l) /* oops, got it in the wrong order */ 1731 {1732 { 1732 1733 DPA_QuickSort(lpPtrs, r, l, pfnCompare, lParam); 1733 1734 return; 1734 }1735 } 1735 1736 m = (l+r)/2; /* divide by two */ 1736 1737 DPA_QuickSort(lpPtrs, l, m, pfnCompare, lParam); … … 1738 1739 1739 1740 /* join the two sides */ 1740 while( (l<=m) && (m<r) ) 1741 while( (l<=m) && (m<r) ) 1741 1742 { 1742 1743 if(pfnCompare(lpPtrs[l],lpPtrs[m+1],lParam)>0) … … 1772 1773 { 1773 1774 if (!hdpa || !pfnCompare) 1774 return FALSE;1775 return FALSE; 1775 1776 1776 1777 TRACE("(%p %p 0x%lx)\n", hdpa, pfnCompare, lParam); 1777 1778 1778 1779 if ((hdpa->nItemCount > 1) && (hdpa->ptrs)) 1779 DPA_QuickSort (hdpa->ptrs, 0, hdpa->nItemCount - 1,1780 pfnCompare, lParam);1780 DPA_QuickSort (hdpa->ptrs, 0, hdpa->nItemCount - 1, 1781 pfnCompare, lParam); 1781 1782 1782 1783 return TRUE; … … 1809 1810 INT WINAPI 1810 1811 DPA_Search (const HDPA hdpa, LPVOID pFind, INT nStart, 1811 PFNDPACOMPARE pfnCompare, LPARAM lParam, UINT uOptions)1812 PFNDPACOMPARE pfnCompare, LPARAM lParam, UINT uOptions) 1812 1813 { 1813 1814 if (!hdpa || !pfnCompare || !pFind) 1814 return -1;1815 return -1; 1815 1816 1816 1817 TRACE("(%p %p %d %p 0x%08lx 0x%08x)\n", 1817 hdpa, pFind, nStart, pfnCompare, lParam, uOptions);1818 hdpa, pFind, nStart, pfnCompare, lParam, uOptions); 1818 1819 1819 1820 if (uOptions & DPAS_SORTED) { 1820 /* array is sorted --> use binary search */1821 INT l, r, x, n;1822 LPVOID *lpPtr;1823 1824 TRACE("binary search\n");1825 1826 l = (nStart == -1) ? 0 : nStart;1827 r = hdpa->nItemCount - 1;1828 lpPtr = hdpa->ptrs;1829 while (r >= l) {1830 x = (l + r) / 2;1831 n = (pfnCompare)(pFind, lpPtr[x], lParam);1832 if (n < 0)1833 r = x - 1;1834 else1835 l = x + 1;1836 if (n == 0) {1837 TRACE("-- ret=%d\n", n);1838 return n;1839 }1840 }1841 1842 if (uOptions & DPAS_INSERTBEFORE) {1843 TRACE("-- ret=%d\n", r);1844 return r;1845 }1846 1847 if (uOptions & DPAS_INSERTAFTER) {1848 TRACE("-- ret=%d\n", l);1849 return l;1850 }1821 /* array is sorted --> use binary search */ 1822 INT l, r, x, n; 1823 LPVOID *lpPtr; 1824 1825 TRACE("binary search\n"); 1826 1827 l = (nStart == -1) ? 0 : nStart; 1828 r = hdpa->nItemCount - 1; 1829 lpPtr = hdpa->ptrs; 1830 while (r >= l) { 1831 x = (l + r) / 2; 1832 n = (pfnCompare)(pFind, lpPtr[x], lParam); 1833 if (n < 0) 1834 r = x - 1; 1835 else 1836 l = x + 1; 1837 if (n == 0) { 1838 TRACE("-- ret=%d\n", n); 1839 return n; 1840 } 1841 } 1842 1843 if (uOptions & DPAS_INSERTBEFORE) { 1844 TRACE("-- ret=%d\n", r); 1845 return r; 1846 } 1847 1848 if (uOptions & DPAS_INSERTAFTER) { 1849 TRACE("-- ret=%d\n", l); 1850 return l; 1851 } 1851 1852 } 1852 1853 else { 1853 /* array is not sorted --> use linear search */1854 LPVOID *lpPtr;1855 INT nIndex;1856 1857 TRACE("linear search\n");1858 1859 nIndex = (nStart == -1)? 0 : nStart;1860 lpPtr = hdpa->ptrs;1861 for (; nIndex < hdpa->nItemCount; nIndex++) {1862 if ((pfnCompare)(pFind, lpPtr[nIndex], lParam) == 0) {1863 TRACE("-- ret=%d\n", nIndex);1864 return nIndex;1865 }1866 }1854 /* array is not sorted --> use linear search */ 1855 LPVOID *lpPtr; 1856 INT nIndex; 1857 1858 TRACE("linear search\n"); 1859 1860 nIndex = (nStart == -1)? 0 : nStart; 1861 lpPtr = hdpa->ptrs; 1862 for (; nIndex < hdpa->nItemCount; nIndex++) { 1863 if ((pfnCompare)(pFind, lpPtr[nIndex], lParam) == 0) { 1864 TRACE("-- ret=%d\n", nIndex); 1865 return nIndex; 1866 } 1867 } 1867 1868 } 1868 1869 … … 1894 1895 1895 1896 if (hHeap) 1896 hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(DPA));1897 hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(DPA)); 1897 1898 else 1898 hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA));1899 hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA)); 1899 1900 1900 1901 if (hdpa) { 1901 hdpa->nGrow = min(8, nGrow);1902 hdpa->hHeap = hHeap ? hHeap : COMCTL32_hHeap;1903 hdpa->nMaxCount = hdpa->nGrow * 2;1904 hdpa->ptrs =1905 (LPVOID*)HeapAlloc (hHeap, HEAP_ZERO_MEMORY,1906 hdpa->nMaxCount * sizeof(LPVOID));1902 hdpa->nGrow = min(8, nGrow); 1903 hdpa->hHeap = hHeap ? hHeap : COMCTL32_hHeap; 1904 hdpa->nMaxCount = hdpa->nGrow * 2; 1905 hdpa->ptrs = 1906 (LPVOID*)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, 1907 hdpa->nMaxCount * sizeof(LPVOID)); 1907 1908 } 1908 1909 … … 1940 1941 1941 1942 TRACE("(0x%04x 0x%04x %d %p 0x%08lx)\n", 1942 lpNotify->hwndFrom, lpNotify->hwndTo, uCode, lpHdr,1943 lpNotify->dwParam5);1943 lpNotify->hwndFrom, lpNotify->hwndTo, uCode, lpHdr, 1944 lpNotify->dwParam5); 1944 1945 1945 1946 if (!lpNotify->hwndTo) 1946 return 0;1947 return 0; 1947 1948 1948 1949 if (lpNotify->hwndFrom == -1) { 1949 lpNmh = lpHdr;1950 idFrom = lpHdr->idFrom;1950 lpNmh = lpHdr; 1951 idFrom = lpHdr->idFrom; 1951 1952 } 1952 1953 else { 1953 if (lpNotify->hwndFrom) {1954 HWND hwndParent = GetParent (lpNotify->hwndFrom);1955 if (hwndParent) {1956 hwndParent = GetWindow (lpNotify->hwndFrom, GW_OWNER);1957 if (hwndParent)1958 idFrom = GetDlgCtrlID (lpNotify->hwndFrom);1959 }1960 }1961 1962 lpNmh = (lpHdr) ? lpHdr : &nmhdr;1963 1964 lpNmh->hwndFrom = lpNotify->hwndFrom;1965 lpNmh->idFrom = idFrom;1966 lpNmh->code = uCode;1954 if (lpNotify->hwndFrom) { 1955 HWND hwndParent = GetParent (lpNotify->hwndFrom); 1956 if (hwndParent) { 1957 hwndParent = GetWindow (lpNotify->hwndFrom, GW_OWNER); 1958 if (hwndParent) 1959 idFrom = GetDlgCtrlID (lpNotify->hwndFrom); 1960 } 1961 } 1962 1963 lpNmh = (lpHdr) ? lpHdr : &nmhdr; 1964 1965 lpNmh->hwndFrom = lpNotify->hwndFrom; 1966 lpNmh->idFrom = idFrom; 1967 lpNmh->code = uCode; 1967 1968 } 1968 1969 … … 1987 1988 LRESULT WINAPI 1988 1989 COMCTL32_SendNotify (HWND hwndFrom, HWND hwndTo, 1989 UINT uCode, LPNMHDR lpHdr)1990 UINT uCode, LPNMHDR lpHdr) 1990 1991 { 1991 1992 NOTIFYDATA notify; 1992 1993 1993 1994 TRACE("(0x%04x 0x%04x %d %p)\n", 1994 hwndFrom, hwndTo, uCode, lpHdr);1995 hwndFrom, hwndTo, uCode, lpHdr); 1995 1996 1996 1997 notify.hwndFrom = hwndFrom; … … 2020 2021 LRESULT WINAPI 2021 2022 COMCTL32_SendNotifyEx (HWND hwndTo, HWND hwndFrom, UINT uCode, 2022 LPNMHDR lpHdr, DWORD dwParam5)2023 LPNMHDR lpHdr, DWORD dwParam5) 2023 2024 { 2024 2025 NOTIFYDATA notify; … … 2026 2027 2027 2028 TRACE("(0x%04x 0x%04x %d %p 0x%08lx)\n", 2028 hwndFrom, hwndTo, uCode, lpHdr, dwParam5);2029 hwndFrom, hwndTo, uCode, lpHdr, dwParam5); 2029 2030 2030 2031 hwndNotify = hwndTo; 2031 2032 if (!hwndTo) { 2032 if (IsWindow (hwndFrom)) {2033 hwndNotify = GetParent (hwndFrom);2034 if (!hwndNotify)2035 return 0;2036 }2033 if (IsWindow (hwndFrom)) { 2034 hwndNotify = GetParent (hwndFrom); 2035 if (!hwndNotify) 2036 return 0; 2037 } 2037 2038 } 2038 2039 … … 2069 2070 2070 2071 if (*lpStr2 == 0) 2071 return ((LPSTR)lpStr1);2072 return ((LPSTR)lpStr1); 2072 2073 len1 = 0; 2073 2074 while (lpStr1[len1] != 0) ++len1; … … 2075 2076 while (lpStr2[len2] != 0) ++len2; 2076 2077 if (len2 == 0) 2077 return ((LPSTR)(lpStr1 + len1));2078 return ((LPSTR)(lpStr1 + len1)); 2078 2079 first = tolower (*lpStr2); 2079 2080 while (len1 >= len2) { 2080 if (tolower(*lpStr1) == first) {2081 for (i = 1; i < len2; ++i)2082 if (tolower (lpStr1[i]) != tolower(lpStr2[i]))2083 break;2084 if (i >= len2)2085 return ((LPSTR)lpStr1);2081 if (tolower(*lpStr1) == first) { 2082 for (i = 1; i < len2; ++i) 2083 if (tolower (lpStr1[i]) != tolower(lpStr2[i])) 2084 break; 2085 if (i >= len2) 2086 return ((LPSTR)lpStr1); 2086 2087 } 2087 ++lpStr1; --len1;2088 ++lpStr1; --len1; 2088 2089 } 2089 2090 return (NULL); … … 2116 2117 * 2117 2118 * Enumerates all items in a dynamic pointer array. 2118 *2119 * PARAMS2120 * hdpa [I] handle to the dynamic pointer array2121 * enumProc [I]2122 * lParam [I]2123 *2124 * RETURNS2125 * none2126 */2127 2128 VOID WINAPI2129 DPA_EnumCallback (const HDPA hdpa, DPAENUMPROC enumProc, LPARAM lParam)2130 {2131 INT i;2132 2133 TRACE("(%p %p %08lx)\n", hdpa, enumProc, lParam);2134 2135 if (!hdpa)2136 return;2137 if (hdpa->nItemCount <= 0)2138 return;2139 2140 for (i = 0; i < hdpa->nItemCount; i++) {2141 if ((enumProc)(hdpa->ptrs[i], lParam) == 0)2142 return;2143 }2144 2145 return;2146 }2147 2148 2149 /**************************************************************************2150 * DPA_DestroyCallback [COMCTL32.386]2151 *2152 * Enumerates all items in a dynamic pointer array and destroys it.2153 2119 * 2154 2120 * PARAMS … … 2158 2124 * 2159 2125 * RETURNS 2126 * none 2127 */ 2128 2129 VOID WINAPI 2130 DPA_EnumCallback (const HDPA hdpa, DPAENUMPROC enumProc, LPARAM lParam) 2131 { 2132 INT i; 2133 2134 TRACE("(%p %p %08lx)\n", hdpa, enumProc, lParam); 2135 2136 if (!hdpa) 2137 return; 2138 if (hdpa->nItemCount <= 0) 2139 return; 2140 2141 for (i = 0; i < hdpa->nItemCount; i++) { 2142 if ((enumProc)(hdpa->ptrs[i], lParam) == 0) 2143 return; 2144 } 2145 2146 return; 2147 } 2148 2149 2150 /************************************************************************** 2151 * DPA_DestroyCallback [COMCTL32.386] 2152 * 2153 * Enumerates all items in a dynamic pointer array and destroys it. 2154 * 2155 * PARAMS 2156 * hdpa [I] handle to the dynamic pointer array 2157 * enumProc [I] 2158 * lParam [I] 2159 * 2160 * RETURNS 2160 2161 * Success: TRUE 2161 2162 * Failure: FALSE … … 2195 2196 2196 2197 if (!hdsa) 2197 return;2198 return; 2198 2199 if (hdsa->nItemCount <= 0) 2199 return;2200 return; 2200 2201 2201 2202 for (i = 0; i < hdsa->nItemCount; i++) { 2202 LPVOID lpItem = DSA_GetItemPtr (hdsa, i);2203 if ((enumProc)(lpItem, lParam) == 0)2204 return;2203 LPVOID lpItem = DSA_GetItemPtr (hdsa, i); 2204 if ((enumProc)(lpItem, lParam) == 0) 2205 return; 2205 2206 } 2206 2207 … … 2301 2302 if (dbcs && lpStart[1] != HIBYTE(wMatch)) continue; 2302 2303 lpGotIt = lpStart; 2303 } 2304 } 2304 2305 return (LPSTR)lpGotIt; 2305 2306 } … … 2355 2356 if( strchrW(lpSet, *(WORD*)lpLoop)) 2356 2357 return (INT)(lpLoop-lpStr); 2357 2358 2358 2359 return (INT)(lpLoop-lpStr); 2359 2360 } … … 2399 2400 2400 2401 if (IsWindow (hwnd) == FALSE) 2401 return FALSE;2402 return FALSE; 2402 2403 2403 2404 if (b == 0) 2404 return FALSE;2405 return FALSE; 2405 2406 2406 2407 -
trunk/src/comctl32/datetime.c
r6470 r6644 1 /* $Id: datetime.c,v 1.18 2001-09-05 12:04:57 bird Exp $ */ 1 2 /* 2 3 * Date and time picker control … … 34 35 COMCTL32_HEADER header; 35 36 #endif 36 HWND hMonthCal;37 HWND hUpdown;38 SYSTEMTIME date;39 BOOL dateValid;40 HWND hwndCheckbut;41 RECT rcClient; /* rect around the edge of the window */42 RECT rcDraw; /* rect inside of the border */43 RECT checkbox; /* checkbox allowing the control to be enabled/disabled */44 RECT calbutton; /* button that toggles the dropdown of the monthcal control */45 BOOL bCalDepressed; /* TRUE = cal button is depressed */46 int select;47 HFONT hFont;48 int nrFieldsAllocated;49 int nrFields;50 int haveFocus;51 int *fieldspec;52 RECT *fieldRect;53 int *buflen; 54 char textbuf[256];37 HWND hMonthCal; 38 HWND hUpdown; 39 SYSTEMTIME date; 40 BOOL dateValid; 41 HWND hwndCheckbut; 42 RECT rcClient; /* rect around the edge of the window */ 43 RECT rcDraw; /* rect inside of the border */ 44 RECT checkbox; /* checkbox allowing the control to be enabled/disabled */ 45 RECT calbutton; /* button that toggles the dropdown of the monthcal control */ 46 BOOL bCalDepressed; /* TRUE = cal button is depressed */ 47 int select; 48 HFONT hFont; 49 int nrFieldsAllocated; 50 int nrFields; 51 int haveFocus; 52 int *fieldspec; 53 RECT *fieldRect; 54 int *buflen; 55 char textbuf[256]; 55 56 POINT monthcal_pos; 56 57 } DATETIME_INFO, *LPDATETIME_INFO; … … 61 62 /* this list of defines is closely related to `allowedformatchars' defined 62 63 * in datetime.c; the high nibble indicates the `base type' of the format 63 * specifier. 64 * specifier. 64 65 * Do not change without first reading DATETIME_UseFormat. 65 * 66 * 66 67 */ 67 68 68 #define DT_END_FORMAT 0 69 #define ONEDIGITDAY 0x0170 #define TWODIGITDAY 0x0271 #define THREECHARDAY 0x0369 #define DT_END_FORMAT 0 70 #define ONEDIGITDAY 0x01 71 #define TWODIGITDAY 0x02 72 #define THREECHARDAY 0x03 72 73 #define FULLDAY 0x04 73 74 #define ONEDIGIT12HOUR 0x11 … … 94 95 #define FORMATCALLBACK 0x81 /* -> maximum of 0x80 callbacks possible */ 95 96 #define FORMATCALLMASK 0x80 96 #define DT_STRING 0x010097 #define DT_STRING 0x0100 97 98 98 99 #define DTHT_DATEFIELD 0xff /* for hit-testing */ 99 100 100 101 #define DTHT_NONE 0 101 #define DTHT_CHECKBOX 0x200 /* these should end at '00' , to make */102 #define DTHT_CHECKBOX 0x200 /* these should end at '00' , to make */ 102 103 #define DTHT_MCPOPUP 0x300 /* & DTHT_DATEFIELD 0 when DATETIME_KeyDown */ 103 104 #define DTHT_GOTFOCUS 0x400 /* tests for date-fields */ … … 126 127 if (!lParam) return GDT_NONE; 127 128 128 if ((dwStyle & DTS_SHOWNONE) && 129 if ((dwStyle & DTS_SHOWNONE) && 129 130 (SendMessageA (infoPtr->hwndCheckbut, BM_GETCHECK, 0, 0))) 130 131 return GDT_NONE; … … 145 146 if (!lParam) return 0; 146 147 147 if (lParam==GDT_VALID) 148 MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date);148 if (lParam==GDT_VALID) 149 MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date); 149 150 if (lParam==GDT_NONE) { 150 infoPtr->dateValid=FALSE;151 infoPtr->dateValid=FALSE; 151 152 SendMessageA (infoPtr->hwndCheckbut, BM_SETCHECK, 0, 0); 152 }153 } 153 154 return 1; 154 155 } … … 228 229 229 230 230 /* 231 Split up a formattxt in actions. 231 /* 232 Split up a formattxt in actions. 232 233 See ms documentation for the meaning of the letter codes/'specifiers'. 233 234 234 Notes: 235 Notes: 235 236 *'dddddd' is handled as 'dddd' plus 'dd'. 236 *unrecognized formats are strings (here given the type DT_STRING; 237 *unrecognized formats are strings (here given the type DT_STRING; 237 238 start of the string is encoded in lower bits of DT_STRING. 238 239 Therefore, 'string' ends finally up as '<show seconds>tring'. … … 241 242 242 243 243 static void 244 static void 244 245 DATETIME_UseFormat (DATETIME_INFO *infoPtr, const char *formattxt) 245 246 { … … 256 257 257 258 for (i=0; i<strlen (formattxt); i++) { 258 TRACE ("\n%d %c:",i, formattxt[i]);259 for (j=0; j<len; j++) {260 if (allowedformatchars[j]==formattxt[i]) {261 TRACE ("%c[%d,%x]",allowedformatchars[j], *nrFields,262 infoPtr->fieldspec[*nrFields]);263 if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) {264 infoPtr->fieldspec[*nrFields]=(j<<4) +1;265 break;266 }267 if (infoPtr->fieldspec[*nrFields]>>4!=j) { 268 (*nrFields)++; 269 infoPtr->fieldspec[*nrFields]=(j<<4) +1;270 break;271 }272 if ((infoPtr->fieldspec[*nrFields] & 0x0f)==maxrepetition[j]) {273 (*nrFields)++; 274 infoPtr->fieldspec[*nrFields]=(j<<4) +1;275 break;276 }277 infoPtr->fieldspec[*nrFields]++;278 break;279 } /* if allowedformatchar */280 } /* for j */281 282 283 /* char is not a specifier: handle char like a string */284 if (j==len) {285 if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) {286 infoPtr->fieldspec[*nrFields]=DT_STRING+k;287 infoPtr->buflen[*nrFields]=0;288 } else 289 if ((infoPtr->fieldspec[*nrFields] & DT_STRING)!=DT_STRING) {290 (*nrFields)++;291 infoPtr->fieldspec[*nrFields]=DT_STRING+k;292 infoPtr->buflen[*nrFields]=0;293 } 294 infoPtr->textbuf[k]=formattxt[i];295 k++;296 infoPtr->buflen[*nrFields]++;297 } /* if j=len */298 299 if (*nrFields==infoPtr->nrFieldsAllocated) {300 FIXME ("out of memory; should reallocate. crash ahead.\n");301 }259 TRACE ("\n%d %c:",i, formattxt[i]); 260 for (j=0; j<len; j++) { 261 if (allowedformatchars[j]==formattxt[i]) { 262 TRACE ("%c[%d,%x]",allowedformatchars[j], *nrFields, 263 infoPtr->fieldspec[*nrFields]); 264 if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) { 265 infoPtr->fieldspec[*nrFields]=(j<<4) +1; 266 break; 267 } 268 if (infoPtr->fieldspec[*nrFields]>>4!=j) { 269 (*nrFields)++; 270 infoPtr->fieldspec[*nrFields]=(j<<4) +1; 271 break; 272 } 273 if ((infoPtr->fieldspec[*nrFields] & 0x0f)==maxrepetition[j]) { 274 (*nrFields)++; 275 infoPtr->fieldspec[*nrFields]=(j<<4) +1; 276 break; 277 } 278 infoPtr->fieldspec[*nrFields]++; 279 break; 280 } /* if allowedformatchar */ 281 } /* for j */ 282 283 284 /* char is not a specifier: handle char like a string */ 285 if (j==len) { 286 if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) { 287 infoPtr->fieldspec[*nrFields]=DT_STRING+k; 288 infoPtr->buflen[*nrFields]=0; 289 } else 290 if ((infoPtr->fieldspec[*nrFields] & DT_STRING)!=DT_STRING) { 291 (*nrFields)++; 292 infoPtr->fieldspec[*nrFields]=DT_STRING+k; 293 infoPtr->buflen[*nrFields]=0; 294 } 295 infoPtr->textbuf[k]=formattxt[i]; 296 k++; 297 infoPtr->buflen[*nrFields]++; 298 } /* if j=len */ 299 300 if (*nrFields==infoPtr->nrFieldsAllocated) { 301 FIXME ("out of memory; should reallocate. crash ahead.\n"); 302 } 302 303 303 304 } /* for i */ … … 309 310 310 311 311 static LRESULT 312 static LRESULT 312 313 DATETIME_SetFormat (HWND hwnd, WPARAM wParam, LPARAM lParam) 313 314 { … … 318 319 TRACE("%04x %08lx\n",wParam,lParam); 319 320 if (!lParam) { 320 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);321 322 if (dwStyle & DTS_LONGDATEFORMAT) 323 format_item=LOCALE_SLONGDATE;324 else if (dwStyle & DTS_TIMEFORMAT) 325 format_item=LOCALE_STIMEFORMAT;321 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 322 323 if (dwStyle & DTS_LONGDATEFORMAT) 324 format_item=LOCALE_SLONGDATE; 325 else if (dwStyle & DTS_TIMEFORMAT) 326 format_item=LOCALE_STIMEFORMAT; 326 327 else /* DTS_SHORTDATEFORMAT */ 327 format_item=LOCALE_SSHORTDATE;328 GetLocaleInfoA( GetSystemDefaultLCID(), format_item,format_buf,sizeof(format_buf));329 DATETIME_UseFormat (infoPtr, format_buf);330 } 328 format_item=LOCALE_SSHORTDATE; 329 GetLocaleInfoA( GetSystemDefaultLCID(), format_item,format_buf,sizeof(format_buf)); 330 DATETIME_UseFormat (infoPtr, format_buf); 331 } 331 332 else 332 DATETIME_UseFormat (infoPtr, (char *) lParam);333 DATETIME_UseFormat (infoPtr, (char *) lParam); 333 334 334 335 return infoPtr->nrFields; … … 336 337 337 338 338 static LRESULT 339 static LRESULT 339 340 DATETIME_SetFormatW (HWND hwnd, WPARAM wParam, LPARAM lParam) 340 341 … … 342 343 TRACE("%04x %08lx\n",wParam,lParam); 343 344 if (lParam) { 344 LPSTR buf;345 int retval;345 LPSTR buf; 346 int retval; 346 347 int len = WideCharToMultiByte( CP_ACP, 0, (LPWSTR)lParam, -1, NULL, 0, NULL, NULL ); 347 348 348 buf = (LPSTR) COMCTL32_Alloc (len);349 buf = (LPSTR) COMCTL32_Alloc (len); 349 350 WideCharToMultiByte( CP_ACP, 0, (LPWSTR)lParam, -1, buf, len, NULL, NULL ); 350 retval=DATETIME_SetFormat (hwnd, 0, (LPARAM) buf);351 COMCTL32_Free (buf);352 return retval;353 } 351 retval=DATETIME_SetFormat (hwnd, 0, (LPARAM) buf); 352 COMCTL32_Free (buf); 353 return retval; 354 } 354 355 else 355 return DATETIME_SetFormat (hwnd, 0, 0);356 357 } 358 359 360 static void 356 return DATETIME_SetFormat (hwnd, 0, 0); 357 358 } 359 360 361 static void 361 362 DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, char *result) 362 363 { … … 368 369 TRACE ("%d,%d\n", infoPtr->nrFields, count); 369 370 if ((count>infoPtr->nrFields) || (count<0)) { 370 WARN ("buffer overrun, have %d want %d\n", infoPtr->nrFields, count);371 return;371 WARN ("buffer overrun, have %d want %d\n", infoPtr->nrFields, count); 372 return; 372 373 } 373 374 374 375 if (!infoPtr->fieldspec) return; 375 376 376 377 spec=infoPtr->fieldspec[count]; 377 378 if (spec & DT_STRING) { 378 int txtlen=infoPtr->buflen[count];379 380 strncpy (result, infoPtr->textbuf + (spec &~ DT_STRING), txtlen);381 result[txtlen]=0;382 TRACE ("arg%d=%x->[%s]\n",count,infoPtr->fieldspec[count],result);383 return;379 int txtlen=infoPtr->buflen[count]; 380 381 strncpy (result, infoPtr->textbuf + (spec &~ DT_STRING), txtlen); 382 result[txtlen]=0; 383 TRACE ("arg%d=%x->[%s]\n",count,infoPtr->fieldspec[count],result); 384 return; 384 385 } 385 386 386 387 387 388 switch (spec) { 388 case DT_END_FORMAT: 389 *result=0;390 break;391 case ONEDIGITDAY: 392 sprintf (result,"%d",date.wDay);393 break;394 case TWODIGITDAY: 395 sprintf (result,"%.2d",date.wDay);396 break;397 case THREECHARDAY: 398 GetLocaleInfoA( LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1+(date.wDayOfWeek+6)%7,399 result,4);400 /*sprintf (result,"%.3s",days[date.wDayOfWeek]);*/401 break;402 case FULLDAY:403 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SDAYNAME1+ (date.wDayOfWeek+6)%7,404 buffer,sizeof(buffer));405 strcpy (result,buffer);406 break;407 case ONEDIGIT12HOUR: 408 if (date.wHour>12) 409 sprintf (result,"%d",date.wHour-12);410 else 411 sprintf (result,"%d",date.wHour);412 break;413 case TWODIGIT12HOUR: 414 if (date.wHour>12) 415 sprintf (result,"%.2d",date.wHour-12);416 else 417 sprintf (result,"%.2d",date.wHour);418 break;419 case ONEDIGIT24HOUR: 420 sprintf (result,"%d",date.wHour);421 break;422 case TWODIGIT24HOUR: 423 sprintf (result,"%.2d",date.wHour);424 break;425 case ONEDIGITSECOND: 426 sprintf (result,"%d",date.wSecond);427 break;428 case TWODIGITSECOND: 429 sprintf (result,"%.2d",date.wSecond);430 break;431 case ONEDIGITMINUTE: 432 sprintf (result,"%d",date.wMinute);433 break;434 case TWODIGITMINUTE: 435 sprintf (result,"%.2d",date.wMinute);436 break;437 case ONEDIGITMONTH: 438 sprintf (result,"%d",date.wMonth);439 break;440 case TWODIGITMONTH: 441 sprintf (result,"%.2d",date.wMonth);442 break;443 case THREECHARMONTH: 444 GetLocaleInfoA( GetSystemDefaultLCID(),LOCALE_SMONTHNAME1+date.wMonth -1,445 buffer,sizeof(buffer));446 sprintf (result,"%.3s",buffer);447 break;448 case FULLMONTH: 449 GetLocaleInfoA( GetSystemDefaultLCID(),LOCALE_SMONTHNAME1+date.wMonth -1,389 case DT_END_FORMAT: 390 *result=0; 391 break; 392 case ONEDIGITDAY: 393 sprintf (result,"%d",date.wDay); 394 break; 395 case TWODIGITDAY: 396 sprintf (result,"%.2d",date.wDay); 397 break; 398 case THREECHARDAY: 399 GetLocaleInfoA( LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1+(date.wDayOfWeek+6)%7, 400 result,4); 401 /*sprintf (result,"%.3s",days[date.wDayOfWeek]);*/ 402 break; 403 case FULLDAY: 404 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SDAYNAME1+ (date.wDayOfWeek+6)%7, 405 buffer,sizeof(buffer)); 406 strcpy (result,buffer); 407 break; 408 case ONEDIGIT12HOUR: 409 if (date.wHour>12) 410 sprintf (result,"%d",date.wHour-12); 411 else 412 sprintf (result,"%d",date.wHour); 413 break; 414 case TWODIGIT12HOUR: 415 if (date.wHour>12) 416 sprintf (result,"%.2d",date.wHour-12); 417 else 418 sprintf (result,"%.2d",date.wHour); 419 break; 420 case ONEDIGIT24HOUR: 421 sprintf (result,"%d",date.wHour); 422 break; 423 case TWODIGIT24HOUR: 424 sprintf (result,"%.2d",date.wHour); 425 break; 426 case ONEDIGITSECOND: 427 sprintf (result,"%d",date.wSecond); 428 break; 429 case TWODIGITSECOND: 430 sprintf (result,"%.2d",date.wSecond); 431 break; 432 case ONEDIGITMINUTE: 433 sprintf (result,"%d",date.wMinute); 434 break; 435 case TWODIGITMINUTE: 436 sprintf (result,"%.2d",date.wMinute); 437 break; 438 case ONEDIGITMONTH: 439 sprintf (result,"%d",date.wMonth); 440 break; 441 case TWODIGITMONTH: 442 sprintf (result,"%.2d",date.wMonth); 443 break; 444 case THREECHARMONTH: 445 GetLocaleInfoA( GetSystemDefaultLCID(),LOCALE_SMONTHNAME1+date.wMonth -1, 446 buffer,sizeof(buffer)); 447 sprintf (result,"%.3s",buffer); 448 break; 449 case FULLMONTH: 450 GetLocaleInfoA( GetSystemDefaultLCID(),LOCALE_SMONTHNAME1+date.wMonth -1, 450 451 #ifdef __WIN32OS2__ 451 buffer,sizeof(buffer));452 strcpy (result,buffer);452 buffer,sizeof(buffer)); 453 strcpy (result,buffer); 453 454 #else 454 result,sizeof(result));455 result,sizeof(result)); 455 456 #endif 456 break;457 case ONELETTERAMPM: 458 if (date.wHour<12) 459 strcpy (result,"A");460 else 461 strcpy (result,"P");462 break;463 case TWOLETTERAMPM: 464 if (date.wHour<12) 465 strcpy (result,"AM");466 else 467 strcpy (result,"PM");468 break;469 case FORMATCALLBACK: 470 FIXME ("Not implemented\n");471 strcpy (result,"xxx");472 break;473 case ONEDIGITYEAR: 474 sprintf (result,"%d",date.wYear-10* (int) floor(date.wYear/10));475 break;476 case TWODIGITYEAR: 477 sprintf (result,"%.2d",date.wYear-100* (int) floor(date.wYear/100));478 break;479 case FULLYEAR: 480 sprintf (result,"%d",date.wYear);481 break;457 break; 458 case ONELETTERAMPM: 459 if (date.wHour<12) 460 strcpy (result,"A"); 461 else 462 strcpy (result,"P"); 463 break; 464 case TWOLETTERAMPM: 465 if (date.wHour<12) 466 strcpy (result,"AM"); 467 else 468 strcpy (result,"PM"); 469 break; 470 case FORMATCALLBACK: 471 FIXME ("Not implemented\n"); 472 strcpy (result,"xxx"); 473 break; 474 case ONEDIGITYEAR: 475 sprintf (result,"%d",date.wYear-10* (int) floor(date.wYear/10)); 476 break; 477 case TWODIGITYEAR: 478 sprintf (result,"%.2d",date.wYear-100* (int) floor(date.wYear/100)); 479 break; 480 case FULLYEAR: 481 sprintf (result,"%d",date.wYear); 482 break; 482 483 } 483 484 TRACE ("arg%d=%x->[%s]\n",count,infoPtr->fieldspec[count],result);485 } 486 487 488 static void 484 485 TRACE ("arg%d=%x->[%s]\n",count,infoPtr->fieldspec[count],result); 486 } 487 488 489 static void 489 490 DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number) 490 491 { … … 497 498 spec=infoPtr->fieldspec[number]; 498 499 if ((spec & DTHT_DATEFIELD)==0) return; 499 500 500 501 switch (spec) { 501 case ONEDIGITDAY: 502 case TWODIGITDAY: 503 case THREECHARDAY: 504 case FULLDAY:505 date->wDay++;506 if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear))507 date->wDay=1; 508 break;509 case ONEDIGIT12HOUR: 510 case TWODIGIT12HOUR: 511 case ONEDIGIT24HOUR: 512 case TWODIGIT24HOUR: 513 date->wHour++;514 if (date->wHour>23) date->wHour=0;515 break;516 case ONEDIGITSECOND: 517 case TWODIGITSECOND: 518 date->wSecond++;519 if (date->wSecond>59) date->wSecond=0;520 break;521 case ONEDIGITMINUTE: 522 case TWODIGITMINUTE: 523 date->wMinute++;524 if (date->wMinute>59) date->wMinute=0;525 break;526 case ONEDIGITMONTH: 527 case TWODIGITMONTH: 528 case THREECHARMONTH: 529 case FULLMONTH: 530 date->wMonth++;531 if (date->wMonth>12) date->wMonth=1;532 if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear)) 533 date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear);534 break;535 case ONELETTERAMPM: 536 case TWOLETTERAMPM: 537 date->wHour+=12;538 if (date->wHour>23) date->wHour-=24;539 break;540 case FORMATCALLBACK: 541 FIXME ("Not implemented\n");542 break;543 case ONEDIGITYEAR: 544 case TWODIGITYEAR: 545 case FULLYEAR: 546 date->wYear++;547 break;548 }549 550 } 551 552 553 static void 502 case ONEDIGITDAY: 503 case TWODIGITDAY: 504 case THREECHARDAY: 505 case FULLDAY: 506 date->wDay++; 507 if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear)) 508 date->wDay=1; 509 break; 510 case ONEDIGIT12HOUR: 511 case TWODIGIT12HOUR: 512 case ONEDIGIT24HOUR: 513 case TWODIGIT24HOUR: 514 date->wHour++; 515 if (date->wHour>23) date->wHour=0; 516 break; 517 case ONEDIGITSECOND: 518 case TWODIGITSECOND: 519 date->wSecond++; 520 if (date->wSecond>59) date->wSecond=0; 521 break; 522 case ONEDIGITMINUTE: 523 case TWODIGITMINUTE: 524 date->wMinute++; 525 if (date->wMinute>59) date->wMinute=0; 526 break; 527 case ONEDIGITMONTH: 528 case TWODIGITMONTH: 529 case THREECHARMONTH: 530 case FULLMONTH: 531 date->wMonth++; 532 if (date->wMonth>12) date->wMonth=1; 533 if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear)) 534 date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear); 535 break; 536 case ONELETTERAMPM: 537 case TWOLETTERAMPM: 538 date->wHour+=12; 539 if (date->wHour>23) date->wHour-=24; 540 break; 541 case FORMATCALLBACK: 542 FIXME ("Not implemented\n"); 543 break; 544 case ONEDIGITYEAR: 545 case TWODIGITYEAR: 546 case FULLYEAR: 547 date->wYear++; 548 break; 549 } 550 551 } 552 553 554 static void 554 555 DATETIME_DecreaseField (DATETIME_INFO *infoPtr, int number) 555 556 { … … 562 563 spec = infoPtr->fieldspec[number]; 563 564 if ((spec & DTHT_DATEFIELD)==0) return; 564 565 565 566 TRACE ("%x\n",spec); 566 567 567 568 switch (spec) { 568 case ONEDIGITDAY: 569 case TWODIGITDAY: 570 case THREECHARDAY: 571 case FULLDAY:572 date->wDay--;573 if (date->wDay<1) 574 date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear);575 break;576 case ONEDIGIT12HOUR: 577 case TWODIGIT12HOUR: 578 case ONEDIGIT24HOUR: 579 case TWODIGIT24HOUR: 580 if (date->wHour) 581 date->wHour--;582 else583 date->wHour=23;584 break;585 case ONEDIGITSECOND: 586 case TWODIGITSECOND: 587 if (date->wHour) 588 date->wSecond--;589 else590 date->wHour=59;591 break;592 case ONEDIGITMINUTE: 593 case TWODIGITMINUTE: 594 if (date->wMinute) 595 date->wMinute--;596 else597 date->wMinute=59;598 break;599 case ONEDIGITMONTH: 600 case TWODIGITMONTH: 601 case THREECHARMONTH: 602 case FULLMONTH: 603 if (date->wMonth>1) 604 date->wMonth--;605 else606 date->wMonth=12;607 if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear)) 608 date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear);609 break;610 case ONELETTERAMPM: 611 case TWOLETTERAMPM: 612 if (date->wHour<12) 613 date->wHour+=12;614 else615 date->wHour-=12;616 break;617 case FORMATCALLBACK: 618 FIXME ("Not implemented\n");619 break;620 case ONEDIGITYEAR: 621 case TWODIGITYEAR: 622 case FULLYEAR: 623 date->wYear--;624 break;625 }626 627 } 628 629 630 static void 569 case ONEDIGITDAY: 570 case TWODIGITDAY: 571 case THREECHARDAY: 572 case FULLDAY: 573 date->wDay--; 574 if (date->wDay<1) 575 date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear); 576 break; 577 case ONEDIGIT12HOUR: 578 case TWODIGIT12HOUR: 579 case ONEDIGIT24HOUR: 580 case TWODIGIT24HOUR: 581 if (date->wHour) 582 date->wHour--; 583 else 584 date->wHour=23; 585 break; 586 case ONEDIGITSECOND: 587 case TWODIGITSECOND: 588 if (date->wHour) 589 date->wSecond--; 590 else 591 date->wHour=59; 592 break; 593 case ONEDIGITMINUTE: 594 case TWODIGITMINUTE: 595 if (date->wMinute) 596 date->wMinute--; 597 else 598 date->wMinute=59; 599 break; 600 case ONEDIGITMONTH: 601 case TWODIGITMONTH: 602 case THREECHARMONTH: 603 case FULLMONTH: 604 if (date->wMonth>1) 605 date->wMonth--; 606 else 607 date->wMonth=12; 608 if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear)) 609 date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear); 610 break; 611 case ONELETTERAMPM: 612 case TWOLETTERAMPM: 613 if (date->wHour<12) 614 date->wHour+=12; 615 else 616 date->wHour-=12; 617 break; 618 case FORMATCALLBACK: 619 FIXME ("Not implemented\n"); 620 break; 621 case ONEDIGITYEAR: 622 case TWODIGITYEAR: 623 case FULLYEAR: 624 date->wYear--; 625 break; 626 } 627 628 } 629 630 631 static void 631 632 DATETIME_ResetFieldDown (DATETIME_INFO *infoPtr, int number) 632 633 { … … 639 640 spec = infoPtr->fieldspec[number]; 640 641 if ((spec & DTHT_DATEFIELD)==0) return; 641 642 642 643 643 644 switch (spec) { 644 case ONEDIGITDAY: 645 case TWODIGITDAY: 646 case THREECHARDAY: 647 case FULLDAY:648 date->wDay = 1;649 break;650 case ONEDIGIT12HOUR: 651 case TWODIGIT12HOUR: 652 case ONEDIGIT24HOUR: 653 case TWODIGIT24HOUR: 654 case ONELETTERAMPM: 655 case TWOLETTERAMPM: 656 date->wHour = 0;657 break;658 case ONEDIGITSECOND: 659 case TWODIGITSECOND: 660 date->wSecond = 0;661 break;662 case ONEDIGITMINUTE: 663 case TWODIGITMINUTE: 664 date->wMinute = 0;665 break;666 case ONEDIGITMONTH: 667 case TWODIGITMONTH: 668 case THREECHARMONTH: 669 case FULLMONTH: 670 date->wMonth = 1;671 case FORMATCALLBACK: 672 FIXME ("Not implemented\n");673 break;674 case ONEDIGITYEAR: 675 case TWODIGITYEAR: 645 case ONEDIGITDAY: 646 case TWODIGITDAY: 647 case THREECHARDAY: 648 case FULLDAY: 649 date->wDay = 1; 650 break; 651 case ONEDIGIT12HOUR: 652 case TWODIGIT12HOUR: 653 case ONEDIGIT24HOUR: 654 case TWODIGIT24HOUR: 655 case ONELETTERAMPM: 656 case TWOLETTERAMPM: 657 date->wHour = 0; 658 break; 659 case ONEDIGITSECOND: 660 case TWODIGITSECOND: 661 date->wSecond = 0; 662 break; 663 case ONEDIGITMINUTE: 664 case TWODIGITMINUTE: 665 date->wMinute = 0; 666 break; 667 case ONEDIGITMONTH: 668 case TWODIGITMONTH: 669 case THREECHARMONTH: 670 case FULLMONTH: 671 date->wMonth = 1; 672 case FORMATCALLBACK: 673 FIXME ("Not implemented\n"); 674 break; 675 case ONEDIGITYEAR: 676 case TWODIGITYEAR: 676 677 /* FYI: On 9/14/1752 the calender changed and England and the American */ 677 678 /* colonies changed to the Gregorian calender. This change involved */ 678 679 /* having September 14th following September 2nd. So no date algorithms */ 679 680 /* work before that date. */ 680 case FULLYEAR: 681 date->wSecond = 0;682 date->wMinute = 0;683 date->wHour = 0;684 date->wDay = 14;/* overactive ms-programmers..*/685 date->wMonth = 9;686 date->wYear = 1752;687 break;688 }689 690 } 691 692 693 static void 681 case FULLYEAR: 682 date->wSecond = 0; 683 date->wMinute = 0; 684 date->wHour = 0; 685 date->wDay = 14; /* overactive ms-programmers..*/ 686 date->wMonth = 9; 687 date->wYear = 1752; 688 break; 689 } 690 691 } 692 693 694 static void 694 695 DATETIME_ResetFieldUp (DATETIME_INFO *infoPtr, int number) 695 696 { … … 702 703 spec=infoPtr->fieldspec[number]; 703 704 if ((spec & DTHT_DATEFIELD)==0) return; 704 705 705 706 switch (spec) { 706 case ONEDIGITDAY: 707 case TWODIGITDAY: 708 case THREECHARDAY: 709 case FULLDAY:710 date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear);711 break;712 case ONEDIGIT12HOUR: 713 case TWODIGIT12HOUR: 714 case ONEDIGIT24HOUR: 715 case TWODIGIT24HOUR: 716 case ONELETTERAMPM: 717 case TWOLETTERAMPM: 718 date->wHour=23;719 break;720 case ONEDIGITSECOND: 721 case TWODIGITSECOND: 722 date->wSecond=59;723 break;724 case ONEDIGITMINUTE: 725 case TWODIGITMINUTE: 726 date->wMinute=59;727 break;728 case ONEDIGITMONTH: 729 case TWODIGITMONTH: 730 case THREECHARMONTH: 731 case FULLMONTH: 732 date->wMonth=12;733 case FORMATCALLBACK: 734 FIXME ("Not implemented\n");735 break;736 case ONEDIGITYEAR: 737 case TWODIGITYEAR: 738 case FULLYEAR: 739 date->wYear=9999; /* Y10K problem? naaah. */740 break;741 }707 case ONEDIGITDAY: 708 case TWODIGITDAY: 709 case THREECHARDAY: 710 case FULLDAY: 711 date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear); 712 break; 713 case ONEDIGIT12HOUR: 714 case TWODIGIT12HOUR: 715 case ONEDIGIT24HOUR: 716 case TWODIGIT24HOUR: 717 case ONELETTERAMPM: 718 case TWOLETTERAMPM: 719 date->wHour=23; 720 break; 721 case ONEDIGITSECOND: 722 case TWODIGITSECOND: 723 date->wSecond=59; 724 break; 725 case ONEDIGITMINUTE: 726 case TWODIGITMINUTE: 727 date->wMinute=59; 728 break; 729 case ONEDIGITMONTH: 730 case TWODIGITMONTH: 731 case THREECHARMONTH: 732 case FULLMONTH: 733 date->wMonth=12; 734 case FORMATCALLBACK: 735 FIXME ("Not implemented\n"); 736 break; 737 case ONEDIGITYEAR: 738 case TWODIGITYEAR: 739 case FULLYEAR: 740 date->wYear=9999; /* Y10K problem? naaah. */ 741 break; 742 } 742 743 743 744 } … … 758 759 SIZE size; 759 760 COLORREF oldBk, oldTextColor; 760 761 761 762 /* draw control edge */ 762 763 TRACE("\n"); … … 764 765 FillRect(hdc, rcClient, hbr); 765 766 DrawEdge(hdc, rcClient, EDGE_SUNKEN, BF_RECT); 766 DeleteObject(hbr); 767 767 DeleteObject(hbr); 768 768 769 if (infoPtr->dateValid) { 769 770 char txt[80]; … … 798 799 DT_RIGHT | DT_VCENTER | DT_SINGLELINE ); 799 800 SetBkColor (hdc, oldBk); 800 SetTextColor (hdc, oldTextColor);801 SetTextColor (hdc, oldTextColor); 801 802 } 802 803 else … … 832 833 if (PtInRect (&infoPtr->fieldRect[i], pt)) { 833 834 retval = i; 834 TRACE("Hit in date text in field %d\n", i); 835 TRACE("Hit in date text in field %d\n", i); 835 836 break; 836 837 } … … 845 846 DATETIME_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) 846 847 { 847 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 848 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 848 849 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 849 850 int old, new; … … 874 875 infoPtr->monthcal_pos.x = infoPtr->rcClient.right - ((infoPtr->calbutton.right - 875 876 infoPtr->calbutton.left) + 145); 876 else 877 else 877 878 infoPtr->monthcal_pos.x = 8; 878 879 … … 888 889 889 890 TRACE ("dt:%x mc:%x mc parent:%x, desktop:%x, mcpp:%x\n", 890 hwnd,infoPtr->hMonthCal, 891 hwnd,infoPtr->hMonthCal, 891 892 GetParent (infoPtr->hMonthCal), 892 893 GetDesktopWindow (), … … 904 905 DATETIME_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) 905 906 { 906 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 907 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 907 908 908 909 TRACE("\n"); 909 910 910 911 if(infoPtr->bCalDepressed == TRUE) { 911 912 infoPtr->bCalDepressed = FALSE; … … 934 935 DATETIME_ParentNotify (HWND hwnd, WPARAM wParam, LPARAM lParam) 935 936 { 936 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 937 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 937 938 LPNMHDR lpnmh = (LPNMHDR) lParam; 938 939 … … 954 955 955 956 { 956 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 957 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 957 958 LPNMHDR lpnmh = (LPNMHDR) lParam; 958 959 … … 964 965 965 966 966 static LRESULT 967 static LRESULT 967 968 DATETIME_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam) 968 969 { … … 978 979 979 980 if (infoPtr->select & FORMATCALLMASK) { 980 FIXME ("Callbacks not implemented yet\n");981 FIXME ("Callbacks not implemented yet\n"); 981 982 } 982 983 983 984 switch (wParam) { 984 case VK_ADD:985 case VK_UP:986 DATETIME_IncreaseField (infoPtr,FieldNum);987 DATETIME_SendDateTimeChangeNotify (hwnd);988 break;989 case VK_SUBTRACT:990 case VK_DOWN:991 DATETIME_DecreaseField (infoPtr,FieldNum);992 DATETIME_SendDateTimeChangeNotify (hwnd);993 break;994 case VK_HOME:995 DATETIME_ResetFieldDown (infoPtr,FieldNum);996 DATETIME_SendDateTimeChangeNotify (hwnd);997 break;998 case VK_END:999 DATETIME_ResetFieldUp(infoPtr,FieldNum);1000 DATETIME_SendDateTimeChangeNotify (hwnd);1001 break;1002 case VK_LEFT: 1003 do {1004 if (infoPtr->select==0) {1005 infoPtr->select = infoPtr->nrFields - 1;1006 wrap++;1007 } else 1008 infoPtr->select--;1009 }1010 while ((infoPtr->fieldspec[infoPtr->select] & DT_STRING) && (wrap<2));1011 break;1012 case VK_RIGHT: 1013 do {1014 infoPtr->select++;1015 if (infoPtr->select==infoPtr->nrFields) {1016 infoPtr->select = 0;1017 wrap++;1018 }1019 }1020 while ((infoPtr->fieldspec[infoPtr->select] & DT_STRING) && (wrap<2));1021 break;1022 }985 case VK_ADD: 986 case VK_UP: 987 DATETIME_IncreaseField (infoPtr,FieldNum); 988 DATETIME_SendDateTimeChangeNotify (hwnd); 989 break; 990 case VK_SUBTRACT: 991 case VK_DOWN: 992 DATETIME_DecreaseField (infoPtr,FieldNum); 993 DATETIME_SendDateTimeChangeNotify (hwnd); 994 break; 995 case VK_HOME: 996 DATETIME_ResetFieldDown (infoPtr,FieldNum); 997 DATETIME_SendDateTimeChangeNotify (hwnd); 998 break; 999 case VK_END: 1000 DATETIME_ResetFieldUp(infoPtr,FieldNum); 1001 DATETIME_SendDateTimeChangeNotify (hwnd); 1002 break; 1003 case VK_LEFT: 1004 do { 1005 if (infoPtr->select==0) { 1006 infoPtr->select = infoPtr->nrFields - 1; 1007 wrap++; 1008 } else 1009 infoPtr->select--; 1010 } 1011 while ((infoPtr->fieldspec[infoPtr->select] & DT_STRING) && (wrap<2)); 1012 break; 1013 case VK_RIGHT: 1014 do { 1015 infoPtr->select++; 1016 if (infoPtr->select==infoPtr->nrFields) { 1017 infoPtr->select = 0; 1018 wrap++; 1019 } 1020 } 1021 while ((infoPtr->fieldspec[infoPtr->select] & DT_STRING) && (wrap<2)); 1022 break; 1023 } 1023 1024 1024 1025 InvalidateRect(hwnd, NULL, FALSE); … … 1031 1032 DATETIME_KillFocus (HWND hwnd, WPARAM wParam, LPARAM lParam) 1032 1033 { 1033 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 1034 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 1034 1035 1035 1036 TRACE ("\n"); 1036 1037 1037 1038 if (infoPtr->haveFocus) { 1038 DATETIME_SendSimpleNotify (hwnd, NM_KILLFOCUS);1039 infoPtr->haveFocus = 0;1039 DATETIME_SendSimpleNotify (hwnd, NM_KILLFOCUS); 1040 infoPtr->haveFocus = 0; 1040 1041 } 1041 1042 … … 1049 1050 DATETIME_SetFocus (HWND hwnd, WPARAM wParam, LPARAM lParam) 1050 1051 { 1051 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 1052 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 1052 1053 1053 1054 TRACE ("\n"); 1054 1055 1055 1056 if (infoPtr->haveFocus==0) { 1056 DATETIME_SendSimpleNotify (hwnd, NM_SETFOCUS); 1057 infoPtr->haveFocus = DTHT_GOTFOCUS;1057 DATETIME_SendSimpleNotify (hwnd, NM_SETFOCUS); 1058 infoPtr->haveFocus = DTHT_GOTFOCUS; 1058 1059 } 1059 1060 … … 1068 1069 1069 1070 { 1070 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 1071 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 1071 1072 NMDATETIMECHANGE dtdtc; 1072 1073 … … 1136 1137 infoPtr->monthcal_pos.x = infoPtr->rcClient.right - ((infoPtr->calbutton.right - 1137 1138 infoPtr->calbutton.left) + 145); 1138 else 1139 else 1139 1140 infoPtr->monthcal_pos.x = 8; 1140 1141 … … 1172 1173 1173 1174 if (dwStyle & DTS_SHOWNONE) { 1174 infoPtr->hwndCheckbut=CreateWindowExA (0,"button", 0, 1175 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 1175 infoPtr->hwndCheckbut=CreateWindowExA (0,"button", 0, 1176 WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 1176 1177 2,2,13,13, 1177 hwnd, 1178 hwnd, 1178 1179 0, GetWindowLongA (hwnd, GWL_HINSTANCE), 0); 1179 1180 SendMessageA (infoPtr->hwndCheckbut, BM_SETCHECK, 1, 0); … … 1196 1197 1197 1198 /* create the monthcal control */ 1198 infoPtr->hMonthCal = CreateWindowExA (0,"SysMonthCal32", 0, 1199 WS_BORDER | WS_POPUP | WS_CLIPSIBLINGS,1200 0, 0, 0, 0,1201 GetParent(hwnd), 1202 0, 0, 0);1199 infoPtr->hMonthCal = CreateWindowExA (0,"SysMonthCal32", 0, 1200 WS_BORDER | WS_POPUP | WS_CLIPSIBLINGS, 1201 0, 0, 0, 0, 1202 GetParent(hwnd), 1203 0, 0, 0); 1203 1204 1204 1205 /* initialize info structure */ … … 1214 1215 { 1215 1216 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); 1216 1217 1217 1218 TRACE("\n"); 1218 1219 COMCTL32_Free (infoPtr); … … 1227 1228 1228 1229 if (!DATETIME_GetInfoPtr(hwnd) && (uMsg != WM_CREATE)) 1229 return DefWindowProcA( hwnd, uMsg, wParam, lParam );1230 1230 return DefWindowProcA( hwnd, uMsg, wParam, lParam ); 1231 1231 1232 switch (uMsg) 1232 1233 { … … 1236 1237 1237 1238 case DTM_SETSYSTEMTIME: 1238 return DATETIME_SetSystemTime (hwnd, wParam, lParam);1239 return DATETIME_SetSystemTime (hwnd, wParam, lParam); 1239 1240 1240 1241 case DTM_GETRANGE: … … 1266 1267 1267 1268 case WM_PARENTNOTIFY: 1268 return DATETIME_ParentNotify (hwnd, wParam, lParam);1269 return DATETIME_ParentNotify (hwnd, wParam, lParam); 1269 1270 1270 1271 case WM_NOTIFY: 1271 return DATETIME_Notify (hwnd, wParam, lParam);1272 return DATETIME_Notify (hwnd, wParam, lParam); 1272 1273 1273 1274 case WM_GETDLGCODE: … … 1296 1297 1297 1298 case WM_CREATE: 1298 return DATETIME_Create (hwnd, wParam, lParam);1299 return DATETIME_Create (hwnd, wParam, lParam); 1299 1300 1300 1301 case WM_DESTROY: 1301 return DATETIME_Destroy (hwnd, wParam, lParam);1302 return DATETIME_Destroy (hwnd, wParam, lParam); 1302 1303 1303 1304 default: 1304 if (uMsg >= WM_USER)1305 ERR("unknown msg %04x wp=%08x lp=%08lx\n",1306 uMsg, wParam, lParam);1305 if (uMsg >= WM_USER) 1306 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 1307 uMsg, wParam, lParam); 1307 1308 #ifdef __WIN32OS2__ 1308 1309 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 1309 1310 #else 1310 return DefWindowProcA (hwnd, uMsg, wParam, lParam);1311 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 1311 1312 #endif 1312 1313 } … … 1329 1330 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 1330 1331 wndClass.lpszClassName = DATETIMEPICK_CLASSA; 1331 1332 1332 1333 RegisterClassA (&wndClass); 1333 1334 } -
trunk/src/comctl32/flatsb.c
r5416 r6644 1 /* $Id: flatsb.c,v 1.10 2001-09-05 12:04:58 bird Exp $ */ 1 2 /* 2 3 * Flat Scrollbar control … … 39 40 40 41 /*********************************************************************** 41 * InitializeFlatSB42 * 43 * returns nonzero if successful, zero otherwise42 * InitializeFlatSB 43 * 44 * returns nonzero if successful, zero otherwise 44 45 * 45 46 */ … … 52 53 53 54 /*********************************************************************** 54 * UninitializeFlatSB55 * 56 * returns:57 * E_FAILif one of the scroll bars is currently in use58 * S_FALSEif InitializeFlatSB was never called on this hwnd59 * S_OKotherwise55 * UninitializeFlatSB 56 * 57 * returns: 58 * E_FAIL if one of the scroll bars is currently in use 59 * S_FALSE if InitializeFlatSB was never called on this hwnd 60 * S_OK otherwise 60 61 * 61 62 */ … … 68 69 69 70 /*********************************************************************** 70 * FlatSB_GetScrollProp71 * 72 * Returns nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE,73 * the return is nonzero if InitializeFlatSB has been called for this window, or74 * zero otherwise.75 * 76 */ 77 BOOL WINAPI 71 * FlatSB_GetScrollProp 72 * 73 * Returns nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE, 74 * the return is nonzero if InitializeFlatSB has been called for this window, or 75 * zero otherwise. 76 * 77 */ 78 BOOL WINAPI 78 79 FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop) 79 80 { … … 84 85 85 86 /*********************************************************************** 86 * FlatSB_SetScrollProp87 */ 88 BOOL WINAPI 87 * FlatSB_SetScrollProp 88 */ 89 BOOL WINAPI 89 90 FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag) 90 91 { … … 95 96 96 97 /*********************************************************************** 97 * From the Microsoft docs:98 * "If flat scroll bars haven't been initialized for the99 * window, the flat scroll bar APIs will defer to the corresponding100 * standard APIs. This allows the developer to turn flat scroll101 * bars on and off without having to write conditional code."102 * 103 * So, if we just call the standard functions until we implement104 * the flat scroll bar functions, flat scroll bars will show up and105 * behave properly, as though they had simply not been setup to106 * have flat properties.107 * 108 * Susan <sfarley@codeweavers.com>109 * 110 */ 111 112 /*********************************************************************** 113 * FlatSB_EnableScrollBar114 */ 115 BOOL WINAPI 98 * From the Microsoft docs: 99 * "If flat scroll bars haven't been initialized for the 100 * window, the flat scroll bar APIs will defer to the corresponding 101 * standard APIs. This allows the developer to turn flat scroll 102 * bars on and off without having to write conditional code." 103 * 104 * So, if we just call the standard functions until we implement 105 * the flat scroll bar functions, flat scroll bars will show up and 106 * behave properly, as though they had simply not been setup to 107 * have flat properties. 108 * 109 * Susan <sfarley@codeweavers.com> 110 * 111 */ 112 113 /*********************************************************************** 114 * FlatSB_EnableScrollBar 115 */ 116 BOOL WINAPI 116 117 FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags) 117 118 { … … 120 121 121 122 /*********************************************************************** 122 * FlatSB_ShowScrollBar123 */ 124 BOOL WINAPI 123 * FlatSB_ShowScrollBar 124 */ 125 BOOL WINAPI 125 126 FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow) 126 127 { … … 129 130 130 131 /*********************************************************************** 131 * FlatSB_GetScrollRange132 */ 133 BOOL WINAPI 132 * FlatSB_GetScrollRange 133 */ 134 BOOL WINAPI 134 135 FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max) 135 136 { … … 138 139 139 140 /*********************************************************************** 140 * FlatSB_GetScrollInfo141 */ 142 BOOL WINAPI 141 * FlatSB_GetScrollInfo 142 */ 143 BOOL WINAPI 143 144 FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info) 144 145 { … … 147 148 148 149 /*********************************************************************** 149 * FlatSB_GetScrollPos150 */ 151 INT WINAPI 150 * FlatSB_GetScrollPos 151 */ 152 INT WINAPI 152 153 FlatSB_GetScrollPos(HWND hwnd, int nBar) 153 154 { … … 156 157 157 158 /*********************************************************************** 158 * FlatSB_SetScrollPos159 */ 160 INT WINAPI 159 * FlatSB_SetScrollPos 160 */ 161 INT WINAPI 161 162 FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw) 162 163 { … … 165 166 166 167 /*********************************************************************** 167 * FlatSB_SetScrollInfo168 */ 169 INT WINAPI 168 * FlatSB_SetScrollInfo 169 */ 170 INT WINAPI 170 171 FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw) 171 172 { … … 174 175 175 176 /*********************************************************************** 176 * FlatSB_SetScrollRange177 */ 178 INT WINAPI 177 * FlatSB_SetScrollRange 178 */ 179 INT WINAPI 179 180 FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw) 180 181 { … … 212 213 switch (uMsg) 213 214 { 214 case WM_CREATE:215 return FlatSB_Create (hwnd, wParam, lParam);216 217 case WM_DESTROY:218 return FlatSB_Destroy (hwnd, wParam, lParam);219 220 default:221 if (uMsg >= WM_USER)222 ERR("unknown msg %04x wp=%08x lp=%08lx\n",215 case WM_CREATE: 216 return FlatSB_Create (hwnd, wParam, lParam); 217 218 case WM_DESTROY: 219 return FlatSB_Destroy (hwnd, wParam, lParam); 220 221 default: 222 if (uMsg >= WM_USER) 223 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 223 224 uMsg, wParam, lParam); 224 225 #ifdef __WIN32OS2__ 225 226 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 226 227 #else 227 return DefWindowProcA (hwnd, uMsg, wParam, lParam);228 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 228 229 #endif 229 230 } … … 245 246 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 246 247 wndClass.lpszClassName = FLATSB_CLASSA; 247 248 248 249 RegisterClassA (&wndClass); 249 250 } -
trunk/src/comctl32/imagelist.c
r6380 r6644 1 /* $Id: imagelist.c,v 1.15 2001-09-05 12:04:58 bird Exp $ */ 1 2 /* 2 3 * ImageList implementation … … 20 21 * - ImageList_Draw, ImageList_DrawEx and ImageList_GetIcon use 21 22 * ImageList_DrawIndirect. Since ImageList_DrawIndirect is still 22 * partially implemented, the functions mentioned above will be 23 * partially implemented, the functions mentioned above will be 23 24 * limited in functionality too. 24 25 */ … … 69 70 70 71 /************************************************************************* 71 * IMAGELIST_InternalExpandBitmaps [Internal] 72 * IMAGELIST_InternalExpandBitmaps [Internal] 72 73 * 73 74 * Expands the bitmaps of an image list by the given number of images. … … 92 93 if ((himl->cCurImage + nImageCount < himl->cMaxImage) 93 94 && (himl->cy >= cy)) 94 return;95 return; 95 96 96 97 if (cy == 0) cy = himl->cy; … … 116 117 117 118 if (himl->hbmMask) { 118 hbmNewBitmap = 119 hbmNewBitmap = 119 120 CreateBitmap (nNewWidth, cy, 1, 1, NULL); 120 121 … … 138 139 139 140 /************************************************************************* 140 * IMAGELIST_InternalDraw [Internal] 141 * IMAGELIST_InternalDraw [Internal] 141 142 * 142 143 * Draws the image in the ImageList (without the mask) … … 151 152 * 152 153 * NOTES 153 * This function is used by ImageList_DrawIndirect, when it is 154 * This function is used by ImageList_DrawIndirect, when it is 154 155 * required to draw only the Image (without the mask) to the screen. 155 156 * … … 164 165 hImageDC = CreateCompatibleDC(0); 165 166 hOldBitmap = SelectObject(hImageDC, pimldp->himl->hbmImage); 166 BitBlt(pimldp->hdcDst, 167 BitBlt(pimldp->hdcDst, 167 168 pimldp->x, pimldp->y, cx, cy, 168 hImageDC, 169 pimldp->himl->cx * pimldp->i, 0, 169 hImageDC, 170 pimldp->himl->cx * pimldp->i, 0, 170 171 SRCCOPY); 171 172 … … 176 177 177 178 /************************************************************************* 178 * IMAGELIST_InternalDrawMask [Internal] 179 * IMAGELIST_InternalDrawMask [Internal] 179 180 * 180 181 * Draws the image in the ImageList with the mask … … 189 190 * 190 191 * NOTES 191 * This function is used by ImageList_DrawIndirect, when it is 192 * This function is used by ImageList_DrawIndirect, when it is 192 193 * required to draw the Image with the mask to the screen. 193 194 * … … 205 206 UINT fStyle = pimldp->fStyle & (~ILD_OVERLAYMASK); 206 207 207 /* 208 * We need a dc and bitmap to draw on that is 208 /* 209 * We need a dc and bitmap to draw on that is 209 210 * not on the screen. 210 211 */ … … 221 222 hOffScreenDC = CreateCompatibleDC( pimldp->hdcDst ); 222 223 223 if ( hOffScreenDC ) 224 if ( hOffScreenDC ) 224 225 { 225 226 hOffScreenBmp = CreateCompatibleBitmap( pimldp->hdcDst, cx, cy ); 226 227 227 if ( hOffScreenBmp ) 228 if ( hOffScreenBmp ) 228 229 SelectObject( hOffScreenDC, hOffScreenBmp ); 229 230 else … … 235 236 hOldBitmapImage = SelectObject(hImageDC, himlLocal->hbmImage); 236 237 hOldBitmapMask = SelectObject(hMaskDC, himlLocal->hbmMask); 237 238 /* 239 * Get a copy of the image for the masking operations. 238 239 /* 240 * Get a copy of the image for the masking operations. 240 241 * We will use the copy, and this dc for all the various 241 242 * blitting, and then do one final blit to the screen dc. 242 243 * This should clean up most of the flickering. 243 244 */ 244 BitBlt( hOffScreenDC, 0, 0, cx, cy, pimldp->hdcDst, pimldp->x, 245 BitBlt( hOffScreenDC, 0, 0, cx, cy, pimldp->hdcDst, pimldp->x, 245 246 pimldp->y, SRCCOPY); 246 247 247 /* 248 /* 248 249 * Draw the Background for the appropriate Styles 249 250 */ 250 if( bUseCustomBackground && (fStyle == ILD_NORMAL || fStyle & ILD_IMAGE 251 if( bUseCustomBackground && (fStyle == ILD_NORMAL || fStyle & ILD_IMAGE 251 252 || bBlendFlag) ) 252 253 { 253 254 254 255 hBrush = CreateSolidBrush (himlLocal->clrBk); 255 256 hOldBrush = SelectObject (pimldp->hdcDst, hBrush); 256 257 257 258 PatBlt( hOffScreenDC, pimldp->x, pimldp->y, cx, cy, PATCOPY ); 258 259 … … 260 261 } 261 262 262 /* 263 /* 263 264 * Draw Image Transparently over the current background 264 265 */ 265 if(fStyle == ILD_NORMAL || (fStyle & ILD_TRANSPARENT) || 266 ((fStyle & ILD_IMAGE) && bUseCustomBackground) || bBlendFlag) 267 { /* 266 if(fStyle == ILD_NORMAL || (fStyle & ILD_TRANSPARENT) || 267 ((fStyle & ILD_IMAGE) && bUseCustomBackground) || bBlendFlag) 268 { /* 268 269 * To obtain a transparent look, background color should be set 269 * to white and foreground color to black when blting the 270 * monochrome mask. 270 * to white and foreground color to black when blting the 271 * monochrome mask. 271 272 */ 272 273 oldBkColor = SetBkColor( hOffScreenDC, RGB( 0xff, 0xff, 0xff ) ); 273 274 oldBkColor = SetBkColor( hOffScreenDC, RGB( 0xff, 0xff, 0xff ) ); 274 275 oldFgColor = SetTextColor( hOffScreenDC, RGB( 0, 0, 0 ) ); 275 276 … … 279 280 BitBlt( hOffScreenDC, 0, 0, cx, cy, hImageDC,himlLocal->cx * pimldp->i, 280 281 0, SRCPAINT ); 281 282 } 283 282 283 } 284 284 285 /* 285 286 * Draw the image when no Background is specified … … 287 288 else if((fStyle & ILD_IMAGE) && !bUseCustomBackground) 288 289 { 289 BitBlt( hOffScreenDC, 0, 0, cx, cy, hImageDC, 290 BitBlt( hOffScreenDC, 0, 0, cx, cy, hImageDC, 290 291 himlLocal->cx * pimldp->i, 0, SRCCOPY); 291 292 } 292 /* 293 /* 293 294 * Draw the mask with or without a background 294 295 */ … … 298 299 0, bUseCustomBackground ? SRCCOPY : SRCAND); 299 300 } 300 301 301 302 /* 302 303 * Blit the bitmap to the screen now. … … 305 306 hOffScreenDC, 0, 0, SRCCOPY); 306 307 307 308 308 309 SelectObject(hImageDC, hOldBitmapImage); 309 310 SelectObject(hMaskDC, hOldBitmapMask); 310 311 311 312 cleanup: 312 313 313 314 DeleteDC(hImageDC); 314 315 DeleteDC(hMaskDC); 315 316 316 317 DeleteDC( hOffScreenDC ); 317 318 DeleteObject( hOffScreenBmp ); 318 319 319 320 return; 320 321 } 321 322 322 323 /************************************************************************* 323 * IMAGELIST_InternalDrawBlend [Internal] 324 * 325 * Draws the Blend over the current image 324 * IMAGELIST_InternalDrawBlend [Internal] 325 * 326 * Draws the Blend over the current image 326 327 * 327 328 * PARAMS … … 334 335 * 335 336 * NOTES 336 * This functions is used by ImageList_DrawIndirect, when it is 337 * required to add the blend to the current image. 338 * 337 * This functions is used by ImageList_DrawIndirect, when it is 338 * required to add the blend to the current image. 339 * 339 340 */ 340 341 static VOID … … 375 376 376 377 BitBlt(hBlendMaskDC, 377 0,0, cx, cy, 378 0,0, cx, cy, 378 379 hMaskDC, 379 380 himlLocal->cx * pimldp->i,0, … … 381 382 382 383 BitBlt(hBlendMaskDC, 383 0,0, cx, cy, 384 0,0, cx, cy, 384 385 hBlendMaskDC, 385 0,0, 386 0,0, 386 387 NOTSRCCOPY); 387 388 … … 397 398 hOldBrush = (HBRUSH) SelectObject (pimldp->hdcDst, hBlendColorBrush); 398 399 399 BitBlt (pimldp->hdcDst, 400 pimldp->x, pimldp->y, cx, cy, 401 hBlendMaskDC, 402 0, 0, 400 BitBlt (pimldp->hdcDst, 401 pimldp->x, pimldp->y, cx, cy, 402 hBlendMaskDC, 403 0, 0, 403 404 0xB8074A); /* PSDPxax */ 404 405 … … 413 414 414 415 /************************************************************************* 415 * IMAGELIST_InternalDrawOverlay [Internal] 416 * 417 * Draws the overlay image 416 * IMAGELIST_InternalDrawOverlay [Internal] 417 * 418 * Draws the overlay image 418 419 * 419 420 * PARAMS … … 426 427 * 427 428 * NOTES 428 * This functions is used by ImageList_DrawIndirect, when it is 429 * This functions is used by ImageList_DrawIndirect, when it is 429 430 * required to draw the overlay 430 431 * 431 * 432 */ 433 static VOID 432 * 433 */ 434 static VOID 434 435 IMAGELIST_InternalDrawOverlay(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy) 435 436 { … … 447 448 if (pimldp->himl->hbmMask) 448 449 { 449 hOldBitmap = (HBITMAP) SelectObject (hImageDC, 450 hOldBitmap = (HBITMAP) SelectObject (hImageDC, 450 451 pimldp->himl->hbmMask); 451 452 452 BitBlt (pimldp->hdcDst, 453 BitBlt (pimldp->hdcDst, 453 454 pimldp->x, pimldp->y, cx, cy, 454 455 hImageDC, pimldp->himl->cx * nOvlIdx, 0, … … 457 458 SelectObject(hImageDC, hOldBitmap); 458 459 } 459 hOldBitmap = (HBITMAP) SelectObject (hImageDC, 460 hOldBitmap = (HBITMAP) SelectObject (hImageDC, 460 461 pimldp->himl->hbmImage); 461 462 462 BitBlt (pimldp->hdcDst, 463 pimldp->x, pimldp->y, cx, cy, 463 BitBlt (pimldp->hdcDst, 464 pimldp->x, pimldp->y, cx, cy, 464 465 hImageDC, 465 466 pimldp->himl->cx * nOvlIdx, 0, … … 492 493 493 494 INT WINAPI 494 ImageList_Add (HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)495 ImageList_Add (HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask) 495 496 { 496 497 HDC hdcImage, hdcBitmap; … … 531 532 hOldBitmapTemp = (HBITMAP) SelectObject(hdcTemp, hbmMask); 532 533 533 BitBlt (hdcMask, 534 BitBlt (hdcMask, 534 535 nStartX, 0, bmp.bmWidth, bmp.bmHeight, 535 hdcTemp, 536 0, 0, 536 hdcTemp, 537 0, 0, 537 538 SRCCOPY); 538 539 … … 542 543 /* Remove the background from the image 543 544 */ 544 BitBlt (hdcImage, 545 BitBlt (hdcImage, 545 546 nStartX, 0, bmp.bmWidth, bmp.bmHeight, 546 hdcMask, 547 nStartX, 0, 547 hdcMask, 548 nStartX, 0, 548 549 0x220326); /* NOTSRCAND */ 549 550 … … 586 587 587 588 /************************************************************************* 588 * ImageList_AddMasked [COMCTL32.42] 589 * ImageList_AddMasked [COMCTL32.42] 589 590 * 590 591 * Adds an image or images to an image list and creates a mask from the … … 651 652 GetPixel (hdcBitmap, 0, 0); 652 653 SetBkColor (hdcBitmap, bkColor); 653 BitBlt (hdcMask, 654 BitBlt (hdcMask, 654 655 nMaskXOffset, 0, bmp.bmWidth, bmp.bmHeight, 655 hdcBitmap, 0, 0, 656 hdcBitmap, 0, 0, 656 657 SRCCOPY); 657 658 … … 668 669 This is here in case some apps rely on this bug 669 670 */ 670 BitBlt(hdcBitmap, 671 BitBlt(hdcBitmap, 671 672 0, 0, bmp.bmWidth, bmp.bmHeight, 672 hdcMask, 673 nMaskXOffset, 0, 673 hdcMask, 674 nMaskXOffset, 0, 674 675 0x220326); /* NOTSRCAND */ 675 676 /* Copy result to the imagelist 676 677 */ 677 BitBlt (hdcImage, 678 BitBlt (hdcImage, 678 679 nIndex * himl->cx, 0, bmp.bmWidth, bmp.bmHeight, 679 hdcBitmap, 680 0, 0, 680 hdcBitmap, 681 0, 0, 681 682 SRCCOPY); 682 683 /* Clean up … … 698 699 699 700 /************************************************************************* 700 * ImageList_BeginDrag [COMCTL32.43] 701 * ImageList_BeginDrag [COMCTL32.43] 701 702 * 702 703 * Creates a temporary image list that contains one image. It will be used … … 716 717 BOOL WINAPI 717 718 ImageList_BeginDrag (HIMAGELIST himlTrack, INT iTrack, 718 INT dxHotspot, INT dyHotspot)719 INT dxHotspot, INT dyHotspot) 719 720 { 720 721 HDC hdcSrc, hdcDst; … … 723 724 724 725 if (himlTrack == NULL) 725 return FALSE;726 return FALSE; 726 727 727 728 if (himlInternalDrag) … … 729 730 730 731 himlInternalDrag = 731 ImageList_Create (himlTrack->cx, himlTrack->cy,732 himlTrack->flags, 1, 1);732 ImageList_Create (himlTrack->cx, himlTrack->cy, 733 himlTrack->flags, 1, 1); 733 734 if (himlInternalDrag == NULL) { 734 735 ERR("Error creating drag image list!\n"); … … 764 765 765 766 /************************************************************************* 766 * ImageList_Copy [COMCTL32.44] 767 * 768 * Copies an image of the source image list to an image of the 767 * ImageList_Copy [COMCTL32.44] 768 * 769 * Copies an image of the source image list to an image of the 769 770 * destination image list. Images can be copied or swapped. 770 771 * … … 787 788 788 789 BOOL WINAPI 789 ImageList_Copy (HIMAGELIST himlDst, INT iDst, HIMAGELIST himlSrc,790 INT iSrc, INT uFlags)791 { 792 HDC hdcSrc, hdcDst; 790 ImageList_Copy (HIMAGELIST himlDst, INT iDst, HIMAGELIST himlSrc, 791 INT iSrc, INT uFlags) 792 { 793 HDC hdcSrc, hdcDst; 793 794 794 795 TRACE("iDst=%d iSrc=%d\n", iDst, iSrc); 795 796 796 797 if ((himlSrc == NULL) || (himlDst == NULL)) 797 return FALSE;798 return FALSE; 798 799 if ((iDst < 0) || (iDst >= himlDst->cCurImage)) 799 return FALSE;800 return FALSE; 800 801 if ((iSrc < 0) || (iSrc >= himlSrc->cCurImage)) 801 return FALSE;802 return FALSE; 802 803 803 804 hdcSrc = CreateCompatibleDC (0); … … 815 816 himlSrc->uBitsPixel, NULL); 816 817 hbmTempMask = CreateBitmap (himlSrc->cx, himlSrc->cy, 1, 817 1, NULL);818 1, NULL); 818 819 819 820 /* copy (and stretch) destination to temporary bitmaps.(save) */ … … 908 909 HIMAGELIST WINAPI 909 910 ImageList_Create (INT cx, INT cy, UINT flags, 910 INT cInitial, INT cGrow)911 INT cInitial, INT cGrow) 911 912 { 912 913 HIMAGELIST himl; … … 914 915 INT nCount; 915 916 HBITMAP hbmTemp; 916 static WORD aBitBlend25[] = 917 static WORD aBitBlend25[] = 917 918 {0xAA, 0x00, 0x55, 0x00, 0xAA, 0x00, 0x55, 0x00}; 918 919 … … 948 949 if (himl->cMaxImage > 0) { 949 950 himl->hbmImage = 950 CreateBitmap (himl->cx * himl->cMaxImage, himl->cy,951 CreateBitmap (himl->cx * himl->cMaxImage, himl->cy, 951 952 1, himl->uBitsPixel, NULL); 952 if (himl->hbmImage == 0) {953 ERR("Error creating image bitmap!\n");954 return NULL;955 }953 if (himl->hbmImage == 0) { 954 ERR("Error creating image bitmap!\n"); 955 return NULL; 956 } 956 957 } 957 958 else 958 959 himl->hbmImage = 0; 959 960 960 961 if ( (himl->cMaxImage > 0) && (himl->flags & ILC_MASK)) { 961 962 himl->hbmMask = CreateBitmap (himl->cx * himl->cMaxImage, himl->cy, 962 1, 1, NULL);963 1, 1, NULL); 963 964 if (himl->hbmMask == 0) { 964 965 ERR("Error creating mask bitmap!\n"); … … 986 987 987 988 /************************************************************************* 988 * ImageList_Destroy [COMCTL32.46] 989 * ImageList_Destroy [COMCTL32.46] 989 990 * 990 991 * Destroys an image list. … … 1000 1001 BOOL WINAPI 1001 1002 ImageList_Destroy (HIMAGELIST himl) 1002 { 1003 { 1003 1004 if (!himl) 1004 return FALSE;1005 return FALSE; 1005 1006 1006 1007 /* delete image bitmaps */ … … 1015 1016 if (himl->hbrBlend50) 1016 1017 DeleteObject (himl->hbrBlend50); 1017 1018 1018 1019 COMCTL32_Free (himl); 1019 1020 … … 1023 1024 1024 1025 /************************************************************************* 1025 * ImageList_DragEnter [COMCTL32.47] 1026 * ImageList_DragEnter [COMCTL32.47] 1026 1027 * 1027 1028 * Locks window update and displays the drag image at the given position. … … 1045 1046 { 1046 1047 if (himlInternalDrag == NULL) 1047 return FALSE;1048 return FALSE; 1048 1049 1049 1050 if (hwndLock) 1050 hwndInternalDrag = hwndLock;1051 hwndInternalDrag = hwndLock; 1051 1052 else 1052 hwndInternalDrag = GetDesktopWindow ();1053 hwndInternalDrag = GetDesktopWindow (); 1053 1054 1054 1055 xInternalPos = x; … … 1057 1058 hdcBackBuffer = CreateCompatibleDC (0); 1058 1059 hbmBackBuffer = CreateCompatibleBitmap (hdcBackBuffer, 1059 himlInternalDrag->cx, himlInternalDrag->cy);1060 himlInternalDrag->cx, himlInternalDrag->cy); 1060 1061 1061 1062 ImageList_DragShowNolock (TRUE); … … 1066 1067 1067 1068 /************************************************************************* 1068 * ImageList_DragLeave [COMCTL32.48] 1069 * ImageList_DragLeave [COMCTL32.48] 1069 1070 * 1070 1071 * Unlocks window update and hides the drag image. … … 1082 1083 { 1083 1084 if (hwndLock) 1084 hwndInternalDrag = hwndLock;1085 hwndInternalDrag = hwndLock; 1085 1086 else 1086 hwndInternalDrag = GetDesktopWindow ();1087 hwndInternalDrag = GetDesktopWindow (); 1087 1088 1088 1089 ImageList_DragShowNolock (FALSE); … … 1096 1097 1097 1098 /************************************************************************* 1098 * ImageList_DragMove [COMCTL32.49] 1099 * ImageList_DragMove [COMCTL32.49] 1099 1100 * 1100 1101 * Moves the drag image. … … 1128 1129 1129 1130 /************************************************************************* 1130 * ImageList_DragShowNolock [COMCTL32.50] 1131 * ImageList_DragShowNolock [COMCTL32.50] 1131 1132 * 1132 1133 * Shows or hides the drag image. … … 1152 1153 1153 1154 hdcDrag = GetDCEx (hwndInternalDrag, 0, 1154 DCX_WINDOW | DCX_CACHE | DCX_LOCKWINDOWUPDATE);1155 DCX_WINDOW | DCX_CACHE | DCX_LOCKWINDOWUPDATE); 1155 1156 1156 1157 if (bShow) { 1157 /* show drag image */1158 1159 /* save background */1160 1161 /* draw drag image */1158 /* show drag image */ 1159 1160 /* save background */ 1161 1162 /* draw drag image */ 1162 1163 1163 1164 } 1164 1165 else { 1165 /* hide drag image */1166 1167 /* restore background */1166 /* hide drag image */ 1167 1168 /* restore background */ 1168 1169 1169 1170 } … … 1199 1200 BOOL WINAPI 1200 1201 ImageList_Draw (HIMAGELIST himl, INT i, HDC hdc, 1201 INT x, INT y, UINT fStyle)1202 INT x, INT y, UINT fStyle) 1202 1203 { 1203 1204 IMAGELISTDRAWPARAMS imldp; … … 1252 1253 BOOL WINAPI 1253 1254 ImageList_DrawEx (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, 1254 INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg,1255 UINT fStyle)1255 INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, 1256 UINT fStyle) 1256 1257 { 1257 1258 IMAGELISTDRAWPARAMS imldp; … … 1277 1278 1278 1279 /************************************************************************* 1279 * ImageList_DrawIndirect [COMCTL32.53] 1280 * ImageList_DrawIndirect [COMCTL32.53] 1280 1281 * 1281 1282 * Draws an image using ... … … 1292 1293 ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp) 1293 1294 { 1294 INT cx, cy; 1295 /* 1295 INT cx, cy; 1296 /* 1296 1297 Do some Error Checking 1297 1298 */ … … 1303 1304 return FALSE; 1304 1305 if ((pimldp->i < 0) || (pimldp->i >= pimldp->himl->cCurImage)) { 1305 ERR("%d not within range (max %d)\n",pimldp->i,pimldp->himl->cCurImage-1);1306 ERR("%d not within range (max %d)\n",pimldp->i,pimldp->himl->cCurImage-1); 1306 1307 return FALSE; 1307 1308 } … … 1322 1323 IMAGELIST_InternalDraw(pimldp, cx, cy); 1323 1324 } 1324 /* 1325 /* 1325 1326 Apply the blend if needed to the Image 1326 1327 */ … … 1387 1388 DeleteDC (hdcSrc); 1388 1389 1389 himlDst->cCurImage = himlSrc->cCurImage;1390 himlDst->cMaxImage = himlSrc->cMaxImage;1390 himlDst->cCurImage = himlSrc->cCurImage; 1391 himlDst->cMaxImage = himlSrc->cMaxImage; 1391 1392 } 1392 1393 return himlDst; … … 1447 1448 { 1448 1449 if (himl == NULL) 1449 return CLR_NONE;1450 return CLR_NONE; 1450 1451 1451 1452 return himl->clrBk; … … 1483 1484 1484 1485 /************************************************************************* 1485 * ImageList_GetIcon [COMCTL32.59] 1486 * ImageList_GetIcon [COMCTL32.59] 1486 1487 * 1487 1488 * Creates an icon from a masked image of an image list. … … 1506 1507 1507 1508 if ((himl == NULL) || (i < 0) || (i >= himl->cCurImage)) { 1508 FIXME("(%p,%d,%x), params out of range!\n",himl,i,fStyle);1509 return 0;1509 FIXME("(%p,%d,%x), params out of range!\n",himl,i,fStyle); 1510 return 0; 1510 1511 } 1511 1512 … … 1519 1520 hOldDstBitmap = (HBITMAP)SelectObject (hdcDst, ii.hbmMask); 1520 1521 if (himl->hbmMask) { 1521 SelectObject (hdcSrc, himl->hbmMask);1522 BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,1523 hdcSrc, i * himl->cx, 0, SRCCOPY);1522 SelectObject (hdcSrc, himl->hbmMask); 1523 BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, 1524 hdcSrc, i * himl->cx, 0, SRCCOPY); 1524 1525 } 1525 1526 else 1526 PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS);1527 PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS); 1527 1528 1528 1529 /* draw image*/ … … 1531 1532 SelectObject (hdcDst, ii.hbmColor); 1532 1533 BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, 1533 hdcSrc, i * himl->cx, 0, SRCCOPY);1534 hdcSrc, i * himl->cx, 0, SRCCOPY); 1534 1535 1535 1536 /* 1536 1537 * CreateIconIndirect requires us to deselect the bitmaps from 1537 * the DCs before calling 1538 * the DCs before calling 1538 1539 */ 1539 1540 SelectObject(hdcSrc, hOldSrcBitmap); 1540 1541 SelectObject(hdcDst, hOldDstBitmap); 1541 1542 1542 hIcon = CreateIconIndirect (&ii); 1543 hIcon = CreateIconIndirect (&ii); 1543 1544 1544 1545 DeleteDC (hdcSrc); … … 1573 1574 { 1574 1575 if (himl == NULL) 1575 return FALSE;1576 return FALSE; 1576 1577 if ((himl->cx <= 0) || (himl->cy <= 0)) 1577 return FALSE;1578 return FALSE; 1578 1579 1579 1580 if (cx) 1580 *cx = himl->cx;1581 *cx = himl->cx; 1581 1582 if (cy) 1582 *cy = himl->cy;1583 *cy = himl->cy; 1583 1584 1584 1585 return TRUE; … … 1603 1604 { 1604 1605 if (himl == NULL) 1605 return 0;1606 return 0; 1606 1607 1607 1608 return himl->cCurImage; … … 1628 1629 { 1629 1630 if ((himl == NULL) || (pImageInfo == NULL)) 1630 return FALSE;1631 return FALSE; 1631 1632 if ((i < 0) || (i >= himl->cCurImage)) 1632 return FALSE;1633 return FALSE; 1633 1634 1634 1635 pImageInfo->hbmImage = himl->hbmImage; 1635 1636 pImageInfo->hbmMask = himl->hbmMask; 1636 1637 1637 1638 pImageInfo->rcImage.top = 0; 1638 1639 pImageInfo->rcImage.bottom = himl->cy; 1639 1640 pImageInfo->rcImage.left = i * himl->cx; 1640 1641 pImageInfo->rcImage.right = (i+1) * himl->cx; 1641 1642 1642 1643 return TRUE; 1643 1644 } … … 1645 1646 1646 1647 /************************************************************************* 1647 * ImageList_GetImageRect [COMCTL32.63] 1648 * ImageList_GetImageRect [COMCTL32.63] 1648 1649 * 1649 1650 * Retrieves the rectangle of the specified image in an image list. … … 1666 1667 { 1667 1668 if ((himl == NULL) || (lpRect == NULL)) 1668 return FALSE;1669 return FALSE; 1669 1670 if ((i < 0) || (i >= himl->cCurImage)) 1670 return FALSE;1671 return FALSE; 1671 1672 1672 1673 lpRect->left = i * himl->cx; … … 1704 1705 HIMAGELIST WINAPI 1705 1706 ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow, 1706 COLORREF clrMask, UINT uType, UINT uFlags)1707 COLORREF clrMask, UINT uType, UINT uFlags) 1707 1708 { 1708 1709 HIMAGELIST himl = NULL; … … 1744 1745 GetIconInfo (handle, &ii); 1745 1746 GetObjectA (ii.hbmColor, sizeof(BITMAP), (LPVOID)&bmp); 1746 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 1747 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 1747 1748 ILC_MASK | ILC_COLOR, 1, cGrow); 1748 1749 ImageList_Add (himl, ii.hbmColor, ii.hbmMask); … … 1752 1753 1753 1754 DeleteObject (handle); 1754 1755 1755 1756 return himl; 1756 1757 } … … 1781 1782 HIMAGELIST WINAPI 1782 1783 ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow, 1783 COLORREF clrMask, UINT uType,UINT uFlags)1784 COLORREF clrMask, UINT uType, UINT uFlags) 1784 1785 { 1785 1786 HIMAGELIST himl = NULL; … … 1808 1809 GetIconInfo (handle, &ii); 1809 1810 GetObjectA (ii.hbmMask, sizeof(BITMAP), (LPVOID)&bmp); 1810 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 1811 himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, 1811 1812 ILC_MASK | ILC_COLOR, 1, cGrow); 1812 1813 ImageList_Add (himl, ii.hbmColor, ii.hbmMask); … … 1816 1817 1817 1818 DeleteObject (handle); 1818 1819 1819 1820 return himl; 1820 1821 } … … 1822 1823 1823 1824 /************************************************************************* 1824 * ImageList_Merge [COMCTL32.67] 1825 * ImageList_Merge [COMCTL32.67] 1825 1826 * 1826 1827 * Creates a new image list that contains a merged image from the specified … … 1842 1843 HIMAGELIST WINAPI 1843 1844 ImageList_Merge (HIMAGELIST himl1, INT i1, HIMAGELIST himl2, INT i2, 1844 INT dx, INT dy)1845 INT dx, INT dy) 1845 1846 { 1846 1847 HIMAGELIST himlDst = NULL; … … 1851 1852 1852 1853 if ((himl1 == NULL) || (himl2 == NULL)) 1853 return NULL;1854 return NULL; 1854 1855 1855 1856 /* check indices */ … … 1903 1904 nX1 = i1 * himl1->cx; 1904 1905 nX2 = i2 * himl2->cx; 1905 1906 1906 1907 /* copy image */ 1907 1908 SelectObject (hdcSrcImage, himl1->hbmImage); 1908 1909 SelectObject (hdcDstImage, himlDst->hbmImage); 1909 BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 1910 BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 1910 1911 hdcSrcImage, 0, 0, BLACKNESS); 1911 BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 1912 BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 1912 1913 hdcSrcImage, nX1, 0, SRCCOPY); 1913 1914 1914 1915 SelectObject (hdcSrcImage, himl2->hbmMask); 1915 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1916 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1916 1917 hdcSrcImage, nX2, 0, SRCAND); 1917 1918 1918 1919 SelectObject (hdcSrcImage, himl2->hbmImage); 1919 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1920 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1920 1921 hdcSrcImage, nX2, 0, SRCPAINT); 1921 1922 … … 1923 1924 SelectObject (hdcSrcImage, himl1->hbmMask); 1924 1925 SelectObject (hdcDstImage, himlDst->hbmMask); 1925 BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 1926 BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, 1926 1927 hdcSrcImage, 0, 0, WHITENESS); 1927 BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 1928 BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, 1928 1929 hdcSrcImage, nX1, 0, SRCCOPY); 1929 1930 1930 1931 SelectObject (hdcSrcImage, himl2->hbmMask); 1931 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1932 BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, 1932 1933 hdcSrcImage, nX2, 0, SRCAND); 1933 1934 … … 1935 1936 DeleteDC (hdcDstImage); 1936 1937 } 1937 1938 1938 1939 return himlDst; 1939 1940 } … … 1945 1946 int bitspixel = GetDeviceCaps(hdc,BITSPIXEL)*GetDeviceCaps(hdc,PLANES); 1946 1947 if (bitspixel>8) 1947 return TRUE;1948 return TRUE; 1948 1949 if (bitspixel<=4) 1949 return FALSE;1950 return FALSE; 1950 1951 return GetDeviceCaps(hdc,CAPS1) & C1_DIBENGINE; 1951 1952 } … … 1954 1955 /* helper for ImageList_Read, see comments below */ 1955 1956 static HBITMAP _read_bitmap(LPSTREAM pstm,int ilcFlag,int cx,int cy) { 1956 HDC xdc = 0;1957 BITMAPFILEHEADER bmfh;1958 BITMAPINFOHEADER bmih;1959 int bitsperpixel,palspace,longsperline,width,height;1960 LPBITMAPINFOHEADER bmihc = NULL;1961 int result = 0;1962 HBITMAP hbitmap = 0;1963 LPBYTE bits = NULL,nbits = NULL;1964 int nbytesperline,bytesperline;1965 1966 if (!SUCCEEDED(IStream_Read ( pstm, &bmfh, sizeof(bmfh), NULL)) ||1967 (bmfh.bfType != (('M'<<8)|'B'))||1968 !SUCCEEDED(IStream_Read ( pstm, &bmih, sizeof(bmih), NULL))||1969 (bmih.biSize != sizeof(bmih))1957 HDC xdc = 0; 1958 BITMAPFILEHEADER bmfh; 1959 BITMAPINFOHEADER bmih; 1960 int bitsperpixel,palspace,longsperline,width,height; 1961 LPBITMAPINFOHEADER bmihc = NULL; 1962 int result = 0; 1963 HBITMAP hbitmap = 0; 1964 LPBYTE bits = NULL,nbits = NULL; 1965 int nbytesperline,bytesperline; 1966 1967 if (!SUCCEEDED(IStream_Read ( pstm, &bmfh, sizeof(bmfh), NULL)) || 1968 (bmfh.bfType != (('M'<<8)|'B')) || 1969 !SUCCEEDED(IStream_Read ( pstm, &bmih, sizeof(bmih), NULL)) || 1970 (bmih.biSize != sizeof(bmih)) 1970 1971 ) 1971 return 0;1972 return 0; 1972 1973 1973 1974 bitsperpixel = bmih.biPlanes * bmih.biBitCount; 1974 1975 if (bitsperpixel<=8) 1975 palspace = (1<<bitsperpixel)*sizeof(RGBQUAD);1976 palspace = (1<<bitsperpixel)*sizeof(RGBQUAD); 1976 1977 else 1977 palspace = 0;1978 palspace = 0; 1978 1979 width = bmih.biWidth; 1979 1980 height = bmih.biHeight; 1980 1981 bmihc = (LPBITMAPINFOHEADER)LocalAlloc(LMEM_ZEROINIT,sizeof(bmih)+palspace); 1981 1982 memcpy(bmihc,&bmih,sizeof(bmih)); 1982 longsperline = ((width*bitsperpixel+31)&~0x1f)>>5;1983 bmihc->biSizeImage = (longsperline*height)<<2;1983 longsperline = ((width*bitsperpixel+31)&~0x1f)>>5; 1984 bmihc->biSizeImage = (longsperline*height)<<2; 1984 1985 1985 1986 /* read the palette right after the end of the bitmapinfoheader */ 1986 1987 if (palspace) 1987 if (!SUCCEEDED(IStream_Read ( pstm, bmihc+1, palspace, NULL)))1988 goto ret1;1988 if (!SUCCEEDED(IStream_Read ( pstm, bmihc+1, palspace, NULL))) 1989 goto ret1; 1989 1990 1990 1991 xdc = GetDC(0); 1991 1992 #if 0 /* Magic for NxM -> 1x(N*M) not implemented for DIB Sections */ 1992 1993 if ((bitsperpixel>1) && 1993 ((ilcFlag!=ILC_COLORDDB) && (!ilcFlag || may_use_dibsection(xdc)))1994 ((ilcFlag!=ILC_COLORDDB) && (!ilcFlag || may_use_dibsection(xdc))) 1994 1995 ) { 1995 hbitmap = CreateDIBSection(xdc,(BITMAPINFO*)bmihc,0,(LPVOID*)&bits,0,0);1996 if (!hbitmap)1997 goto ret1;1998 if (!SUCCEEDED(IStream_Read( pstm, bits, bmihc->biSizeImage, NULL)))1999 goto ret1;2000 result = 1;1996 hbitmap = CreateDIBSection(xdc,(BITMAPINFO*)bmihc,0,(LPVOID*)&bits,0,0); 1997 if (!hbitmap) 1998 goto ret1; 1999 if (!SUCCEEDED(IStream_Read( pstm, bits, bmihc->biSizeImage, NULL))) 2000 goto ret1; 2001 result = 1; 2001 2002 } else 2002 2003 #endif 2003 2004 { 2004 int i,nwidth,nheight;2005 2006 nwidth= width*(height/cy);2007 nheight= cy;2008 2009 if (bitsperpixel==1)2010 hbitmap = CreateBitmap(nwidth,nheight,1,1,NULL);2011 else2012 hbitmap = CreateCompatibleBitmap(xdc,nwidth,nheight);2013 2014 /* Might be a bit excessive memory use here */2015 bits = (LPBYTE)LocalAlloc(LMEM_ZEROINIT,bmihc->biSizeImage);2016 nbits = (LPBYTE)LocalAlloc(LMEM_ZEROINIT,bmihc->biSizeImage);2017 if (!SUCCEEDED(IStream_Read ( pstm, bits, bmihc->biSizeImage, NULL)))2018 goto ret1;2019 2020 /* Copy the NxM bitmap into a 1x(N*M) bitmap we need, linewise */2021 /* Do not forget that windows bitmaps are bottom->top */2022 bytesperline= longsperline*4;2023 nbytesperline= (height/cy)*bytesperline;2024 for (i=0;i<height;i++) {2025 memcpy(2026 nbits+((height-1-i)%cy)*nbytesperline+(i/cy)*bytesperline,2027 bits+bytesperline*(height-1-i),2028 bytesperline2029 );2030 }2031 bmihc->biWidth= nwidth;2032 bmihc->biHeight= nheight;2033 if (!SetDIBits(xdc,hbitmap,0,nheight,nbits,(BITMAPINFO*)bmihc,0))2034 goto ret1;2035 LocalFree((HLOCAL)nbits);2036 LocalFree((HLOCAL)bits);2037 result = 1;2005 int i,nwidth,nheight; 2006 2007 nwidth = width*(height/cy); 2008 nheight = cy; 2009 2010 if (bitsperpixel==1) 2011 hbitmap = CreateBitmap(nwidth,nheight,1,1,NULL); 2012 else 2013 hbitmap = CreateCompatibleBitmap(xdc,nwidth,nheight); 2014 2015 /* Might be a bit excessive memory use here */ 2016 bits = (LPBYTE)LocalAlloc(LMEM_ZEROINIT,bmihc->biSizeImage); 2017 nbits = (LPBYTE)LocalAlloc(LMEM_ZEROINIT,bmihc->biSizeImage); 2018 if (!SUCCEEDED(IStream_Read ( pstm, bits, bmihc->biSizeImage, NULL))) 2019 goto ret1; 2020 2021 /* Copy the NxM bitmap into a 1x(N*M) bitmap we need, linewise */ 2022 /* Do not forget that windows bitmaps are bottom->top */ 2023 bytesperline = longsperline*4; 2024 nbytesperline = (height/cy)*bytesperline; 2025 for (i=0;i<height;i++) { 2026 memcpy( 2027 nbits+((height-1-i)%cy)*nbytesperline+(i/cy)*bytesperline, 2028 bits+bytesperline*(height-1-i), 2029 bytesperline 2030 ); 2031 } 2032 bmihc->biWidth = nwidth; 2033 bmihc->biHeight = nheight; 2034 if (!SetDIBits(xdc,hbitmap,0,nheight,nbits,(BITMAPINFO*)bmihc,0)) 2035 goto ret1; 2036 LocalFree((HLOCAL)nbits); 2037 LocalFree((HLOCAL)bits); 2038 result = 1; 2038 2039 } 2039 2040 ret1: 2040 if (xdc) ReleaseDC(0,xdc);2041 if (bmihc) LocalFree((HLOCAL)bmihc);2041 if (xdc) ReleaseDC(0,xdc); 2042 if (bmihc) LocalFree((HLOCAL)bmihc); 2042 2043 if (!result) { 2043 if (hbitmap) {2044 DeleteObject(hbitmap);2045 hbitmap = 0;2046 }2044 if (hbitmap) { 2045 DeleteObject(hbitmap); 2046 hbitmap = 0; 2047 } 2047 2048 } 2048 2049 return hbitmap; … … 2062 2063 * 2063 2064 * The format is like this: 2064 * ILHEADilheadstruct;2065 * ILHEAD ilheadstruct; 2065 2066 * 2066 2067 * for the color image part: 2067 * BITMAPFILEHEADER bmfh;2068 * BITMAPINFOHEADERbmih;2068 * BITMAPFILEHEADER bmfh; 2069 * BITMAPINFOHEADER bmih; 2069 2070 * only if it has a palette: 2070 * RGBQUAD rgbs[nr_of_paletted_colors];2071 * 2072 * BYTEcolorbits[imagesize];2071 * RGBQUAD rgbs[nr_of_paletted_colors]; 2072 * 2073 * BYTE colorbits[imagesize]; 2073 2074 * 2074 2075 * the following only if the ILC_MASK bit is set in ILHEAD.ilFlags: 2075 * BITMAPFILEHEADERbmfh_mask;2076 * BITMAPINFOHEADERbmih_mask;2076 * BITMAPFILEHEADER bmfh_mask; 2077 * BITMAPINFOHEADER bmih_mask; 2077 2078 * only if it has a palette (it usually does not): 2078 * RGBQUAD rgbs[nr_of_paletted_colors];2079 * 2080 * BYTEmaskbits[imagesize];2079 * RGBQUAD rgbs[nr_of_paletted_colors]; 2080 * 2081 * BYTE maskbits[imagesize]; 2081 2082 * 2082 2083 * CAVEAT: Those images are within a NxM bitmap, not the 1xN we expect. … … 2085 2086 HIMAGELIST WINAPI ImageList_Read (LPSTREAM pstm) 2086 2087 { 2087 ILHEAD ilHead;2088 HIMAGELIST himl;2089 HBITMAP hbmColor=0,hbmMask=0;2090 int i;2088 ILHEAD ilHead; 2089 HIMAGELIST himl; 2090 HBITMAP hbmColor=0,hbmMask=0; 2091 int i; 2091 2092 2092 2093 if (!SUCCEEDED(IStream_Read (pstm, &ilHead, sizeof(ILHEAD), NULL))) 2093 return NULL;2094 return NULL; 2094 2095 if (ilHead.usMagic != (('L' << 8) | 'I')) 2095 return NULL;2096 return NULL; 2096 2097 if (ilHead.usVersion != 0x101) /* probably version? */ 2097 return NULL;2098 return NULL; 2098 2099 2099 2100 #if 0 2100 FIXME(" ilHead.cCurImage = %d\n",ilHead.cCurImage);2101 FIXME(" ilHead.cMaxImage = %d\n",ilHead.cMaxImage);2102 FIXME(" ilHead.cGrow = %d\n",ilHead.cGrow);2103 FIXME(" ilHead.cx = %d\n",ilHead.cx);2104 FIXME(" ilHead.cy = %d\n",ilHead.cy);2105 FIXME(" ilHead.flags = %x\n",ilHead.flags);2106 FIXME(" ilHead.ovls[0] = %d\n",ilHead.ovls[0]);2107 FIXME(" ilHead.ovls[1] = %d\n",ilHead.ovls[1]);2108 FIXME(" ilHead.ovls[2] = %d\n",ilHead.ovls[2]);2109 FIXME(" ilHead.ovls[3] = %d\n",ilHead.ovls[3]);2101 FIXME(" ilHead.cCurImage = %d\n",ilHead.cCurImage); 2102 FIXME(" ilHead.cMaxImage = %d\n",ilHead.cMaxImage); 2103 FIXME(" ilHead.cGrow = %d\n",ilHead.cGrow); 2104 FIXME(" ilHead.cx = %d\n",ilHead.cx); 2105 FIXME(" ilHead.cy = %d\n",ilHead.cy); 2106 FIXME(" ilHead.flags = %x\n",ilHead.flags); 2107 FIXME(" ilHead.ovls[0] = %d\n",ilHead.ovls[0]); 2108 FIXME(" ilHead.ovls[1] = %d\n",ilHead.ovls[1]); 2109 FIXME(" ilHead.ovls[2] = %d\n",ilHead.ovls[2]); 2110 FIXME(" ilHead.ovls[3] = %d\n",ilHead.ovls[3]); 2110 2111 #endif 2111 2112 2112 2113 hbmColor = _read_bitmap(pstm,ilHead.flags & ~ILC_MASK,ilHead.cx,ilHead.cy); 2113 2114 if (!hbmColor) 2114 return NULL;2115 return NULL; 2115 2116 if (ilHead.flags & ILC_MASK) { 2116 hbmMask = _read_bitmap(pstm,0,ilHead.cx,ilHead.cy);2117 if (!hbmMask) {2118 DeleteObject(hbmColor);2119 return NULL;2120 }2117 hbmMask = _read_bitmap(pstm,0,ilHead.cx,ilHead.cy); 2118 if (!hbmMask) { 2119 DeleteObject(hbmColor); 2120 return NULL; 2121 } 2121 2122 } 2122 2123 2123 2124 himl = ImageList_Create ( 2124 ilHead.cx,2125 ilHead.cy,2126 ilHead.flags,2127 1,/* initial */2128 ilHead.cGrow2125 ilHead.cx, 2126 ilHead.cy, 2127 ilHead.flags, 2128 1, /* initial */ 2129 ilHead.cGrow 2129 2130 ); 2130 2131 if (!himl) { 2131 DeleteObject(hbmColor);2132 DeleteObject(hbmMask);2133 return NULL;2132 DeleteObject(hbmColor); 2133 DeleteObject(hbmMask); 2134 return NULL; 2134 2135 } 2135 2136 himl->hbmImage = hbmColor; … … 2140 2141 ImageList_SetBkColor(himl,ilHead.bkcolor); 2141 2142 for (i=0;i<4;i++) 2142 ImageList_SetOverlayImage(himl,ilHead.ovls[i],i+1);2143 ImageList_SetOverlayImage(himl,ilHead.ovls[i],i+1); 2143 2144 return himl; 2144 2145 } … … 2168 2169 return FALSE; 2169 2170 } 2170 2171 2171 2172 if ((i < -1) || (i >= himl->cCurImage)) { 2172 2173 ERR("index out of range! %d\n", i); … … 2211 2212 TRACE(" - Max. number of images: %d / %d (Old/New)\n", 2212 2213 himl->cMaxImage, himl->cCurImage + himl->cGrow - 1); 2213 2214 2214 2215 hbmNewImage = 2215 2216 CreateBitmap (cxNew, himl->cy, 1, himl->uBitsPixel, NULL); … … 2226 2227 if (i > 0) { 2227 2228 TRACE("Pre image copy: Copy %d images\n", i); 2228 2229 2229 2230 SelectObject (hdcSrc, himl->hbmImage); 2230 2231 SelectObject (hdcDst, hbmNewImage); … … 2277 2278 2278 2279 /************************************************************************* 2279 * ImageList_Replace [COMCTL32.70] 2280 * ImageList_Replace [COMCTL32.70] 2280 2281 * 2281 2282 * Replaces an image in an image list with a new image. … … 2294 2295 BOOL WINAPI 2295 2296 ImageList_Replace (HIMAGELIST himl, INT i, HBITMAP hbmImage, 2296 HBITMAP hbmMask)2297 HBITMAP hbmMask) 2297 2298 { 2298 2299 HDC hdcImageList, hdcImage; … … 2303 2304 return FALSE; 2304 2305 } 2305 2306 2306 2307 if ((i >= himl->cMaxImage) || (i < 0)) { 2307 2308 ERR("Invalid image index!\n"); … … 2333 2334 */ 2334 2335 SelectObject (hdcImageList, himl->hbmImage); 2335 StretchBlt (hdcImageList, 2336 StretchBlt (hdcImageList, 2336 2337 i*himl->cx, 0, himl->cx, himl->cy, 2337 hdcImage, 2338 0, 0, bmp.bmWidth, bmp.bmHeight, 2338 hdcImage, 2339 0, 0, bmp.bmWidth, bmp.bmHeight, 2339 2340 0x220326); /* NOTSRCAND */ 2340 2341 } … … 2375 2376 2376 2377 if (himl == NULL) 2377 return -1;2378 return -1; 2378 2379 if ((i >= himl->cMaxImage) || (i < -1)) 2379 return -1;2380 return -1; 2380 2381 2381 2382 hBestFitIcon = CopyImage( 2382 hIcon, IMAGE_ICON, 2383 himl->cx, himl->cy, 2383 hIcon, IMAGE_ICON, 2384 himl->cx, himl->cy, 2384 2385 LR_COPYFROMRESOURCE); 2385 2386 2386 2387 GetIconInfo (hBestFitIcon, &ii); 2387 2388 if (ii.hbmMask == 0) 2388 ERR("no mask!\n");2389 ERR("no mask!\n"); 2389 2390 if (ii.hbmColor == 0) 2390 ERR("no color!\n");2391 ERR("no color!\n"); 2391 2392 GetObjectA (ii.hbmMask, sizeof(BITMAP), (LPVOID)&bmp); 2392 2393 … … 2404 2405 TRACE("hdcImageList=0x%x!\n", hdcImageList); 2405 2406 if (hdcImageList == 0) 2406 ERR("invalid hdcImageList!\n");2407 ERR("invalid hdcImageList!\n"); 2407 2408 2408 2409 hdcImage = CreateCompatibleDC (0); 2409 2410 TRACE("hdcImage=0x%x!\n", hdcImage); 2410 2411 if (hdcImage == 0) 2411 ERR("invalid hdcImage!\n");2412 ERR("invalid hdcImage!\n"); 2412 2413 2413 2414 hbmOldDst = SelectObject (hdcImageList, himl->hbmImage); … … 2429 2430 2430 2431 if(hBestFitIcon) 2431 DestroyIcon(hBestFitIcon);2432 DestroyIcon(hBestFitIcon); 2432 2433 if (hdcImageList) 2433 DeleteDC (hdcImageList);2434 DeleteDC (hdcImageList); 2434 2435 if (hdcImage) 2435 DeleteDC (hdcImage);2436 DeleteDC (hdcImage); 2436 2437 if (ii.hbmColor) 2437 DeleteObject (ii.hbmColor);2438 DeleteObject (ii.hbmColor); 2438 2439 if (ii.hbmMask) 2439 DeleteObject (ii.hbmMask);2440 DeleteObject (ii.hbmMask); 2440 2441 2441 2442 return nIndex; … … 2444 2445 2445 2446 /************************************************************************* 2446 * ImageList_SetBkColor [COMCTL32.76] 2447 * ImageList_SetBkColor [COMCTL32.76] 2447 2448 * 2448 2449 * Sets the background color of an image list. … … 2463 2464 2464 2465 if (himl == NULL) 2465 return CLR_NONE;2466 return CLR_NONE; 2466 2467 2467 2468 clrOldBk = himl->clrBk; … … 2492 2493 BOOL WINAPI 2493 2494 ImageList_SetDragCursorImage (HIMAGELIST himlDrag, INT iDrag, 2494 INT dxHotspot, INT dyHotspot)2495 INT dxHotspot, INT dyHotspot) 2495 2496 { 2496 2497 HIMAGELIST himlTemp; … … 2499 2500 2500 2501 if (himlInternalDrag == NULL) 2501 return FALSE;2502 return FALSE; 2502 2503 2503 2504 TRACE(" dxH=%d dyH=%d nX=%d nY=%d\n", 2504 dxHotspot, dyHotspot, nInternalDragHotspotX, nInternalDragHotspotY);2505 dxHotspot, dyHotspot, nInternalDragHotspotX, nInternalDragHotspotY); 2505 2506 2506 2507 himlTemp = ImageList_Merge (himlInternalDrag, 0, himlDrag, iDrag, 2507 dxHotspot, dyHotspot);2508 dxHotspot, dyHotspot); 2508 2509 2509 2510 ImageList_Destroy (himlInternalDrag); … … 2518 2519 2519 2520 /************************************************************************* 2520 * ImageList_SetFilter [COMCTL32.78] 2521 * ImageList_SetFilter [COMCTL32.78] 2521 2522 * 2522 2523 * Sets a filter (or does something completely different)!!??? … … 2540 2541 { 2541 2542 FIXME("(%p 0x%x 0x%lx):empty stub!\n", 2542 himl, i, dwFilter);2543 himl, i, dwFilter); 2543 2544 2544 2545 return FALSE; … … 2567 2568 2568 2569 if (!himl) 2569 return FALSE;2570 return FALSE; 2570 2571 2571 2572 /* remove all images */ … … 2617 2618 2618 2619 if (!himl) 2619 return FALSE;2620 return FALSE; 2620 2621 if (himl->cCurImage >= iImageCount) 2621 return FALSE;2622 return FALSE; 2622 2623 if (himl->cMaxImage > iImageCount) 2623 return TRUE;2624 return TRUE; 2624 2625 2625 2626 nNewCount = iImageCount + himl->cGrow; … … 2636 2637 SelectObject (hdcBitmap, hbmNewBitmap); 2637 2638 2638 /* copy images */2639 /* copy images */ 2639 2640 BitBlt (hdcBitmap, 0, 0, nCopyCount * himl->cx, himl->cy, 2640 2641 hdcImageList, 0, 0, SRCCOPY); 2641 2642 #if 0 2642 /* delete 'empty' image space */2643 SetBkColor (hdcBitmap, RGB(255, 255, 255));2644 SetTextColor (hdcBitmap, RGB(0, 0, 0));2645 PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, 2646 (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS);2643 /* delete 'empty' image space */ 2644 SetBkColor (hdcBitmap, RGB(255, 255, 255)); 2645 SetTextColor (hdcBitmap, RGB(0, 0, 0)); 2646 PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, 2647 (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS); 2647 2648 #endif 2648 DeleteObject (himl->hbmImage);2649 himl->hbmImage = hbmNewBitmap;2649 DeleteObject (himl->hbmImage); 2650 himl->hbmImage = hbmNewBitmap; 2650 2651 } 2651 2652 else 2652 ERR("Could not create new image bitmap !\n");2653 ERR("Could not create new image bitmap !\n"); 2653 2654 2654 2655 if (himl->hbmMask) … … 2661 2662 SelectObject (hdcBitmap, hbmNewBitmap); 2662 2663 2663 /* copy images */2664 /* copy images */ 2664 2665 BitBlt (hdcBitmap, 0, 0, nCopyCount * himl->cx, himl->cy, 2665 2666 hdcImageList, 0, 0, SRCCOPY); 2666 2667 #if 0 2667 /* delete 'empty' image space */2668 SetBkColor (hdcBitmap, RGB(255, 255, 255));2669 SetTextColor (hdcBitmap, RGB(0, 0, 0));2670 PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, 2671 (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS);2668 /* delete 'empty' image space */ 2669 SetBkColor (hdcBitmap, RGB(255, 255, 255)); 2670 SetTextColor (hdcBitmap, RGB(0, 0, 0)); 2671 PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, 2672 (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS); 2672 2673 #endif 2673 2674 DeleteObject (himl->hbmMask); … … 2709 2710 { 2710 2711 if (!himl) 2711 return FALSE;2712 return FALSE; 2712 2713 if ((iOverlay < 1) || (iOverlay > MAX_OVERLAYIMAGE)) 2713 return FALSE;2714 return FALSE; 2714 2715 if ((iImage!=-1) && ((iImage < 0) || (iImage > himl->cCurImage))) 2715 return FALSE;2716 return FALSE; 2716 2717 himl->nOvlIdx[iOverlay - 1] = iImage; 2717 2718 return TRUE; … … 2744 2745 { 2745 2746 if (!himl) 2746 return FALSE;2747 return FALSE; 2747 2748 2748 2749 FIXME("empty stub!\n"); -
trunk/src/comctl32/initcomctl32.cpp
r6401 r6644 1 /* $Id: initcomctl32.cpp,v 1.3 2001-09-05 12:04:58 bird Exp $ */ 1 2 /* 2 3 * COMCTL32 DLL entry point … … 26 27 #define INCL_DOSMODULEMGR 27 28 #define INCL_DOSPROCESS 28 #include <os2wrap.h> //Odin32 OS/2 api wrappers29 #include <os2wrap.h> //Odin32 OS/2 api wrappers 29 30 #include <stdlib.h> 30 31 #include <stdio.h> … … 59 60 { 60 61 BOOL ret = COMCTL32_LibMain(hinstDLL, fdwReason, fImpLoad); 61 return ret;62 return ret; 62 63 } 63 64 } … … 85 86 switch (ulFlag) { 86 87 case 0 : 87 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&comctl32_PEResTab,88 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&comctl32_PEResTab, 88 89 COMCTL32_MAJORIMAGE_VERSION, COMCTL32_MINORIMAGE_VERSION, 89 90 IMAGE_SUBSYSTEM_WINDOWS_GUI); 90 if(dllHandle == 0) 91 return 0UL;91 if(dllHandle == 0) 92 return 0UL; 92 93 93 94 break; 94 95 case 1 : 95 96 if(dllHandle) { 96 UnregisterLxDll(dllHandle);97 UnregisterLxDll(dllHandle); 97 98 } 98 99 break; -
trunk/src/comctl32/initterm.cpp
r6375 r6644 1 /* $Id: initterm.cpp,v 1.16 2001-09-05 12:04:59 bird Exp $ */ 1 2 /* 2 3 * COMCTL32 DLL entry point … … 26 27 #define INCL_DOSMODULEMGR 27 28 #define INCL_DOSPROCESS 28 #include <os2wrap.h> //Odin32 OS/2 api wrappers29 #include <os2wrap.h> //Odin32 OS/2 api wrappers 29 30 #include <stdlib.h> 30 31 #include <stdio.h> -
trunk/src/comctl32/listview.c
r6320 r6644 1 /* $Id: listview.c,v 1.33 2001-09-05 12:04:59 bird Exp $ */ 1 2 /* 2 3 * Listview control -
trunk/src/comctl32/monthcal.c
r5416 r6644 1 /* $Id: monthcal.c,v 1.12 2001-09-05 12:05:00 bird Exp $ */ 1 2 /* Month calendar control 2 3 * 3 4 * 4 5 * Copyright 1998, 1999 Eric Kohl (ekohl@abo.rhein-zeitung.de) 5 6 * Copyright 1999 Alex Priem (alexp@sci.kun.nl) 6 7 * Copyright 1999 Chris Morgan <cmorgan@wpi.edu> and 7 * James Abbatiello <abbeyj@wpi.edu>8 * James Abbatiello <abbeyj@wpi.edu> 8 9 * Copyright 2000 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> 9 10 * … … 13 14 * 14 15 * FIXME: handle resources better (doesn't work now); also take care 15 of internationalization.16 * of internationalization. 16 17 * FIXME: keyboard handling. 17 18 */ … … 43 44 DEFAULT_DEBUG_CHANNEL(monthcal); 44 45 45 #define MC_SEL_LBUTUP 1/* Left button released */46 #define MC_SEL_LBUTDOWN 2/* Left button pressed in calendar */46 #define MC_SEL_LBUTUP 1 /* Left button released */ 47 #define MC_SEL_LBUTDOWN 2 /* Left button pressed in calendar */ 47 48 #define MC_PREVPRESSED 4 /* Prev month button pressed */ 48 49 #define MC_NEXTPRESSED 8 /* Next month button pressed */ 49 #define MC_NEXTMONTHDELAY 350 /* when continuously pressing `next */50 /* month', wait 500 ms before going */51 /* to the next month */52 #define MC_NEXTMONTHTIMER 1 /* Timer ID's */53 #define MC_PREVMONTHTIMER 2 50 #define MC_NEXTMONTHDELAY 350 /* when continuously pressing `next */ 51 /* month', wait 500 ms before going */ 52 /* to the next month */ 53 #define MC_NEXTMONTHTIMER 1 /* Timer ID's */ 54 #define MC_PREVMONTHTIMER 2 54 55 55 56 typedef struct … … 58 59 COMCTL32_HEADER header; 59 60 #endif 60 COLORREF bk;61 COLORREF txt;62 COLORREF titlebk;63 COLORREF titletxt;64 COLORREF monthbk;65 COLORREF trailingtxt;66 HFONT hFont;67 HFONT hBoldFont;68 int textHeight;69 int textWidth;70 int height_increment;71 int width_increment;72 int left_offset;73 int top_offset;74 int firstDayplace; /* place of the first day of the current month */75 int delta;/* scroll rate; # of months that the */61 COLORREF bk; 62 COLORREF txt; 63 COLORREF titlebk; 64 COLORREF titletxt; 65 COLORREF monthbk; 66 COLORREF trailingtxt; 67 HFONT hFont; 68 HFONT hBoldFont; 69 int textHeight; 70 int textWidth; 71 int height_increment; 72 int width_increment; 73 int left_offset; 74 int top_offset; 75 int firstDayplace; /* place of the first day of the current month */ 76 int delta; /* scroll rate; # of months that the */ 76 77 /* control moves when user clicks a scroll button */ 77 int visible;/* # of months visible */78 int firstDay;/* Start month calendar with firstDay's day */79 int monthRange;78 int visible; /* # of months visible */ 79 int firstDay; /* Start month calendar with firstDay's day */ 80 int monthRange; 80 81 MONTHDAYSTATE *monthdayState; 81 SYSTEMTIME todaysDate;82 DWORD currentMonth;83 DWORD currentYear;84 int status;/* See MC_SEL flags */85 int curSelDay;/* current selected day */86 int firstSelDay;/* first selected day */87 int maxSelCount;88 SYSTEMTIME minSel;89 SYSTEMTIME maxSel;90 DWORD rangeValid;91 SYSTEMTIME minDate;92 SYSTEMTIME maxDate;93 94 RECT rcClient; /* rect for whole client area */95 RECT rcDraw; /* rect for drawable portion of client area */96 RECT title; /* rect for the header above the calendar */97 RECT titlebtnnext; /* the `next month' button in the header */98 RECT titlebtnprev; /* the `prev month' button in the header */ 99 RECT titlemonth; /* the `month name' txt in the header */100 RECT titleyear; /* the `year number' txt in the header */101 RECT wdays; /* week days at top */102 RECT days; /* calendar area */103 RECT weeknums; /* week numbers at left side */104 RECT todayrect; /* `today: xx/xx/xx' text rect */82 SYSTEMTIME todaysDate; 83 DWORD currentMonth; 84 DWORD currentYear; 85 int status; /* See MC_SEL flags */ 86 int curSelDay; /* current selected day */ 87 int firstSelDay; /* first selected day */ 88 int maxSelCount; 89 SYSTEMTIME minSel; 90 SYSTEMTIME maxSel; 91 DWORD rangeValid; 92 SYSTEMTIME minDate; 93 SYSTEMTIME maxDate; 94 95 RECT rcClient; /* rect for whole client area */ 96 RECT rcDraw; /* rect for drawable portion of client area */ 97 RECT title; /* rect for the header above the calendar */ 98 RECT titlebtnnext; /* the `next month' button in the header */ 99 RECT titlebtnprev; /* the `prev month' button in the header */ 100 RECT titlemonth; /* the `month name' txt in the header */ 101 RECT titleyear; /* the `year number' txt in the header */ 102 RECT wdays; /* week days at top */ 103 RECT days; /* calendar area */ 104 RECT weeknums; /* week numbers at left side */ 105 RECT todayrect; /* `today: xx/xx/xx' text rect */ 105 106 HWND hWndYearEdit; /* Window Handle of edit box to handle years */ 106 107 HWND hWndYearUpDown;/* Window Handle of updown box to handle years */ … … 141 142 142 143 /* make sure that time is valid */ 143 static int MONTHCAL_ValidateTime(SYSTEMTIME time) 144 static int MONTHCAL_ValidateTime(SYSTEMTIME time) 144 145 { 145 146 if(time.wMonth > 12) return FALSE; 146 147 if(time.wDayOfWeek > 6) return FALSE; 147 148 if(time.wDay > MONTHCAL_MonthLength(time.wMonth, time.wYear)) 148 return FALSE;149 return FALSE; 149 150 if(time.wHour > 23) return FALSE; 150 151 if(time.wMinute > 59) return FALSE; … … 156 157 157 158 158 void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) 159 void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) 159 160 { 160 161 to->wYear = from->wYear; … … 169 170 170 171 171 /* Note:Depending on DST, this may be offset by a day. 172 /* Note:Depending on DST, this may be offset by a day. 172 173 Need to find out if we're on a DST place & adjust the clock accordingly. 173 174 Above function assumes we have a valid data. … … 182 183 year-=(month < 3); 183 184 184 return((year + year/4 - year/100 + year/400 + 185 return((year + year/4 - year/100 + year/400 + 185 186 DayOfWeekTable[month-1] + day - 1 ) % 7); 186 187 } … … 189 190 and day in the calendar. day== 0 mean the last day of tha last month 190 191 */ 191 static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y, 192 int *daypos,int *weekpos) 192 static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y, 193 int *daypos,int *weekpos) 193 194 { 194 195 int retval, firstDay; … … 202 203 *daypos = (x - infoPtr->days.left ) / infoPtr->width_increment; 203 204 *weekpos = (y - infoPtr->days.top ) / infoPtr->height_increment; 204 205 205 206 firstDay = (MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear)+6 - infoPtr->firstDay)%7; 206 207 retval = *daypos + (7 * *weekpos) - firstDay; … … 211 212 /* sets x and y to be the position of the day */ 212 213 /* x == day, y == week where(0,0) == firstDay, 1st week */ 213 static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month, 214 static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month, 214 215 int *x, int *y) 215 216 { … … 227 228 if(prevMonth==0) 228 229 prevMonth = 12; 229 230 230 231 *x = (MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) - firstDay) % 7; 231 232 *y = 0; … … 240 241 241 242 /* x: column(day), y: row(week) */ 242 static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y) 243 static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y) 243 244 { 244 245 r->left = infoPtr->days.left + x * infoPtr->width_increment; … … 252 253 /* day is the day value of the month(1 == 1st), month is the month */ 253 254 /* value(january == 1, december == 12) */ 254 static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr, 255 static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr, 255 256 int day, int month, RECT *r) 256 257 { … … 278 279 x = day_rect.left; 279 280 y = day_rect.top; 280 281 281 282 points[0].x = x; 282 283 points[0].y = y - 1; … … 287 288 points[3].x = x + infoPtr->width_increment; 288 289 points[3].y = y + 0.5 * infoPtr->height_increment; 289 290 290 291 points[4].x = x + infoPtr->width_increment; 291 292 points[4].y = y + 0.9 * infoPtr->height_increment; … … 294 295 points[6].x = x + 0.5 * infoPtr->width_increment; 295 296 points[6].y = y + 0.9 * infoPtr->height_increment; /* bring the bottom up just 296 a hair to fit inside the day rectangle */297 297 a hair to fit inside the day rectangle */ 298 298 299 points[7].x = x + 0.2 * infoPtr->width_increment; 299 300 points[7].y = y + 0.8 * infoPtr->height_increment; … … 309 310 points[12].x = x + 0.4 * infoPtr->width_increment; 310 311 points[12].y = y + 0.2 * infoPtr->height_increment; 311 312 312 313 PolyBezier(hdc, points, 13); 313 314 DeleteObject(hRedPen); … … 329 330 sprintf(buf, "%d", day); 330 331 331 /* No need to check styles: when selection is not valid, it is set to zero. 332 /* No need to check styles: when selection is not valid, it is set to zero. 332 333 * 1<day<31, so evertyhing's OK. 333 334 */ … … 349 350 350 351 /* FIXME: this may need to be changed now b/c of the other 351 drawing changes 11/3/99 CMM */352 drawing changes 11/3/99 CMM */ 352 353 r2.left = r.left - 0.25 * infoPtr->textWidth; 353 354 r2.top = r.top; … … 390 391 391 392 /* CHECKME: For `todays date', do we need to check the locale?*/ 392 static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps) 393 static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps) 393 394 { 394 395 MONTHCAL_INFO *infoPtr=MONTHCAL_GetInfoPtr(hwnd); … … 425 426 hbr = CreateSolidBrush (infoPtr->bk); 426 427 FillRect(hdc, rcClient, hbr); 427 DeleteObject(hbr); 428 DeleteObject(hbr); 428 429 429 430 /* draw header */ … … 434 435 DeleteObject(hbr); 435 436 } 436 437 437 438 /* if the previous button is pressed draw it depressed */ 438 439 if(IntersectRect(&rcTemp, &(ps->rcPaint), prev)) 439 { 440 { 440 441 if((infoPtr->status & MC_PREVPRESSED)) 441 442 DrawFrameControl(hdc, prev, DFC_SCROLL, 442 DFCS_SCROLLLEFT | DFCS_PUSHED |443 DFCS_SCROLLLEFT | DFCS_PUSHED | 443 444 (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0)); 444 445 else /* if the previous button is pressed draw it depressed */ 445 446 DrawFrameControl(hdc, prev, DFC_SCROLL, 446 DFCS_SCROLLLEFT |(dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0));447 } 448 449 /* if next button is depressed draw it depressed */ 447 DFCS_SCROLLLEFT |(dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0)); 448 } 449 450 /* if next button is depressed draw it depressed */ 450 451 if(IntersectRect(&rcTemp, &(ps->rcPaint), next)) 451 452 { 452 453 if((infoPtr->status & MC_NEXTPRESSED)) 453 454 DrawFrameControl(hdc, next, DFC_SCROLL, 454 DFCS_SCROLLRIGHT | DFCS_PUSHED |455 DFCS_SCROLLRIGHT | DFCS_PUSHED | 455 456 (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0)); 456 457 else /* if the next button is pressed draw it depressed */ … … 466 467 titlemonth->left = title->left; 467 468 titlemonth->right = title->right; 468 469 469 470 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1, 470 buf1,sizeof(buf1));471 buf1,sizeof(buf1)); 471 472 sprintf(buf, "%s %ld", buf1, infoPtr->currentYear); 472 473 473 474 if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth)) 474 475 { 475 DrawTextA(hdc, buf, strlen(buf), titlemonth, 476 DrawTextA(hdc, buf, strlen(buf), titlemonth, 476 477 DT_CENTER | DT_VCENTER | DT_SINGLELINE); 477 478 } … … 481 482 /* titlemonth left/right contained rect for whole titletxt('June 1999') 482 483 * MCM_HitTestInfo wants month & year rects, so prepare these now. 483 *(no, we can't draw them separately; the whole text is centered) 484 *(no, we can't draw them separately; the whole text is centered) 484 485 */ 485 486 GetTextExtentPoint32A(hdc, buf, strlen(buf), &size); … … 489 490 titlemonth->right = titlemonth->left + size.cx; 490 491 titleyear->left = titlemonth->right; 491 492 492 493 /* draw month area */ 493 494 rcTemp.top=infoPtr->wdays.top; … … 501 502 DeleteObject(hbr); 502 503 } 503 504 504 505 /* draw line under day abbreviatons */ 505 506 506 507 MoveToEx(hdc, infoPtr->days.left + 3, title->bottom + textHeight + 1, NULL); 507 508 508 509 LineTo(hdc, rcDraw->right - 3, title->bottom + textHeight + 1); 509 510 510 511 prevMonth = infoPtr->currentMonth - 1; 511 512 if(prevMonth == 0) /* if currentMonth is january(1) prevMonth is */ … … 529 530 for(j=0; j<7; j++) { 530 531 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SABBREVDAYNAME1 + (i +j)%7, 531 buf,sizeof(buf));532 buf,sizeof(buf)); 532 533 DrawTextA(hdc, buf, strlen(buf), days, 533 534 DT_CENTER | DT_VCENTER | DT_SINGLELINE ); … … 537 538 538 539 /* draw day numbers; first, the previous month */ 539 540 540 541 firstDay = MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear); 541 542 day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) + 542 543 day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) + 543 544 (infoPtr->firstDay + 7 - firstDay)%7 + 1; 544 545 if (day > MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear)) … … 553 554 if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) 554 555 { 555 MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0, 556 MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0, 556 557 infoPtr->monthdayState[m] & mask); 557 558 } … … 577 578 { 578 579 579 MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0, 580 infoPtr->monthdayState[m] & mask);580 MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0, 581 infoPtr->monthdayState[m] & mask); 581 582 582 583 if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) && 583 584 (day==infoPtr->todaysDate.wDay) && 584 (infoPtr->currentYear == infoPtr->todaysDate.wYear)) {585 (infoPtr->currentYear == infoPtr->todaysDate.wYear)) { 585 586 if(!(dwStyle & MCS_NOTODAYCIRCLE)) 586 MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth);587 MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth); 587 588 } 588 589 } … … 595 596 j = 1; /* move to the 2nd week of the current month */ 596 597 i = 0; /* move back to sunday */ 597 while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) { 598 while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) { 598 599 MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j); 599 600 if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) … … 604 605 if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) && 605 606 (day==infoPtr->todaysDate.wDay) && 606 (infoPtr->currentYear == infoPtr->todaysDate.wYear)) 607 if(!(dwStyle & MCS_NOTODAYCIRCLE)) 608 MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth);607 (infoPtr->currentYear == infoPtr->todaysDate.wYear)) 608 if(!(dwStyle & MCS_NOTODAYCIRCLE)) 609 MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth); 609 610 } 610 611 mask<<=1; … … 627 628 MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j); 628 629 if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) 629 { 630 { 630 631 MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth + 1, i, j, 631 infoPtr->monthdayState[m] & mask);632 infoPtr->monthdayState[m] & mask); 632 633 } 633 634 634 635 mask<<=1; 635 636 day++; 636 i++; 637 i++; 637 638 if(i==7) { /* past saturday, go to next week's sunday */ 638 639 i = 0; … … 650 651 if(!(dwStyle & MCS_NOTODAYCIRCLE)) { 651 652 /*day is the number of days from nextmonth we put on the calendar */ 652 MONTHCAL_CircleDay(hdc, infoPtr, 653 day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear), 654 infoPtr->currentMonth);653 MONTHCAL_CircleDay(hdc, infoPtr, 654 day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear), 655 infoPtr->currentMonth); 655 656 offset+=textWidth; 656 657 } 657 658 if (!LoadStringA(COMCTL32_hModule,IDM_TODAY,buf1,sizeof(buf1))) 658 659 { 659 WARN("Can't load resource\n");660 strcpy(buf1,"Today:");660 WARN("Can't load resource\n"); 661 strcpy(buf1,"Today:"); 661 662 } 662 663 MONTHCAL_CalcDayRect(infoPtr, &rtoday, 1, 6); … … 674 675 } 675 676 676 /*eventually draw week numbers*/ 677 /*eventually draw week numbers*/ 677 678 if(dwStyle & MCS_WEEKNUMBERS) { 678 679 /* display weeknumbers*/ … … 682 683 LOCALE_IFIRSTWEEKOFYEAR == 0 (e.g US?): 683 684 The week containing Jan 1 is the first week of year 684 LOCALE_IFIRSTWEEKOFYEAR == 2 (e.g. Germany): 685 LOCALE_IFIRSTWEEKOFYEAR == 2 (e.g. Germany): 685 686 First week of year must contain 4 days of the new year 686 687 LOCALE_IFIRSTWEEKOFYEAR == 1 (what contries?) … … 688 689 */ 689 690 GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR, 690 buf, sizeof(buf));691 buf, sizeof(buf)); 691 692 sscanf(buf, "%d", &weeknum); 692 693 switch (weeknum) 693 694 { 694 695 case 1: mindays = 6; 695 break;696 break; 696 697 case 2: mindays = 3; 697 break;698 break; 698 699 case 0: 699 700 default: 700 mindays = 0;701 mindays = 0; 701 702 } 702 703 if (infoPtr->currentMonth < 2) 703 704 { 704 /* calculate all those exceptions for january */705 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear);706 if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays) 707 weeknum =1;708 else709 {710 weeknum = 0;711 for(i=0; i<11; i++) 712 weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear-1);713 weeknum +=startofprescal+ 7;714 weeknum /=7;715 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear-1);716 if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays)717 weeknum++;718 }705 /* calculate all those exceptions for january */ 706 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear); 707 if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays) 708 weeknum =1; 709 else 710 { 711 weeknum = 0; 712 for(i=0; i<11; i++) 713 weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear-1); 714 weeknum +=startofprescal+ 7; 715 weeknum /=7; 716 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear-1); 717 if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays) 718 weeknum++; 719 } 719 720 } 720 721 else 721 722 { 722 weeknum = 0;723 for(i=0; i<prevMonth-1; i++) 724 weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear);725 weeknum +=startofprescal+ 7;726 weeknum /=7;727 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear);728 if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays)729 weeknum++;723 weeknum = 0; 724 for(i=0; i<prevMonth-1; i++) 725 weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear); 726 weeknum +=startofprescal+ 7; 727 weeknum /=7; 728 weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear); 729 if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays) 730 weeknum++; 730 731 } 731 732 days->left = infoPtr->weeknums.left; … … 735 736 for(i=0; i<6; i++) { 736 737 if((i==0)&&(weeknum>50)) 737 {738 sprintf(buf, "%d", weeknum);739 weeknum=0;740 }738 { 739 sprintf(buf, "%d", weeknum); 740 weeknum=0; 741 } 741 742 else if((i==5)&&(weeknum>47)) 742 {743 sprintf(buf, "%d", 1);744 }743 { 744 sprintf(buf, "%d", 1); 745 } 745 746 else 746 sprintf(buf, "%d", weeknum + i);747 sprintf(buf, "%d", weeknum + i); 747 748 DrawTextA(hdc, buf, -1, days, DT_CENTER | DT_VCENTER | DT_SINGLELINE ); 748 749 days->top+=infoPtr->height_increment; 749 750 days->bottom+=infoPtr->height_increment; 750 751 } 751 752 752 753 MoveToEx(hdc, infoPtr->weeknums.right, infoPtr->weeknums.top + 3 , NULL); 753 754 LineTo(hdc, infoPtr->weeknums.right, infoPtr->weeknums.bottom ); 754 755 755 756 } 756 757 /* currentFont was font at entering Refresh */ 757 758 758 759 SetBkColor(hdc, oldBkColor); 759 SelectObject(hdc, currentFont); 760 SelectObject(hdc, currentFont); 760 761 SetTextColor(hdc, oldTextColor); 761 762 } 762 763 763 764 764 static LRESULT 765 static LRESULT 765 766 MONTHCAL_GetMinReqRect(HWND hwnd, WPARAM wParam, LPARAM lParam) 766 767 { … … 768 769 LPRECT lpRect = (LPRECT) lParam; 769 770 TRACE("%x %lx\n", wParam, lParam); 770 771 771 772 /* validate parameters */ 772 773 … … 781 782 782 783 783 static LRESULT 784 static LRESULT 784 785 MONTHCAL_GetColor(HWND hwnd, WPARAM wParam, LPARAM lParam) 785 786 { … … 807 808 808 809 809 static LRESULT 810 static LRESULT 810 811 MONTHCAL_SetColor(HWND hwnd, WPARAM wParam, LPARAM lParam) 811 812 { … … 847 848 848 849 849 static LRESULT 850 static LRESULT 850 851 MONTHCAL_GetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam) 851 852 { … … 853 854 854 855 TRACE("%x %lx\n", wParam, lParam); 855 856 856 857 if(infoPtr->delta) 857 858 return infoPtr->delta; … … 861 862 862 863 863 static LRESULT 864 static LRESULT 864 865 MONTHCAL_SetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam) 865 866 { … … 868 869 869 870 TRACE("%x %lx\n", wParam, lParam); 870 871 871 872 infoPtr->delta = (int)wParam; 872 873 return prev; … … 874 875 875 876 876 static LRESULT 877 static LRESULT 877 878 MONTHCAL_GetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam) 878 879 { 879 880 MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); 880 881 881 882 return infoPtr->firstDay; 882 883 } … … 887 888 /* FIXME: this needs to be implemented properly in MONTHCAL_Refresh() */ 888 889 /* FIXME: we need more error checking here */ 889 static LRESULT 890 static LRESULT 890 891 MONTHCAL_SetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam) 891 892 { … … 903 904 { 904 905 GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, 905 buf, sizeof(buf));906 buf, sizeof(buf)); 906 907 TRACE("%s %d\n", buf, strlen(buf)); 907 908 if(sscanf(buf, "%d", &day) == 1) 908 infoPtr->firstDay = day;909 infoPtr->firstDay = day; 909 910 else 910 infoPtr->firstDay = 0;911 infoPtr->firstDay = 0; 911 912 } 912 913 return prev; … … 916 917 /* FIXME: fill this in */ 917 918 static LRESULT 918 MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 919 MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 919 920 { 920 921 MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); … … 937 938 938 939 /* FIXME: are validated times taken from current date/time or simply 939 * copied? 940 * copied? 940 941 * FIXME: check whether MCM_GETMONTHRANGE shows correct result after 941 942 * adjusting range with MCM_SETRANGE … … 950 951 951 952 TRACE("%x %lx\n", wParam, lParam); 952 953 953 954 if(wParam & GDTR_MAX) { 954 955 if(MONTHCAL_ValidateTime(lprgSysTimeArray[1])){ … … 973 974 infoPtr->monthRange = infoPtr->maxDate.wMonth - infoPtr->minDate.wMonth; 974 975 975 if(infoPtr->monthRange!=prev) { 976 COMCTL32_ReAlloc(infoPtr->monthdayState, 977 infoPtr->monthRange * sizeof(MONTHDAYSTATE));976 if(infoPtr->monthRange!=prev) { 977 COMCTL32_ReAlloc(infoPtr->monthdayState, 978 infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 978 979 } 979 980 … … 983 984 984 985 /* CHECKME: At the moment, we copy ranges anyway,regardless of 985 * infoPtr->rangeValid; a invalid range is simply filled with zeros in 986 * infoPtr->rangeValid; a invalid range is simply filled with zeros in 986 987 * SetRange. Is this the right behavior? 987 988 */ … … 1015 1016 if(iMonths!=infoPtr->monthRange) return 0; 1016 1017 1017 for(i=0; i<iMonths; i++) 1018 for(i=0; i<iMonths; i++) 1018 1019 infoPtr->monthdayState[i] = dayStates[i]; 1019 1020 return 1; 1020 1021 } 1021 1022 1022 static LRESULT 1023 static LRESULT 1023 1024 MONTHCAL_GetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) 1024 1025 { … … 1036 1037 /* FIXME: if the specified date is not visible, make it visible */ 1037 1038 /* FIXME: redraw? */ 1038 static LRESULT 1039 static LRESULT 1039 1040 MONTHCAL_SetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) 1040 1041 { … … 1057 1058 1058 1059 1059 static LRESULT 1060 static LRESULT 1060 1061 MONTHCAL_GetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam) 1061 1062 { … … 1067 1068 1068 1069 1069 static LRESULT 1070 static LRESULT 1070 1071 MONTHCAL_SetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam) 1071 1072 { … … 1081 1082 1082 1083 1083 static LRESULT 1084 static LRESULT 1084 1085 MONTHCAL_GetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 1085 1086 { … … 1100 1101 return TRUE; 1101 1102 } 1102 1103 1103 1104 return FALSE; 1104 1105 } 1105 1106 1106 1107 1107 static LRESULT 1108 static LRESULT 1108 1109 MONTHCAL_SetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam) 1109 1110 { … … 1124 1125 return TRUE; 1125 1126 } 1126 1127 1127 1128 return FALSE; 1128 1129 } 1129 1130 1130 1131 1131 static LRESULT 1132 static LRESULT 1132 1133 MONTHCAL_GetToday(HWND hwnd, WPARAM wParam, LPARAM lParam) 1133 1134 { … … 1145 1146 1146 1147 1147 static LRESULT 1148 static LRESULT 1148 1149 MONTHCAL_SetToday(HWND hwnd, WPARAM wParam, LPARAM lParam) 1149 1150 { … … 1170 1171 DWORD retval; 1171 1172 int day,wday,wnum; 1172 1173 1173 1174 1174 1175 x = lpht->pt.x; 1175 1176 y = lpht->pt.y; 1176 1177 retval = MCHT_NOWHERE; 1177 1178 1179 /* Comment in for debugging... 1180 TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y, 1181 infoPtr->wdays.left, infoPtr->wdays.right,1182 infoPtr->wdays.top, infoPtr->wdays.bottom,1183 infoPtr->days.left, infoPtr->days.right,1184 infoPtr->days.top, infoPtr->days.bottom,1185 infoPtr->todayrect.left, infoPtr->todayrect.right,1186 infoPtr->todayrect.top, infoPtr->todayrect.bottom,1187 infoPtr->weeknums.left, infoPtr->weeknums.right,1188 infoPtr->weeknums.top, infoPtr->weeknums.bottom);1178 1179 1180 /* Comment in for debugging... 1181 TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y, 1182 infoPtr->wdays.left, infoPtr->wdays.right, 1183 infoPtr->wdays.top, infoPtr->wdays.bottom, 1184 infoPtr->days.left, infoPtr->days.right, 1185 infoPtr->days.top, infoPtr->days.bottom, 1186 infoPtr->todayrect.left, infoPtr->todayrect.right, 1187 infoPtr->todayrect.top, infoPtr->todayrect.bottom, 1188 infoPtr->weeknums.left, infoPtr->weeknums.right, 1189 infoPtr->weeknums.top, infoPtr->weeknums.bottom); 1189 1190 */ 1190 1191 1191 1192 /* are we in the header? */ 1192 1193 1193 1194 if(PtInRect(&infoPtr->title, lpht->pt)) { 1194 1195 if(PtInRect(&infoPtr->titlebtnprev, lpht->pt)) { … … 1208 1209 goto done; 1209 1210 } 1210 1211 1211 1212 retval = MCHT_TITLE; 1212 1213 goto done; 1213 1214 } 1214 1215 1215 1216 day = MONTHCAL_CalcDayFromPos(infoPtr,x,y,&wday,&wnum); 1216 1217 if(PtInRect(&infoPtr->wdays, lpht->pt)) { … … 1218 1219 lpht->st.wYear = infoPtr->currentYear; 1219 1220 lpht->st.wMonth = (day < 1)? infoPtr->currentMonth -1 : infoPtr->currentMonth; 1220 lpht->st.wDay = (day < 1)? 1221 lpht->st.wDay = (day < 1)? 1221 1222 MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : day; 1222 1223 goto done; 1223 1224 } 1224 if(PtInRect(&infoPtr->weeknums, lpht->pt)) { 1225 retval = MCHT_CALENDARWEEKNUM; 1225 if(PtInRect(&infoPtr->weeknums, lpht->pt)) { 1226 retval = MCHT_CALENDARWEEKNUM; 1226 1227 lpht->st.wYear = infoPtr->currentYear; 1227 lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 : 1228 (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 1228 lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 : 1229 (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 1229 1230 infoPtr->currentMonth +1 :infoPtr->currentMonth; 1230 lpht->st.wDay = (day < 1 ) ? 1231 MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : 1232 (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 1231 lpht->st.wDay = (day < 1 ) ? 1232 MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : 1233 (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? 1233 1234 day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) : day; 1234 goto done; 1235 } 1236 if(PtInRect(&infoPtr->days, lpht->pt)) 1235 goto done; 1236 } 1237 if(PtInRect(&infoPtr->days, lpht->pt)) 1237 1238 { 1238 1239 lpht->st.wYear = infoPtr->currentYear; 1239 if ( day < 1) 1240 {1241 retval = MCHT_CALENDARDATEPREV;1242 lpht->st.wMonth = infoPtr->currentMonth - 1;1243 if (lpht->st.wMonth <1)1244 {1245 lpht->st.wMonth = 12;1246 lpht->st.wYear--;1247 }1248 lpht->st.wDay = MONTHCAL_MonthLength(lpht->st.wMonth,lpht->st.wYear) -day;1249 }1240 if ( day < 1) 1241 { 1242 retval = MCHT_CALENDARDATEPREV; 1243 lpht->st.wMonth = infoPtr->currentMonth - 1; 1244 if (lpht->st.wMonth <1) 1245 { 1246 lpht->st.wMonth = 12; 1247 lpht->st.wYear--; 1248 } 1249 lpht->st.wDay = MONTHCAL_MonthLength(lpht->st.wMonth,lpht->st.wYear) -day; 1250 } 1250 1251 else if (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) 1251 {1252 retval = MCHT_CALENDARDATENEXT;1253 lpht->st.wMonth = infoPtr->currentMonth + 1;1254 if (lpht->st.wMonth <12)1255 {1256 lpht->st.wMonth = 1;1257 lpht->st.wYear++;1258 }1259 lpht->st.wDay = day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) ;1260 }1252 { 1253 retval = MCHT_CALENDARDATENEXT; 1254 lpht->st.wMonth = infoPtr->currentMonth + 1; 1255 if (lpht->st.wMonth <12) 1256 { 1257 lpht->st.wMonth = 1; 1258 lpht->st.wYear++; 1259 } 1260 lpht->st.wDay = day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) ; 1261 } 1261 1262 else { 1262 retval = MCHT_CALENDARDATE;1263 lpht->st.wMonth = infoPtr->currentMonth;1264 lpht->st.wDay = day;1263 retval = MCHT_CALENDARDATE; 1264 lpht->st.wMonth = infoPtr->currentMonth; 1265 lpht->st.wDay = day; 1265 1266 } 1266 1267 goto done; 1267 1268 } 1268 1269 if(PtInRect(&infoPtr->todayrect, lpht->pt)) { 1269 retval = MCHT_TODAYLINK; 1270 retval = MCHT_TODAYLINK; 1270 1271 goto done; 1271 1272 } 1272 1273 1273 1274 1274 1275 /* Hit nothing special? What's left must be background :-) */ 1275 1276 retval = MCHT_CALENDARBK; 1277 done: 1276 1277 retval = MCHT_CALENDARBK; 1278 done: 1278 1279 lpht->uHit = retval; 1279 1280 return retval; … … 1300 1301 nmds.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); 1301 1302 nmds.nmhdr.code = MCN_GETDAYSTATE; 1302 nmds.cDayState = infoPtr->monthRange;1303 nmds.prgDayState = COMCTL32_Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE));1303 nmds.cDayState = infoPtr->monthRange; 1304 nmds.prgDayState = COMCTL32_Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 1304 1305 1305 1306 SendMessageA(GetParent(hwnd), WM_NOTIFY, … … 1330 1331 nmds.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); 1331 1332 nmds.nmhdr.code = MCN_GETDAYSTATE; 1332 nmds.cDayState = infoPtr->monthRange;1333 nmds.prgDayState = COMCTL32_Alloc1333 nmds.cDayState = infoPtr->monthRange; 1334 nmds.prgDayState = COMCTL32_Alloc 1334 1335 (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 1335 1336 … … 1348 1349 POINT menupoint; 1349 1350 char buf[32]; 1350 1351 1351 1352 hMenu = CreatePopupMenu(); 1352 1353 if (!LoadStringA(COMCTL32_hModule,IDM_GOTODAY,buf,sizeof(buf))) … … 1360 1361 ClientToScreen(hwnd, &menupoint); 1361 1362 if( TrackPopupMenu(hMenu,TPM_RIGHTBUTTON| TPM_NONOTIFY|TPM_RETURNCMD, 1362 menupoint.x,menupoint.y,0,hwnd,NULL))1363 menupoint.x,menupoint.y,0,hwnd,NULL)) 1363 1364 { 1364 1365 infoPtr->currentMonth=infoPtr->todaysDate.wMonth; 1365 1366 infoPtr->currentYear=infoPtr->todaysDate.wYear; 1366 1367 InvalidateRect(hwnd, NULL, FALSE); 1367 } 1368 } 1368 1369 return 0; 1369 1370 } … … 1381 1382 POINT menupoint; 1382 1383 TRACE("%x %lx\n", wParam, lParam); 1383 1384 1384 1385 if (infoPtr->hWndYearUpDown) 1385 1386 { 1386 1387 infoPtr->currentYear=SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)0); 1387 1388 if(!DestroyWindow(infoPtr->hWndYearUpDown)) 1388 {1389 FIXME("Can't destroy Updown Control\n");1390 }1389 { 1390 FIXME("Can't destroy Updown Control\n"); 1391 } 1391 1392 else 1392 infoPtr->hWndYearUpDown=0;1393 infoPtr->hWndYearUpDown=0; 1393 1394 if(!DestroyWindow(infoPtr->hWndYearEdit)) 1394 {1395 FIXME("Can't destroy Updown Control\n");1396 }1395 { 1396 FIXME("Can't destroy Updown Control\n"); 1397 } 1397 1398 else 1398 infoPtr->hWndYearEdit=0;1399 infoPtr->hWndYearEdit=0; 1399 1400 InvalidateRect(hwnd, NULL, FALSE); 1400 1401 } 1401 1402 1402 1403 ht.pt.x = (INT)LOWORD(lParam); 1403 1404 ht.pt.y = (INT)HIWORD(lParam); … … 1414 1415 return TRUE; 1415 1416 } 1416 if(hit == MCHT_TITLEBTNPREV){ 1417 if(hit == MCHT_TITLEBTNPREV){ 1417 1418 MONTHCAL_GoToPrevMonth(hwnd, infoPtr); 1418 1419 infoPtr->status = MC_PREVPRESSED; … … 1424 1425 if(hit == MCHT_TITLEMONTH) { 1425 1426 hMenu = CreatePopupMenu(); 1426 1427 1427 1428 for (i=0; i<12;i++) 1428 1429 { 1429 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i,1430 buf,sizeof(buf));1431 AppendMenuA(hMenu, MF_STRING|MF_ENABLED,i+1, buf);1430 GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i, 1431 buf,sizeof(buf)); 1432 AppendMenuA(hMenu, MF_STRING|MF_ENABLED,i+1, buf); 1432 1433 } 1433 1434 menupoint.x=infoPtr->titlemonth.right; … … 1435 1436 ClientToScreen(hwnd, &menupoint); 1436 1437 i= TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RIGHTBUTTON | TPM_RETURNCMD, 1437 menupoint.x,menupoint.y,0,hwnd,NULL);1438 menupoint.x,menupoint.y,0,hwnd,NULL); 1438 1439 if ((i>0) && (i<13)) 1439 1440 { 1440 infoPtr->currentMonth=i;1441 InvalidateRect(hwnd, NULL, FALSE);1441 infoPtr->currentMonth=i; 1442 InvalidateRect(hwnd, NULL, FALSE); 1442 1443 } 1443 1444 } 1444 1445 if(hit == MCHT_TITLEYEAR) { 1445 1446 infoPtr->hWndYearEdit=CreateWindowExA(0, 1446 "EDIT",1447 0,1448 WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT,1449 infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top,1450 infoPtr->titleyear.right-infoPtr->titleyear.left,1451 infoPtr->textHeight,1452 hwnd,1453 (HMENU)NULL, 1454 (HINSTANCE)NULL, 1455 NULL);1447 "EDIT", 1448 0, 1449 WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT, 1450 infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top, 1451 infoPtr->titleyear.right-infoPtr->titleyear.left, 1452 infoPtr->textHeight, 1453 hwnd, 1454 (HMENU)NULL, 1455 (HINSTANCE)NULL, 1456 NULL); 1456 1457 infoPtr->hWndYearUpDown=CreateWindowExA(0, 1457 UPDOWN_CLASSA,1458 0,1459 WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS,1460 infoPtr->titleyear.right+6,infoPtr->titlebtnnext.top,1461 20,1462 infoPtr->textHeight,1463 hwnd,1464 (HMENU)NULL, 1465 (HINSTANCE)NULL, 1466 NULL);1458 UPDOWN_CLASSA, 1459 0, 1460 WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS, 1461 infoPtr->titleyear.right+6,infoPtr->titlebtnnext.top, 1462 20, 1463 infoPtr->textHeight, 1464 hwnd, 1465 (HMENU)NULL, 1466 (HINSTANCE)NULL, 1467 NULL); 1467 1468 SendMessageA( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753)); 1468 1469 SendMessageA( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 ); 1469 1470 SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear ); 1470 1471 return TRUE; 1471 1472 1472 1473 } 1473 1474 if(hit == MCHT_TODAYLINK) { … … 1487 1488 MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel); 1488 1489 MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel); 1489 1490 1490 1491 SendMessageA(GetParent(hwnd), WM_NOTIFY, 1491 1492 (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc); … … 1493 1494 MONTHCAL_CopyTime(&ht.st, &selArray[0]); 1494 1495 MONTHCAL_CopyTime(&ht.st, &selArray[1]); 1495 MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); 1496 MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); 1496 1497 1497 1498 /* redraw both old and new days if the selected day changed */ … … 1546 1547 return TRUE; 1547 1548 } 1548 if(hit == MCHT_CALENDARDATEPREV){ 1549 if(hit == MCHT_CALENDARDATEPREV){ 1549 1550 MONTHCAL_GoToPrevMonth(hwnd, infoPtr); 1550 1551 InvalidateRect(hwnd, NULL, FALSE); … … 1564 1565 MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel); 1565 1566 MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel); 1566 1567 1567 1568 SendMessageA(GetParent(hwnd), WM_NOTIFY, 1568 1569 (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc); 1569 1570 1570 1571 /* redraw if necessary */ 1571 1572 if(redraw) 1572 1573 InvalidateRect(hwnd, NULL, FALSE); 1573 1574 1574 1575 return 0; 1575 1576 } … … 1586 1587 1587 1588 switch(wParam) { 1588 case MC_NEXTMONTHTIMER: 1589 case MC_NEXTMONTHTIMER: 1589 1590 redraw = TRUE; 1590 1591 MONTHCAL_GoToNextMonth(hwnd, infoPtr); … … 1618 1619 ht.pt.x = LOWORD(lParam); 1619 1620 ht.pt.y = HIWORD(lParam); 1620 1621 1621 1622 hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht); 1622 1623 1623 1624 /* not on the calendar date numbers? bail out */ 1624 1625 TRACE("hit:%x\n",hit); … … 1638 1639 if(infoPtr->firstSelDay==selArray[0].wDay) i=1; 1639 1640 TRACE("oldRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i); 1640 if(infoPtr->firstSelDay==selArray[1].wDay) { 1641 if(infoPtr->firstSelDay==selArray[1].wDay) { 1641 1642 /* 1st time we get here: selArray[0]=selArray[1]) */ 1642 1643 /* if we're still at the first selected date, return */ … … 1644 1645 if(selday<infoPtr->firstSelDay) i = 0; 1645 1646 } 1646 1647 1647 1648 if(abs(infoPtr->firstSelDay - selday) >= infoPtr->maxSelCount) { 1648 1649 if(selday>infoPtr->firstSelDay) … … 1651 1652 selday = infoPtr->firstSelDay - infoPtr->maxSelCount; 1652 1653 } 1653 1654 1654 1655 if(selArray[i].wDay!=selday) { 1655 1656 TRACE("newRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i); 1656 1657 1657 1658 selArray[i].wDay = selday; 1658 1659 … … 1712 1713 { 1713 1714 TRACE("\n"); 1714 1715 1715 1716 InvalidateRect(hwnd, NULL, FALSE); 1716 1717 … … 1769 1770 1770 1771 /* recalculate the height and width increments and offsets */ 1771 /* FIXME: We use up all available width. This will inhibit having multiple 1772 calendars in a row, like win doesn 1772 /* FIXME: We use up all available width. This will inhibit having multiple 1773 calendars in a row, like win doesn 1773 1774 */ 1774 1775 if(dwStyle & MCS_WEEKNUMBERS) … … 1776 1777 else 1777 1778 xdiv=7.0; 1778 infoPtr->width_increment = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) / xdiv; 1779 infoPtr->height_increment = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) / 10.0; 1779 infoPtr->width_increment = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) / xdiv; 1780 infoPtr->height_increment = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) / 10.0; 1780 1781 infoPtr->left_offset = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) - (infoPtr->width_increment * xdiv); 1781 1782 infoPtr->top_offset = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) - (infoPtr->height_increment * 10.0); … … 1790 1791 rcDraw->bottom = rcDraw->top + 9 * infoPtr->textHeight + 5; 1791 1792 }*/ 1792 1793 1793 1794 /* calculate title area */ 1794 1795 title->top = rcClient->top; … … 1805 1806 next->right = title->right - 6; 1806 1807 next->left = next->right - (title->bottom - title->top); 1807 1808 1808 1809 /* titlemonth->left and right change based upon the current month */ 1809 1810 /* and are recalculated in refresh as the current month may change */ … … 1811 1812 titlemonth->top = titleyear->top = title->top + (infoPtr->height_increment)/2; 1812 1813 titlemonth->bottom = titleyear->bottom = title->bottom - (infoPtr->height_increment)/2; 1813 1814 1814 1815 /* setup the dimensions of the rectangle we draw the names of the */ 1815 1816 /* days of the week in */ 1816 1817 weeknumrect->left =infoPtr->left_offset; 1817 if(dwStyle & MCS_WEEKNUMBERS) 1818 if(dwStyle & MCS_WEEKNUMBERS) 1818 1819 weeknumrect->right=prev->right; 1819 1820 else … … 1823 1824 wdays->top = title->bottom ; 1824 1825 wdays->bottom = wdays->top + infoPtr->height_increment; 1825 1826 1826 1827 days->top = weeknumrect->top = wdays->bottom ; 1827 1828 days->bottom = weeknumrect->bottom = days->top + 6 * infoPtr->height_increment; 1828 1829 1829 1830 todayrect->left = rcClient->left; 1830 1831 todayrect->right = rcClient->right; … … 1832 1833 todayrect->bottom = days->bottom + infoPtr->height_increment; 1833 1834 1834 /* uncomment for excessive debugging 1835 /* uncomment for excessive debugging 1835 1836 TRACE("dx=%d dy=%d rcC[%d %d %d %d] t[%d %d %d %d] wd[%d %d %d %d] w[%d %d %d %d] t[%d %d %d %d]\n", 1836 infoPtr->width_increment,infoPtr->height_increment,1837 rcClient->left, rcClient->right, rcClient->top, rcClient->bottom,1838 title->left, title->right, title->top, title->bottom,1839 wdays->left, wdays->right, wdays->top, wdays->bottom,1840 days->left, days->right, days->top, days->bottom,1841 todayrect->left,todayrect->right,todayrect->top,todayrect->bottom);1837 infoPtr->width_increment,infoPtr->height_increment, 1838 rcClient->left, rcClient->right, rcClient->top, rcClient->bottom, 1839 title->left, title->right, title->top, title->bottom, 1840 wdays->left, wdays->right, wdays->top, wdays->bottom, 1841 days->left, days->right, days->top, days->bottom, 1842 todayrect->left,todayrect->right,todayrect->top,todayrect->bottom); 1842 1843 */ 1843 1844 1844 1845 /* restore the originally selected font */ 1845 SelectObject(hdc, currentFont); 1846 SelectObject(hdc, currentFont); 1846 1847 1847 1848 ReleaseDC(hwnd, hdc); … … 1865 1866 { 1866 1867 MONTHCAL_INFO *infoPtr; 1867 LOGFONTA logFont;1868 LOGFONTA logFont; 1868 1869 1869 1870 /* allocate memory for info structure */ … … 1900 1901 infoPtr->maxSelCount = 7; 1901 1902 infoPtr->monthRange = 3; 1902 infoPtr->monthdayState = COMCTL32_Alloc 1903 infoPtr->monthdayState = COMCTL32_Alloc 1903 1904 (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); 1904 1905 infoPtr->titlebk = GetSysColor(COLOR_ACTIVECAPTION); … … 1907 1908 infoPtr->trailingtxt = GetSysColor(COLOR_GRAYTEXT); 1908 1909 infoPtr->bk = GetSysColor(COLOR_WINDOW); 1909 infoPtr->txt = GetSysColor(COLOR_WINDOWTEXT);1910 infoPtr->txt = GetSysColor(COLOR_WINDOWTEXT); 1910 1911 1911 1912 /* call MONTHCAL_UpdateSize to set all of the dimensions */ … … 2062 2063 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 2063 2064 wndClass.lpszClassName = MONTHCAL_CLASSA; 2064 2065 2065 2066 RegisterClassA(&wndClass); 2066 2067 } -
trunk/src/comctl32/pager.c
r6380 r6644 1 /* $Id: pager.c,v 1.9 2001-09-05 12:05:01 bird Exp $ */ 1 2 /* 2 3 * Pager control … … 39 40 INT nPos; /* scroll position */ 40 41 INT nWidth; /* from child wnd's response to PGN_CALCSIZE */ 41 INT nHeight; /* from child wnd's response to PGN_CALCSIZE */ 42 INT nHeight; /* from child wnd's response to PGN_CALCSIZE */ 42 43 BOOL bForward; /* forward WM_MOUSEMOVE msgs to the contained wnd */ 43 44 INT TLbtnState; /* state of top or left btn */ … … 57 58 #define REPEAT_DELAY 50 58 59 59 /* the horizontal arrows are: 60 /* the horizontal arrows are: 60 61 * 61 62 * 01234 01234 … … 66 67 * 5 ** ** 67 68 * 6 * * 68 * 7 69 * 7 69 70 * 70 71 */ … … 74 75 INT x, y, w, h; 75 76 HPEN hOldPen; 76 77 77 78 w = r.right - r.left + 1; 78 79 h = r.bottom - r.top + 1; … … 107 108 } 108 109 109 /* the vertical arrows are: 110 /* the vertical arrows are: 110 111 * 111 112 * 01234567 01234567 112 * 1****** ** 113 * 1****** ** 113 114 * 2 **** **** 114 115 * 3 ** ****** … … 121 122 INT x, y, w, h; 122 123 HPEN hOldPen; 123 124 124 125 w = r.right - r.left + 1; 125 126 h = r.bottom - r.top + 1; … … 165 166 166 167 if ((rc.right - rc.left <= 0) || (rc.bottom - rc.top <= 0)) 167 return; 168 return; 168 169 169 170 hBrush = CreateSolidBrush(clrBk); … … 172 173 FillRect(hdc, &rc, hBrush); 173 174 174 if (btnState == PGF_HOT) 175 if (btnState == PGF_HOT) 175 176 { 176 177 DrawEdge( hdc, &rc, BDR_RAISEDINNER, BF_RECT); … … 180 181 PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); 181 182 } 182 else if (btnState == PGF_NORMAL) 183 else if (btnState == PGF_NORMAL) 183 184 { 184 185 DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT); … … 188 189 PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); 189 190 } 190 else if (btnState == PGF_DEPRESSED) 191 else if (btnState == PGF_DEPRESSED) 191 192 { 192 193 DrawEdge( hdc, &rc, BDR_SUNKENOUTER, BF_RECT); … … 196 197 PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); 197 198 } 198 else if (btnState == PGF_GRAYED) 199 else if (btnState == PGF_GRAYED) 199 200 { 200 201 DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT); … … 233 234 PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam) 234 235 { 235 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 236 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 236 237 LRESULT btnState = PGF_INVISIBLE; 237 238 INT btn = (INT)lParam; … … 250 251 PAGER_GetPos(HWND hwnd) 251 252 { 252 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 253 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 253 254 TRACE("[%04x] returns %d\n", hwnd, infoPtr->nPos); 254 255 return (LRESULT)infoPtr->nPos; … … 258 259 PAGER_GetButtonSize(HWND hwnd) 259 260 { 260 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 261 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 261 262 TRACE("[%04x] returns %d\n", hwnd, infoPtr->nButtonSize); 262 263 return (LRESULT)infoPtr->nButtonSize; … … 266 267 PAGER_GetBorder(HWND hwnd) 267 268 { 268 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 269 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 269 270 TRACE("[%04x] returns %d\n", hwnd, infoPtr->nBorder); 270 271 return (LRESULT)infoPtr->nBorder; … … 274 275 PAGER_GetBkColor(HWND hwnd) 275 276 { 276 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 277 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); 277 278 TRACE("[%04x] returns %06lx\n", hwnd, infoPtr->clrBk); 278 279 return (LRESULT)infoPtr->clrBk; 279 280 } 280 281 281 static void 282 PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth) 282 static void 283 PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth) 283 284 { 284 285 NMPGCALCSIZE nmpgcs; … … 333 334 infoPtr->nHeight = wndSize; 334 335 335 TRACE("[%04x] SWP %dx%d at (%d,%d)\n", hwnd, 336 TRACE("[%04x] SWP %dx%d at (%d,%d)\n", hwnd, 336 337 infoPtr->nWidth, infoPtr->nHeight, 337 338 0, -nPos); … … 379 380 } 380 381 381 static void 382 static void 382 383 PAGER_GrayAndRestoreBtns(PAGER_INFO* infoPtr, INT scrollRange, 383 384 BOOL* needsResize, BOOL* needsRepaint) … … 416 417 417 418 418 static void 419 static void 419 420 PAGER_NormalizeBtns(PAGER_INFO* infoPtr, BOOL* needsRepaint) 420 421 { … … 432 433 } 433 434 434 static void 435 static void 435 436 PAGER_HideGrayBtns(PAGER_INFO* infoPtr, BOOL* needsResize) 436 437 { … … 464 465 465 466 if (resizeClient) /* initiate NCCalcSize to resize client wnd */ 466 SetWindowPos(hwnd, 0,0,0,0,0, 467 SetWindowPos(hwnd, 0,0,0,0,0, 467 468 SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | 468 469 SWP_NOZORDER | SWP_NOACTIVATE); 469 470 470 471 if (repaintBtns) 471 SendMessageA(hwnd, WM_NCPAINT, 0, 0); 472 } 473 474 static LRESULT 472 SendMessageA(hwnd, WM_NCPAINT, 0, 0); 473 } 474 475 static LRESULT 475 476 PAGER_SetPos(HWND hwnd, INT newPos, BOOL fromBtnPress) 476 477 { … … 518 519 } 519 520 520 static void 521 static void 521 522 PAGER_SetFixedWidth(HWND hwnd, PAGER_INFO* infoPtr) 522 523 { … … 544 545 545 546 /* adjust non-scrollable dimension to fit the child */ 546 SetWindowPos(hwnd, 0, 0,0, infoPtr->nWidth, h, 547 SetWindowPos(hwnd, 0, 0,0, infoPtr->nWidth, h, 547 548 SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER); 548 549 549 550 550 551 TRACE("[%04x] infoPtr->nWidth set to %d\n", 551 hwnd, infoPtr->nWidth);552 } 553 554 static void 552 hwnd, infoPtr->nWidth); 553 } 554 555 static void 555 556 PAGER_SetFixedHeight(HWND hwnd, PAGER_INFO* infoPtr) 556 557 { … … 578 579 579 580 /* adjust non-scrollable dimension to fit the child */ 580 SetWindowPos(hwnd, 0, 0,0, w, infoPtr->nHeight, 581 SetWindowPos(hwnd, 0, 0,0, w, infoPtr->nHeight, 581 582 SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER); 582 583 583 584 TRACE("[%04x] infoPtr->nHeight set to %d\n", 584 hwnd, infoPtr->nHeight);585 hwnd, infoPtr->nHeight); 585 586 } 586 587 … … 601 602 PAGER_SetPos(hwnd, 0, FALSE); 602 603 } 603 else 604 else 604 605 { 605 606 PAGER_UpdateBtns(hwnd, infoPtr, scrollRange, TRUE); … … 700 701 nmpgScroll.hdr.code = PGN_SCROLL; 701 702 702 GetWindowRect(hwnd, &rcWnd); 703 GetClientRect(hwnd, &nmpgScroll.rcParent); 703 GetWindowRect(hwnd, &rcWnd); 704 GetClientRect(hwnd, &nmpgScroll.rcParent); 704 705 nmpgScroll.iXpos = nmpgScroll.iYpos = 0; 705 706 nmpgScroll.iDir = dir; … … 716 717 } 717 718 nmpgScroll.iScroll -= 2*infoPtr->nButtonSize; 718 719 719 720 SendMessageA (hwnd, WM_NOTIFY, 720 721 (WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll); 721 722 722 723 TRACE("[%04x] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll); 723 724 … … 769 770 FIXME("[%04x] Drag and Drop style is not implemented yet.\n", hwnd); 770 771 /* 771 * If neither horizontal nor vertical style specified, default to vertical.772 * This is probably not necessary, since the style may be set later on as773 * the control is initialized, but just in case it isn't, set it here.774 */772 * If neither horizontal nor vertical style specified, default to vertical. 773 * This is probably not necessary, since the style may be set later on as 774 * the control is initialized, but just in case it isn't, set it here. 775 */ 775 776 if (!(dwStyle & PGS_HORZ) && !(dwStyle & PGS_VERT)) 776 777 { … … 800 801 /* 801 802 * lParam points to a RECT struct. On entry, the struct 802 * contains the proposed wnd rectangle for the window. 803 * contains the proposed wnd rectangle for the window. 803 804 * On exit, the struct should contain the screen 804 805 * coordinates of the corresponding window's client area. 805 806 */ 806 807 807 808 if (PAGER_IsHorizontal(hwnd)) 808 809 { 809 810 if (infoPtr->TLbtnState) /* != PGF_INVISIBLE */ 810 811 lpRect->left += infoPtr->nButtonSize; 811 if (infoPtr->BRbtnState) 812 if (infoPtr->BRbtnState) 812 813 lpRect->right -= infoPtr->nButtonSize; 813 814 } … … 863 864 bHorizontal, TRUE, infoPtr->TLbtnState); 864 865 PAGER_DrawButton(hdc, infoPtr->clrBk, rcBottomRight, 865 bHorizontal, FALSE, infoPtr->BRbtnState); 866 bHorizontal, FALSE, infoPtr->BRbtnState); 866 867 867 868 ReleaseDC( hwnd, hdc ); … … 869 870 } 870 871 871 static INT 872 static INT 872 873 PAGER_HitTest (HWND hwnd, LPPOINT pt) 873 874 { … … 976 977 if(!(trackinfo.dwFlags & TME_LEAVE)) { 977 978 trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */ 978 979 979 980 /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */ 980 981 /* and can properly deactivate the hot button */ … … 982 983 } 983 984 984 SendMessageA(hwnd, WM_NCPAINT, 0, 0); 985 SendMessageA(hwnd, WM_NCPAINT, 0, 0); 985 986 } 986 987 … … 1025 1026 1026 1027 TRACE("[%04x]\n", hwnd); 1027 1028 1028 1029 hit = PAGER_HitTest(hwnd, &pt); 1029 1030 … … 1033 1034 repaintBtns = infoPtr->TLbtnState != PGF_DEPRESSED; 1034 1035 infoPtr->TLbtnState = PGF_DEPRESSED; 1035 SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); 1036 SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); 1036 1037 } 1037 1038 else if (hit == HTRIGHT || hit == HTBOTTOM) … … 1039 1040 repaintBtns = infoPtr->BRbtnState != PGF_DEPRESSED; 1040 1041 infoPtr->BRbtnState = PGF_DEPRESSED; 1041 SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); 1042 SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); 1042 1043 } 1043 1044 1044 1045 if (repaintBtns) 1045 SendMessageA(hwnd, WM_NCPAINT, 0, 0); 1046 SendMessageA(hwnd, WM_NCPAINT, 0, 0); 1046 1047 1047 1048 switch(hit) … … 1130 1131 1131 1132 if (!infoPtr && (uMsg != WM_CREATE)) 1132 return DefWindowProcA (hwnd, uMsg, wParam, lParam);1133 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 1133 1134 1134 1135 switch (uMsg) … … 1156 1157 case PGM_RECALCSIZE: 1157 1158 return PAGER_RecalcSize(hwnd); 1158 1159 1159 1160 case PGM_SETBKCOLOR: 1160 1161 return PAGER_SetBkColor (hwnd, wParam, lParam); … … 1204 1205 if (infoPtr->bForward && infoPtr->hwndChild) 1205 1206 PostMessageA(infoPtr->hwndChild, WM_MOUSEMOVE, wParam, lParam); 1206 return TRUE; 1207 return TRUE; 1207 1208 1208 1209 case WM_MOUSELEAVE: 1209 return PAGER_MouseLeave (hwnd, wParam, lParam); 1210 return PAGER_MouseLeave (hwnd, wParam, lParam); 1210 1211 1211 1212 case WM_LBUTTONDOWN: … … 1219 1220 /* 1220 1221 case WM_PAINT: 1221 return PAGER_Paint (hwnd, wParam); 1222 return PAGER_Paint (hwnd, wParam); 1222 1223 */ 1223 1224 case WM_TIMER: … … 1233 1234 { 1234 1235 PAGER_Scroll(hwnd, infoPtr->direction); 1235 SetTimer(hwnd, TIMERID2, REPEAT_DELAY, 0); 1236 SetTimer(hwnd, TIMERID2, REPEAT_DELAY, 0); 1236 1237 } 1237 1238 break; … … 1266 1267 wndClass.hbrBackground = 0; 1267 1268 wndClass.lpszClassName = WC_PAGESCROLLERA; 1268 1269 1269 1270 RegisterClassA (&wndClass); 1270 1271 } -
trunk/src/comctl32/rebar.c
r6380 r6644 1 /* $Id: rebar.c,v 1.16 2001-09-05 12:05:01 bird Exp $ */ 1 2 /* 2 3 * … … 21 22 * - vertical placement 22 23 * - ComboBox and ComboBoxEx placement 23 * - center image 24 * - center image 24 25 * - Layout code. 25 26 * - Display code. … … 30 31 * rev 2,3,4 31 32 * - Implement initial version of row grouping, row separators, 32 * text and background colors. Support additional messages. 33 * text and background colors. Support additional messages. 33 34 * Support RBBS_BREAK. Implement ERASEBKGND and improve painting. 34 35 * rev 5 35 36 * - implement support for dragging Gripper left or right in a row. Supports 36 * WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_MOUSEMOVE. Also support 37 * WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_MOUSEMOVE. Also support 37 38 * RBS_BANDBORDERS. 38 39 * rev 6 … … 62 63 * 12. Correct drawing of rebar borders and handling of RBS_BORDERS. 63 64 * rev 7d 64 * 13. Support WM_NOTIFYFORMAT (both incoming and outgoing) and do 65 * 13. Support WM_NOTIFYFORMAT (both incoming and outgoing) and do 65 66 * WM_NOTIFY correctly based on results. 66 67 * 14. Implement WM_SETREDRAW. 67 68 * 15. Native WM_ERASEBKGND draws horz and vert separators between bands and 68 * rows, and fills in the background color for each band. The gripper, 69 * rows, and fills in the background color for each band. The gripper, 69 70 * image, and text for each band is drawn by the WM_PAINT process. Change 70 71 * this code to match. … … 95 96 * 2. Following still not handled: RBBS_FIXEDBMP, RBBS_CHILDEDGE, 96 97 * RBBS_USECHEVRON 97 * 3. Following are only partially handled: 98 * 3. Following are only partially handled: 98 99 * RBS_AUTOSIZE, RBBS_VARIABLEHEIGHT 99 100 * 5. Native uses (on each draw!!) SM_CYBORDER (or SM_CXBORDER for CCS_VERT) 100 * to set the size of the separator width (the value SEP_WIDTH_SIZE 101 * to set the size of the separator width (the value SEP_WIDTH_SIZE 101 102 * in here). Should be fixed!! 102 103 * 6. The following messages are not implemented: … … 211 212 BOOL NtfUnicode; /* TRUE if parent wants notify in W format */ 212 213 BOOL DoRedraw; /* TRUE to acutally draw bands */ 213 UINT fStatus; /* Status flags (see below) */ 214 UINT fStatus; /* Status flags (see below) */ 214 215 HCURSOR hcurArrow; /* handle to the arrow cursor */ 215 216 HCURSOR hcurHorz; /* handle to the EW cursor */ … … 263 264 264 265 /* This is the increment that is used over the band height */ 265 /* Determined by experiment. */ 266 /* Determined by experiment. */ 266 267 #define REBARSPACE 4 267 268 … … 274 275 #define rcBrb(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.bottom : b->rcBand.right) 275 276 #define rcBw(b) ((infoPtr->dwStyle & CCS_VERT) ? (b->rcBand.bottom - b->rcBand.top) : \ 276 (b->rcBand.right - b->rcBand.left))277 (b->rcBand.right - b->rcBand.left)) 277 278 #define ircBlt(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.left : b->rcBand.top) 278 279 #define ircBrb(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.right : b->rcBand.bottom) 279 280 #define ircBw(b) ((infoPtr->dwStyle & CCS_VERT) ? (b->rcBand.right - b->rcBand.left) : \ 280 (b->rcBand.bottom - b->rcBand.top))281 (b->rcBand.bottom - b->rcBand.top)) 281 282 282 283 /* The following define determines if a given band is hidden */ … … 338 339 *line = 0; 339 340 while (band_stylename[i]) { 340 if (style & (1<<i)) {341 if (*line != 0) strcat(line, " | ");342 strcat(line, band_stylename[i]);343 }344 i++;341 if (style & (1<<i)) { 342 if (*line != 0) strcat(line, " | "); 343 strcat(line, band_stylename[i]); 344 } 345 i++; 345 346 } 346 347 return line; … … 355 356 *line = 0; 356 357 while (band_maskname[i]) { 357 if (mask & (1<<i)) {358 if (*line != 0) strcat(line, " | ");359 strcat(line, band_maskname[i]);360 }361 i++;358 if (mask & (1<<i)) { 359 if (*line != 0) strcat(line, " | "); 360 strcat(line, band_maskname[i]); 361 } 362 i++; 362 363 } 363 364 return line; … … 370 371 if( !TRACE_ON(rebar) ) return; 371 372 TRACE("band info: ID=%u, size=%u, child=%04x, clrF=0x%06lx, clrB=0x%06lx\n", 372 pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack); 373 pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack); 373 374 TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(pB->fMask)); 374 375 if (pB->fMask & RBBIM_STYLE) 375 TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle));376 TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle)); 376 377 if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_HEADERSIZE | RBBIM_LPARAM )) { 377 TRACE("band info:");378 if (pB->fMask & RBBIM_SIZE)379 DPRINTF(" cx=%u", pB->cx);380 if (pB->fMask & RBBIM_IDEALSIZE)381 DPRINTF(" xIdeal=%u", pB->cxIdeal);382 if (pB->fMask & RBBIM_HEADERSIZE)383 DPRINTF(" xHeader=%u", pB->cxHeader);384 if (pB->fMask & RBBIM_LPARAM)385 DPRINTF(" lParam=0x%08lx", pB->lParam);386 DPRINTF("\n");378 TRACE("band info:"); 379 if (pB->fMask & RBBIM_SIZE) 380 DPRINTF(" cx=%u", pB->cx); 381 if (pB->fMask & RBBIM_IDEALSIZE) 382 DPRINTF(" xIdeal=%u", pB->cxIdeal); 383 if (pB->fMask & RBBIM_HEADERSIZE) 384 DPRINTF(" xHeader=%u", pB->cxHeader); 385 if (pB->fMask & RBBIM_LPARAM) 386 DPRINTF(" lParam=0x%08lx", pB->lParam); 387 DPRINTF("\n"); 387 388 } 388 389 if (pB->fMask & RBBIM_CHILDSIZE) 389 TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",390 pB->cxMinChild, 391 pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral);390 TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n", 391 pB->cxMinChild, 392 pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral); 392 393 } 393 394 … … 400 401 if(! TRACE_ON(rebar) ) return; 401 402 402 TRACE("hwnd=%04x: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n", 403 iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows,404 iP->calcSize.cx, iP->calcSize.cy);403 TRACE("hwnd=%04x: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n", 404 iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows, 405 iP->calcSize.cx, iP->calcSize.cy); 405 406 TRACE("hwnd=%04x: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, ihitBand=%d\n", 406 iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y,407 iP->dragNow.x, iP->dragNow.y,408 iP->ihitBand);407 iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y, 408 iP->dragNow.x, iP->dragNow.y, 409 iP->ihitBand); 409 410 TRACE("hwnd=%04x: style=%08lx, I'm Unicode=%s, notify in Unicode=%s, redraw=%s\n", 410 iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE",411 (iP->NtfUnicode)?"TRUE":"FALSE", (iP->DoRedraw)?"TRUE":"FALSE");411 iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE", 412 (iP->NtfUnicode)?"TRUE":"FALSE", (iP->DoRedraw)?"TRUE":"FALSE"); 412 413 for (i = 0; i < iP->uNumBands; i++) { 413 pB = &iP->bands[i];414 TRACE("band # %u: ID=%u, child=%04x, row=%u, clrF=0x%06lx, clrB=0x%06lx\n",415 i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack);416 TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask));417 if (pB->fMask & RBBIM_STYLE)418 TRACE("band # %u: style=0x%08x (%s)\n", 419 i, pB->fStyle, REBAR_FmtStyle(pB->fStyle));420 TRACE("band # %u: uMinH=%u xHeader=%u", 421 i, pB->uMinHeight, pB->cxHeader);422 if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) {423 if (pB->fMask & RBBIM_SIZE)424 DPRINTF(" cx=%u", pB->cx);425 if (pB->fMask & RBBIM_IDEALSIZE)426 DPRINTF(" xIdeal=%u", pB->cxIdeal);427 if (pB->fMask & RBBIM_LPARAM)428 DPRINTF(" lParam=0x%08lx", pB->lParam);429 }430 DPRINTF("\n");431 if (RBBIM_CHILDSIZE)432 TRACE("band # %u: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",433 i, pB->cxMinChild, pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral);434 TRACE("band # %u: lcx=%u, ccx=%u, hcx=%u, lcy=%u, ccy=%u, hcy=%u, offChild=%ld,%ld\n",435 i, pB->lcx, pB->ccx, pB->hcx, pB->lcy, pB->ccy, pB->hcy, pB->offChild.cx, pB->offChild.cy);436 TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%d,%d)-(%d,%d), Grip=(%d,%d)-(%d,%d)\n",437 i, pB->fStatus, pB->fDraw,438 pB->rcBand.left, pB->rcBand.top, pB->rcBand.right, pB->rcBand.bottom,439 pB->rcGripper.left, pB->rcGripper.top, pB->rcGripper.right, pB->rcGripper.bottom);440 TRACE("band # %u: Img=(%d,%d)-(%d,%d), Txt=(%d,%d)-(%d,%d), Child=(%d,%d)-(%d,%d)\n",441 i,442 pB->rcCapImage.left, pB->rcCapImage.top, pB->rcCapImage.right, pB->rcCapImage.bottom,443 pB->rcCapText.left, pB->rcCapText.top, pB->rcCapText.right, pB->rcCapText.bottom,444 pB->rcChild.left, pB->rcChild.top, pB->rcChild.right, pB->rcChild.bottom);414 pB = &iP->bands[i]; 415 TRACE("band # %u: ID=%u, child=%04x, row=%u, clrF=0x%06lx, clrB=0x%06lx\n", 416 i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack); 417 TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask)); 418 if (pB->fMask & RBBIM_STYLE) 419 TRACE("band # %u: style=0x%08x (%s)\n", 420 i, pB->fStyle, REBAR_FmtStyle(pB->fStyle)); 421 TRACE("band # %u: uMinH=%u xHeader=%u", 422 i, pB->uMinHeight, pB->cxHeader); 423 if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) { 424 if (pB->fMask & RBBIM_SIZE) 425 DPRINTF(" cx=%u", pB->cx); 426 if (pB->fMask & RBBIM_IDEALSIZE) 427 DPRINTF(" xIdeal=%u", pB->cxIdeal); 428 if (pB->fMask & RBBIM_LPARAM) 429 DPRINTF(" lParam=0x%08lx", pB->lParam); 430 } 431 DPRINTF("\n"); 432 if (RBBIM_CHILDSIZE) 433 TRACE("band # %u: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n", 434 i, pB->cxMinChild, pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral); 435 TRACE("band # %u: lcx=%u, ccx=%u, hcx=%u, lcy=%u, ccy=%u, hcy=%u, offChild=%ld,%ld\n", 436 i, pB->lcx, pB->ccx, pB->hcx, pB->lcy, pB->ccy, pB->hcy, pB->offChild.cx, pB->offChild.cy); 437 TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%d,%d)-(%d,%d), Grip=(%d,%d)-(%d,%d)\n", 438 i, pB->fStatus, pB->fDraw, 439 pB->rcBand.left, pB->rcBand.top, pB->rcBand.right, pB->rcBand.bottom, 440 pB->rcGripper.left, pB->rcGripper.top, pB->rcGripper.right, pB->rcGripper.bottom); 441 TRACE("band # %u: Img=(%d,%d)-(%d,%d), Txt=(%d,%d)-(%d,%d), Child=(%d,%d)-(%d,%d)\n", 442 i, 443 pB->rcCapImage.left, pB->rcCapImage.top, pB->rcCapImage.right, pB->rcCapImage.bottom, 444 pB->rcCapText.left, pB->rcCapText.top, pB->rcCapText.right, pB->rcCapText.bottom, 445 pB->rcChild.left, pB->rcChild.top, pB->rcChild.right, pB->rcChild.bottom); 445 446 } 446 447 … … 456 457 if (!parent) { 457 458 parent = GetParent (infoPtr->hwndSelf); 458 owner = GetWindow (infoPtr->hwndSelf, GW_OWNER);459 if (owner) parent = owner;459 owner = GetWindow (infoPtr->hwndSelf, GW_OWNER); 460 if (owner) parent = owner; 460 461 } 461 462 return parent; … … 474 475 475 476 TRACE("window %04x, code=%08x, %s\n", parent, code, 476 (infoPtr->NtfUnicode) ? "via Unicode" : "via ANSI");477 (infoPtr->NtfUnicode) ? "via Unicode" : "via ANSI"); 477 478 478 479 if (infoPtr->NtfUnicode) 479 return SendMessageW (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom,480 (LPARAM)nmhdr);480 return SendMessageW (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom, 481 (LPARAM)nmhdr); 481 482 else 482 return SendMessageA (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom,483 (LPARAM)nmhdr);483 return SendMessageA (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom, 484 (LPARAM)nmhdr); 484 485 } 485 486 … … 492 493 notify_rebar.dwMask = 0; 493 494 if (uBand!=-1) { 494 lpBand = &infoPtr->bands[uBand];495 if (lpBand->fMask & RBBIM_ID) {496 notify_rebar.dwMask |= RBNM_ID;497 notify_rebar.wID = lpBand->wID;498 }499 if (lpBand->fMask & RBBIM_LPARAM) {500 notify_rebar.dwMask |= RBNM_LPARAM;501 notify_rebar.lParam = lpBand->lParam;502 }503 if (lpBand->fMask & RBBIM_STYLE) {504 notify_rebar.dwMask |= RBNM_STYLE;505 notify_rebar.fStyle = lpBand->fStyle;506 }495 lpBand = &infoPtr->bands[uBand]; 496 if (lpBand->fMask & RBBIM_ID) { 497 notify_rebar.dwMask |= RBNM_ID; 498 notify_rebar.wID = lpBand->wID; 499 } 500 if (lpBand->fMask & RBBIM_LPARAM) { 501 notify_rebar.dwMask |= RBNM_LPARAM; 502 notify_rebar.lParam = lpBand->lParam; 503 } 504 if (lpBand->fMask & RBBIM_STYLE) { 505 notify_rebar.dwMask |= RBNM_STYLE; 506 notify_rebar.fStyle = lpBand->fStyle; 507 } 507 508 } 508 509 notify_rebar.uBand = uBand; … … 521 522 /* draw caption image */ 522 523 if (lpBand->fDraw & DRAW_IMAGE) { 523 POINT pt;524 525 /* center image */526 pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2;527 pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2;528 529 ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc,530 pt.x, pt.y,531 ILD_TRANSPARENT);524 POINT pt; 525 526 /* center image */ 527 pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2; 528 pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2; 529 530 ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc, 531 pt.x, pt.y, 532 ILD_TRANSPARENT); 532 533 } 533 534 534 535 /* draw caption text */ 535 536 if (lpBand->fDraw & DRAW_TEXT) { 536 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);537 INT oldBkMode = SetBkMode (hdc, TRANSPARENT);538 COLORREF oldcolor = CLR_NONE;539 oldcolor = SetTextColor (hdc, (lpBand->clrFore != CLR_NONE) ?540 lpBand->clrFore : infoPtr->clrBtnText);541 DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText,542 DT_CENTER | DT_VCENTER | DT_SINGLELINE);543 if (oldBkMode != TRANSPARENT)544 SetBkMode (hdc, oldBkMode);545 SetTextColor (hdc, oldcolor);546 SelectObject (hdc, hOldFont);537 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); 538 INT oldBkMode = SetBkMode (hdc, TRANSPARENT); 539 COLORREF oldcolor = CLR_NONE; 540 oldcolor = SetTextColor (hdc, (lpBand->clrFore != CLR_NONE) ? 541 lpBand->clrFore : infoPtr->clrBtnText); 542 DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, 543 DT_CENTER | DT_VCENTER | DT_SINGLELINE); 544 if (oldBkMode != TRANSPARENT) 545 SetBkMode (hdc, oldBkMode); 546 SetTextColor (hdc, oldcolor); 547 SelectObject (hdc, hOldFont); 547 548 } 548 549 } … … 559 560 oldrow = infoPtr->bands[0].iRow; 560 561 for (i = 0; i < infoPtr->uNumBands; i++) { 561 lpBand = &infoPtr->bands[i];562 563 if (HIDDENBAND(lpBand)) continue; 564 565 /* now draw the band */566 REBAR_DrawBand (hdc, infoPtr, lpBand);562 lpBand = &infoPtr->bands[i]; 563 564 if (HIDDENBAND(lpBand)) continue; 565 566 /* now draw the band */ 567 REBAR_DrawBand (hdc, infoPtr, lpBand); 567 568 568 569 } … … 572 573 static void 573 574 REBAR_FixVert (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend, 574 INT mcy)575 /* Function: */ 575 INT mcy) 576 /* Function: */ 576 577 /* Cycle through bands in row and fix height of each band. */ 577 578 /* Also determine whether each band has changed. */ … … 585 586 for (i = (INT)rowstart; i<=(INT)rowend; i++) { 586 587 lpBand = &infoPtr->bands[i]; 587 if (HIDDENBAND(lpBand)) continue;588 589 /* adjust height of bands in row to "mcy" value */590 if (infoPtr->dwStyle & CCS_VERT) {591 if (lpBand->rcBand.right != lpBand->rcBand.left + mcy)592 lpBand->rcBand.right = lpBand->rcBand.left + mcy;593 }594 else {595 if (lpBand->rcBand.bottom != lpBand->rcBand.top + mcy)596 lpBand->rcBand.bottom = lpBand->rcBand.top + mcy;597 598 }599 600 /* mark whether we need to invalidate this band and trace */601 if ((lpBand->rcoldBand.left !=lpBand->rcBand.left) ||602 (lpBand->rcoldBand.top !=lpBand->rcBand.top) ||603 (lpBand->rcoldBand.right !=lpBand->rcBand.right) ||604 (lpBand->rcoldBand.bottom !=lpBand->rcBand.bottom)) {605 lpBand->fDraw |= NTF_INVALIDATE;606 TRACE("band %d row=%d: changed to (%d,%d)-(%d,%d) from (%d,%d)-(%d,%d)\n",607 i, lpBand->iRow,608 lpBand->rcBand.left, lpBand->rcBand.top,609 lpBand->rcBand.right, lpBand->rcBand.bottom,610 lpBand->rcoldBand.left, lpBand->rcoldBand.top,611 lpBand->rcoldBand.right, lpBand->rcoldBand.bottom);612 }613 else614 TRACE("band %d row=%d: unchanged (%d,%d)-(%d,%d)\n",615 i, lpBand->iRow,616 lpBand->rcBand.left, lpBand->rcBand.top,617 lpBand->rcBand.right, lpBand->rcBand.bottom);588 if (HIDDENBAND(lpBand)) continue; 589 590 /* adjust height of bands in row to "mcy" value */ 591 if (infoPtr->dwStyle & CCS_VERT) { 592 if (lpBand->rcBand.right != lpBand->rcBand.left + mcy) 593 lpBand->rcBand.right = lpBand->rcBand.left + mcy; 594 } 595 else { 596 if (lpBand->rcBand.bottom != lpBand->rcBand.top + mcy) 597 lpBand->rcBand.bottom = lpBand->rcBand.top + mcy; 598 599 } 600 601 /* mark whether we need to invalidate this band and trace */ 602 if ((lpBand->rcoldBand.left !=lpBand->rcBand.left) || 603 (lpBand->rcoldBand.top !=lpBand->rcBand.top) || 604 (lpBand->rcoldBand.right !=lpBand->rcBand.right) || 605 (lpBand->rcoldBand.bottom !=lpBand->rcBand.bottom)) { 606 lpBand->fDraw |= NTF_INVALIDATE; 607 TRACE("band %d row=%d: changed to (%d,%d)-(%d,%d) from (%d,%d)-(%d,%d)\n", 608 i, lpBand->iRow, 609 lpBand->rcBand.left, lpBand->rcBand.top, 610 lpBand->rcBand.right, lpBand->rcBand.bottom, 611 lpBand->rcoldBand.left, lpBand->rcoldBand.top, 612 lpBand->rcoldBand.right, lpBand->rcoldBand.bottom); 613 } 614 else 615 TRACE("band %d row=%d: unchanged (%d,%d)-(%d,%d)\n", 616 i, lpBand->iRow, 617 lpBand->rcBand.left, lpBand->rcBand.top, 618 lpBand->rcBand.right, lpBand->rcBand.bottom); 618 619 } 619 620 } … … 622 623 static void 623 624 REBAR_AdjustBands (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend, 624 INT maxx, INT mcy)625 INT maxx, INT mcy) 625 626 /* Function: This routine distributes the extra space in a row. */ 626 627 /* See algorithm below. */ … … 634 635 635 636 TRACE("start=%u, end=%u, max x=%d, max y=%d\n", 636 rowstart, rowend, maxx, mcy);637 rowstart, rowend, maxx, mcy); 637 638 638 639 /* ******************* Phase 1 ************************ */ … … 642 643 /* or band's ->ccx reached. */ 643 644 /* If any band modified, add any space left to last band */ 644 /* adjusted. */ 645 /* adjusted. */ 645 646 /* */ 646 647 /* ****************************************************** */ … … 650 651 last_adjusted = 0; 651 652 for (i=(INT)rowstart; i<=(INT)rowend; i++) { 652 lpBand = &infoPtr->bands[i];653 if (HIDDENBAND(lpBand)) continue;654 xsep = (x == 0) ? 0 : SEP_WIDTH;655 curwidth = rcBw(lpBand);656 657 /* set new left/top point */658 if (infoPtr->dwStyle & CCS_VERT)659 lpBand->rcBand.top = x + xsep;660 else661 lpBand->rcBand.left = x + xsep;662 663 /* compute new width */664 if (lpBand->hwndChild && extra) {665 /* set to the "current" band size less the header */666 fudge = lpBand->ccx;667 last_adjusted = i;668 if ((lpBand->fMask & RBBIM_SIZE) && (lpBand->cx > 0) &&669 (fudge > curwidth)) {670 TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d, extra=%d\n",671 i, fudge-curwidth, fudge, curwidth, extra);672 if ((fudge - curwidth) > extra)673 fudge = curwidth + extra;674 extra -= (fudge - curwidth);675 curwidth = fudge;676 }677 else {678 TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d\n",679 i, extra, fudge, curwidth);680 curwidth += extra;681 extra = 0;682 }683 }684 685 /* set new right/bottom point */686 if (infoPtr->dwStyle & CCS_VERT)687 lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth;688 else689 lpBand->rcBand.right = lpBand->rcBand.left + curwidth;690 TRACE("Phase 1 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n",691 i, lpBand->rcBand.left, lpBand->rcBand.top,692 lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep);693 x = rcBrb(lpBand);653 lpBand = &infoPtr->bands[i]; 654 if (HIDDENBAND(lpBand)) continue; 655 xsep = (x == 0) ? 0 : SEP_WIDTH; 656 curwidth = rcBw(lpBand); 657 658 /* set new left/top point */ 659 if (infoPtr->dwStyle & CCS_VERT) 660 lpBand->rcBand.top = x + xsep; 661 else 662 lpBand->rcBand.left = x + xsep; 663 664 /* compute new width */ 665 if (lpBand->hwndChild && extra) { 666 /* set to the "current" band size less the header */ 667 fudge = lpBand->ccx; 668 last_adjusted = i; 669 if ((lpBand->fMask & RBBIM_SIZE) && (lpBand->cx > 0) && 670 (fudge > curwidth)) { 671 TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d, extra=%d\n", 672 i, fudge-curwidth, fudge, curwidth, extra); 673 if ((fudge - curwidth) > extra) 674 fudge = curwidth + extra; 675 extra -= (fudge - curwidth); 676 curwidth = fudge; 677 } 678 else { 679 TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d\n", 680 i, extra, fudge, curwidth); 681 curwidth += extra; 682 extra = 0; 683 } 684 } 685 686 /* set new right/bottom point */ 687 if (infoPtr->dwStyle & CCS_VERT) 688 lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth; 689 else 690 lpBand->rcBand.right = lpBand->rcBand.left + curwidth; 691 TRACE("Phase 1 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n", 692 i, lpBand->rcBand.left, lpBand->rcBand.top, 693 lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep); 694 x = rcBrb(lpBand); 694 695 } 695 696 if ((x >= maxx) || last_adjusted) { 696 if (x > maxx) {697 ERR("Phase 1 failed, x=%d, maxx=%d, start=%u, end=%u\n", 698 x, maxx, rowstart, rowend);699 }700 /* done, so spread extra space */701 if (x < maxx) {702 fudge = maxx - x;703 TRACE("Need to spread %d on last adjusted band %d\n",704 fudge, last_adjusted);705 for (i=(INT)last_adjusted; i<=(INT)rowend; i++) {706 lpBand = &infoPtr->bands[i];707 if (HIDDENBAND(lpBand)) continue;708 709 /* set right/bottom point */710 if (i != last_adjusted) {711 if (infoPtr->dwStyle & CCS_VERT)712 lpBand->rcBand.top += fudge;713 else714 lpBand->rcBand.left += fudge;715 }716 717 /* set left/bottom point */718 if (infoPtr->dwStyle & CCS_VERT)719 lpBand->rcBand.bottom += fudge;720 else721 lpBand->rcBand.right += fudge;722 }723 }724 TRACE("Phase 1 succeeded, used x=%d\n", x);725 REBAR_FixVert (infoPtr, rowstart, rowend, mcy);726 return;697 if (x > maxx) { 698 ERR("Phase 1 failed, x=%d, maxx=%d, start=%u, end=%u\n", 699 x, maxx, rowstart, rowend); 700 } 701 /* done, so spread extra space */ 702 if (x < maxx) { 703 fudge = maxx - x; 704 TRACE("Need to spread %d on last adjusted band %d\n", 705 fudge, last_adjusted); 706 for (i=(INT)last_adjusted; i<=(INT)rowend; i++) { 707 lpBand = &infoPtr->bands[i]; 708 if (HIDDENBAND(lpBand)) continue; 709 710 /* set right/bottom point */ 711 if (i != last_adjusted) { 712 if (infoPtr->dwStyle & CCS_VERT) 713 lpBand->rcBand.top += fudge; 714 else 715 lpBand->rcBand.left += fudge; 716 } 717 718 /* set left/bottom point */ 719 if (infoPtr->dwStyle & CCS_VERT) 720 lpBand->rcBand.bottom += fudge; 721 else 722 lpBand->rcBand.right += fudge; 723 } 724 } 725 TRACE("Phase 1 succeeded, used x=%d\n", x); 726 REBAR_FixVert (infoPtr, rowstart, rowend, mcy); 727 return; 727 728 } 728 729 … … 736 737 x = 0; 737 738 for (i=(INT)rowstart; i<=(INT)rowend; i++) { 738 lpBand = &infoPtr->bands[i];739 if (HIDDENBAND(lpBand)) continue;740 xsep = (x == 0) ? 0 : SEP_WIDTH;741 curwidth = rcBw(lpBand);742 743 /* set new left/top point */744 if (infoPtr->dwStyle & CCS_VERT)745 lpBand->rcBand.top = x + xsep;746 else747 lpBand->rcBand.left = x + xsep;748 749 /* compute new width */750 if (extra) {751 curwidth += extra;752 extra = 0;753 }754 755 /* set new right/bottom point */756 if (infoPtr->dwStyle & CCS_VERT)757 lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth;758 else759 lpBand->rcBand.right = lpBand->rcBand.left + curwidth;760 TRACE("Phase 2 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n",761 i, lpBand->rcBand.left, lpBand->rcBand.top,762 lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep);763 x = rcBrb(lpBand);739 lpBand = &infoPtr->bands[i]; 740 if (HIDDENBAND(lpBand)) continue; 741 xsep = (x == 0) ? 0 : SEP_WIDTH; 742 curwidth = rcBw(lpBand); 743 744 /* set new left/top point */ 745 if (infoPtr->dwStyle & CCS_VERT) 746 lpBand->rcBand.top = x + xsep; 747 else 748 lpBand->rcBand.left = x + xsep; 749 750 /* compute new width */ 751 if (extra) { 752 curwidth += extra; 753 extra = 0; 754 } 755 756 /* set new right/bottom point */ 757 if (infoPtr->dwStyle & CCS_VERT) 758 lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth; 759 else 760 lpBand->rcBand.right = lpBand->rcBand.left + curwidth; 761 TRACE("Phase 2 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n", 762 i, lpBand->rcBand.left, lpBand->rcBand.top, 763 lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep); 764 x = rcBrb(lpBand); 764 765 } 765 766 if (x >= maxx) { 766 if (x > maxx) {767 ERR("Phase 2 failed, x=%d, maxx=%d, start=%u, end=%u\n", 768 x, maxx, rowstart, rowend);769 }770 /* done, so spread extra space */771 TRACE("Phase 2 succeeded, used x=%d\n", x);772 REBAR_FixVert (infoPtr, rowstart, rowend, mcy);773 return;767 if (x > maxx) { 768 ERR("Phase 2 failed, x=%d, maxx=%d, start=%u, end=%u\n", 769 x, maxx, rowstart, rowend); 770 } 771 /* done, so spread extra space */ 772 TRACE("Phase 2 succeeded, used x=%d\n", x); 773 REBAR_FixVert (infoPtr, rowstart, rowend, mcy); 774 return; 774 775 } 775 776 … … 781 782 lpBand = &infoPtr->bands[rowstart]; 782 783 ERR("Serious problem adjusting row %d, start band %d, end band %d\n", 783 lpBand->iRow, rowstart, rowend);784 lpBand->iRow, rowstart, rowend); 784 785 REBAR_DumpBand (infoPtr); 785 786 return; … … 805 806 if (HIDDENBAND(lpBand)) { 806 807 SetRect (&lpBand->rcChild, 807 lpBand->rcBand.right, lpBand->rcBand.top,808 lpBand->rcBand.right, lpBand->rcBand.bottom);809 continue;808 lpBand->rcBand.right, lpBand->rcBand.top, 809 lpBand->rcBand.right, lpBand->rcBand.bottom); 810 continue; 810 811 } 811 812 … … 814 815 /* set initial gripper rectangle */ 815 816 SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top, 816 lpBand->rcBand.left, lpBand->rcBand.bottom);817 lpBand->rcBand.left, lpBand->rcBand.bottom); 817 818 818 819 /* calculate gripper rectangle */ 819 820 if ( lpBand->fStatus & HAS_GRIPPER) { 820 lpBand->fDraw |= DRAW_GRIPPER;821 lpBand->rcGripper.left += REBAR_PRE_GRIPPER;822 lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH;823 lpBand->rcGripper.top += 2;824 lpBand->rcGripper.bottom -= 2;825 826 SetRect (&lpBand->rcCapImage,827 lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.top,828 lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.bottom);821 lpBand->fDraw |= DRAW_GRIPPER; 822 lpBand->rcGripper.left += REBAR_PRE_GRIPPER; 823 lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH; 824 lpBand->rcGripper.top += 2; 825 lpBand->rcGripper.bottom -= 2; 826 827 SetRect (&lpBand->rcCapImage, 828 lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.top, 829 lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.bottom); 829 830 } 830 831 else { /* no gripper will be drawn */ 831 xoff = 0;832 if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))833 /* if no gripper but either image or text, then leave space */834 xoff = REBAR_ALWAYS_SPACE;835 SetRect (&lpBand->rcCapImage, 836 lpBand->rcBand.left+xoff, lpBand->rcBand.top,837 lpBand->rcBand.left+xoff, lpBand->rcBand.bottom);832 xoff = 0; 833 if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT)) 834 /* if no gripper but either image or text, then leave space */ 835 xoff = REBAR_ALWAYS_SPACE; 836 SetRect (&lpBand->rcCapImage, 837 lpBand->rcBand.left+xoff, lpBand->rcBand.top, 838 lpBand->rcBand.left+xoff, lpBand->rcBand.bottom); 838 839 } 839 840 840 841 /* image is visible */ 841 842 if (lpBand->fStatus & HAS_IMAGE) { 842 lpBand->fDraw |= DRAW_IMAGE;843 lpBand->rcCapImage.right += infoPtr->imageSize.cx;844 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;845 846 /* set initial caption text rectangle */847 SetRect (&lpBand->rcCapText,848 lpBand->rcCapImage.right+REBAR_POST_IMAGE, lpBand->rcBand.top+1,849 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);850 /* update band height 851 if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) {852 lpBand->uMinHeight = infoPtr->imageSize.cy + 2;853 lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight;854 } */843 lpBand->fDraw |= DRAW_IMAGE; 844 lpBand->rcCapImage.right += infoPtr->imageSize.cx; 845 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy; 846 847 /* set initial caption text rectangle */ 848 SetRect (&lpBand->rcCapText, 849 lpBand->rcCapImage.right+REBAR_POST_IMAGE, lpBand->rcBand.top+1, 850 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1); 851 /* update band height 852 if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) { 853 lpBand->uMinHeight = infoPtr->imageSize.cy + 2; 854 lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight; 855 } */ 855 856 } 856 857 else { 857 /* set initial caption text rectangle */858 SetRect (&lpBand->rcCapText, lpBand->rcCapImage.right, lpBand->rcBand.top+1,859 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);858 /* set initial caption text rectangle */ 859 SetRect (&lpBand->rcCapText, lpBand->rcCapImage.right, lpBand->rcBand.top+1, 860 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1); 860 861 } 861 862 862 863 /* text is visible */ 863 864 if (lpBand->fStatus & HAS_TEXT) { 864 lpBand->fDraw |= DRAW_TEXT;865 lpBand->rcCapText.right = max(lpBand->rcCapText.left, 866 lpBand->rcCapText.right-REBAR_POST_TEXT);865 lpBand->fDraw |= DRAW_TEXT; 866 lpBand->rcCapText.right = max(lpBand->rcCapText.left, 867 lpBand->rcCapText.right-REBAR_POST_TEXT); 867 868 } 868 869 869 870 /* set initial child window rectangle if there is a child */ 870 871 if (lpBand->fMask & RBBIM_CHILD) { 871 xoff = lpBand->offChild.cx;872 yoff = lpBand->offChild.cy;873 SetRect (&lpBand->rcChild,874 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top+yoff,875 lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff);872 xoff = lpBand->offChild.cx; 873 yoff = lpBand->offChild.cy; 874 SetRect (&lpBand->rcChild, 875 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top+yoff, 876 lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff); 876 877 } 877 878 else { 878 879 SetRect (&lpBand->rcChild, 879 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top,880 lpBand->rcBand.right, lpBand->rcBand.bottom);880 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top, 881 lpBand->rcBand.right, lpBand->rcBand.bottom); 881 882 } 882 883 883 884 /* flag if notify required and invalidate rectangle */ 884 if (notify && 885 ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) ||886 (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {887 TRACE("Child rectangle changed for band %u\n", i);888 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n",889 oldChild.left, oldChild.top,890 oldChild.right, oldChild.bottom,891 lpBand->rcChild.left, lpBand->rcChild.top,892 lpBand->rcChild.right, lpBand->rcChild.bottom);885 if (notify && 886 ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) || 887 (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) { 888 TRACE("Child rectangle changed for band %u\n", i); 889 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", 890 oldChild.left, oldChild.top, 891 oldChild.right, oldChild.bottom, 892 lpBand->rcChild.left, lpBand->rcChild.top, 893 lpBand->rcChild.right, lpBand->rcChild.bottom); 893 894 } 894 895 if (lpBand->fDraw & NTF_INVALIDATE) { 895 TRACE("invalidating (%d,%d)-(%d,%d)\n",896 lpBand->rcBand.left, 897 lpBand->rcBand.top,898 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0), 899 lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0));900 lpBand->fDraw &= ~NTF_INVALIDATE;901 work = lpBand->rcBand;902 if (lpBand->fDraw & DRAW_RIGHTSEP) work.right += SEP_WIDTH_SIZE;903 if (lpBand->fDraw & DRAW_BOTTOMSEP) work.bottom += SEP_WIDTH_SIZE;904 InvalidateRect(infoPtr->hwndSelf, &work, TRUE);896 TRACE("invalidating (%d,%d)-(%d,%d)\n", 897 lpBand->rcBand.left, 898 lpBand->rcBand.top, 899 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0), 900 lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0)); 901 lpBand->fDraw &= ~NTF_INVALIDATE; 902 work = lpBand->rcBand; 903 if (lpBand->fDraw & DRAW_RIGHTSEP) work.right += SEP_WIDTH_SIZE; 904 if (lpBand->fDraw & DRAW_BOTTOMSEP) work.bottom += SEP_WIDTH_SIZE; 905 InvalidateRect(infoPtr->hwndSelf, &work, TRUE); 905 906 } 906 907 … … 925 926 926 927 for(i=rstart; i<rend; i++){ 927 lpBand = &infoPtr->bands[i];928 if (HIDDENBAND(lpBand)) continue;929 oldChild = lpBand->rcChild;930 931 /* set initial gripper rectangle */932 SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top,933 lpBand->rcBand.right, lpBand->rcBand.top);934 935 /* calculate gripper rectangle */936 if (lpBand->fStatus & HAS_GRIPPER) {937 lpBand->fDraw |= DRAW_GRIPPER;938 939 if (infoPtr->dwStyle & RBS_VERTICALGRIPPER) {940 /* vertical gripper */941 lpBand->rcGripper.left += 3;942 lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH;943 lpBand->rcGripper.top += REBAR_PRE_GRIPPER;944 lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_HEIGHT;945 946 /* initialize Caption image rectangle */947 SetRect (&lpBand->rcCapImage, lpBand->rcBand.left,948 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE,949 lpBand->rcBand.right,950 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE);951 }952 else {953 /* horizontal gripper */954 lpBand->rcGripper.left += 3;955 lpBand->rcGripper.right -= 3;956 lpBand->rcGripper.top += REBAR_PRE_GRIPPER;957 lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_WIDTH;958 959 /* initialize Caption image rectangle */960 SetRect (&lpBand->rcCapImage, lpBand->rcBand.left,961 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE,962 lpBand->rcBand.right,963 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE);964 }965 }966 else { /* no gripper will be drawn */967 xoff = 0;968 if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))969 /* if no gripper but either image or text, then leave space */970 xoff = REBAR_ALWAYS_SPACE;971 /* initialize Caption image rectangle */972 SetRect (&lpBand->rcCapImage, 973 lpBand->rcBand.left, lpBand->rcBand.top+xoff,974 lpBand->rcBand.right, lpBand->rcBand.top+xoff);975 }976 977 /* image is visible */978 if (lpBand->fStatus & HAS_IMAGE) {979 lpBand->fDraw |= DRAW_IMAGE;980 981 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;982 lpBand->rcCapImage.bottom += infoPtr->imageSize.cy;983 984 /* set initial caption text rectangle */985 SetRect (&lpBand->rcCapText, 986 lpBand->rcBand.left, lpBand->rcCapImage.bottom+REBAR_POST_IMAGE,987 lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader);988 /* update band height *989 if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) {990 lpBand->uMinHeight = infoPtr->imageSize.cx + 2;991 lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight;992 } */993 }994 else {995 /* set initial caption text rectangle */996 SetRect (&lpBand->rcCapText, 997 lpBand->rcBand.left, lpBand->rcCapImage.bottom,998 lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader);999 }1000 1001 /* text is visible */1002 if (lpBand->fStatus & HAS_TEXT) {1003 lpBand->fDraw |= DRAW_TEXT;1004 lpBand->rcCapText.bottom = max(lpBand->rcCapText.top,1005 lpBand->rcCapText.bottom-REBAR_POST_TEXT);1006 }1007 1008 /* set initial child window rectangle if there is a child */1009 if (lpBand->fMask & RBBIM_CHILD) {1010 yoff = lpBand->offChild.cx;1011 xoff = lpBand->offChild.cy;1012 SetRect (&lpBand->rcChild,1013 lpBand->rcBand.left+xoff, lpBand->rcBand.top+lpBand->cxHeader,1014 lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff);1015 }1016 else {1017 SetRect (&lpBand->rcChild,1018 lpBand->rcBand.left, lpBand->rcBand.top+lpBand->cxHeader,1019 lpBand->rcBand.right, lpBand->rcBand.bottom);1020 }1021 1022 /* flag if notify required and invalidate rectangle */1023 if (notify && 1024 ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) ||1025 (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {1026 TRACE("Child rectangle changed for band %u\n", i);1027 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n",1028 oldChild.left, oldChild.top,1029 oldChild.right, oldChild.bottom,1030 lpBand->rcChild.left, lpBand->rcChild.top,1031 lpBand->rcChild.right, lpBand->rcChild.bottom);1032 }1033 if (lpBand->fDraw & NTF_INVALIDATE) {1034 TRACE("invalidating (%d,%d)-(%d,%d)\n",1035 lpBand->rcBand.left, 1036 lpBand->rcBand.top,1037 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0), 1038 lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0));1039 lpBand->fDraw &= ~NTF_INVALIDATE;1040 work = lpBand->rcBand;1041 if (lpBand->fDraw & DRAW_RIGHTSEP) work.bottom += SEP_WIDTH_SIZE;1042 if (lpBand->fDraw & DRAW_BOTTOMSEP) work.right += SEP_WIDTH_SIZE;1043 InvalidateRect(infoPtr->hwndSelf, &work, TRUE);1044 }928 lpBand = &infoPtr->bands[i]; 929 if (HIDDENBAND(lpBand)) continue; 930 oldChild = lpBand->rcChild; 931 932 /* set initial gripper rectangle */ 933 SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top, 934 lpBand->rcBand.right, lpBand->rcBand.top); 935 936 /* calculate gripper rectangle */ 937 if (lpBand->fStatus & HAS_GRIPPER) { 938 lpBand->fDraw |= DRAW_GRIPPER; 939 940 if (infoPtr->dwStyle & RBS_VERTICALGRIPPER) { 941 /* vertical gripper */ 942 lpBand->rcGripper.left += 3; 943 lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH; 944 lpBand->rcGripper.top += REBAR_PRE_GRIPPER; 945 lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_HEIGHT; 946 947 /* initialize Caption image rectangle */ 948 SetRect (&lpBand->rcCapImage, lpBand->rcBand.left, 949 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE, 950 lpBand->rcBand.right, 951 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE); 952 } 953 else { 954 /* horizontal gripper */ 955 lpBand->rcGripper.left += 3; 956 lpBand->rcGripper.right -= 3; 957 lpBand->rcGripper.top += REBAR_PRE_GRIPPER; 958 lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_WIDTH; 959 960 /* initialize Caption image rectangle */ 961 SetRect (&lpBand->rcCapImage, lpBand->rcBand.left, 962 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE, 963 lpBand->rcBand.right, 964 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE); 965 } 966 } 967 else { /* no gripper will be drawn */ 968 xoff = 0; 969 if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT)) 970 /* if no gripper but either image or text, then leave space */ 971 xoff = REBAR_ALWAYS_SPACE; 972 /* initialize Caption image rectangle */ 973 SetRect (&lpBand->rcCapImage, 974 lpBand->rcBand.left, lpBand->rcBand.top+xoff, 975 lpBand->rcBand.right, lpBand->rcBand.top+xoff); 976 } 977 978 /* image is visible */ 979 if (lpBand->fStatus & HAS_IMAGE) { 980 lpBand->fDraw |= DRAW_IMAGE; 981 982 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx; 983 lpBand->rcCapImage.bottom += infoPtr->imageSize.cy; 984 985 /* set initial caption text rectangle */ 986 SetRect (&lpBand->rcCapText, 987 lpBand->rcBand.left, lpBand->rcCapImage.bottom+REBAR_POST_IMAGE, 988 lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader); 989 /* update band height * 990 if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) { 991 lpBand->uMinHeight = infoPtr->imageSize.cx + 2; 992 lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight; 993 } */ 994 } 995 else { 996 /* set initial caption text rectangle */ 997 SetRect (&lpBand->rcCapText, 998 lpBand->rcBand.left, lpBand->rcCapImage.bottom, 999 lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader); 1000 } 1001 1002 /* text is visible */ 1003 if (lpBand->fStatus & HAS_TEXT) { 1004 lpBand->fDraw |= DRAW_TEXT; 1005 lpBand->rcCapText.bottom = max(lpBand->rcCapText.top, 1006 lpBand->rcCapText.bottom-REBAR_POST_TEXT); 1007 } 1008 1009 /* set initial child window rectangle if there is a child */ 1010 if (lpBand->fMask & RBBIM_CHILD) { 1011 yoff = lpBand->offChild.cx; 1012 xoff = lpBand->offChild.cy; 1013 SetRect (&lpBand->rcChild, 1014 lpBand->rcBand.left+xoff, lpBand->rcBand.top+lpBand->cxHeader, 1015 lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff); 1016 } 1017 else { 1018 SetRect (&lpBand->rcChild, 1019 lpBand->rcBand.left, lpBand->rcBand.top+lpBand->cxHeader, 1020 lpBand->rcBand.right, lpBand->rcBand.bottom); 1021 } 1022 1023 /* flag if notify required and invalidate rectangle */ 1024 if (notify && 1025 ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) || 1026 (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) { 1027 TRACE("Child rectangle changed for band %u\n", i); 1028 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", 1029 oldChild.left, oldChild.top, 1030 oldChild.right, oldChild.bottom, 1031 lpBand->rcChild.left, lpBand->rcChild.top, 1032 lpBand->rcChild.right, lpBand->rcChild.bottom); 1033 } 1034 if (lpBand->fDraw & NTF_INVALIDATE) { 1035 TRACE("invalidating (%d,%d)-(%d,%d)\n", 1036 lpBand->rcBand.left, 1037 lpBand->rcBand.top, 1038 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0), 1039 lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0)); 1040 lpBand->fDraw &= ~NTF_INVALIDATE; 1041 work = lpBand->rcBand; 1042 if (lpBand->fDraw & DRAW_RIGHTSEP) work.bottom += SEP_WIDTH_SIZE; 1043 if (lpBand->fDraw & DRAW_BOTTOMSEP) work.right += SEP_WIDTH_SIZE; 1044 InvalidateRect(infoPtr->hwndSelf, &work, TRUE); 1045 } 1045 1046 1046 1047 } … … 1063 1064 1064 1065 TRACE( " old [%ld x %ld], new [%ld x %ld], client [%d x %d]\n", 1065 infoPtr->oldSize.cx, infoPtr->oldSize.cy,1066 infoPtr->calcSize.cx, infoPtr->calcSize.cy,1067 rc.right, rc.bottom);1066 infoPtr->oldSize.cx, infoPtr->oldSize.cy, 1067 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 1068 rc.right, rc.bottom); 1068 1069 1069 1070 /* If we need to shrink client, then skip size test */ 1070 1071 if ((infoPtr->calcSize.cy >= rc.bottom) && 1071 (infoPtr->calcSize.cx >= rc.right)) {1072 1073 /* if size did not change then skip process */1074 if ((infoPtr->oldSize.cx == infoPtr->calcSize.cx) &&1075 (infoPtr->oldSize.cy == infoPtr->calcSize.cy) &&1076 !(infoPtr->fStatus & RESIZE_ANYHOW))1077 {1078 TRACE("skipping reset\n");1079 return;1080 }1072 (infoPtr->calcSize.cx >= rc.right)) { 1073 1074 /* if size did not change then skip process */ 1075 if ((infoPtr->oldSize.cx == infoPtr->calcSize.cx) && 1076 (infoPtr->oldSize.cy == infoPtr->calcSize.cy) && 1077 !(infoPtr->fStatus & RESIZE_ANYHOW)) 1078 { 1079 TRACE("skipping reset\n"); 1080 return; 1081 } 1081 1082 } 1082 1083 … … 1094 1095 #if 0 1095 1096 if (GetWindowLongA (infoPtr->hwndSelf, GWL_STYLE) & WS_BORDER) { 1096 InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));1097 InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); 1097 1098 } 1098 1099 #endif 1099 1100 1100 1101 TRACE("setting to (0,0)-(%d,%d)\n", 1101 rc.right - rc.left, rc.bottom - rc.top);1102 rc.right - rc.left, rc.bottom - rc.top); 1102 1103 SetWindowPos (infoPtr->hwndSelf, 0, 0, 0, 1103 rc.right - rc.left, rc.bottom - rc.top,1104 SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW);1104 rc.right - rc.left, rc.bottom - rc.top, 1105 SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW); 1105 1106 } 1106 1107 … … 1120 1121 1121 1122 for (i = start; i < endplus; i++) { 1122 lpBand = &infoPtr->bands[i];1123 1124 if (HIDDENBAND(lpBand)) continue;1125 if (lpBand->hwndChild) {1126 TRACE("hwndChild = %x\n", lpBand->hwndChild);1127 1128 /* Always geterate the RBN_CHILDSIZE even it child1129 did not change */1130 rbcz.uBand = i;1131 rbcz.wID = lpBand->wID;1132 rbcz.rcChild = lpBand->rcChild;1133 rbcz.rcBand = lpBand->rcBand;1134 rbcz.rcBand.left += lpBand->cxHeader;1135 REBAR_Notify ((NMHDR *)&rbcz, infoPtr, RBN_CHILDSIZE);1136 if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) {1137 TRACE("Child rect changed by NOTIFY for band %u\n", i);1138 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n",1139 lpBand->rcChild.left, lpBand->rcChild.top,1140 lpBand->rcChild.right, lpBand->rcChild.bottom,1141 rbcz.rcChild.left, rbcz.rcChild.top,1142 rbcz.rcChild.right, rbcz.rcChild.bottom);1143 }1144 1145 GetClassNameA (lpBand->hwndChild, szClassName, 40);1146 if (!lstrcmpA (szClassName, "ComboBox") ||1147 !lstrcmpA (szClassName, WC_COMBOBOXEXA)) {1148 INT nEditHeight, yPos;1149 RECT rc;1150 1151 /* special placement code for combo or comboex box */1152 1153 1154 /* get size of edit line */1155 GetWindowRect (lpBand->hwndChild, &rc);1156 nEditHeight = rc.bottom - rc.top;1157 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2;1158 1159 /* center combo box inside child area */1160 TRACE("moving child (Combo(Ex)) %04x to (%d,%d) for (%d,%d)\n",1161 lpBand->hwndChild,1162 lpBand->rcChild.left, yPos,1163 lpBand->rcChild.right - lpBand->rcChild.left,1164 nEditHeight);1165 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP,1166 lpBand->rcChild.left,1167 /*lpBand->rcChild.top*/ yPos,1168 lpBand->rcChild.right - lpBand->rcChild.left,1169 nEditHeight,1170 SWP_NOZORDER);1171 if (!deferpos)1172 ERR("DeferWindowPos returned NULL\n");1173 }1174 else {1175 TRACE("moving child (Other) %04x to (%d,%d) for (%d,%d)\n",1176 lpBand->hwndChild,1177 lpBand->rcChild.left, lpBand->rcChild.top,1178 lpBand->rcChild.right - lpBand->rcChild.left,1179 lpBand->rcChild.bottom - lpBand->rcChild.top);1180 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP,1181 lpBand->rcChild.left,1182 lpBand->rcChild.top,1183 lpBand->rcChild.right - lpBand->rcChild.left,1184 lpBand->rcChild.bottom - lpBand->rcChild.top,1185 SWP_NOZORDER);1186 if (!deferpos)1187 ERR("DeferWindowPos returned NULL\n");1188 }1189 }1123 lpBand = &infoPtr->bands[i]; 1124 1125 if (HIDDENBAND(lpBand)) continue; 1126 if (lpBand->hwndChild) { 1127 TRACE("hwndChild = %x\n", lpBand->hwndChild); 1128 1129 /* Always geterate the RBN_CHILDSIZE even it child 1130 did not change */ 1131 rbcz.uBand = i; 1132 rbcz.wID = lpBand->wID; 1133 rbcz.rcChild = lpBand->rcChild; 1134 rbcz.rcBand = lpBand->rcBand; 1135 rbcz.rcBand.left += lpBand->cxHeader; 1136 REBAR_Notify ((NMHDR *)&rbcz, infoPtr, RBN_CHILDSIZE); 1137 if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) { 1138 TRACE("Child rect changed by NOTIFY for band %u\n", i); 1139 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", 1140 lpBand->rcChild.left, lpBand->rcChild.top, 1141 lpBand->rcChild.right, lpBand->rcChild.bottom, 1142 rbcz.rcChild.left, rbcz.rcChild.top, 1143 rbcz.rcChild.right, rbcz.rcChild.bottom); 1144 } 1145 1146 GetClassNameA (lpBand->hwndChild, szClassName, 40); 1147 if (!lstrcmpA (szClassName, "ComboBox") || 1148 !lstrcmpA (szClassName, WC_COMBOBOXEXA)) { 1149 INT nEditHeight, yPos; 1150 RECT rc; 1151 1152 /* special placement code for combo or comboex box */ 1153 1154 1155 /* get size of edit line */ 1156 GetWindowRect (lpBand->hwndChild, &rc); 1157 nEditHeight = rc.bottom - rc.top; 1158 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2; 1159 1160 /* center combo box inside child area */ 1161 TRACE("moving child (Combo(Ex)) %04x to (%d,%d) for (%d,%d)\n", 1162 lpBand->hwndChild, 1163 lpBand->rcChild.left, yPos, 1164 lpBand->rcChild.right - lpBand->rcChild.left, 1165 nEditHeight); 1166 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP, 1167 lpBand->rcChild.left, 1168 /*lpBand->rcChild.top*/ yPos, 1169 lpBand->rcChild.right - lpBand->rcChild.left, 1170 nEditHeight, 1171 SWP_NOZORDER); 1172 if (!deferpos) 1173 ERR("DeferWindowPos returned NULL\n"); 1174 } 1175 else { 1176 TRACE("moving child (Other) %04x to (%d,%d) for (%d,%d)\n", 1177 lpBand->hwndChild, 1178 lpBand->rcChild.left, lpBand->rcChild.top, 1179 lpBand->rcChild.right - lpBand->rcChild.left, 1180 lpBand->rcChild.bottom - lpBand->rcChild.top); 1181 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP, 1182 lpBand->rcChild.left, 1183 lpBand->rcChild.top, 1184 lpBand->rcChild.right - lpBand->rcChild.left, 1185 lpBand->rcChild.bottom - lpBand->rcChild.top, 1186 SWP_NOZORDER); 1187 if (!deferpos) 1188 ERR("DeferWindowPos returned NULL\n"); 1189 } 1190 } 1190 1191 } 1191 1192 if (!EndDeferWindowPos(deferpos)) … … 1212 1213 1213 1214 if (!(infoPtr->fStatus & BAND_NEEDS_LAYOUT)) { 1214 TRACE("no layout done. No band changed.\n");1215 REBAR_DumpBand (infoPtr);1216 return;1215 TRACE("no layout done. No band changed.\n"); 1216 REBAR_DumpBand (infoPtr); 1217 return; 1217 1218 } 1218 1219 infoPtr->fStatus &= ~BAND_NEEDS_LAYOUT; … … 1221 1222 GetClientRect (infoPtr->hwndSelf, &rcClient); 1222 1223 TRACE("Client is (%d,%d)-(%d,%d)\n", 1223 rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);1224 rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); 1224 1225 1225 1226 if (lpRect) { 1226 rcAdj = *lpRect;1227 TRACE("adjustment rect is (%d,%d)-(%d,%d)\n",1228 rcAdj.left, rcAdj.top, rcAdj.right, rcAdj.bottom);1227 rcAdj = *lpRect; 1228 TRACE("adjustment rect is (%d,%d)-(%d,%d)\n", 1229 rcAdj.left, rcAdj.top, rcAdj.right, rcAdj.bottom); 1229 1230 } 1230 1231 else { … … 1243 1244 1244 1245 if (!infoPtr->DoRedraw && (clientcx == 0) && (clientcy == 0)) { 1245 ERR("no redraw and client is zero, skip layout\n");1246 infoPtr->fStatus |= BAND_NEEDS_LAYOUT;1247 return;1246 ERR("no redraw and client is zero, skip layout\n"); 1247 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 1248 return; 1248 1249 } 1249 1250 1250 1251 /* save height of original control */ 1251 if (infoPtr->dwStyle & CCS_VERT) 1252 if (infoPtr->dwStyle & CCS_VERT) 1252 1253 origheight = infoPtr->calcSize.cx; 1253 1254 else … … 1258 1259 1259 1260 TRACE("band loop constants, clientcx=%d, clientcy=%d\n", 1260 clientcx, clientcy);1261 clientcx, clientcy); 1261 1262 x = 0; 1262 1263 y = 0; … … 1268 1269 1269 1270 for (i = 0; i < infoPtr->uNumBands; i++) { 1270 lpBand = &infoPtr->bands[i];1271 lpBand->fDraw = 0;1272 lpBand->iRow = row;1273 1274 if (HIDDENBAND(lpBand)) continue;1275 1276 lpBand->rcoldBand = lpBand->rcBand;1277 1278 /* separator from previous band */1279 cxsep = ( ((infoPtr->dwStyle & CCS_VERT) ? y : x)==0) ? 0 : SEP_WIDTH; 1280 1281 /* Header: includes gripper, text, image */1282 cx = lpBand->cxHeader; 1283 if (lpBand->fStyle & RBBS_FIXEDSIZE) cx = lpBand->lcx;1284 1285 if (infoPtr->dwStyle & CCS_VERT)1286 dobreak = (y + cx + cxsep > adjcy);1271 lpBand = &infoPtr->bands[i]; 1272 lpBand->fDraw = 0; 1273 lpBand->iRow = row; 1274 1275 if (HIDDENBAND(lpBand)) continue; 1276 1277 lpBand->rcoldBand = lpBand->rcBand; 1278 1279 /* separator from previous band */ 1280 cxsep = ( ((infoPtr->dwStyle & CCS_VERT) ? y : x)==0) ? 0 : SEP_WIDTH; 1281 1282 /* Header: includes gripper, text, image */ 1283 cx = lpBand->cxHeader; 1284 if (lpBand->fStyle & RBBS_FIXEDSIZE) cx = lpBand->lcx; 1285 1286 if (infoPtr->dwStyle & CCS_VERT) 1287 dobreak = (y + cx + cxsep > adjcy); 1287 1288 else 1288 dobreak = (x + cx + cxsep > adjcx);1289 1290 /* This is the check for whether we need to start a new row */1291 if ( ( (lpBand->fStyle & RBBS_BREAK) && (i != 0) ) ||1292 ( ((infoPtr->dwStyle & CCS_VERT) ? (y != 0) : (x != 0)) && dobreak)) {1293 1294 for (j = rowstart; j < i; j++) {1295 REBAR_BAND *lpB;1296 lpB = &infoPtr->bands[j];1297 if (infoPtr->dwStyle & CCS_VERT) {1298 lpB->rcBand.right = lpB->rcBand.left + mcy;1299 }1300 else {1301 lpB->rcBand.bottom = lpB->rcBand.top + mcy;1302 }1303 }1304 1305 TRACE("Spliting to new row %d on band %u\n", row+1, i);1306 if (infoPtr->dwStyle & CCS_VERT) {1307 y = 0;1308 x += (mcy + SEP_WIDTH);1309 }1310 else {1311 x = 0;1312 y += (mcy + SEP_WIDTH);1313 }1314 1315 mcy = 0;1316 cxsep = 0;1317 row++;1318 lpBand->iRow = row;1319 prevBand = NULL;1320 rowstart = i;1321 }1322 1323 if (mcy < lpBand->lcy + REBARSPACE) mcy = lpBand->lcy + REBARSPACE;1324 1325 /* if boundary rect specified then limit mcy */1326 if (lpRect) {1327 if (infoPtr->dwStyle & CCS_VERT) {1328 if (x+mcy > adjcx) {1329 mcy = adjcx - x;1330 TRACE("row %u limiting mcy=%d, adjcx=%d, x=%d\n",1331 i, mcy, adjcx, x);1332 }1333 }1334 else {1335 if (y+mcy > adjcy) {1336 mcy = adjcy - y;1337 TRACE("row %u limiting mcy=%d, adjcy=%d, y=%d\n",1338 i, mcy, adjcy, y);1339 }1340 }1341 }1342 1343 TRACE("band %u, row %d, x=%d, y=%d, cxsep=%d, cx=%d\n",1344 i, row,1345 x, y, cxsep, cx);1346 if (infoPtr->dwStyle & CCS_VERT) {1347 /* bound the bottom side if we have a bounding rectangle */1348 rightx = clientcx;1349 bottomy = (lpRect) ? min(clientcy, y+cxsep+cx) : y+cxsep+cx;1350 lpBand->rcBand.left = x;1351 lpBand->rcBand.right = x + min(mcy, lpBand->lcy+REBARSPACE);1352 lpBand->rcBand.top = min(bottomy, y + cxsep);1353 lpBand->rcBand.bottom = bottomy;1354 lpBand->uMinHeight = lpBand->lcy;1355 y = bottomy;1356 }1357 else {1358 /* bound the right side if we have a bounding rectangle */1359 rightx = (lpRect) ? min(clientcx, x+cxsep+cx) : x+cxsep+cx;1360 bottomy = clientcy;1361 lpBand->rcBand.left = min(rightx, x + cxsep);1362 lpBand->rcBand.right = rightx;1363 lpBand->rcBand.top = y;1364 lpBand->rcBand.bottom = y + min(mcy, lpBand->lcy+REBARSPACE);1365 lpBand->uMinHeight = lpBand->lcy;1366 x = rightx;1367 }1368 TRACE("band %u, row %d, (%d,%d)-(%d,%d)\n",1369 i, row,1370 lpBand->rcBand.left, lpBand->rcBand.top,1371 lpBand->rcBand.right, lpBand->rcBand.bottom);1372 prevBand = lpBand;1289 dobreak = (x + cx + cxsep > adjcx); 1290 1291 /* This is the check for whether we need to start a new row */ 1292 if ( ( (lpBand->fStyle & RBBS_BREAK) && (i != 0) ) || 1293 ( ((infoPtr->dwStyle & CCS_VERT) ? (y != 0) : (x != 0)) && dobreak)) { 1294 1295 for (j = rowstart; j < i; j++) { 1296 REBAR_BAND *lpB; 1297 lpB = &infoPtr->bands[j]; 1298 if (infoPtr->dwStyle & CCS_VERT) { 1299 lpB->rcBand.right = lpB->rcBand.left + mcy; 1300 } 1301 else { 1302 lpB->rcBand.bottom = lpB->rcBand.top + mcy; 1303 } 1304 } 1305 1306 TRACE("Spliting to new row %d on band %u\n", row+1, i); 1307 if (infoPtr->dwStyle & CCS_VERT) { 1308 y = 0; 1309 x += (mcy + SEP_WIDTH); 1310 } 1311 else { 1312 x = 0; 1313 y += (mcy + SEP_WIDTH); 1314 } 1315 1316 mcy = 0; 1317 cxsep = 0; 1318 row++; 1319 lpBand->iRow = row; 1320 prevBand = NULL; 1321 rowstart = i; 1322 } 1323 1324 if (mcy < lpBand->lcy + REBARSPACE) mcy = lpBand->lcy + REBARSPACE; 1325 1326 /* if boundary rect specified then limit mcy */ 1327 if (lpRect) { 1328 if (infoPtr->dwStyle & CCS_VERT) { 1329 if (x+mcy > adjcx) { 1330 mcy = adjcx - x; 1331 TRACE("row %u limiting mcy=%d, adjcx=%d, x=%d\n", 1332 i, mcy, adjcx, x); 1333 } 1334 } 1335 else { 1336 if (y+mcy > adjcy) { 1337 mcy = adjcy - y; 1338 TRACE("row %u limiting mcy=%d, adjcy=%d, y=%d\n", 1339 i, mcy, adjcy, y); 1340 } 1341 } 1342 } 1343 1344 TRACE("band %u, row %d, x=%d, y=%d, cxsep=%d, cx=%d\n", 1345 i, row, 1346 x, y, cxsep, cx); 1347 if (infoPtr->dwStyle & CCS_VERT) { 1348 /* bound the bottom side if we have a bounding rectangle */ 1349 rightx = clientcx; 1350 bottomy = (lpRect) ? min(clientcy, y+cxsep+cx) : y+cxsep+cx; 1351 lpBand->rcBand.left = x; 1352 lpBand->rcBand.right = x + min(mcy, lpBand->lcy+REBARSPACE); 1353 lpBand->rcBand.top = min(bottomy, y + cxsep); 1354 lpBand->rcBand.bottom = bottomy; 1355 lpBand->uMinHeight = lpBand->lcy; 1356 y = bottomy; 1357 } 1358 else { 1359 /* bound the right side if we have a bounding rectangle */ 1360 rightx = (lpRect) ? min(clientcx, x+cxsep+cx) : x+cxsep+cx; 1361 bottomy = clientcy; 1362 lpBand->rcBand.left = min(rightx, x + cxsep); 1363 lpBand->rcBand.right = rightx; 1364 lpBand->rcBand.top = y; 1365 lpBand->rcBand.bottom = y + min(mcy, lpBand->lcy+REBARSPACE); 1366 lpBand->uMinHeight = lpBand->lcy; 1367 x = rightx; 1368 } 1369 TRACE("band %u, row %d, (%d,%d)-(%d,%d)\n", 1370 i, row, 1371 lpBand->rcBand.left, lpBand->rcBand.top, 1372 lpBand->rcBand.right, lpBand->rcBand.bottom); 1373 prevBand = lpBand; 1373 1374 1374 1375 } /* for (i = 0; i < infoPtr->uNumBands... */ … … 1380 1381 1381 1382 for (j = rowstart; j < infoPtr->uNumBands; j++) { 1382 lpBand = &infoPtr->bands[j];1383 if (infoPtr->dwStyle & CCS_VERT) {1384 lpBand->rcBand.right = lpBand->rcBand.left + mcy;1385 }1386 else {1387 lpBand->rcBand.bottom = lpBand->rcBand.top + mcy;1388 }1383 lpBand = &infoPtr->bands[j]; 1384 if (infoPtr->dwStyle & CCS_VERT) { 1385 lpBand->rcBand.right = lpBand->rcBand.left + mcy; 1386 } 1387 else { 1388 lpBand->rcBand.bottom = lpBand->rcBand.top + mcy; 1389 } 1389 1390 } 1390 1391 … … 1399 1400 mmcy = 0; 1400 1401 if (!(infoPtr->dwStyle & RBS_VARHEIGHT)) { 1401 INT xy;1402 1403 /* get the max height of all bands */1404 for (i=0; i<infoPtr->uNumBands; i++) {1405 lpBand = &infoPtr->bands[i];1406 if (HIDDENBAND(lpBand)) continue;1407 if (infoPtr->dwStyle & CCS_VERT)1408 mmcy = max(mmcy, lpBand->rcBand.right - lpBand->rcBand.left);1409 else1410 mmcy = max(mmcy, lpBand->rcBand.bottom - lpBand->rcBand.top);1411 }1412 1413 /* now adjust all rectangles by using the height found above */1414 xy = 0;1415 row = 1;1416 for (i=0; i<infoPtr->uNumBands; i++) {1417 lpBand = &infoPtr->bands[i];1418 if (HIDDENBAND(lpBand)) continue;1419 if (lpBand->iRow != row)1420 xy += (mmcy + SEP_WIDTH);1421 if (infoPtr->dwStyle & CCS_VERT) {1422 lpBand->rcBand.left = xy;1423 lpBand->rcBand.right = xy + mmcy;1424 }1425 else {1426 lpBand->rcBand.top = xy;1427 lpBand->rcBand.bottom = xy + mmcy;1428 }1429 }1430 1431 /* set the x/y values to the correct maximum */1432 if (infoPtr->dwStyle & CCS_VERT)1433 x = xy + mmcy;1434 else1435 y = xy + mmcy;1402 INT xy; 1403 1404 /* get the max height of all bands */ 1405 for (i=0; i<infoPtr->uNumBands; i++) { 1406 lpBand = &infoPtr->bands[i]; 1407 if (HIDDENBAND(lpBand)) continue; 1408 if (infoPtr->dwStyle & CCS_VERT) 1409 mmcy = max(mmcy, lpBand->rcBand.right - lpBand->rcBand.left); 1410 else 1411 mmcy = max(mmcy, lpBand->rcBand.bottom - lpBand->rcBand.top); 1412 } 1413 1414 /* now adjust all rectangles by using the height found above */ 1415 xy = 0; 1416 row = 1; 1417 for (i=0; i<infoPtr->uNumBands; i++) { 1418 lpBand = &infoPtr->bands[i]; 1419 if (HIDDENBAND(lpBand)) continue; 1420 if (lpBand->iRow != row) 1421 xy += (mmcy + SEP_WIDTH); 1422 if (infoPtr->dwStyle & CCS_VERT) { 1423 lpBand->rcBand.left = xy; 1424 lpBand->rcBand.right = xy + mmcy; 1425 } 1426 else { 1427 lpBand->rcBand.top = xy; 1428 lpBand->rcBand.bottom = xy + mmcy; 1429 } 1430 } 1431 1432 /* set the x/y values to the correct maximum */ 1433 if (infoPtr->dwStyle & CCS_VERT) 1434 x = xy + mmcy; 1435 else 1436 y = xy + mmcy; 1436 1437 } 1437 1438 … … 1445 1446 if (lpRect) { 1446 1447 INT i, j, prev_rh, new_rh, adj_rh, prev_idx, current_idx; 1447 REBAR_BAND *prev, *current, *walk;1448 REBAR_BAND *prev, *current, *walk; 1448 1449 1449 1450 /* FIXME: problem # 2 */ 1450 if (((infoPtr->dwStyle & CCS_VERT) ? 1451 if (((infoPtr->dwStyle & CCS_VERT) ? 1451 1452 #if PROBLEM2 1452 (x < adjcx) : (y < adjcy)1453 (x < adjcx) : (y < adjcy) 1453 1454 #else 1454 (adjcx - x > 4) : (adjcy - y > 4)1455 (adjcx - x > 4) : (adjcy - y > 4) 1455 1456 #endif 1456 ) &&1457 (infoPtr->uNumBands > 1)) {1458 for (i=(INT)infoPtr->uNumBands-2; i>=0; i--) {1459 TRACE("adjcx=%d, adjcy=%d, x=%d, y=%d\n",1460 adjcx, adjcy, x, y);1461 1462 /* find the current band (starts at i+1) */1463 current = &infoPtr->bands[i+1];1464 current_idx = i+1;1465 while (HIDDENBAND(current)) {1466 i--;1467 if (i < 0) break; /* out of bands */1468 current = &infoPtr->bands[i+1];1469 current_idx = i+1;1470 }1471 if (i < 0) break; /* out of bands */1472 1473 /* now find the prev band (starts at i) */1474 prev = &infoPtr->bands[i];1475 prev_idx = i;1476 while (HIDDENBAND(prev)) {1477 i--;1478 if (i < 0) break; /* out of bands */1479 prev = &infoPtr->bands[i];1480 prev_idx = i;1481 }1482 if (i < 0) break; /* out of bands */1483 1484 prev_rh = ircBw(prev);1485 if (prev->iRow == current->iRow) {1486 new_rh = (infoPtr->dwStyle & RBS_VARHEIGHT) ?1487 current->lcy + REBARSPACE :1488 mmcy;1489 adj_rh = new_rh + SEP_WIDTH;1490 infoPtr->uNumRows++;1491 current->fDraw |= NTF_INVALIDATE;1492 current->iRow++;1493 if (infoPtr->dwStyle & CCS_VERT) {1494 current->rcBand.top = 0;1495 current->rcBand.bottom = clientcy;1496 current->rcBand.left += (prev_rh + SEP_WIDTH);1497 current->rcBand.right = current->rcBand.left + new_rh;1498 x += adj_rh;1499 }1500 else {1501 current->rcBand.left = 0;1502 current->rcBand.right = clientcx;1503 current->rcBand.top += (prev_rh + SEP_WIDTH);1504 current->rcBand.bottom = current->rcBand.top + new_rh;1505 y += adj_rh;1506 }1507 TRACE("moving band %d to own row at (%d,%d)-(%d,%d)\n",1508 current_idx,1509 current->rcBand.left, current->rcBand.top,1510 current->rcBand.right, current->rcBand.bottom);1511 TRACE("prev band %d at (%d,%d)-(%d,%d)\n",1512 prev_idx,1513 prev->rcBand.left, prev->rcBand.top,1514 prev->rcBand.right, prev->rcBand.bottom);1515 TRACE("values: prev_rh=%d, new_rh=%d, adj_rh=%d\n",1516 prev_rh, new_rh, adj_rh);1517 /* for bands below current adjust row # and top/bottom */1518 for (j = current_idx+1; j<infoPtr->uNumBands; j++) {1519 walk = &infoPtr->bands[j];1520 if (HIDDENBAND(walk)) continue;1521 walk->fDraw |= NTF_INVALIDATE;1522 walk->iRow++;1523 if (infoPtr->dwStyle & CCS_VERT) {1524 walk->rcBand.left += adj_rh;1525 walk->rcBand.right += adj_rh;1526 }1527 else {1528 walk->rcBand.top += adj_rh;1529 walk->rcBand.bottom += adj_rh;1530 }1531 }1532 if ((infoPtr->dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy)) 1533 break; /* all done */1534 }1535 }1536 }1457 ) && 1458 (infoPtr->uNumBands > 1)) { 1459 for (i=(INT)infoPtr->uNumBands-2; i>=0; i--) { 1460 TRACE("adjcx=%d, adjcy=%d, x=%d, y=%d\n", 1461 adjcx, adjcy, x, y); 1462 1463 /* find the current band (starts at i+1) */ 1464 current = &infoPtr->bands[i+1]; 1465 current_idx = i+1; 1466 while (HIDDENBAND(current)) { 1467 i--; 1468 if (i < 0) break; /* out of bands */ 1469 current = &infoPtr->bands[i+1]; 1470 current_idx = i+1; 1471 } 1472 if (i < 0) break; /* out of bands */ 1473 1474 /* now find the prev band (starts at i) */ 1475 prev = &infoPtr->bands[i]; 1476 prev_idx = i; 1477 while (HIDDENBAND(prev)) { 1478 i--; 1479 if (i < 0) break; /* out of bands */ 1480 prev = &infoPtr->bands[i]; 1481 prev_idx = i; 1482 } 1483 if (i < 0) break; /* out of bands */ 1484 1485 prev_rh = ircBw(prev); 1486 if (prev->iRow == current->iRow) { 1487 new_rh = (infoPtr->dwStyle & RBS_VARHEIGHT) ? 1488 current->lcy + REBARSPACE : 1489 mmcy; 1490 adj_rh = new_rh + SEP_WIDTH; 1491 infoPtr->uNumRows++; 1492 current->fDraw |= NTF_INVALIDATE; 1493 current->iRow++; 1494 if (infoPtr->dwStyle & CCS_VERT) { 1495 current->rcBand.top = 0; 1496 current->rcBand.bottom = clientcy; 1497 current->rcBand.left += (prev_rh + SEP_WIDTH); 1498 current->rcBand.right = current->rcBand.left + new_rh; 1499 x += adj_rh; 1500 } 1501 else { 1502 current->rcBand.left = 0; 1503 current->rcBand.right = clientcx; 1504 current->rcBand.top += (prev_rh + SEP_WIDTH); 1505 current->rcBand.bottom = current->rcBand.top + new_rh; 1506 y += adj_rh; 1507 } 1508 TRACE("moving band %d to own row at (%d,%d)-(%d,%d)\n", 1509 current_idx, 1510 current->rcBand.left, current->rcBand.top, 1511 current->rcBand.right, current->rcBand.bottom); 1512 TRACE("prev band %d at (%d,%d)-(%d,%d)\n", 1513 prev_idx, 1514 prev->rcBand.left, prev->rcBand.top, 1515 prev->rcBand.right, prev->rcBand.bottom); 1516 TRACE("values: prev_rh=%d, new_rh=%d, adj_rh=%d\n", 1517 prev_rh, new_rh, adj_rh); 1518 /* for bands below current adjust row # and top/bottom */ 1519 for (j = current_idx+1; j<infoPtr->uNumBands; j++) { 1520 walk = &infoPtr->bands[j]; 1521 if (HIDDENBAND(walk)) continue; 1522 walk->fDraw |= NTF_INVALIDATE; 1523 walk->iRow++; 1524 if (infoPtr->dwStyle & CCS_VERT) { 1525 walk->rcBand.left += adj_rh; 1526 walk->rcBand.right += adj_rh; 1527 } 1528 else { 1529 walk->rcBand.top += adj_rh; 1530 walk->rcBand.bottom += adj_rh; 1531 } 1532 } 1533 if ((infoPtr->dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy)) 1534 break; /* all done */ 1535 } 1536 } 1537 } 1537 1538 } 1538 1539 … … 1545 1546 /* clientcy/clientcx height/width of client area */ 1546 1547 1547 /* **** FIXME FIXME FIXME 1548 /* **** FIXME FIXME FIXME 1548 1549 * this does not take into account that more than one band 1549 1550 * is in a row!!!!!!!!! … … 1551 1552 1552 1553 if (((infoPtr->dwStyle & CCS_VERT) ? clientcx > x : clientcy > y) && 1553 infoPtr->uNumBands) {1554 INT diff, i, j;1555 1556 diff = (infoPtr->dwStyle & CCS_VERT) ? clientcx - x : clientcy - y;1557 for (i = infoPtr->uNumBands-1; i >= 0; i--) {1558 lpBand = &infoPtr->bands[i];1559 if(HIDDENBAND(lpBand)) continue;1560 if (!lpBand->fMask & RBBS_VARIABLEHEIGHT) continue;1561 if (((INT)lpBand->cyMaxChild < 1) || 1562 ((INT)lpBand->cyIntegral < 1)) {1563 if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue;1564 ERR("band %u RBBS_VARIABLEHEIGHT set but cyMax=%d, cyInt=%d\n",1565 i, lpBand->cyMaxChild, lpBand->cyIntegral);1566 continue;1567 }1568 /* j is now the maximum height/width in the client area */1569 j = ((diff / lpBand->cyIntegral) * lpBand->cyIntegral) + 1570 ircBw(lpBand);1571 if (j > lpBand->cyMaxChild + REBARSPACE) 1572 j = lpBand->cyMaxChild + REBARSPACE;1573 diff -= (j - ircBw(lpBand));1574 if (infoPtr->dwStyle & CCS_VERT)1575 lpBand->rcBand.right = lpBand->rcBand.left + j;1576 else1577 lpBand->rcBand.bottom = lpBand->rcBand.top + j;1578 TRACE("P2a band %d, row %d changed to (%d,%d)-(%d,%d)\n",1579 i, lpBand->iRow,1580 lpBand->rcBand.left, lpBand->rcBand.top,1581 lpBand->rcBand.right, lpBand->rcBand.bottom);1582 if (diff <= 0) break;1583 }1584 if (diff < 0) {1585 ERR("allocated more than available, diff=%d\n", diff);1586 diff = 0;1587 }1588 if (infoPtr->dwStyle & CCS_VERT)1589 x = clientcx - diff;1590 else1591 y = clientcy - diff;1554 infoPtr->uNumBands) { 1555 INT diff, i, j; 1556 1557 diff = (infoPtr->dwStyle & CCS_VERT) ? clientcx - x : clientcy - y; 1558 for (i = infoPtr->uNumBands-1; i >= 0; i--) { 1559 lpBand = &infoPtr->bands[i]; 1560 if(HIDDENBAND(lpBand)) continue; 1561 if (!lpBand->fMask & RBBS_VARIABLEHEIGHT) continue; 1562 if (((INT)lpBand->cyMaxChild < 1) || 1563 ((INT)lpBand->cyIntegral < 1)) { 1564 if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue; 1565 ERR("band %u RBBS_VARIABLEHEIGHT set but cyMax=%d, cyInt=%d\n", 1566 i, lpBand->cyMaxChild, lpBand->cyIntegral); 1567 continue; 1568 } 1569 /* j is now the maximum height/width in the client area */ 1570 j = ((diff / lpBand->cyIntegral) * lpBand->cyIntegral) + 1571 ircBw(lpBand); 1572 if (j > lpBand->cyMaxChild + REBARSPACE) 1573 j = lpBand->cyMaxChild + REBARSPACE; 1574 diff -= (j - ircBw(lpBand)); 1575 if (infoPtr->dwStyle & CCS_VERT) 1576 lpBand->rcBand.right = lpBand->rcBand.left + j; 1577 else 1578 lpBand->rcBand.bottom = lpBand->rcBand.top + j; 1579 TRACE("P2a band %d, row %d changed to (%d,%d)-(%d,%d)\n", 1580 i, lpBand->iRow, 1581 lpBand->rcBand.left, lpBand->rcBand.top, 1582 lpBand->rcBand.right, lpBand->rcBand.bottom); 1583 if (diff <= 0) break; 1584 } 1585 if (diff < 0) { 1586 ERR("allocated more than available, diff=%d\n", diff); 1587 diff = 0; 1588 } 1589 if (infoPtr->dwStyle & CCS_VERT) 1590 x = clientcx - diff; 1591 else 1592 y = clientcy - diff; 1592 1593 } 1593 1594 … … 1598 1599 1599 1600 if (infoPtr->uNumBands) { 1600 INT bandnum, bandnum_start, bandnum_end;1601 1602 /* If RBS_BANDBORDERS set then indicate to draw bottom separator */1603 /* on all bands in all rows but last row. */1604 /* Also indicate to draw the right separator for each band in */1605 /* each row but the rightmost band. */1606 if (infoPtr->dwStyle & RBS_BANDBORDERS) {1607 REBAR_BAND *prevband;1608 INT currow;1609 1610 prevband = NULL;1611 currow = -1;1612 for (i = 0; i < infoPtr->uNumBands; i++) {1613 lpBand = &infoPtr->bands[i];1614 if (HIDDENBAND(lpBand)) continue;1615 1616 if (lpBand->iRow < infoPtr->uNumRows) 1617 lpBand->fDraw |= DRAW_BOTTOMSEP;1618 1619 if (lpBand->iRow != currow) prevband = NULL;1620 currow = lpBand->iRow;1621 if (prevband) prevband->fDraw |= DRAW_RIGHTSEP;1622 prevband = lpBand;1623 }1624 }1625 1626 /* Distribute the extra space on the horizontal and adjust */1627 /* all bands in row to same height. */1628 bandnum = 0;1629 for (i=1; i<=infoPtr->uNumRows; i++) {1630 bandnum_start = -1;1631 bandnum_end = -1;1632 mcy = 0;1633 TRACE("processing row %d, starting band %d\n", i, bandnum);1634 while (TRUE) {1635 lpBand = &infoPtr->bands[bandnum];1636 if ((bandnum >= infoPtr->uNumBands) ||1637 ((lpBand->iRow != i) &&1638 !HIDDENBAND(lpBand))) {1639 if ((bandnum_start == -1) ||1640 (bandnum_end == -1)) {1641 ERR("logic error? bands=%d, rows=%d, start=%d, end=%d\n",1642 infoPtr->uNumBands, infoPtr->uNumRows, 1643 (INT)bandnum_start, (INT)bandnum_end);1644 ERR(" current row=%d, band=%d\n",1645 i, bandnum);1646 break;1647 }1648 REBAR_AdjustBands (infoPtr, bandnum_start, bandnum_end,1649 (infoPtr->dwStyle & CCS_VERT) ? 1650 clientcy : clientcx, mcy);1651 break;1652 }1653 if (!HIDDENBAND(lpBand)) {1654 if (bandnum_start == -1) bandnum_start = bandnum;1655 if (bandnum_end < bandnum) bandnum_end = bandnum;1656 if (mcy < ircBw(lpBand)) 1657 mcy = ircBw(lpBand);1658 }1659 bandnum++;1660 TRACE("point 1, bandnum=%d\n", bandnum);1661 }1662 TRACE("point 2, i=%d, numrows=%d, bandnum=%d\n",1663 i, infoPtr->uNumRows, bandnum);1664 }1665 TRACE("point 3\n");1666 1667 /* Calculate the other rectangles in each band */1668 if (infoPtr->dwStyle & CCS_VERT) {1669 REBAR_CalcVertBand (infoPtr, 0, infoPtr->uNumBands,1670 notify);1671 }1672 else {1673 REBAR_CalcHorzBand (infoPtr, 0, infoPtr->uNumBands, 1674 notify);1675 }1601 INT bandnum, bandnum_start, bandnum_end; 1602 1603 /* If RBS_BANDBORDERS set then indicate to draw bottom separator */ 1604 /* on all bands in all rows but last row. */ 1605 /* Also indicate to draw the right separator for each band in */ 1606 /* each row but the rightmost band. */ 1607 if (infoPtr->dwStyle & RBS_BANDBORDERS) { 1608 REBAR_BAND *prevband; 1609 INT currow; 1610 1611 prevband = NULL; 1612 currow = -1; 1613 for (i = 0; i < infoPtr->uNumBands; i++) { 1614 lpBand = &infoPtr->bands[i]; 1615 if (HIDDENBAND(lpBand)) continue; 1616 1617 if (lpBand->iRow < infoPtr->uNumRows) 1618 lpBand->fDraw |= DRAW_BOTTOMSEP; 1619 1620 if (lpBand->iRow != currow) prevband = NULL; 1621 currow = lpBand->iRow; 1622 if (prevband) prevband->fDraw |= DRAW_RIGHTSEP; 1623 prevband = lpBand; 1624 } 1625 } 1626 1627 /* Distribute the extra space on the horizontal and adjust */ 1628 /* all bands in row to same height. */ 1629 bandnum = 0; 1630 for (i=1; i<=infoPtr->uNumRows; i++) { 1631 bandnum_start = -1; 1632 bandnum_end = -1; 1633 mcy = 0; 1634 TRACE("processing row %d, starting band %d\n", i, bandnum); 1635 while (TRUE) { 1636 lpBand = &infoPtr->bands[bandnum]; 1637 if ((bandnum >= infoPtr->uNumBands) || 1638 ((lpBand->iRow != i) && 1639 !HIDDENBAND(lpBand))) { 1640 if ((bandnum_start == -1) || 1641 (bandnum_end == -1)) { 1642 ERR("logic error? bands=%d, rows=%d, start=%d, end=%d\n", 1643 infoPtr->uNumBands, infoPtr->uNumRows, 1644 (INT)bandnum_start, (INT)bandnum_end); 1645 ERR(" current row=%d, band=%d\n", 1646 i, bandnum); 1647 break; 1648 } 1649 REBAR_AdjustBands (infoPtr, bandnum_start, bandnum_end, 1650 (infoPtr->dwStyle & CCS_VERT) ? 1651 clientcy : clientcx, mcy); 1652 break; 1653 } 1654 if (!HIDDENBAND(lpBand)) { 1655 if (bandnum_start == -1) bandnum_start = bandnum; 1656 if (bandnum_end < bandnum) bandnum_end = bandnum; 1657 if (mcy < ircBw(lpBand)) 1658 mcy = ircBw(lpBand); 1659 } 1660 bandnum++; 1661 TRACE("point 1, bandnum=%d\n", bandnum); 1662 } 1663 TRACE("point 2, i=%d, numrows=%d, bandnum=%d\n", 1664 i, infoPtr->uNumRows, bandnum); 1665 } 1666 TRACE("point 3\n"); 1667 1668 /* Calculate the other rectangles in each band */ 1669 if (infoPtr->dwStyle & CCS_VERT) { 1670 REBAR_CalcVertBand (infoPtr, 0, infoPtr->uNumBands, 1671 notify); 1672 } 1673 else { 1674 REBAR_CalcHorzBand (infoPtr, 0, infoPtr->uNumBands, 1675 notify); 1676 } 1676 1677 } 1677 1678 … … 1681 1682 infoPtr->oldSize = infoPtr->calcSize; 1682 1683 if (infoPtr->dwStyle & CCS_VERT) { 1683 infoPtr->calcSize.cx = x;1684 infoPtr->calcSize.cy = clientcy;1685 TRACE("vert, notify=%d, x=%d, origheight=%d\n",1686 notify, x, origheight);1687 if (notify && (x != origheight)) infoPtr->fStatus |= NTF_HGHTCHG;1684 infoPtr->calcSize.cx = x; 1685 infoPtr->calcSize.cy = clientcy; 1686 TRACE("vert, notify=%d, x=%d, origheight=%d\n", 1687 notify, x, origheight); 1688 if (notify && (x != origheight)) infoPtr->fStatus |= NTF_HGHTCHG; 1688 1689 } 1689 1690 else { 1690 infoPtr->calcSize.cx = clientcx;1691 infoPtr->calcSize.cy = y;1692 TRACE("horz, notify=%d, y=%d, origheight=%d\n",1693 notify, y, origheight);1694 if (notify && (y != origheight)) infoPtr->fStatus |= NTF_HGHTCHG; 1691 infoPtr->calcSize.cx = clientcx; 1692 infoPtr->calcSize.cy = y; 1693 TRACE("horz, notify=%d, y=%d, origheight=%d\n", 1694 notify, y, origheight); 1695 if (notify && (y != origheight)) infoPtr->fStatus |= NTF_HGHTCHG; 1695 1696 } 1696 1697 … … 1749 1750 /* calculate gripper rectangle */ 1750 1751 if ( (!(lpBand->fStyle & RBBS_NOGRIPPER)) && 1751 ( (lpBand->fStyle & RBBS_GRIPPERALWAYS) || 1752 ( !(lpBand->fStyle & RBBS_FIXEDSIZE) && (infoPtr->uNumBands > 1)))1752 ( (lpBand->fStyle & RBBS_GRIPPERALWAYS) || 1753 ( !(lpBand->fStyle & RBBS_FIXEDSIZE) && (infoPtr->uNumBands > 1))) 1753 1754 ) { 1754 lpBand->fStatus |= HAS_GRIPPER;1755 lpBand->fStatus |= HAS_GRIPPER; 1755 1756 if (infoPtr->dwStyle & CCS_VERT) 1756 if (infoPtr->dwStyle & RBS_VERTICALGRIPPER)1757 if (infoPtr->dwStyle & RBS_VERTICALGRIPPER) 1757 1758 header += (GRIPPER_HEIGHT + REBAR_PRE_GRIPPER); 1758 1759 else 1759 header += (GRIPPER_WIDTH + REBAR_PRE_GRIPPER);1760 header += (GRIPPER_WIDTH + REBAR_PRE_GRIPPER); 1760 1761 else 1761 1762 header += (REBAR_PRE_GRIPPER + GRIPPER_WIDTH); … … 1766 1767 /* image is visible */ 1767 1768 if ((lpBand->fMask & RBBIM_IMAGE) && (infoPtr->himl)) { 1768 lpBand->fStatus |= HAS_IMAGE;1769 lpBand->fStatus |= HAS_IMAGE; 1769 1770 if (infoPtr->dwStyle & CCS_VERT) { 1770 header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE);1771 lpBand->lcy = infoPtr->imageSize.cx + 2;1772 }1773 else {1774 header += (infoPtr->imageSize.cx + REBAR_POST_IMAGE);1775 lpBand->lcy = infoPtr->imageSize.cy + 2;1776 }1771 header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE); 1772 lpBand->lcy = infoPtr->imageSize.cx + 2; 1773 } 1774 else { 1775 header += (infoPtr->imageSize.cx + REBAR_POST_IMAGE); 1776 lpBand->lcy = infoPtr->imageSize.cy + 2; 1777 } 1777 1778 } 1778 1779 1779 1780 /* text is visible */ 1780 1781 if ((lpBand->fMask & RBBIM_TEXT) && (lpBand->lpText)) { 1781 HDC hdc = GetDC (0);1782 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);1783 SIZE size;1784 1785 lpBand->fStatus |= HAS_TEXT;1786 GetTextExtentPoint32W (hdc, lpBand->lpText,1787 lstrlenW (lpBand->lpText), &size);1788 header += ((infoPtr->dwStyle & CCS_VERT) ? (size.cy + REBAR_POST_TEXT) : (size.cx + REBAR_POST_TEXT));1789 textheight = (infoPtr->dwStyle & CCS_VERT) ? 0 : size.cy;1790 1791 SelectObject (hdc, hOldFont);1792 ReleaseDC (0, hdc);1782 HDC hdc = GetDC (0); 1783 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); 1784 SIZE size; 1785 1786 lpBand->fStatus |= HAS_TEXT; 1787 GetTextExtentPoint32W (hdc, lpBand->lpText, 1788 lstrlenW (lpBand->lpText), &size); 1789 header += ((infoPtr->dwStyle & CCS_VERT) ? (size.cy + REBAR_POST_TEXT) : (size.cx + REBAR_POST_TEXT)); 1790 textheight = (infoPtr->dwStyle & CCS_VERT) ? 0 : size.cy; 1791 1792 SelectObject (hdc, hOldFont); 1793 ReleaseDC (0, hdc); 1793 1794 } 1794 1795 1795 1796 /* if no gripper but either image or text, then leave space */ 1796 1797 if ((lpBand->fStatus & (HAS_IMAGE | HAS_TEXT)) && 1797 !(lpBand->fStatus & HAS_GRIPPER)) {1798 header += REBAR_ALWAYS_SPACE;1798 !(lpBand->fStatus & HAS_GRIPPER)) { 1799 header += REBAR_ALWAYS_SPACE; 1799 1800 } 1800 1801 … … 1810 1811 lpBand->ccy = lpBand->lcy; 1811 1812 if (lpBand->fMask & RBBIM_CHILDSIZE) { 1812 if (!(lpBand->fStyle & RBBS_FIXEDSIZE)) {1813 lpBand->offChild.cx = 4;1814 lpBand->offChild.cy = 2;1813 if (!(lpBand->fStyle & RBBS_FIXEDSIZE)) { 1814 lpBand->offChild.cx = 4; 1815 lpBand->offChild.cy = 2; 1815 1816 } 1816 1817 lpBand->lcx = lpBand->cxMinChild; 1817 1818 1818 /* Set the .cy values for CHILDSIZE case */1819 /* Set the .cy values for CHILDSIZE case */ 1819 1820 lpBand->lcy = max(lpBand->lcy, lpBand->cyMinChild); 1820 lpBand->ccy = lpBand->lcy;1821 lpBand->ccy = lpBand->lcy; 1821 1822 lpBand->hcy = lpBand->lcy; 1822 1823 if (lpBand->cyMaxChild != 0xffffffff) { 1823 lpBand->hcy = lpBand->cyMaxChild;1824 } 1825 if (lpBand->cyChild != 0xffffffff)1826 lpBand->ccy = max (lpBand->cyChild, lpBand->lcy);1824 lpBand->hcy = lpBand->cyMaxChild; 1825 } 1826 if (lpBand->cyChild != 0xffffffff) 1827 lpBand->ccy = max (lpBand->cyChild, lpBand->lcy); 1827 1828 1828 1829 TRACE("_CHILDSIZE\n"); … … 1851 1852 1852 1853 if (lprbbi->fMask & RBBIM_STYLE) 1853 lpBand->fStyle = lprbbi->fStyle;1854 lpBand->fStyle = lprbbi->fStyle; 1854 1855 1855 1856 if (lprbbi->fMask & RBBIM_COLORS) { 1856 lpBand->clrFore = lprbbi->clrFore;1857 lpBand->clrBack = lprbbi->clrBack;1857 lpBand->clrFore = lprbbi->clrFore; 1858 lpBand->clrBack = lprbbi->clrBack; 1858 1859 } 1859 1860 1860 1861 if (lprbbi->fMask & RBBIM_IMAGE) 1861 lpBand->iImage = lprbbi->iImage;1862 lpBand->iImage = lprbbi->iImage; 1862 1863 1863 1864 if (lprbbi->fMask & RBBIM_CHILD) { 1864 if (lprbbi->hwndChild) {1865 lpBand->hwndChild = lprbbi->hwndChild;1866 lpBand->hwndPrevParent =1867 SetParent (lpBand->hwndChild, hwnd);1868 /* below in trace fro WinRAR */1869 ShowWindow(lpBand->hwndChild, SW_SHOWNOACTIVATE | SW_SHOWNORMAL);1870 /* above in trace fro WinRAR */1871 }1872 else {1873 TRACE("child: 0x%x prev parent: 0x%x\n",1874 lpBand->hwndChild, lpBand->hwndPrevParent);1875 lpBand->hwndChild = 0;1876 lpBand->hwndPrevParent = 0;1877 }1865 if (lprbbi->hwndChild) { 1866 lpBand->hwndChild = lprbbi->hwndChild; 1867 lpBand->hwndPrevParent = 1868 SetParent (lpBand->hwndChild, hwnd); 1869 /* below in trace fro WinRAR */ 1870 ShowWindow(lpBand->hwndChild, SW_SHOWNOACTIVATE | SW_SHOWNORMAL); 1871 /* above in trace fro WinRAR */ 1872 } 1873 else { 1874 TRACE("child: 0x%x prev parent: 0x%x\n", 1875 lpBand->hwndChild, lpBand->hwndPrevParent); 1876 lpBand->hwndChild = 0; 1877 lpBand->hwndPrevParent = 0; 1878 } 1878 1879 } 1879 1880 1880 1881 if (lprbbi->fMask & RBBIM_CHILDSIZE) { 1881 lpBand->cxMinChild = lprbbi->cxMinChild;1882 lpBand->cyMinChild = lprbbi->cyMinChild;1883 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {1884 lpBand->cyChild = lprbbi->cyChild;1885 lpBand->cyMaxChild = lprbbi->cyMaxChild;1886 lpBand->cyIntegral = lprbbi->cyIntegral;1887 }1888 else { /* special case - these should be zeroed out since */1889 /* RBBIM_CHILDSIZE added these in WIN32_IE >= 0x0400 */1890 lpBand->cyChild = 0;1891 lpBand->cyMaxChild = 0;1892 lpBand->cyIntegral = 0;1893 }1882 lpBand->cxMinChild = lprbbi->cxMinChild; 1883 lpBand->cyMinChild = lprbbi->cyMinChild; 1884 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { 1885 lpBand->cyChild = lprbbi->cyChild; 1886 lpBand->cyMaxChild = lprbbi->cyMaxChild; 1887 lpBand->cyIntegral = lprbbi->cyIntegral; 1888 } 1889 else { /* special case - these should be zeroed out since */ 1890 /* RBBIM_CHILDSIZE added these in WIN32_IE >= 0x0400 */ 1891 lpBand->cyChild = 0; 1892 lpBand->cyMaxChild = 0; 1893 lpBand->cyIntegral = 0; 1894 } 1894 1895 } 1895 1896 1896 1897 if (lprbbi->fMask & RBBIM_SIZE) 1897 lpBand->cx = lprbbi->cx;1898 lpBand->cx = lprbbi->cx; 1898 1899 1899 1900 if (lprbbi->fMask & RBBIM_BACKGROUND) 1900 lpBand->hbmBack = lprbbi->hbmBack;1901 lpBand->hbmBack = lprbbi->hbmBack; 1901 1902 1902 1903 if (lprbbi->fMask & RBBIM_ID) 1903 lpBand->wID = lprbbi->wID;1904 lpBand->wID = lprbbi->wID; 1904 1905 1905 1906 /* check for additional data */ 1906 1907 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { 1907 if (lprbbi->fMask & RBBIM_IDEALSIZE)1908 lpBand->cxIdeal = lprbbi->cxIdeal;1909 1910 if (lprbbi->fMask & RBBIM_LPARAM)1911 lpBand->lParam = lprbbi->lParam;1912 1913 if (lprbbi->fMask & RBBIM_HEADERSIZE)1914 lpBand->cxHeader = lprbbi->cxHeader;1908 if (lprbbi->fMask & RBBIM_IDEALSIZE) 1909 lpBand->cxIdeal = lprbbi->cxIdeal; 1910 1911 if (lprbbi->fMask & RBBIM_LPARAM) 1912 lpBand->lParam = lprbbi->lParam; 1913 1914 if (lprbbi->fMask & RBBIM_HEADERSIZE) 1915 lpBand->cxHeader = lprbbi->cxHeader; 1915 1916 } 1916 1917 } … … 1932 1933 for(i=0; i<infoPtr->uNumBands; i++) { 1933 1934 lpBand = &infoPtr->bands[i]; 1934 if (HIDDENBAND(lpBand)) continue;1935 1936 /* draw band separator between rows */1937 if (lpBand->iRow != oldrow) {1938 oldrow = lpBand->iRow;1939 if (lpBand->fDraw & DRAW_BOTTOMSEP) {1940 RECT rcRowSep;1941 rcRowSep = lpBand->rcBand;1942 if (infoPtr->dwStyle & CCS_VERT) {1943 rcRowSep.right += SEP_WIDTH_SIZE;1944 rcRowSep.bottom = infoPtr->calcSize.cy;1945 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_RIGHT);1946 }1947 else {1948 rcRowSep.bottom += SEP_WIDTH_SIZE;1949 rcRowSep.right = infoPtr->calcSize.cx;1950 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_BOTTOM);1951 }1952 TRACE ("drawing band separator bottom (%d,%d)-(%d,%d)\n",1953 rcRowSep.left, rcRowSep.top,1954 rcRowSep.right, rcRowSep.bottom);1955 }1956 }1957 1958 /* draw band separator between bands in a row */1959 if (lpBand->fDraw & DRAW_RIGHTSEP) {1960 RECT rcSep;1961 rcSep = lpBand->rcBand;1962 if (infoPtr->dwStyle & CCS_VERT) {1963 rcSep.bottom += SEP_WIDTH_SIZE;1964 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_BOTTOM);1965 }1966 else {1967 rcSep.right += SEP_WIDTH_SIZE;1968 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_RIGHT);1969 }1970 TRACE("drawing band separator right (%d,%d)-(%d,%d)\n",1971 rcSep.left, rcSep.top, rcSep.right, rcSep.bottom);1972 }1973 1974 /* draw the actual background */1975 if (lpBand->clrBack != CLR_NONE)1976 new = lpBand->clrBack;1977 else1978 new = infoPtr->clrBtnFace;1979 rect = lpBand->rcBand;1980 old = SetBkColor (hdc, new);1981 TRACE("%s backround color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n",1982 (lpBand->clrBack == CLR_NONE) ? "std" : "",1983 new,1984 lpBand->rcBand.left,lpBand->rcBand.top,1985 lpBand->rcBand.right,lpBand->rcBand.bottom,1986 clip->left, clip->top,1987 clip->right, clip->bottom);1988 ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0);1989 SetBkColor (hdc, old);1935 if (HIDDENBAND(lpBand)) continue; 1936 1937 /* draw band separator between rows */ 1938 if (lpBand->iRow != oldrow) { 1939 oldrow = lpBand->iRow; 1940 if (lpBand->fDraw & DRAW_BOTTOMSEP) { 1941 RECT rcRowSep; 1942 rcRowSep = lpBand->rcBand; 1943 if (infoPtr->dwStyle & CCS_VERT) { 1944 rcRowSep.right += SEP_WIDTH_SIZE; 1945 rcRowSep.bottom = infoPtr->calcSize.cy; 1946 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_RIGHT); 1947 } 1948 else { 1949 rcRowSep.bottom += SEP_WIDTH_SIZE; 1950 rcRowSep.right = infoPtr->calcSize.cx; 1951 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_BOTTOM); 1952 } 1953 TRACE ("drawing band separator bottom (%d,%d)-(%d,%d)\n", 1954 rcRowSep.left, rcRowSep.top, 1955 rcRowSep.right, rcRowSep.bottom); 1956 } 1957 } 1958 1959 /* draw band separator between bands in a row */ 1960 if (lpBand->fDraw & DRAW_RIGHTSEP) { 1961 RECT rcSep; 1962 rcSep = lpBand->rcBand; 1963 if (infoPtr->dwStyle & CCS_VERT) { 1964 rcSep.bottom += SEP_WIDTH_SIZE; 1965 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_BOTTOM); 1966 } 1967 else { 1968 rcSep.right += SEP_WIDTH_SIZE; 1969 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_RIGHT); 1970 } 1971 TRACE("drawing band separator right (%d,%d)-(%d,%d)\n", 1972 rcSep.left, rcSep.top, rcSep.right, rcSep.bottom); 1973 } 1974 1975 /* draw the actual background */ 1976 if (lpBand->clrBack != CLR_NONE) 1977 new = lpBand->clrBack; 1978 else 1979 new = infoPtr->clrBtnFace; 1980 rect = lpBand->rcBand; 1981 old = SetBkColor (hdc, new); 1982 TRACE("%s backround color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n", 1983 (lpBand->clrBack == CLR_NONE) ? "std" : "", 1984 new, 1985 lpBand->rcBand.left,lpBand->rcBand.top, 1986 lpBand->rcBand.right,lpBand->rcBand.bottom, 1987 clip->left, clip->top, 1988 clip->right, clip->bottom); 1989 ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0); 1990 SetBkColor (hdc, old); 1990 1991 } 1991 1992 return TRUE; … … 2004 2005 if (PtInRect (&rect, *lpPt)) 2005 2006 { 2006 if (infoPtr->uNumBands == 0) { 2007 *pFlags = RBHT_NOWHERE; 2008 if (pBand) 2009 *pBand = -1; 2010 TRACE("NOWHERE\n"); 2011 return; 2012 } 2013 else { 2014 /* somewhere inside */ 2015 infoPtr->ihitBand = -1; 2016 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) { 2017 lpBand = &infoPtr->bands[iCount]; 2018 if (HIDDENBAND(lpBand)) continue; 2019 if (PtInRect (&lpBand->rcBand, *lpPt)) { 2020 if (pBand) 2021 *pBand = iCount; 2022 if (PtInRect (&lpBand->rcGripper, *lpPt)) { 2023 *pFlags = RBHT_GRABBER; 2024 infoPtr->ihitBand = iCount; 2025 TRACE("ON GRABBER %d\n", iCount); 2026 return; 2027 } 2028 else if (PtInRect (&lpBand->rcCapImage, *lpPt)) { 2029 *pFlags = RBHT_CAPTION; 2030 TRACE("ON CAPTION %d\n", iCount); 2031 return; 2032 } 2033 else if (PtInRect (&lpBand->rcCapText, *lpPt)) { 2034 *pFlags = RBHT_CAPTION; 2035 TRACE("ON CAPTION %d\n", iCount); 2036 return; 2037 } 2038 else if (PtInRect (&lpBand->rcChild, *lpPt)) { 2039 *pFlags = RBHT_CLIENT; 2040 TRACE("ON CLIENT %d\n", iCount); 2041 return; 2042 } 2043 else { 2044 *pFlags = RBHT_NOWHERE; 2045 TRACE("NOWHERE %d\n", iCount); 2046 return; 2047 } 2048 } 2049 } 2050 2051 *pFlags = RBHT_NOWHERE; 2052 if (pBand) 2053 *pBand = -1; 2054 2055 TRACE("NOWHERE\n"); 2056 return; 2057 } 2007 if (infoPtr->uNumBands == 0) { 2008 *pFlags = RBHT_NOWHERE; 2009 if (pBand) 2010 *pBand = -1; 2011 TRACE("NOWHERE\n"); 2012 return; 2058 2013 } 2059 2014 else { 2060 *pFlags = RBHT_NOWHERE; 2061 if (pBand) 2062 *pBand = -1; 2063 TRACE("NOWHERE\n"); 2064 return; 2015 /* somewhere inside */ 2016 infoPtr->ihitBand = -1; 2017 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) { 2018 lpBand = &infoPtr->bands[iCount]; 2019 if (HIDDENBAND(lpBand)) continue; 2020 if (PtInRect (&lpBand->rcBand, *lpPt)) { 2021 if (pBand) 2022 *pBand = iCount; 2023 if (PtInRect (&lpBand->rcGripper, *lpPt)) { 2024 *pFlags = RBHT_GRABBER; 2025 infoPtr->ihitBand = iCount; 2026 TRACE("ON GRABBER %d\n", iCount); 2027 return; 2028 } 2029 else if (PtInRect (&lpBand->rcCapImage, *lpPt)) { 2030 *pFlags = RBHT_CAPTION; 2031 TRACE("ON CAPTION %d\n", iCount); 2032 return; 2033 } 2034 else if (PtInRect (&lpBand->rcCapText, *lpPt)) { 2035 *pFlags = RBHT_CAPTION; 2036 TRACE("ON CAPTION %d\n", iCount); 2037 return; 2038 } 2039 else if (PtInRect (&lpBand->rcChild, *lpPt)) { 2040 *pFlags = RBHT_CLIENT; 2041 TRACE("ON CLIENT %d\n", iCount); 2042 return; 2043 } 2044 else { 2045 *pFlags = RBHT_NOWHERE; 2046 TRACE("NOWHERE %d\n", iCount); 2047 return; 2048 } 2049 } 2050 } 2051 2052 *pFlags = RBHT_NOWHERE; 2053 if (pBand) 2054 *pBand = -1; 2055 2056 TRACE("NOWHERE\n"); 2057 return; 2058 } 2059 } 2060 else { 2061 *pFlags = RBHT_NOWHERE; 2062 if (pBand) 2063 *pBand = -1; 2064 TRACE("NOWHERE\n"); 2065 return; 2065 2066 } 2066 2067 … … 2091 2092 /* if this band is not shrinkable, then just move it */ 2092 2093 Leadjust = Readjust = movement; 2093 ret = movement;2094 ret = movement; 2094 2095 } 2095 2096 else { 2096 2097 if (movement < 0) { 2097 /* Drag to left */2098 if (avail <= abs(movement)) {2099 Readjust = movement;2100 Leadjust = movement + avail;2101 ret = Leadjust;2102 }2103 else {2104 Readjust = movement;2105 Leadjust = 0;2106 ret = 0;2107 }2108 }2109 else {2110 /* Drag to right */2111 if (avail <= abs(movement)) {2112 Leadjust = movement;2113 Readjust = movement - avail;2114 ret = Readjust;2115 }2116 else {2117 Leadjust = movement;2118 Readjust = 0;2119 ret = 0;2120 }2121 }2098 /* Drag to left */ 2099 if (avail <= abs(movement)) { 2100 Readjust = movement; 2101 Leadjust = movement + avail; 2102 ret = Leadjust; 2103 } 2104 else { 2105 Readjust = movement; 2106 Leadjust = 0; 2107 ret = 0; 2108 } 2109 } 2110 else { 2111 /* Drag to right */ 2112 if (avail <= abs(movement)) { 2113 Leadjust = movement; 2114 Readjust = movement - avail; 2115 ret = Readjust; 2116 } 2117 else { 2118 Leadjust = movement; 2119 Readjust = 0; 2120 ret = 0; 2121 } 2122 } 2122 2123 } 2123 2124 … … 2125 2126 if (rcBlt(band) + Leadjust < 0) { 2126 2127 ERR("adjustment will fail, band %d: left=%d, right=%d, move=%d, rtn=%d\n", 2127 i, Leadjust, Readjust, movement, ret);2128 i, Leadjust, Readjust, movement, ret); 2128 2129 } 2129 2130 … … 2132 2133 2133 2134 TRACE("band %d: left=%d, right=%d, move=%d, rtn=%d, rcBand=(%d,%d)-(%d,%d)\n", 2134 i, Leadjust, Readjust, movement, ret,2135 band->rcBand.left, band->rcBand.top,2136 band->rcBand.right, band->rcBand.bottom);2135 i, Leadjust, Readjust, movement, ret, 2136 band->rcBand.left, band->rcBand.top, 2137 band->rcBand.right, band->rcBand.bottom); 2137 2138 return ret; 2138 2139 } … … 2157 2158 2158 2159 if (!(infoPtr->fStatus & BEGIN_DRAG_ISSUED)) { 2159 if (REBAR_Notify_NMREBAR (infoPtr, -1, RBN_BEGINDRAG)) {2160 /* Notify returned TRUE - abort drag */2161 infoPtr->dragStart.x = 0;2162 infoPtr->dragStart.y = 0;2163 infoPtr->dragNow = infoPtr->dragStart;2164 infoPtr->ihitBand = -1;2165 ReleaseCapture ();2166 return ;2167 }2168 infoPtr->fStatus |= BEGIN_DRAG_ISSUED;2160 if (REBAR_Notify_NMREBAR (infoPtr, -1, RBN_BEGINDRAG)) { 2161 /* Notify returned TRUE - abort drag */ 2162 infoPtr->dragStart.x = 0; 2163 infoPtr->dragStart.y = 0; 2164 infoPtr->dragNow = infoPtr->dragStart; 2165 infoPtr->ihitBand = -1; 2166 ReleaseCapture (); 2167 return ; 2168 } 2169 infoPtr->fStatus |= BEGIN_DRAG_ISSUED; 2169 2170 } 2170 2171 … … 2176 2177 for (i=0; i<infoPtr->uNumBands; i++) { 2177 2178 band = &infoPtr->bands[i]; 2178 if (HIDDENBAND(band)) continue;2179 if (band->iRow == hitBand->iRow) {2180 imaxdBand = i;2181 if (imindBand == -1) imindBand = i;2182 /* minimum size of each band is size of header plus */2183 /* size of minimum child plus offset of child from header plus */2184 /* a one to separate each band. */2185 if (i < ihitBand)2186 LHeaderSum += (band->lcx + SEP_WIDTH);2187 else 2188 RHeaderSum += (band->lcx + SEP_WIDTH);2189 2190 }2179 if (HIDDENBAND(band)) continue; 2180 if (band->iRow == hitBand->iRow) { 2181 imaxdBand = i; 2182 if (imindBand == -1) imindBand = i; 2183 /* minimum size of each band is size of header plus */ 2184 /* size of minimum child plus offset of child from header plus */ 2185 /* a one to separate each band. */ 2186 if (i < ihitBand) 2187 LHeaderSum += (band->lcx + SEP_WIDTH); 2188 else 2189 RHeaderSum += (band->lcx + SEP_WIDTH); 2190 2191 } 2191 2192 } 2192 2193 if (RHeaderSum) RHeaderSum -= SEP_WIDTH; /* no separator afterlast band */ … … 2200 2201 /* limit movement to inside adjustable bands - Left */ 2201 2202 if ( (ptsmove->x < mindBand->rcBand.left) || 2202 (ptsmove->x > maxdBand->rcBand.right) ||2203 (ptsmove->y < mindBand->rcBand.top) ||2204 (ptsmove->y > maxdBand->rcBand.bottom))2203 (ptsmove->x > maxdBand->rcBand.right) || 2204 (ptsmove->y < mindBand->rcBand.top) || 2205 (ptsmove->y > maxdBand->rcBand.bottom)) 2205 2206 return; /* should swap bands */ 2206 2207 2207 2208 if (infoPtr->dwStyle & CCS_VERT) 2208 2209 movement = ptsmove->y - ((hitBand->rcBand.top+REBAR_PRE_GRIPPER) - 2209 infoPtr->ihitoffset);2210 infoPtr->ihitoffset); 2210 2211 else 2211 2212 movement = ptsmove->x - ((hitBand->rcBand.left+REBAR_PRE_GRIPPER) - 2212 infoPtr->ihitoffset);2213 infoPtr->ihitoffset); 2213 2214 infoPtr->dragNow = *ptsmove; 2214 2215 2215 2216 TRACE("before: movement=%d (%d,%d), imindBand=%d, ihitBand=%d, imaxdBand=%d, LSum=%d, RSum=%d\n", 2216 movement, ptsmove->x, ptsmove->y, imindBand, ihitBand,2217 imaxdBand, LHeaderSum, RHeaderSum);2217 movement, ptsmove->x, ptsmove->y, imindBand, ihitBand, 2218 imaxdBand, LHeaderSum, RHeaderSum); 2218 2219 REBAR_DumpBand (infoPtr); 2219 2220 2220 if (movement < 0) { 2221 if (movement < 0) { 2221 2222 2222 2223 /* *** Drag left/up *** */ 2223 2224 compress = rcBlt(hitBand) - rcBlt(mindBand) - 2224 LHeaderSum;2225 if (compress < abs(movement)) {2226 TRACE("limiting left drag, was %d changed to %d\n",2227 movement, -compress);2228 movement = -compress;2229 }2225 LHeaderSum; 2226 if (compress < abs(movement)) { 2227 TRACE("limiting left drag, was %d changed to %d\n", 2228 movement, -compress); 2229 movement = -compress; 2230 } 2230 2231 2231 2232 for (i=ihitBand; i>=imindBand; i--) { 2232 band = &infoPtr->bands[i];2233 if (HIDDENBAND(band)) continue;2234 if (i == ihitBand) {2235 LEADJ(band, movement)2236 }2237 else 2238 movement = REBAR_Shrink (infoPtr, band, movement, i);2239 band->ccx = rcBw(band);2240 }2233 band = &infoPtr->bands[i]; 2234 if (HIDDENBAND(band)) continue; 2235 if (i == ihitBand) { 2236 LEADJ(band, movement) 2237 } 2238 else 2239 movement = REBAR_Shrink (infoPtr, band, movement, i); 2240 band->ccx = rcBw(band); 2241 } 2241 2242 } 2242 2243 else { 2243 BOOL first = TRUE;2244 BOOL first = TRUE; 2244 2245 2245 2246 /* *** Drag right/down *** */ 2246 2247 compress = rcBrb(maxdBand) - rcBlt(hitBand) - 2247 RHeaderSum;2248 if (compress < abs(movement)) {2249 TRACE("limiting right drag, was %d changed to %d\n",2250 movement, compress);2251 movement = compress;2252 }2248 RHeaderSum; 2249 if (compress < abs(movement)) { 2250 TRACE("limiting right drag, was %d changed to %d\n", 2251 movement, compress); 2252 movement = compress; 2253 } 2253 2254 for (i=ihitBand-1; i<=imaxdBand; i++) { 2254 band = &infoPtr->bands[i];2255 if (HIDDENBAND(band)) continue;2256 if (first) {2257 first = FALSE;2258 READJ(band, movement)2259 }2260 else 2261 movement = REBAR_Shrink (infoPtr, band, movement, i);2262 band->ccx = rcBw(band);2263 }2255 band = &infoPtr->bands[i]; 2256 if (HIDDENBAND(band)) continue; 2257 if (first) { 2258 first = FALSE; 2259 READJ(band, movement) 2260 } 2261 else 2262 movement = REBAR_Shrink (infoPtr, band, movement, i); 2263 band->ccx = rcBw(band); 2264 } 2264 2265 } 2265 2266 2266 2267 /* recompute all rectangles */ 2267 2268 if (infoPtr->dwStyle & CCS_VERT) { 2268 REBAR_CalcVertBand (infoPtr, imindBand, imaxdBand+1,2269 FALSE);2269 REBAR_CalcVertBand (infoPtr, imindBand, imaxdBand+1, 2270 FALSE); 2270 2271 } 2271 2272 else { 2272 REBAR_CalcHorzBand (infoPtr, imindBand, imaxdBand+1, 2273 FALSE);2273 REBAR_CalcHorzBand (infoPtr, imindBand, imaxdBand+1, 2274 FALSE); 2274 2275 } 2275 2276 2276 2277 TRACE("bands after adjustment, see band # %d, %d\n", 2277 imindBand, imaxdBand);2278 imindBand, imaxdBand); 2278 2279 REBAR_DumpBand (infoPtr); 2279 2280 2280 SetRect (&newrect, 2281 mindBand->rcBand.left,2282 mindBand->rcBand.top,2283 maxdBand->rcBand.right,2284 maxdBand->rcBand.bottom);2281 SetRect (&newrect, 2282 mindBand->rcBand.left, 2283 mindBand->rcBand.top, 2284 maxdBand->rcBand.right, 2285 maxdBand->rcBand.bottom); 2285 2286 2286 2287 REBAR_MoveChildWindows (infoPtr, imindBand, imaxdBand+1); … … 2304 2305 2305 2306 if (uBand >= infoPtr->uNumBands) 2306 return FALSE;2307 return FALSE; 2307 2308 2308 2309 TRACE("deleting band %u!\n", uBand); … … 2311 2312 2312 2313 if (infoPtr->uNumBands == 1) { 2313 TRACE(" simple delete!\n");2314 if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild)2315 childhwnd = lpBand->hwndChild;2316 COMCTL32_Free (infoPtr->bands);2317 infoPtr->bands = NULL;2318 infoPtr->uNumBands = 0;2314 TRACE(" simple delete!\n"); 2315 if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild) 2316 childhwnd = lpBand->hwndChild; 2317 COMCTL32_Free (infoPtr->bands); 2318 infoPtr->bands = NULL; 2319 infoPtr->uNumBands = 0; 2319 2320 } 2320 2321 else { 2321 REBAR_BAND *oldBands = infoPtr->bands;2322 REBAR_BAND *oldBands = infoPtr->bands; 2322 2323 TRACE("complex delete! [uBand=%u]\n", uBand); 2323 2324 2324 if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild)2325 childhwnd = lpBand->hwndChild;2326 2327 infoPtr->uNumBands--;2328 infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands);2325 if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild) 2326 childhwnd = lpBand->hwndChild; 2327 2328 infoPtr->uNumBands--; 2329 infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands); 2329 2330 if (uBand > 0) { 2330 2331 memcpy (&infoPtr->bands[0], &oldBands[0], … … 2337 2338 } 2338 2339 2339 COMCTL32_Free (oldBands);2340 COMCTL32_Free (oldBands); 2340 2341 } 2341 2342 … … 2369 2370 2370 2371 if (!lParam) 2371 return 0;2372 return 0; 2372 2373 if ((UINT)wParam >= infoPtr->uNumBands) 2373 return 0;2374 return 0; 2374 2375 2375 2376 lpBand = &infoPtr->bands[(UINT)wParam]; … … 2381 2382 /* style. - GA */ 2382 2383 if (infoPtr->dwStyle & RBS_BANDBORDERS) { 2383 if (infoPtr->dwStyle & CCS_VERT) { 2384 lpRect->left = 1; 2385 lpRect->top = lpBand->cxHeader + 4; 2386 lpRect->right = 1; 2387 lpRect->bottom = 0; 2388 } 2389 else { 2390 lpRect->left = lpBand->cxHeader + 4; 2391 lpRect->top = 1; 2392 lpRect->right = 0; 2393 lpRect->bottom = 1; 2394 } 2384 if (infoPtr->dwStyle & CCS_VERT) { 2385 lpRect->left = 1; 2386 lpRect->top = lpBand->cxHeader + 4; 2387 lpRect->right = 1; 2388 lpRect->bottom = 0; 2395 2389 } 2396 2390 else { 2397 lpRect->left = lpBand->cxHeader; 2391 lpRect->left = lpBand->cxHeader + 4; 2392 lpRect->top = 1; 2393 lpRect->right = 0; 2394 lpRect->bottom = 1; 2395 } 2396 } 2397 else { 2398 lpRect->left = lpBand->cxHeader; 2398 2399 } 2399 2400 return 0; … … 2417 2418 2418 2419 if (lprbbi == NULL) 2419 return FALSE;2420 return FALSE; 2420 2421 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) 2421 return FALSE;2422 return FALSE; 2422 2423 if ((UINT)wParam >= infoPtr->uNumBands) 2423 return FALSE;2424 return FALSE; 2424 2425 2425 2426 TRACE("index %u\n", (UINT)wParam); … … 2429 2430 2430 2431 if (lprbbi->fMask & RBBIM_STYLE) 2431 lprbbi->fStyle = lpBand->fStyle;2432 lprbbi->fStyle = lpBand->fStyle; 2432 2433 2433 2434 if (lprbbi->fMask & RBBIM_COLORS) { 2434 lprbbi->clrFore = lpBand->clrFore;2435 lprbbi->clrBack = lpBand->clrBack;2436 if (lprbbi->clrBack == CLR_NONE)2437 lprbbi->clrBack = infoPtr->clrBtnFace;2435 lprbbi->clrFore = lpBand->clrFore; 2436 lprbbi->clrBack = lpBand->clrBack; 2437 if (lprbbi->clrBack == CLR_NONE) 2438 lprbbi->clrBack = infoPtr->clrBtnFace; 2438 2439 } 2439 2440 … … 2445 2446 lprbbi->lpText[lprbbi->cch-1] = 0; 2446 2447 } 2447 else 2448 *lprbbi->lpText = 0;2448 else 2449 *lprbbi->lpText = 0; 2449 2450 } 2450 2451 2451 2452 if (lprbbi->fMask & RBBIM_IMAGE) { 2452 2453 if (lpBand->fMask & RBBIM_IMAGE) 2453 lprbbi->iImage = lpBand->iImage;2454 lprbbi->iImage = lpBand->iImage; 2454 2455 else 2455 lprbbi->iImage = -1;2456 lprbbi->iImage = -1; 2456 2457 } 2457 2458 2458 2459 if (lprbbi->fMask & RBBIM_CHILD) 2459 lprbbi->hwndChild = lpBand->hwndChild;2460 lprbbi->hwndChild = lpBand->hwndChild; 2460 2461 2461 2462 if (lprbbi->fMask & RBBIM_CHILDSIZE) { 2462 lprbbi->cxMinChild = lpBand->cxMinChild;2463 lprbbi->cyMinChild = lpBand->cyMinChild;2464 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {2465 lprbbi->cyChild = lpBand->cyChild;2466 lprbbi->cyMaxChild = lpBand->cyMaxChild;2467 lprbbi->cyIntegral = lpBand->cyIntegral;2468 }2463 lprbbi->cxMinChild = lpBand->cxMinChild; 2464 lprbbi->cyMinChild = lpBand->cyMinChild; 2465 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { 2466 lprbbi->cyChild = lpBand->cyChild; 2467 lprbbi->cyMaxChild = lpBand->cyMaxChild; 2468 lprbbi->cyIntegral = lpBand->cyIntegral; 2469 } 2469 2470 } 2470 2471 2471 2472 if (lprbbi->fMask & RBBIM_SIZE) 2472 lprbbi->cx = lpBand->cx;2473 lprbbi->cx = lpBand->cx; 2473 2474 2474 2475 if (lprbbi->fMask & RBBIM_BACKGROUND) 2475 lprbbi->hbmBack = lpBand->hbmBack;2476 lprbbi->hbmBack = lpBand->hbmBack; 2476 2477 2477 2478 if (lprbbi->fMask & RBBIM_ID) 2478 lprbbi->wID = lpBand->wID;2479 lprbbi->wID = lpBand->wID; 2479 2480 2480 2481 /* check for additional data */ 2481 2482 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { 2482 if (lprbbi->fMask & RBBIM_IDEALSIZE)2483 lprbbi->cxIdeal = lpBand->cxIdeal;2484 2485 if (lprbbi->fMask & RBBIM_LPARAM)2486 lprbbi->lParam = lpBand->lParam;2487 2488 if (lprbbi->fMask & RBBIM_HEADERSIZE)2489 lprbbi->cxHeader = lpBand->cxHeader;2483 if (lprbbi->fMask & RBBIM_IDEALSIZE) 2484 lprbbi->cxIdeal = lpBand->cxIdeal; 2485 2486 if (lprbbi->fMask & RBBIM_LPARAM) 2487 lprbbi->lParam = lpBand->lParam; 2488 2489 if (lprbbi->fMask & RBBIM_HEADERSIZE) 2490 lprbbi->cxHeader = lpBand->cxHeader; 2490 2491 } 2491 2492 … … 2503 2504 2504 2505 if (lprbbi == NULL) 2505 return FALSE;2506 return FALSE; 2506 2507 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) 2507 return FALSE;2508 return FALSE; 2508 2509 if ((UINT)wParam >= infoPtr->uNumBands) 2509 return FALSE;2510 return FALSE; 2510 2511 2511 2512 TRACE("index %u\n", (UINT)wParam); … … 2515 2516 2516 2517 if (lprbbi->fMask & RBBIM_STYLE) 2517 lprbbi->fStyle = lpBand->fStyle;2518 lprbbi->fStyle = lpBand->fStyle; 2518 2519 2519 2520 if (lprbbi->fMask & RBBIM_COLORS) { 2520 lprbbi->clrFore = lpBand->clrFore;2521 lprbbi->clrBack = lpBand->clrBack;2522 if (lprbbi->clrBack == CLR_NONE)2523 lprbbi->clrBack = infoPtr->clrBtnFace;2521 lprbbi->clrFore = lpBand->clrFore; 2522 lprbbi->clrBack = lpBand->clrBack; 2523 if (lprbbi->clrBack == CLR_NONE) 2524 lprbbi->clrBack = infoPtr->clrBtnFace; 2524 2525 } 2525 2526 2526 2527 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { 2527 2528 if (lpBand->lpText && (lpBand->fMask & RBBIM_TEXT)) 2528 lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch);2529 else 2530 *lprbbi->lpText = 0;2529 lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch); 2530 else 2531 *lprbbi->lpText = 0; 2531 2532 } 2532 2533 2533 2534 if (lprbbi->fMask & RBBIM_IMAGE) { 2534 2535 if (lpBand->fMask & RBBIM_IMAGE) 2535 lprbbi->iImage = lpBand->iImage;2536 lprbbi->iImage = lpBand->iImage; 2536 2537 else 2537 lprbbi->iImage = -1;2538 lprbbi->iImage = -1; 2538 2539 } 2539 2540 2540 2541 if (lprbbi->fMask & RBBIM_CHILD) 2541 lprbbi->hwndChild = lpBand->hwndChild;2542 lprbbi->hwndChild = lpBand->hwndChild; 2542 2543 2543 2544 if (lprbbi->fMask & RBBIM_CHILDSIZE) { 2544 lprbbi->cxMinChild = lpBand->cxMinChild;2545 lprbbi->cyMinChild = lpBand->cyMinChild;2546 if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) {2547 lprbbi->cyChild = lpBand->cyChild;2548 lprbbi->cyMaxChild = lpBand->cyMaxChild;2549 lprbbi->cyIntegral = lpBand->cyIntegral;2550 }2545 lprbbi->cxMinChild = lpBand->cxMinChild; 2546 lprbbi->cyMinChild = lpBand->cyMinChild; 2547 if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) { 2548 lprbbi->cyChild = lpBand->cyChild; 2549 lprbbi->cyMaxChild = lpBand->cyMaxChild; 2550 lprbbi->cyIntegral = lpBand->cyIntegral; 2551 } 2551 2552 } 2552 2553 2553 2554 if (lprbbi->fMask & RBBIM_SIZE) 2554 lprbbi->cx = lpBand->cx;2555 lprbbi->cx = lpBand->cx; 2555 2556 2556 2557 if (lprbbi->fMask & RBBIM_BACKGROUND) 2557 lprbbi->hbmBack = lpBand->hbmBack;2558 lprbbi->hbmBack = lpBand->hbmBack; 2558 2559 2559 2560 if (lprbbi->fMask & RBBIM_ID) 2560 lprbbi->wID = lpBand->wID;2561 lprbbi->wID = lpBand->wID; 2561 2562 2562 2563 /* check for additional data */ 2563 2564 if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) { 2564 if (lprbbi->fMask & RBBIM_IDEALSIZE)2565 lprbbi->cxIdeal = lpBand->cxIdeal;2566 2567 if (lprbbi->fMask & RBBIM_LPARAM)2568 lprbbi->lParam = lpBand->lParam;2569 2570 if (lprbbi->fMask & RBBIM_HEADERSIZE)2571 lprbbi->cxHeader = lpBand->cxHeader;2565 if (lprbbi->fMask & RBBIM_IDEALSIZE) 2566 lprbbi->cxIdeal = lpBand->cxIdeal; 2567 2568 if (lprbbi->fMask & RBBIM_LPARAM) 2569 lprbbi->lParam = lpBand->lParam; 2570 2571 if (lprbbi->fMask & RBBIM_HEADERSIZE) 2572 lprbbi->cxHeader = lpBand->cxHeader; 2572 2573 } 2573 2574 … … 2597 2598 2598 2599 if (lpInfo == NULL) 2599 return FALSE;2600 return FALSE; 2600 2601 2601 2602 if (lpInfo->cbSize < sizeof (REBARINFO)) 2602 return FALSE;2603 return FALSE; 2603 2604 2604 2605 TRACE("getting bar info!\n"); 2605 2606 2606 2607 if (infoPtr->himl) { 2607 lpInfo->himl = infoPtr->himl;2608 lpInfo->fMask |= RBIM_IMAGELIST;2608 lpInfo->himl = infoPtr->himl; 2609 lpInfo->fMask |= RBIM_IMAGELIST; 2609 2610 } 2610 2611 … … 2648 2649 2649 2650 if ((iBand < 0) && ((UINT)iBand >= infoPtr->uNumBands)) 2650 return FALSE;2651 return FALSE; 2651 2652 if (!lprc) 2652 return FALSE;2653 return FALSE; 2653 2654 2654 2655 lpBand = &infoPtr->bands[iBand]; … … 2656 2657 2657 2658 TRACE("band %d, (%d,%d)-(%d,%d)\n", iBand, 2658 lprc->left, lprc->top, lprc->right, lprc->bottom);2659 lprc->left, lprc->top, lprc->right, lprc->bottom); 2659 2660 2660 2661 return TRUE; … … 2680 2681 2681 2682 for (i=0; i<infoPtr->uNumBands; i++) { 2682 lpBand = &infoPtr->bands[i];2683 if (HIDDENBAND(lpBand)) continue;2684 if (lpBand->iRow != iRow) continue;2685 if (infoPtr->dwStyle & CCS_VERT)2686 j = lpBand->rcBand.right - lpBand->rcBand.left;2687 else2688 j = lpBand->rcBand.bottom - lpBand->rcBand.top;2689 if (j > ret) ret = j;2683 lpBand = &infoPtr->bands[i]; 2684 if (HIDDENBAND(lpBand)) continue; 2685 if (lpBand->iRow != iRow) continue; 2686 if (infoPtr->dwStyle & CCS_VERT) 2687 j = lpBand->rcBand.right - lpBand->rcBand.left; 2688 else 2689 j = lpBand->rcBand.bottom - lpBand->rcBand.top; 2690 if (j > ret) ret = j; 2690 2691 } 2691 2692 … … 2715 2716 REBAR_GetUnicodeFormat (REBAR_INFO *infoPtr) 2716 2717 { 2717 TRACE("%s hwnd=0x%x\n", 2718 infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf);2718 TRACE("%s hwnd=0x%x\n", 2719 infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf); 2719 2720 2720 2721 return infoPtr->bUnicode; … … 2733 2734 REBAR_HitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2734 2735 { 2735 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; 2736 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; 2736 2737 2737 2738 if (!lprbht) 2738 return -1;2739 return -1; 2739 2740 2740 2741 REBAR_InternalHitTest (infoPtr, &lprbht->pt, &lprbht->flags, &lprbht->iBand); … … 2750 2751 2751 2752 if (infoPtr == NULL) 2752 return -1;2753 return -1; 2753 2754 2754 2755 if (infoPtr->uNumBands < 1) 2755 return -1;2756 return -1; 2756 2757 2757 2758 for (i = 0; i < infoPtr->uNumBands; i++) { 2758 if (infoPtr->bands[i].wID == (UINT)wParam) {2759 TRACE("id %u is band %u found!\n", (UINT)wParam, i);2760 return i;2761 }2759 if (infoPtr->bands[i].wID == (UINT)wParam) { 2760 TRACE("id %u is band %u found!\n", (UINT)wParam, i); 2761 return i; 2762 } 2762 2763 } 2763 2764 … … 2775 2776 2776 2777 if (infoPtr == NULL) 2777 return FALSE;2778 return FALSE; 2778 2779 if (lprbbi == NULL) 2779 return FALSE;2780 return FALSE; 2780 2781 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) 2781 return FALSE;2782 return FALSE; 2782 2783 2783 2784 /* trace the index as signed to see the -1 */ … … 2786 2787 2787 2788 if (infoPtr->uNumBands == 0) { 2788 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));2789 uIndex = 0;2789 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND)); 2790 uIndex = 0; 2790 2791 } 2791 2792 else { 2792 REBAR_BAND *oldBands = infoPtr->bands;2793 infoPtr->bands =2794 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));2795 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))2796 uIndex = infoPtr->uNumBands;2797 2798 /* pre insert copy */2799 if (uIndex > 0) {2800 memcpy (&infoPtr->bands[0], &oldBands[0],2801 uIndex * sizeof(REBAR_BAND));2802 }2803 2804 /* post copy */2805 if (uIndex < infoPtr->uNumBands - 1) {2806 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],2807 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));2808 }2809 2810 COMCTL32_Free (oldBands);2793 REBAR_BAND *oldBands = infoPtr->bands; 2794 infoPtr->bands = 2795 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND)); 2796 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands)) 2797 uIndex = infoPtr->uNumBands; 2798 2799 /* pre insert copy */ 2800 if (uIndex > 0) { 2801 memcpy (&infoPtr->bands[0], &oldBands[0], 2802 uIndex * sizeof(REBAR_BAND)); 2803 } 2804 2805 /* post copy */ 2806 if (uIndex < infoPtr->uNumBands - 1) { 2807 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex], 2808 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND)); 2809 } 2810 2811 COMCTL32_Free (oldBands); 2811 2812 } 2812 2813 … … 2831 2832 lpBand->lpText = (LPWSTR)COMCTL32_Alloc (len*sizeof(WCHAR)); 2832 2833 MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len ); 2833 }2834 } 2834 2835 } 2835 2836 … … 2837 2838 /* On insert of second band, revalidate band 1 to possible add gripper */ 2838 2839 if (infoPtr->uNumBands == 2) 2839 REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);2840 REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]); 2840 2841 2841 2842 REBAR_DumpBand (infoPtr); … … 2855 2856 2856 2857 if (infoPtr == NULL) 2857 return FALSE;2858 return FALSE; 2858 2859 if (lprbbi == NULL) 2859 return FALSE;2860 return FALSE; 2860 2861 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) 2861 return FALSE;2862 return FALSE; 2862 2863 2863 2864 /* trace the index as signed to see the -1 */ … … 2866 2867 2867 2868 if (infoPtr->uNumBands == 0) { 2868 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));2869 uIndex = 0;2869 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND)); 2870 uIndex = 0; 2870 2871 } 2871 2872 else { 2872 REBAR_BAND *oldBands = infoPtr->bands;2873 infoPtr->bands =2874 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));2875 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))2876 uIndex = infoPtr->uNumBands;2877 2878 /* pre insert copy */2879 if (uIndex > 0) {2880 memcpy (&infoPtr->bands[0], &oldBands[0],2881 uIndex * sizeof(REBAR_BAND));2882 }2883 2884 /* post copy */2885 if (uIndex < infoPtr->uNumBands - 1) {2886 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],2887 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));2888 }2889 2890 COMCTL32_Free (oldBands);2873 REBAR_BAND *oldBands = infoPtr->bands; 2874 infoPtr->bands = 2875 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND)); 2876 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands)) 2877 uIndex = infoPtr->uNumBands; 2878 2879 /* pre insert copy */ 2880 if (uIndex > 0) { 2881 memcpy (&infoPtr->bands[0], &oldBands[0], 2882 uIndex * sizeof(REBAR_BAND)); 2883 } 2884 2885 /* post copy */ 2886 if (uIndex < infoPtr->uNumBands - 1) { 2887 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex], 2888 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND)); 2889 } 2890 2891 COMCTL32_Free (oldBands); 2891 2892 } 2892 2893 … … 2907 2908 lpBand->lpText = NULL; 2908 2909 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { 2909 INT len = lstrlenW (lprbbi->lpText);2910 if (len > 0) {2911 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));2912 strcpyW (lpBand->lpText, lprbbi->lpText);2913 }2910 INT len = lstrlenW (lprbbi->lpText); 2911 if (len > 0) { 2912 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 2913 strcpyW (lpBand->lpText, lprbbi->lpText); 2914 } 2914 2915 } 2915 2916 … … 2917 2918 /* On insert of second band, revalidate band 1 to possible add gripper */ 2918 2919 if (infoPtr->uNumBands == 2) 2919 REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);2920 REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]); 2920 2921 2921 2922 REBAR_DumpBand (infoPtr); … … 2931 2932 { 2932 2933 FIXME("(uBand = %u fIdeal = %s) stub\n", 2933 (UINT)wParam, lParam ? "TRUE" : "FALSE");2934 (UINT)wParam, lParam ? "TRUE" : "FALSE"); 2934 2935 2935 2936 return 0; … … 2954 2955 /* Validate */ 2955 2956 if ((infoPtr->uNumBands == 0) || 2956 ((INT)uBand < 0) || (uBand >= infoPtr->uNumBands)) {2957 /* error !!! */2958 ERR("Illegal MinimizeBand, requested=%d, current band count=%d\n",2959 (INT)uBand, infoPtr->uNumBands);2960 return FALSE;2957 ((INT)uBand < 0) || (uBand >= infoPtr->uNumBands)) { 2958 /* error !!! */ 2959 ERR("Illegal MinimizeBand, requested=%d, current band count=%d\n", 2960 (INT)uBand, infoPtr->uNumBands); 2961 return FALSE; 2961 2962 } 2962 2963 … … 2965 2966 2966 2967 if (infoPtr->dwStyle & CCS_VERT) 2967 movement = lpBand->rcBand.bottom - lpBand->rcBand.top -2968 lpBand->cxHeader;2968 movement = lpBand->rcBand.bottom - lpBand->rcBand.top - 2969 lpBand->cxHeader; 2969 2970 else 2970 movement = lpBand->rcBand.right - lpBand->rcBand.left -2971 lpBand->cxHeader;2971 movement = lpBand->rcBand.right - lpBand->rcBand.left - 2972 lpBand->cxHeader; 2972 2973 if (movement < 0) { 2973 ERR("something is wrong, band=(%d,%d)-(%d,%d), cxheader=%d\n",2974 lpBand->rcBand.left, lpBand->rcBand.top,2975 lpBand->rcBand.right, lpBand->rcBand.bottom,2976 lpBand->cxHeader);2977 return FALSE;2974 ERR("something is wrong, band=(%d,%d)-(%d,%d), cxheader=%d\n", 2975 lpBand->rcBand.left, lpBand->rcBand.top, 2976 lpBand->rcBand.right, lpBand->rcBand.bottom, 2977 lpBand->cxHeader); 2978 return FALSE; 2978 2979 } 2979 2980 … … 2985 2986 for (i=0; i<infoPtr->uNumBands; i++) { 2986 2987 band = &infoPtr->bands[i]; 2987 if (HIDDENBAND(band)) continue;2988 if (band->iRow == lpBand->iRow) {2989 imaxdBand = i;2990 if (imindBand == -1) imindBand = i;2991 }2988 if (HIDDENBAND(band)) continue; 2989 if (band->iRow == lpBand->iRow) { 2990 imaxdBand = i; 2991 if (imindBand == -1) imindBand = i; 2992 } 2992 2993 } 2993 2994 … … 2995 2996 /* next visible band */ 2996 2997 if (imindBand == uBand) { 2997 band = NULL;2998 movement = -movement;2999 /* find the first visible band to the right of the selected band */3000 for (i=uBand+1; i<=imaxdBand; i++) {3001 band = &infoPtr->bands[i];3002 if (!HIDDENBAND(band)) {3003 iprevBand = i;3004 LEADJ(band, movement);3005 band->ccx = rcBw(band);3006 break;3007 }3008 }3009 /* what case is this */3010 if (iprevBand == -1) {3011 ERR("no previous visible band\n");3012 return FALSE;3013 }3014 startBand = uBand;3015 endBand = iprevBand;3016 SetRect (&newrect, 3017 lpBand->rcBand.left,3018 lpBand->rcBand.top,3019 band->rcBand.right,3020 band->rcBand.bottom);2998 band = NULL; 2999 movement = -movement; 3000 /* find the first visible band to the right of the selected band */ 3001 for (i=uBand+1; i<=imaxdBand; i++) { 3002 band = &infoPtr->bands[i]; 3003 if (!HIDDENBAND(band)) { 3004 iprevBand = i; 3005 LEADJ(band, movement); 3006 band->ccx = rcBw(band); 3007 break; 3008 } 3009 } 3010 /* what case is this */ 3011 if (iprevBand == -1) { 3012 ERR("no previous visible band\n"); 3013 return FALSE; 3014 } 3015 startBand = uBand; 3016 endBand = iprevBand; 3017 SetRect (&newrect, 3018 lpBand->rcBand.left, 3019 lpBand->rcBand.top, 3020 band->rcBand.right, 3021 band->rcBand.bottom); 3021 3022 } 3022 3023 /* otherwise expand previous visible band */ 3023 3024 else { 3024 band = NULL;3025 /* find the first visible band to the left of the selected band */3026 for (i=uBand-1; i>=imindBand; i--) {3027 band = &infoPtr->bands[i];3028 if (!HIDDENBAND(band)) {3029 iprevBand = i;3030 READJ(band, movement);3031 band->ccx = rcBw(band);3032 break;3033 }3034 }3035 /* what case is this */3036 if (iprevBand == -1) {3037 ERR("no previous visible band\n");3038 return FALSE;3039 }3040 startBand = iprevBand;3041 endBand = uBand;3042 SetRect (&newrect, 3043 band->rcBand.left,3044 band->rcBand.top,3045 lpBand->rcBand.right,3046 lpBand->rcBand.bottom);3025 band = NULL; 3026 /* find the first visible band to the left of the selected band */ 3027 for (i=uBand-1; i>=imindBand; i--) { 3028 band = &infoPtr->bands[i]; 3029 if (!HIDDENBAND(band)) { 3030 iprevBand = i; 3031 READJ(band, movement); 3032 band->ccx = rcBw(band); 3033 break; 3034 } 3035 } 3036 /* what case is this */ 3037 if (iprevBand == -1) { 3038 ERR("no previous visible band\n"); 3039 return FALSE; 3040 } 3041 startBand = iprevBand; 3042 endBand = uBand; 3043 SetRect (&newrect, 3044 band->rcBand.left, 3045 band->rcBand.top, 3046 lpBand->rcBand.right, 3047 lpBand->rcBand.bottom); 3047 3048 } 3048 3049 … … 3051 3052 /* recompute all rectangles */ 3052 3053 if (infoPtr->dwStyle & CCS_VERT) { 3053 REBAR_CalcVertBand (infoPtr, startBand, endBand+1,3054 FALSE);3054 REBAR_CalcVertBand (infoPtr, startBand, endBand+1, 3055 FALSE); 3055 3056 } 3056 3057 else { 3057 REBAR_CalcHorzBand (infoPtr, startBand, endBand+1, 3058 FALSE);3058 REBAR_CalcHorzBand (infoPtr, startBand, endBand+1, 3059 FALSE); 3059 3060 } 3060 3061 3061 3062 TRACE("bands after minimize, see band # %d, %d\n", 3062 startBand, endBand);3063 startBand, endBand); 3063 3064 REBAR_DumpBand (infoPtr); 3064 3065 … … 3081 3082 /* Validate */ 3082 3083 if ((infoPtr->uNumBands == 0) || 3083 ((INT)uFrom < 0) || (uFrom >= infoPtr->uNumBands) ||3084 ((INT)uTo < 0) || (uTo >= infoPtr->uNumBands)) {3085 /* error !!! */3086 ERR("Illegal MoveBand, from=%d, to=%d, current band count=%d\n",3087 (INT)uFrom, (INT)uTo, infoPtr->uNumBands);3088 return FALSE;3084 ((INT)uFrom < 0) || (uFrom >= infoPtr->uNumBands) || 3085 ((INT)uTo < 0) || (uTo >= infoPtr->uNumBands)) { 3086 /* error !!! */ 3087 ERR("Illegal MoveBand, from=%d, to=%d, current band count=%d\n", 3088 (INT)uFrom, (INT)uTo, infoPtr->uNumBands); 3089 return FALSE; 3089 3090 } 3090 3091 … … 3094 3095 /* close up rest of bands (psuedo delete) */ 3095 3096 if (uFrom < infoPtr->uNumBands - 1) { 3096 memcpy (&oldBands[uFrom], &oldBands[uFrom+1],3097 (infoPtr->uNumBands - uFrom - 1) * sizeof(REBAR_BAND));3097 memcpy (&oldBands[uFrom], &oldBands[uFrom+1], 3098 (infoPtr->uNumBands - uFrom - 1) * sizeof(REBAR_BAND)); 3098 3099 } 3099 3100 3100 3101 /* allocate new space and copy rest of bands into it */ 3101 3102 infoPtr->bands = 3102 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND));3103 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND)); 3103 3104 3104 3105 /* pre insert copy */ 3105 3106 if (uTo > 0) { 3106 memcpy (&infoPtr->bands[0], &oldBands[0],3107 uTo * sizeof(REBAR_BAND));3107 memcpy (&infoPtr->bands[0], &oldBands[0], 3108 uTo * sizeof(REBAR_BAND)); 3108 3109 } 3109 3110 … … 3113 3114 /* post copy */ 3114 3115 if (uTo < infoPtr->uNumBands - 1) { 3115 memcpy (&infoPtr->bands[uTo+1], &oldBands[uTo],3116 (infoPtr->uNumBands - uTo - 1) * sizeof(REBAR_BAND));3116 memcpy (&infoPtr->bands[uTo+1], &oldBands[uTo], 3117 (infoPtr->uNumBands - uTo - 1) * sizeof(REBAR_BAND)); 3117 3118 } 3118 3119 … … 3143 3144 3144 3145 if (lprbbi == NULL) 3145 return FALSE;3146 return FALSE; 3146 3147 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) 3147 return FALSE;3148 return FALSE; 3148 3149 if ((UINT)wParam >= infoPtr->uNumBands) 3149 return FALSE;3150 return FALSE; 3150 3151 3151 3152 TRACE("index %u\n", (UINT)wParam); … … 3157 3158 REBAR_CommonSetupBand (infoPtr->hwndSelf, lprbbi, lpBand); 3158 3159 if (lprbbi->fMask & RBBIM_TEXT) { 3159 if (lpBand->lpText) {3160 COMCTL32_Free (lpBand->lpText);3161 lpBand->lpText = NULL;3162 }3163 if (lprbbi->lpText) {3160 if (lpBand->lpText) { 3161 COMCTL32_Free (lpBand->lpText); 3162 lpBand->lpText = NULL; 3163 } 3164 if (lprbbi->lpText) { 3164 3165 INT len = MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, NULL, 0 ); 3165 3166 lpBand->lpText = (LPWSTR)COMCTL32_Alloc (len*sizeof(WCHAR)); 3166 3167 MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len ); 3167 }3168 } 3168 3169 } 3169 3170 … … 3173 3174 3174 3175 if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) 3175 REBAR_Layout (infoPtr, NULL, TRUE, FALSE);3176 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 3176 3177 3177 3178 return TRUE; … … 3186 3187 3187 3188 if (lprbbi == NULL) 3188 return FALSE;3189 return FALSE; 3189 3190 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) 3190 return FALSE;3191 return FALSE; 3191 3192 if ((UINT)wParam >= infoPtr->uNumBands) 3192 return FALSE;3193 return FALSE; 3193 3194 3194 3195 TRACE("index %u\n", (UINT)wParam); … … 3200 3201 REBAR_CommonSetupBand (infoPtr->hwndSelf, (LPREBARBANDINFOA)lprbbi, lpBand); 3201 3202 if (lprbbi->fMask & RBBIM_TEXT) { 3202 if (lpBand->lpText) {3203 COMCTL32_Free (lpBand->lpText);3204 lpBand->lpText = NULL;3205 }3206 if (lprbbi->lpText) {3207 INT len = lstrlenW (lprbbi->lpText);3208 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));3209 strcpyW (lpBand->lpText, lprbbi->lpText);3210 }3203 if (lpBand->lpText) { 3204 COMCTL32_Free (lpBand->lpText); 3205 lpBand->lpText = NULL; 3206 } 3207 if (lprbbi->lpText) { 3208 INT len = lstrlenW (lprbbi->lpText); 3209 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 3210 strcpyW (lpBand->lpText, lprbbi->lpText); 3211 } 3211 3212 } 3212 3213 … … 3230 3231 3231 3232 if (lpInfo == NULL) 3232 return FALSE;3233 return FALSE; 3233 3234 3234 3235 if (lpInfo->cbSize < sizeof (REBARINFO)) 3235 return FALSE;3236 return FALSE; 3236 3237 3237 3238 TRACE("setting bar info!\n"); 3238 3239 3239 3240 if (lpInfo->fMask & RBIM_IMAGELIST) { 3240 infoPtr->himl = lpInfo->himl;3241 if (infoPtr->himl) {3241 infoPtr->himl = lpInfo->himl; 3242 if (infoPtr->himl) { 3242 3243 INT cx, cy; 3243 ImageList_GetIconSize (infoPtr->himl, &cx, &cy);3244 infoPtr->imageSize.cx = cx;3245 infoPtr->imageSize.cy = cy;3246 }3247 else {3248 infoPtr->imageSize.cx = 0;3249 infoPtr->imageSize.cy = 0;3250 }3251 TRACE("new image cx=%ld, cy=%ld\n", infoPtr->imageSize.cx,3252 infoPtr->imageSize.cy);3244 ImageList_GetIconSize (infoPtr->himl, &cx, &cy); 3245 infoPtr->imageSize.cx = cx; 3246 infoPtr->imageSize.cy = cy; 3247 } 3248 else { 3249 infoPtr->imageSize.cx = 0; 3250 infoPtr->imageSize.cy = 0; 3251 } 3252 TRACE("new image cx=%ld, cy=%ld\n", infoPtr->imageSize.cx, 3253 infoPtr->imageSize.cy); 3253 3254 } 3254 3255 … … 3256 3257 for (i=0; i<infoPtr->uNumBands; i++) { 3257 3258 lpBand = &infoPtr->bands[i]; 3258 REBAR_ValidateBand (infoPtr, lpBand);3259 REBAR_ValidateBand (infoPtr, lpBand); 3259 3260 } 3260 3261 … … 3314 3315 BOOL bTemp = infoPtr->bUnicode; 3315 3316 3316 TRACE("to %s hwnd=0x%04x, was %s\n", 3317 ((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf,3318 (bTemp) ? "TRUE" : "FALSE");3317 TRACE("to %s hwnd=0x%04x, was %s\n", 3318 ((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf, 3319 (bTemp) ? "TRUE" : "FALSE"); 3319 3320 3320 3321 infoPtr->bUnicode = (BOOL)wParam; 3321 3322 3322 3323 return bTemp; 3323 3324 } … … 3330 3331 3331 3332 if (iVersion > COMCTL32_VERSION) 3332 return -1;3333 return -1; 3333 3334 3334 3335 infoPtr->iVersion = iVersion; … … 3346 3347 3347 3348 if (((INT)wParam < 0) || ((INT)wParam > infoPtr->uNumBands)) 3348 return FALSE;3349 return FALSE; 3349 3350 3350 3351 lpBand = &infoPtr->bands[(INT)wParam]; 3351 3352 3352 3353 if ((BOOL)lParam) { 3353 TRACE("show band %d\n", (INT)wParam);3354 lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN;3355 if (IsWindow (lpBand->hwndChild))3356 ShowWindow (lpBand->hwndChild, SW_SHOW);3354 TRACE("show band %d\n", (INT)wParam); 3355 lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN; 3356 if (IsWindow (lpBand->hwndChild)) 3357 ShowWindow (lpBand->hwndChild, SW_SHOW); 3357 3358 } 3358 3359 else { 3359 TRACE("hide band %d\n", (INT)wParam);3360 lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN;3361 if (IsWindow (lpBand->hwndChild))3362 ShowWindow (lpBand->hwndChild, SW_HIDE);3360 TRACE("hide band %d\n", (INT)wParam); 3361 lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN; 3362 if (IsWindow (lpBand->hwndChild)) 3363 ShowWindow (lpBand->hwndChild, SW_HIDE); 3363 3364 } 3364 3365 … … 3379 3380 3380 3381 TRACE("[%d %d %d %d]\n", 3381 lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);3382 lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); 3382 3383 3383 3384 /* what is going on???? */ 3384 3385 GetWindowRect(infoPtr->hwndSelf, &t1); 3385 3386 TRACE("window rect [%d %d %d %d]\n", 3386 t1.left, t1.top, t1.right, t1.bottom);3387 t1.left, t1.top, t1.right, t1.bottom); 3387 3388 GetClientRect(infoPtr->hwndSelf, &t1); 3388 3389 TRACE("client rect [%d %d %d %d]\n", 3389 t1.left, t1.top, t1.right, t1.bottom);3390 t1.left, t1.top, t1.right, t1.bottom); 3390 3391 3391 3392 /* force full _Layout processing */ … … 3406 3407 3407 3408 if (TRACE_ON(rebar)) { 3408 GetWindowRect(infoPtr->hwndSelf, &wnrc1);3409 GetClientRect(infoPtr->hwndSelf, &clrc1);3410 TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",3411 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,3412 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,3413 cs->x, cs->y, cs->cx, cs->cy);3409 GetWindowRect(infoPtr->hwndSelf, &wnrc1); 3410 GetClientRect(infoPtr->hwndSelf, &clrc1); 3411 TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n", 3412 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 3413 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom, 3414 cs->x, cs->y, cs->cx, cs->cy); 3414 3415 } 3415 3416 … … 3428 3429 /* free rebar bands */ 3429 3430 if ((infoPtr->uNumBands > 0) && infoPtr->bands) { 3430 /* clean up each band */3431 for (i = 0; i < infoPtr->uNumBands; i++) {3432 lpBand = &infoPtr->bands[i];3433 3434 /* delete text strings */3435 if (lpBand->lpText) {3436 COMCTL32_Free (lpBand->lpText);3437 lpBand->lpText = NULL;3438 }3439 /* destroy child window */3440 DestroyWindow (lpBand->hwndChild);3441 }3442 3443 /* free band array */3444 COMCTL32_Free (infoPtr->bands);3445 infoPtr->bands = NULL;3431 /* clean up each band */ 3432 for (i = 0; i < infoPtr->uNumBands; i++) { 3433 lpBand = &infoPtr->bands[i]; 3434 3435 /* delete text strings */ 3436 if (lpBand->lpText) { 3437 COMCTL32_Free (lpBand->lpText); 3438 lpBand->lpText = NULL; 3439 } 3440 /* destroy child window */ 3441 DestroyWindow (lpBand->hwndChild); 3442 } 3443 3444 /* free band array */ 3445 COMCTL32_Free (infoPtr->bands); 3446 infoPtr->bands = NULL; 3446 3447 } 3447 3448 … … 3522 3523 if (infoPtr->fStatus & BEGIN_DRAG_ISSUED) { 3523 3524 REBAR_Notify((NMHDR *) &layout, infoPtr, RBN_LAYOUTCHANGED); 3524 REBAR_Notify_NMREBAR (infoPtr, ihitBand, RBN_ENDDRAG);3525 infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED;3525 REBAR_Notify_NMREBAR (infoPtr, ihitBand, RBN_ENDDRAG); 3526 infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED; 3526 3527 } 3527 3528 … … 3547 3548 /* if mouse did not move much, exit */ 3548 3549 if ((abs(ptsmove.x - infoPtr->dragNow.x) <= mindragx) && 3549 (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0;3550 (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0; 3550 3551 3551 3552 band1 = &infoPtr->bands[infoPtr->ihitBand-1]; … … 3554 3555 /* Test for valid drag case - must not be first band in row */ 3555 3556 if (infoPtr->dwStyle & CCS_VERT) { 3556 if ((ptsmove.x < band2->rcBand.left) || 3557 (ptsmove.x > band2->rcBand.right) || 3558 ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { 3559 FIXME("Cannot drag to other rows yet!!\n"); 3560 } 3561 else { 3562 REBAR_HandleLRDrag (infoPtr, &ptsmove); 3563 } 3557 if ((ptsmove.x < band2->rcBand.left) || 3558 (ptsmove.x > band2->rcBand.right) || 3559 ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { 3560 FIXME("Cannot drag to other rows yet!!\n"); 3564 3561 } 3565 3562 else { 3566 if ((ptsmove.y < band2->rcBand.top) || 3567 (ptsmove.y > band2->rcBand.bottom) || 3568 ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { 3569 FIXME("Cannot drag to other rows yet!!\n"); 3570 } 3571 else { 3572 REBAR_HandleLRDrag (infoPtr, &ptsmove); 3573 } 3563 REBAR_HandleLRDrag (infoPtr, &ptsmove); 3564 } 3565 } 3566 else { 3567 if ((ptsmove.y < band2->rcBand.top) || 3568 (ptsmove.y > band2->rcBand.bottom) || 3569 ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { 3570 FIXME("Cannot drag to other rows yet!!\n"); 3571 } 3572 else { 3573 REBAR_HandleLRDrag (infoPtr, &ptsmove); 3574 } 3574 3575 } 3575 3576 return 0; … … 3588 3589 #if 0 3589 3590 if (GetWindowLongA (infoPtr->hwndSelf, GWL_STYLE) & WS_BORDER) { 3590 ((LPRECT)lParam)->left += GetSystemMetrics(SM_CXEDGE);3591 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE);3592 ((LPRECT)lParam)->right -= GetSystemMetrics(SM_CXEDGE);3593 ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE);3591 ((LPRECT)lParam)->left += GetSystemMetrics(SM_CXEDGE); 3592 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE); 3593 ((LPRECT)lParam)->right -= GetSystemMetrics(SM_CXEDGE); 3594 ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE); 3594 3595 } 3595 3596 #endif … … 3608 3609 3609 3610 if (infoPtr != NULL) { 3610 ERR("Strange info structure pointer *not* NULL\n");3611 return FALSE;3611 ERR("Strange info structure pointer *not* NULL\n"); 3612 return FALSE; 3612 3613 } 3613 3614 3614 3615 if (TRACE_ON(rebar)) { 3615 GetWindowRect(hwnd, &wnrc1);3616 GetClientRect(hwnd, &clrc1);3617 TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",3618 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,3619 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,3620 cs->x, cs->y, cs->cx, cs->cy);3616 GetWindowRect(hwnd, &wnrc1); 3617 GetClientRect(hwnd, &clrc1); 3618 TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n", 3619 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 3620 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom, 3621 cs->x, cs->y, cs->cx, cs->cy); 3621 3622 } 3622 3623 … … 3646 3647 /* issue WM_NOTIFYFORMAT to get unicode status of parent */ 3647 3648 i = SendMessageA(REBAR_GetNotifyParent (infoPtr), 3648 WM_NOTIFYFORMAT, hwnd, NF_QUERY);3649 WM_NOTIFYFORMAT, hwnd, NF_QUERY); 3649 3650 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 3650 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",3651 i);3652 i = NFR_ANSI;3651 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", 3652 i); 3653 i = NFR_ANSI; 3653 3654 } 3654 3655 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; … … 3659 3660 3660 3661 /* native does: 3661 GetSysColor (numerous);3662 GetSysColorBrush (numerous) (see WM_SYSCOLORCHANGE);3663 GetStockObject (SYSTEM_FONT);3664 *SetWindowLong (hwnd, 0, info ptr);3665 *WM_NOTIFYFORMAT;3666 *SetWindowLong (hwnd, GWL_STYLE, style+0x10000001);3662 GetSysColor (numerous); 3663 GetSysColorBrush (numerous) (see WM_SYSCOLORCHANGE); 3664 GetStockObject (SYSTEM_FONT); 3665 *SetWindowLong (hwnd, 0, info ptr); 3666 *WM_NOTIFYFORMAT; 3667 *SetWindowLong (hwnd, GWL_STYLE, style+0x10000001); 3667 3668 WS_VISIBLE = 0x10000000; 3668 3669 CCS_TOP = 0x00000001; 3669 SystemParametersInfo (SPI_GETNONCLIENTMETRICS...);3670 CreateFontIndirect (lfCaptionFont from above);3671 GetDC ();3672 SelectObject (hdc, fontabove);3673 GetTextMetrics (hdc, ); guessing is tmHeight3674 SelectObject (hdc, oldfont);3675 ReleaseDC ();3676 GetWindowRect ();3677 MapWindowPoints (0, parent, rectabove, 2);3678 GetWindowRect ();3679 GetClientRect ();3680 ClientToScreen (clientrect);3681 SetWindowPos (hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER);3670 SystemParametersInfo (SPI_GETNONCLIENTMETRICS...); 3671 CreateFontIndirect (lfCaptionFont from above); 3672 GetDC (); 3673 SelectObject (hdc, fontabove); 3674 GetTextMetrics (hdc, ); guessing is tmHeight 3675 SelectObject (hdc, oldfont); 3676 ReleaseDC (); 3677 GetWindowRect (); 3678 MapWindowPoints (0, parent, rectabove, 2); 3679 GetWindowRect (); 3680 GetClientRect (); 3681 ClientToScreen (clientrect); 3682 SetWindowPos (hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER); 3682 3683 */ 3683 3684 return TRUE; … … 3707 3708 clpt = pt; 3708 3709 ScreenToClient (infoPtr->hwndSelf, &clpt); 3709 REBAR_InternalHitTest (infoPtr, &clpt, &scrap, 3710 (INT *)&nmmouse.dwItemSpec);3710 REBAR_InternalHitTest (infoPtr, &clpt, &scrap, 3711 (INT *)&nmmouse.dwItemSpec); 3711 3712 nmmouse.dwItemData = 0; 3712 3713 nmmouse.pt = clpt; 3713 3714 nmmouse.dwHitInfo = 0; 3714 3715 if ((i = REBAR_Notify((NMHDR *) &nmmouse, infoPtr, NM_NCHITTEST))) { 3715 TRACE("notify changed return value from %ld to %d\n",3716 ret, i); 3717 ret = (LRESULT) i;3716 TRACE("notify changed return value from %ld to %d\n", 3717 ret, i); 3718 ret = (LRESULT) i; 3718 3719 } 3719 3720 TRACE("returning %ld, client point (%ld,%ld)\n", ret, clpt.x, clpt.y); … … 3729 3730 3730 3731 if (infoPtr->dwStyle & WS_MINIMIZE) 3731 return 0; /* Nothing to do */3732 return 0; /* Nothing to do */ 3732 3733 3733 3734 DefWindowProcA (infoPtr->hwndSelf, WM_NCPAINT, wParam, lParam); 3734 3735 3735 3736 if (!(hdc = GetDCEx( infoPtr->hwndSelf, 0, DCX_USESTYLE | DCX_WINDOW ))) 3736 return 0;3737 return 0; 3737 3738 3738 3739 if (infoPtr->dwStyle & WS_BORDER) { 3739 GetWindowRect (infoPtr->hwndSelf, &rcWindow);3740 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);3741 TRACE("rect (%d,%d)-(%d,%d)\n",3742 rcWindow.left, rcWindow.top,3743 rcWindow.right, rcWindow.bottom);3744 /* see comments in _NCCalcSize for reason this is not done */3745 /* DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT); */3746 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_TOP | BF_BOTTOM);3740 GetWindowRect (infoPtr->hwndSelf, &rcWindow); 3741 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top); 3742 TRACE("rect (%d,%d)-(%d,%d)\n", 3743 rcWindow.left, rcWindow.top, 3744 rcWindow.right, rcWindow.bottom); 3745 /* see comments in _NCCalcSize for reason this is not done */ 3746 /* DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT); */ 3747 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_TOP | BF_BOTTOM); 3747 3748 } 3748 3749 … … 3759 3760 3760 3761 if (lParam == NF_REQUERY) { 3761 i = SendMessageA(REBAR_GetNotifyParent (infoPtr),3762 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);3763 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {3764 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",3765 i);3766 i = NFR_ANSI;3767 }3768 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;3769 return (LRESULT)i;3762 i = SendMessageA(REBAR_GetNotifyParent (infoPtr), 3763 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY); 3764 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 3765 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", 3766 i); 3767 i = NFR_ANSI; 3768 } 3769 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; 3770 return (LRESULT)i; 3770 3771 } 3771 3772 return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI); … … 3784 3785 3785 3786 TRACE("painting (%d,%d)-(%d,%d) client (%d,%d)-(%d,%d)\n", 3786 ps.rcPaint.left, ps.rcPaint.top,3787 ps.rcPaint.right, ps.rcPaint.bottom,3788 rc.left, rc.top, rc.right, rc.bottom);3787 ps.rcPaint.left, ps.rcPaint.top, 3788 ps.rcPaint.right, ps.rcPaint.bottom, 3789 rc.left, rc.top, rc.right, rc.bottom); 3789 3790 3790 3791 if (ps.fErase) { 3791 /* Erase area of paint if requested */3792 /* Erase area of paint if requested */ 3792 3793 REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &ps.rcPaint); 3793 3794 } … … 3795 3796 REBAR_Refresh (infoPtr, hdc); 3796 3797 if (!wParam) 3797 EndPaint (infoPtr->hwndSelf, &ps);3798 EndPaint (infoPtr->hwndSelf, &ps); 3798 3799 return 0; 3799 3800 } … … 3814 3815 3815 3816 if (flags == RBHT_GRABBER) { 3816 if ((infoPtr->dwStyle & CCS_VERT) &&3817 !(infoPtr->dwStyle & RBS_VERTICALGRIPPER))3818 SetCursor (infoPtr->hcurVert);3819 else3820 SetCursor (infoPtr->hcurHorz);3817 if ((infoPtr->dwStyle & CCS_VERT) && 3818 !(infoPtr->dwStyle & RBS_VERTICALGRIPPER)) 3819 SetCursor (infoPtr->hcurVert); 3820 else 3821 SetCursor (infoPtr->hcurHorz); 3821 3822 } 3822 3823 else if (flags != RBHT_CLIENT) 3823 SetCursor (infoPtr->hcurArrow);3824 SetCursor (infoPtr->hcurArrow); 3824 3825 3825 3826 return 0; … … 3839 3840 for (i=0; i<infoPtr->uNumBands; i++) { 3840 3841 lpBand = &infoPtr->bands[i]; 3841 REBAR_ValidateBand (infoPtr, lpBand);3842 REBAR_ValidateBand (infoPtr, lpBand); 3842 3843 } 3843 3844 … … 3860 3861 * 3861 3862 * Documentation: 3862 * According to testing V4.71 of COMCTL32 returns the 3863 * According to testing V4.71 of COMCTL32 returns the 3863 3864 * *previous* status of the redraw flag (either 0 or -1) 3864 3865 * instead of the MSDN documented value of 0 if handled … … 3868 3869 BOOL oldredraw = infoPtr->DoRedraw; 3869 3870 3870 TRACE("set to %s, fStatus=%08x\n", 3871 (wParam) ? "TRUE" : "FALSE", infoPtr->fStatus);3871 TRACE("set to %s, fStatus=%08x\n", 3872 (wParam) ? "TRUE" : "FALSE", infoPtr->fStatus); 3872 3873 infoPtr->DoRedraw = (BOOL) wParam; 3873 3874 if (wParam) { 3874 if (infoPtr->fStatus & BAND_NEEDS_REDRAW) {3875 REBAR_MoveChildWindows (infoPtr, 0, infoPtr->uNumBands);3876 REBAR_ForceResize (infoPtr);3877 InvalidateRect (infoPtr->hwndSelf, 0, TRUE);3878 }3879 infoPtr->fStatus &= ~BAND_NEEDS_REDRAW;3875 if (infoPtr->fStatus & BAND_NEEDS_REDRAW) { 3876 REBAR_MoveChildWindows (infoPtr, 0, infoPtr->uNumBands); 3877 REBAR_ForceResize (infoPtr); 3878 InvalidateRect (infoPtr->hwndSelf, 0, TRUE); 3879 } 3880 infoPtr->fStatus &= ~BAND_NEEDS_REDRAW; 3880 3881 } 3881 3882 return (oldredraw) ? -1 : 0; … … 3890 3891 /* auto resize deadlock check */ 3891 3892 if (infoPtr->fStatus & AUTO_RESIZE) { 3892 infoPtr->fStatus &= ~AUTO_RESIZE;3893 TRACE("AUTO_RESIZE was set, reset, fStatus=%08x lparam=%08lx\n",3894 infoPtr->fStatus, lParam);3895 return 0;3893 infoPtr->fStatus &= ~AUTO_RESIZE; 3894 TRACE("AUTO_RESIZE was set, reset, fStatus=%08x lparam=%08lx\n", 3895 infoPtr->fStatus, lParam); 3896 return 0; 3896 3897 } 3897 3898 3898 3899 if (infoPtr->fStatus & CREATE_RUNNING) { 3899 /* still in CreateWindow */ 3900 RECT rcWin; 3901 3902 TRACE("still in CreateWindow\n"); 3903 infoPtr->fStatus &= ~CREATE_RUNNING; 3904 GetWindowRect ( infoPtr->hwndSelf, &rcWin); 3905 TRACE("win rect (%d,%d)-(%d,%d)\n", 3906 rcWin.left, rcWin.top, rcWin.right, rcWin.bottom); 3907 3908 if ((lParam == 0) && (rcWin.right-rcWin.left == 0) && 3909 (rcWin.bottom-rcWin.top == 0)) { 3910 /* native control seems to do this */ 3911 GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient); 3912 TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n", 3913 rcClient.right, rcClient.bottom); 3914 } 3915 else { 3916 INT cx, cy; 3917 3918 cx = rcWin.right - rcWin.left; 3919 cy = rcWin.bottom - rcWin.top; 3920 if ((cx == LOWORD(lParam)) && (cy == HIWORD(lParam))) { 3921 return 0; 3922 } 3923 3924 /* do the actual WM_SIZE request */ 3925 GetClientRect (infoPtr->hwndSelf, &rcClient); 3926 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 3927 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 3928 LOWORD(lParam), HIWORD(lParam), 3929 rcClient.right, rcClient.bottom); 3930 } 3900 /* still in CreateWindow */ 3901 RECT rcWin; 3902 3903 TRACE("still in CreateWindow\n"); 3904 infoPtr->fStatus &= ~CREATE_RUNNING; 3905 GetWindowRect ( infoPtr->hwndSelf, &rcWin); 3906 TRACE("win rect (%d,%d)-(%d,%d)\n", 3907 rcWin.left, rcWin.top, rcWin.right, rcWin.bottom); 3908 3909 if ((lParam == 0) && (rcWin.right-rcWin.left == 0) && 3910 (rcWin.bottom-rcWin.top == 0)) { 3911 /* native control seems to do this */ 3912 GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient); 3913 TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n", 3914 rcClient.right, rcClient.bottom); 3931 3915 } 3932 3916 else { 3933 /* Handle cases when outside of the CreateWindow process */ 3934 3935 GetClientRect (infoPtr->hwndSelf, &rcClient); 3936 if ((lParam == 0) && (rcClient.right + rcClient.bottom != 0) && 3937 (infoPtr->dwStyle & RBS_AUTOSIZE)) { 3938 /* on a WM_SIZE to zero and current client not zero and AUTOSIZE */ 3939 /* native seems to use the current client rect for the size */ 3940 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 3941 TRACE("sizing rebar to client (%d,%d) size is zero but AUTOSIZE set\n", 3942 rcClient.right, rcClient.bottom); 3943 } 3944 else { 3945 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 3946 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 3947 LOWORD(lParam), HIWORD(lParam), 3948 rcClient.right, rcClient.bottom); 3949 } 3917 INT cx, cy; 3918 3919 cx = rcWin.right - rcWin.left; 3920 cy = rcWin.bottom - rcWin.top; 3921 if ((cx == LOWORD(lParam)) && (cy == HIWORD(lParam))) { 3922 return 0; 3923 } 3924 3925 /* do the actual WM_SIZE request */ 3926 GetClientRect (infoPtr->hwndSelf, &rcClient); 3927 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 3928 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 3929 LOWORD(lParam), HIWORD(lParam), 3930 rcClient.right, rcClient.bottom); 3931 } 3932 } 3933 else { 3934 /* Handle cases when outside of the CreateWindow process */ 3935 3936 GetClientRect (infoPtr->hwndSelf, &rcClient); 3937 if ((lParam == 0) && (rcClient.right + rcClient.bottom != 0) && 3938 (infoPtr->dwStyle & RBS_AUTOSIZE)) { 3939 /* on a WM_SIZE to zero and current client not zero and AUTOSIZE */ 3940 /* native seems to use the current client rect for the size */ 3941 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 3942 TRACE("sizing rebar to client (%d,%d) size is zero but AUTOSIZE set\n", 3943 rcClient.right, rcClient.bottom); 3944 } 3945 else { 3946 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 3947 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 3948 LOWORD(lParam), HIWORD(lParam), 3949 rcClient.right, rcClient.bottom); 3950 } 3950 3951 } 3951 3952 3952 3953 if (infoPtr->dwStyle & RBS_AUTOSIZE) { 3953 NMRBAUTOSIZE autosize;3954 3955 GetClientRect(infoPtr->hwndSelf, &autosize.rcTarget);3956 autosize.fChanged = 0; /* ??? */3957 autosize.rcActual = autosize.rcTarget; /* ??? */3958 REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE);3959 TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n", 3960 autosize.rcTarget.right, autosize.rcTarget.bottom, lParam);3954 NMRBAUTOSIZE autosize; 3955 3956 GetClientRect(infoPtr->hwndSelf, &autosize.rcTarget); 3957 autosize.fChanged = 0; /* ??? */ 3958 autosize.rcActual = autosize.rcTarget; /* ??? */ 3959 REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE); 3960 TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n", 3961 autosize.rcTarget.right, autosize.rcTarget.bottom, lParam); 3961 3962 } 3962 3963 3963 3964 if ((infoPtr->calcSize.cx != rcClient.right) || 3964 (infoPtr->calcSize.cy != rcClient.bottom))3965 infoPtr->fStatus |= BAND_NEEDS_LAYOUT;3965 (infoPtr->calcSize.cy != rcClient.bottom)) 3966 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 3966 3967 3967 3968 REBAR_Layout (infoPtr, &rcClient, TRUE, TRUE); … … 3978 3979 3979 3980 TRACE("current style=%08lx, styleOld=%08lx, style being set to=%08lx\n", 3980 infoPtr->dwStyle, ss->styleOld, ss->styleNew);3981 infoPtr->dwStyle, ss->styleOld, ss->styleNew); 3981 3982 infoPtr->dwStyle = ss->styleNew; 3982 3983 … … 3990 3991 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3991 3992 3992 TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", 3993 hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);3993 TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", 3994 hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam); 3994 3995 if (!infoPtr && (uMsg != WM_NCCREATE)) 3995 return DefWindowProcA (hwnd, uMsg, wParam, lParam);3996 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 3996 3997 switch (uMsg) 3997 3998 { 3998 /* case RB_BEGINDRAG: */3999 4000 case RB_DELETEBAND:4001 return REBAR_DeleteBand (infoPtr, wParam, lParam);4002 4003 /* case RB_DRAGMOVE: */4004 /* case RB_ENDDRAG: */4005 4006 case RB_GETBANDBORDERS:4007 return REBAR_GetBandBorders (infoPtr, wParam, lParam);4008 4009 case RB_GETBANDCOUNT:4010 return REBAR_GetBandCount (infoPtr);4011 4012 case RB_GETBANDINFO:/* obsoleted after IE3, but we have to4013 support it anyway. */4014 case RB_GETBANDINFOA:4015 return REBAR_GetBandInfoA (infoPtr, wParam, lParam);4016 4017 case RB_GETBANDINFOW:4018 return REBAR_GetBandInfoW (infoPtr, wParam, lParam);4019 4020 case RB_GETBARHEIGHT:4021 return REBAR_GetBarHeight (infoPtr, wParam, lParam);4022 4023 case RB_GETBARINFO:4024 return REBAR_GetBarInfo (infoPtr, wParam, lParam);4025 4026 case RB_GETBKCOLOR:4027 return REBAR_GetBkColor (infoPtr);4028 4029 /* case RB_GETCOLORSCHEME: */4030 /* case RB_GETDROPTARGET: */4031 4032 case RB_GETPALETTE:4033 return REBAR_GetPalette (infoPtr, wParam, lParam);4034 4035 case RB_GETRECT:4036 return REBAR_GetRect (infoPtr, wParam, lParam);4037 4038 case RB_GETROWCOUNT:4039 return REBAR_GetRowCount (infoPtr);4040 4041 case RB_GETROWHEIGHT:4042 return REBAR_GetRowHeight (infoPtr, wParam, lParam);4043 4044 case RB_GETTEXTCOLOR:4045 return REBAR_GetTextColor (infoPtr);4046 4047 case RB_GETTOOLTIPS:4048 return REBAR_GetToolTips (infoPtr);4049 4050 case RB_GETUNICODEFORMAT:4051 return REBAR_GetUnicodeFormat (infoPtr);4052 4053 case CCM_GETVERSION:4054 return REBAR_GetVersion (infoPtr);4055 4056 case RB_HITTEST:4057 return REBAR_HitTest (infoPtr, wParam, lParam);4058 4059 case RB_IDTOINDEX:4060 return REBAR_IdToIndex (infoPtr, wParam, lParam);4061 4062 case RB_INSERTBANDA:4063 return REBAR_InsertBandA (infoPtr, wParam, lParam);4064 4065 case RB_INSERTBANDW:4066 return REBAR_InsertBandW (infoPtr, wParam, lParam);4067 4068 case RB_MAXIMIZEBAND:4069 return REBAR_MaximizeBand (infoPtr, wParam, lParam);4070 4071 case RB_MINIMIZEBAND:4072 return REBAR_MinimizeBand (infoPtr, wParam, lParam);4073 4074 case RB_MOVEBAND:4075 return REBAR_MoveBand (infoPtr, wParam, lParam);4076 4077 case RB_SETBANDINFOA:4078 return REBAR_SetBandInfoA (infoPtr, wParam, lParam);4079 4080 case RB_SETBANDINFOW:4081 return REBAR_SetBandInfoW (infoPtr, wParam, lParam);4082 4083 case RB_SETBARINFO:4084 return REBAR_SetBarInfo (infoPtr, wParam, lParam);4085 4086 case RB_SETBKCOLOR:4087 return REBAR_SetBkColor (infoPtr, wParam, lParam);4088 4089 /* case RB_SETCOLORSCHEME: */4090 /* case RB_SETPALETTE: */4091 /* return REBAR_GetPalette (infoPtr, wParam, lParam); */4092 4093 case RB_SETPARENT:4094 return REBAR_SetParent (infoPtr, wParam, lParam);4095 4096 case RB_SETTEXTCOLOR:4097 return REBAR_SetTextColor (infoPtr, wParam, lParam);4098 4099 /* case RB_SETTOOLTIPS: */4100 4101 case RB_SETUNICODEFORMAT:4102 return REBAR_SetUnicodeFormat (infoPtr, wParam);4103 4104 case CCM_SETVERSION:4105 return REBAR_SetVersion (infoPtr, (INT)wParam);4106 4107 case RB_SHOWBAND:4108 return REBAR_ShowBand (infoPtr, wParam, lParam);4109 4110 case RB_SIZETORECT:4111 return REBAR_SizeToRect (infoPtr, wParam, lParam);3999 /* case RB_BEGINDRAG: */ 4000 4001 case RB_DELETEBAND: 4002 return REBAR_DeleteBand (infoPtr, wParam, lParam); 4003 4004 /* case RB_DRAGMOVE: */ 4005 /* case RB_ENDDRAG: */ 4006 4007 case RB_GETBANDBORDERS: 4008 return REBAR_GetBandBorders (infoPtr, wParam, lParam); 4009 4010 case RB_GETBANDCOUNT: 4011 return REBAR_GetBandCount (infoPtr); 4012 4013 case RB_GETBANDINFO: /* obsoleted after IE3, but we have to 4014 support it anyway. */ 4015 case RB_GETBANDINFOA: 4016 return REBAR_GetBandInfoA (infoPtr, wParam, lParam); 4017 4018 case RB_GETBANDINFOW: 4019 return REBAR_GetBandInfoW (infoPtr, wParam, lParam); 4020 4021 case RB_GETBARHEIGHT: 4022 return REBAR_GetBarHeight (infoPtr, wParam, lParam); 4023 4024 case RB_GETBARINFO: 4025 return REBAR_GetBarInfo (infoPtr, wParam, lParam); 4026 4027 case RB_GETBKCOLOR: 4028 return REBAR_GetBkColor (infoPtr); 4029 4030 /* case RB_GETCOLORSCHEME: */ 4031 /* case RB_GETDROPTARGET: */ 4032 4033 case RB_GETPALETTE: 4034 return REBAR_GetPalette (infoPtr, wParam, lParam); 4035 4036 case RB_GETRECT: 4037 return REBAR_GetRect (infoPtr, wParam, lParam); 4038 4039 case RB_GETROWCOUNT: 4040 return REBAR_GetRowCount (infoPtr); 4041 4042 case RB_GETROWHEIGHT: 4043 return REBAR_GetRowHeight (infoPtr, wParam, lParam); 4044 4045 case RB_GETTEXTCOLOR: 4046 return REBAR_GetTextColor (infoPtr); 4047 4048 case RB_GETTOOLTIPS: 4049 return REBAR_GetToolTips (infoPtr); 4050 4051 case RB_GETUNICODEFORMAT: 4052 return REBAR_GetUnicodeFormat (infoPtr); 4053 4054 case CCM_GETVERSION: 4055 return REBAR_GetVersion (infoPtr); 4056 4057 case RB_HITTEST: 4058 return REBAR_HitTest (infoPtr, wParam, lParam); 4059 4060 case RB_IDTOINDEX: 4061 return REBAR_IdToIndex (infoPtr, wParam, lParam); 4062 4063 case RB_INSERTBANDA: 4064 return REBAR_InsertBandA (infoPtr, wParam, lParam); 4065 4066 case RB_INSERTBANDW: 4067 return REBAR_InsertBandW (infoPtr, wParam, lParam); 4068 4069 case RB_MAXIMIZEBAND: 4070 return REBAR_MaximizeBand (infoPtr, wParam, lParam); 4071 4072 case RB_MINIMIZEBAND: 4073 return REBAR_MinimizeBand (infoPtr, wParam, lParam); 4074 4075 case RB_MOVEBAND: 4076 return REBAR_MoveBand (infoPtr, wParam, lParam); 4077 4078 case RB_SETBANDINFOA: 4079 return REBAR_SetBandInfoA (infoPtr, wParam, lParam); 4080 4081 case RB_SETBANDINFOW: 4082 return REBAR_SetBandInfoW (infoPtr, wParam, lParam); 4083 4084 case RB_SETBARINFO: 4085 return REBAR_SetBarInfo (infoPtr, wParam, lParam); 4086 4087 case RB_SETBKCOLOR: 4088 return REBAR_SetBkColor (infoPtr, wParam, lParam); 4089 4090 /* case RB_SETCOLORSCHEME: */ 4091 /* case RB_SETPALETTE: */ 4092 /* return REBAR_GetPalette (infoPtr, wParam, lParam); */ 4093 4094 case RB_SETPARENT: 4095 return REBAR_SetParent (infoPtr, wParam, lParam); 4096 4097 case RB_SETTEXTCOLOR: 4098 return REBAR_SetTextColor (infoPtr, wParam, lParam); 4099 4100 /* case RB_SETTOOLTIPS: */ 4101 4102 case RB_SETUNICODEFORMAT: 4103 return REBAR_SetUnicodeFormat (infoPtr, wParam); 4104 4105 case CCM_SETVERSION: 4106 return REBAR_SetVersion (infoPtr, (INT)wParam); 4107 4108 case RB_SHOWBAND: 4109 return REBAR_ShowBand (infoPtr, wParam, lParam); 4110 4111 case RB_SIZETORECT: 4112 return REBAR_SizeToRect (infoPtr, wParam, lParam); 4112 4113 4113 4114 4114 4115 /* Messages passed to parent */ 4115 case WM_COMMAND:4116 case WM_DRAWITEM:4117 case WM_NOTIFY:4118 if (infoPtr->NtfUnicode)4119 return SendMessageW (REBAR_GetNotifyParent (infoPtr),4120 uMsg, wParam, lParam);4121 else4122 return SendMessageA (REBAR_GetNotifyParent (infoPtr),4123 uMsg, wParam, lParam);4116 case WM_COMMAND: 4117 case WM_DRAWITEM: 4118 case WM_NOTIFY: 4119 if (infoPtr->NtfUnicode) 4120 return SendMessageW (REBAR_GetNotifyParent (infoPtr), 4121 uMsg, wParam, lParam); 4122 else 4123 return SendMessageA (REBAR_GetNotifyParent (infoPtr), 4124 uMsg, wParam, lParam); 4124 4125 4125 4126 4126 4127 /* case WM_CHARTOITEM: supported according to ControlSpy */ 4127 4128 4128 case WM_CREATE:4129 return REBAR_Create (infoPtr, wParam, lParam);4130 4131 case WM_DESTROY:4132 return REBAR_Destroy (infoPtr, wParam, lParam);4129 case WM_CREATE: 4130 return REBAR_Create (infoPtr, wParam, lParam); 4131 4132 case WM_DESTROY: 4133 return REBAR_Destroy (infoPtr, wParam, lParam); 4133 4134 4134 4135 case WM_ERASEBKGND: 4135 return REBAR_EraseBkGnd (infoPtr, wParam, lParam);4136 4137 case WM_GETFONT:4138 return REBAR_GetFont (infoPtr, wParam, lParam);4136 return REBAR_EraseBkGnd (infoPtr, wParam, lParam); 4137 4138 case WM_GETFONT: 4139 return REBAR_GetFont (infoPtr, wParam, lParam); 4139 4140 4140 4141 /* case WM_LBUTTONDBLCLK: supported according to ControlSpy */ 4141 4142 4142 case WM_LBUTTONDOWN:4143 return REBAR_LButtonDown (infoPtr, wParam, lParam);4144 4145 case WM_LBUTTONUP:4146 return REBAR_LButtonUp (infoPtr, wParam, lParam);4143 case WM_LBUTTONDOWN: 4144 return REBAR_LButtonDown (infoPtr, wParam, lParam); 4145 4146 case WM_LBUTTONUP: 4147 return REBAR_LButtonUp (infoPtr, wParam, lParam); 4147 4148 4148 4149 /* case WM_MEASUREITEM: supported according to ControlSpy */ 4149 4150 4150 case WM_MOUSEMOVE:4151 return REBAR_MouseMove (infoPtr, wParam, lParam);4152 4153 case WM_NCCALCSIZE:4154 return REBAR_NCCalcSize (infoPtr, wParam, lParam);4151 case WM_MOUSEMOVE: 4152 return REBAR_MouseMove (infoPtr, wParam, lParam); 4153 4154 case WM_NCCALCSIZE: 4155 return REBAR_NCCalcSize (infoPtr, wParam, lParam); 4155 4156 4156 4157 case WM_NCCREATE: 4157 return REBAR_NCCreate (hwnd, wParam, lParam);4158 return REBAR_NCCreate (hwnd, wParam, lParam); 4158 4159 4159 4160 case WM_NCHITTEST: 4160 return REBAR_NCHitTest (infoPtr, wParam, lParam);4161 4162 case WM_NCPAINT:4163 return REBAR_NCPaint (infoPtr, wParam, lParam);4161 return REBAR_NCHitTest (infoPtr, wParam, lParam); 4162 4163 case WM_NCPAINT: 4164 return REBAR_NCPaint (infoPtr, wParam, lParam); 4164 4165 4165 4166 case WM_NOTIFYFORMAT: 4166 return REBAR_NotifyFormat (infoPtr, wParam, lParam);4167 4168 case WM_PAINT:4169 return REBAR_Paint (infoPtr, wParam, lParam);4167 return REBAR_NotifyFormat (infoPtr, wParam, lParam); 4168 4169 case WM_PAINT: 4170 return REBAR_Paint (infoPtr, wParam, lParam); 4170 4171 4171 4172 /* case WM_PALETTECHANGED: supported according to ControlSpy */ … … 4175 4176 /* case WM_RBUTTONUP: supported according to ControlSpy */ 4176 4177 4177 case WM_SETCURSOR:4178 return REBAR_SetCursor (infoPtr, wParam, lParam);4179 4180 case WM_SETFONT:4181 return REBAR_SetFont (infoPtr, wParam, lParam);4178 case WM_SETCURSOR: 4179 return REBAR_SetCursor (infoPtr, wParam, lParam); 4180 4181 case WM_SETFONT: 4182 return REBAR_SetFont (infoPtr, wParam, lParam); 4182 4183 4183 4184 case WM_SETREDRAW: 4184 return REBAR_SetRedraw (infoPtr, wParam, lParam);4185 4186 case WM_SIZE:4187 return REBAR_Size (infoPtr, wParam, lParam);4185 return REBAR_SetRedraw (infoPtr, wParam, lParam); 4186 4187 case WM_SIZE: 4188 return REBAR_Size (infoPtr, wParam, lParam); 4188 4189 4189 4190 case WM_STYLECHANGED: 4190 return REBAR_StyleChanged (infoPtr, wParam, lParam);4191 return REBAR_StyleChanged (infoPtr, wParam, lParam); 4191 4192 4192 4193 /* case WM_SYSCOLORCHANGE: supported according to ControlSpy */ 4193 4194 /* "Applications that have brushes using the existing system colors 4194 should delete those brushes and recreate them using the new 4195 should delete those brushes and recreate them using the new 4195 4196 system colors." per MSDN */ 4196 4197 4197 4198 /* case WM_VKEYTOITEM: supported according to ControlSpy */ 4198 /* case WM_WININICHANGE: */4199 4200 default:4201 if (uMsg >= WM_USER)4202 ERR("unknown msg %04x wp=%08x lp=%08lx\n",4203 uMsg, wParam, lParam);4199 /* case WM_WININICHANGE: */ 4200 4201 default: 4202 if (uMsg >= WM_USER) 4203 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 4204 uMsg, wParam, lParam); 4204 4205 #ifdef __WIN32OS2__ 4205 4206 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 4206 4207 #else 4207 return DefWindowProcA (hwnd, uMsg, wParam, lParam);4208 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 4208 4209 #endif 4209 4210 } … … 4225 4226 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); 4226 4227 wndClass.lpszClassName = REBARCLASSNAMEA; 4227 4228 4228 4229 RegisterClassA (&wndClass); 4229 4230 -
trunk/src/comctl32/status.c
r6391 r6644 1 /* $Id: status.c,v 1.23 2001-09-05 12:05:02 bird Exp $ */ 1 2 /* 2 3 * Interface code to StatusWindow widget/control … … 26 27 typedef struct 27 28 { 28 INT x;29 INT style;30 RECT bound;31 LPWSTR text;29 INT x; 30 INT style; 31 RECT bound; 32 LPWSTR text; 32 33 HICON hIcon; 33 34 } STATUSWINDOWPART; … … 48 49 COLORREF clrBk; /* background color */ 49 50 BOOL bUnicode; /* unicode flag */ 50 STATUSWINDOWPART part0;/* simple window */51 STATUSWINDOWPART part0; /* simple window */ 51 52 STATUSWINDOWPART *parts; 52 53 } STATUSWINDOWINFO; … … 93 94 SelectObject (hdc, GetSysColorPen (COLOR_3DSHADOW)); 94 95 for (i = 1; i < 11; i += 4) { 95 MoveToEx (hdc, pt.x - i, pt.y, NULL);96 LineTo (hdc, pt.x, pt.y - i);97 98 MoveToEx (hdc, pt.x - i-1, pt.y, NULL);99 LineTo (hdc, pt.x, pt.y - i-1);96 MoveToEx (hdc, pt.x - i, pt.y, NULL); 97 LineTo (hdc, pt.x, pt.y - i); 98 99 MoveToEx (hdc, pt.x - i-1, pt.y, NULL); 100 LineTo (hdc, pt.x, pt.y - i-1); 100 101 } 101 102 102 103 SelectObject (hdc, GetSysColorPen (COLOR_3DHIGHLIGHT)); 103 104 for (i = 3; i < 13; i += 4) { 104 MoveToEx (hdc, pt.x - i, pt.y, NULL);105 LineTo (hdc, pt.x, pt.y - i);105 MoveToEx (hdc, pt.x - i, pt.y, NULL); 106 LineTo (hdc, pt.x, pt.y - i); 106 107 } 107 108 … … 110 111 111 112 112 static void 113 static void 113 114 STATUSBAR_DrawPart (HDC hdc, STATUSWINDOWPART *part) 114 115 { … … 126 127 /* draw the icon */ 127 128 if (part->hIcon) { 128 INT cy = r.bottom - r.top;129 130 r.left += 2;131 DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);132 r.left += cy;129 INT cy = r.bottom - r.top; 130 131 r.left += 2; 132 DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL); 133 r.left += cy; 133 134 } 134 135 … … 139 140 UINT align = DT_LEFT; 140 141 if (*p == L'\t') { 141 p++;142 align = DT_CENTER;143 144 if (*p == L'\t') {145 p++;146 align = DT_RIGHT;147 }142 p++; 143 align = DT_CENTER; 144 145 if (*p == L'\t') { 146 p++; 147 align = DT_RIGHT; 148 } 148 149 } 149 150 r.left += 3; … … 151 152 DrawTextW (hdc, p, -1, &r, align|DT_VCENTER|DT_SINGLELINE); 152 153 if (oldbkmode != TRANSPARENT) 153 SetBkMode(hdc, oldbkmode);154 SetBkMode(hdc, oldbkmode); 154 155 } 155 156 } … … 169 170 170 171 if (infoPtr->clrBk != CLR_DEFAULT) 171 hbrBk = CreateSolidBrush (infoPtr->clrBk);172 hbrBk = CreateSolidBrush (infoPtr->clrBk); 172 173 else 173 hbrBk = GetSysColorBrush (COLOR_3DFACE);174 hbrBk = GetSysColorBrush (COLOR_3DFACE); 174 175 FillRect(hdc, &part->bound, hbrBk); 175 176 … … 177 178 178 179 if (part->style & SBT_OWNERDRAW) { 179 DRAWITEMSTRUCT dis;180 181 dis.CtlID = GetWindowLongA (hwnd, GWL_ID);182 dis.itemID = itemID;183 dis.hwndItem = hwnd;184 dis.hDC = hdc;185 dis.rcItem = part->bound;186 dis.itemData = (INT)part->text;187 SendMessageA (GetParent (hwnd), WM_DRAWITEM,188 (WPARAM)dis.CtlID, (LPARAM)&dis);180 DRAWITEMSTRUCT dis; 181 182 dis.CtlID = GetWindowLongA (hwnd, GWL_ID); 183 dis.itemID = itemID; 184 dis.hwndItem = hwnd; 185 dis.hDC = hdc; 186 dis.rcItem = part->bound; 187 dis.itemData = (INT)part->text; 188 SendMessageA (GetParent (hwnd), WM_DRAWITEM, 189 (WPARAM)dis.CtlID, (LPARAM)&dis); 189 190 } else 190 STATUSBAR_DrawPart (hdc, part);191 STATUSBAR_DrawPart (hdc, part); 191 192 192 193 SelectObject (hdc, hOldFont); 193 194 194 195 if (infoPtr->clrBk != CLR_DEFAULT) 195 DeleteObject (hbrBk);196 DeleteObject (hbrBk); 196 197 197 198 if (GetWindowLongA (hwnd, GWL_STYLE) & SBARS_SIZEGRIP) { 198 RECT rect;199 200 GetClientRect (hwnd, &rect);201 STATUSBAR_DrawSizeGrip (hdc, &rect);199 RECT rect; 200 201 GetClientRect (hwnd, &rect); 202 STATUSBAR_DrawSizeGrip (hdc, &rect); 202 203 } 203 204 } … … 221 222 222 223 if (infoPtr->clrBk != CLR_DEFAULT) 223 hbrBk = CreateSolidBrush (infoPtr->clrBk);224 hbrBk = CreateSolidBrush (infoPtr->clrBk); 224 225 else 225 hbrBk = GetSysColorBrush (COLOR_3DFACE);226 hbrBk = GetSysColorBrush (COLOR_3DFACE); 226 227 FillRect(hdc, &rect, hbrBk); 227 228 … … 229 230 230 231 if (infoPtr->simple) { 231 STATUSBAR_RefreshPart (infoPtr, hwnd, &infoPtr->part0, hdc, 0);232 STATUSBAR_RefreshPart (infoPtr, hwnd, &infoPtr->part0, hdc, 0); 232 233 } else { 233 for (i = 0; i < infoPtr->numParts; i++) {234 if (infoPtr->parts[i].style & SBT_OWNERDRAW) {235 DRAWITEMSTRUCT dis;236 237 dis.CtlID = GetWindowLongA (hwnd, GWL_ID);238 dis.itemID = i;239 dis.hwndItem = hwnd;240 dis.hDC = hdc;241 dis.rcItem = infoPtr->parts[i].bound;242 dis.itemData = (INT)infoPtr->parts[i].text;243 SendMessageA (GetParent (hwnd), WM_DRAWITEM,244 (WPARAM)dis.CtlID, (LPARAM)&dis);245 } else246 STATUSBAR_RefreshPart (infoPtr, hwnd, &infoPtr->parts[i], hdc, i);247 }234 for (i = 0; i < infoPtr->numParts; i++) { 235 if (infoPtr->parts[i].style & SBT_OWNERDRAW) { 236 DRAWITEMSTRUCT dis; 237 238 dis.CtlID = GetWindowLongA (hwnd, GWL_ID); 239 dis.itemID = i; 240 dis.hwndItem = hwnd; 241 dis.hDC = hdc; 242 dis.rcItem = infoPtr->parts[i].bound; 243 dis.itemData = (INT)infoPtr->parts[i].text; 244 SendMessageA (GetParent (hwnd), WM_DRAWITEM, 245 (WPARAM)dis.CtlID, (LPARAM)&dis); 246 } else 247 STATUSBAR_RefreshPart (infoPtr, hwnd, &infoPtr->parts[i], hdc, i); 248 } 248 249 } 249 250 … … 251 252 252 253 if (infoPtr->clrBk != CLR_DEFAULT) 253 DeleteObject (hbrBk);254 DeleteObject (hbrBk); 254 255 255 256 if (GetWindowLongA(hwnd, GWL_STYLE) & SBARS_SIZEGRIP) 256 STATUSBAR_DrawSizeGrip (hdc, &rect);257 STATUSBAR_DrawSizeGrip (hdc, &rect); 257 258 258 259 return TRUE; … … 265 266 STATUSWINDOWPART *part; 266 267 RECT rect, *r; 267 int i;268 int i; 268 269 269 270 /* get our window size */ … … 278 279 /* set bounds for non-simple rectangles */ 279 280 for (i = 0; i < infoPtr->numParts; i++) { 280 part = &infoPtr->parts[i];281 r = &infoPtr->parts[i].bound;282 r->top = rect.top;283 r->bottom = rect.bottom;284 if (i == 0)285 r->left = 0;286 else287 r->left = infoPtr->parts[i-1].bound.right + HORZ_GAP;288 if (part->x == -1)289 r->right = rect.right;290 else291 r->right = part->x;292 293 if (infoPtr->hwndToolTip) {294 TTTOOLINFOA ti;295 296 ti.cbSize = sizeof(TTTOOLINFOA);297 ti.hwnd = hwnd;298 ti.uId = i;299 ti.rect = *r;300 SendMessageA (infoPtr->hwndToolTip, TTM_NEWTOOLRECTA,301 0, (LPARAM)&ti);302 }281 part = &infoPtr->parts[i]; 282 r = &infoPtr->parts[i].bound; 283 r->top = rect.top; 284 r->bottom = rect.bottom; 285 if (i == 0) 286 r->left = 0; 287 else 288 r->left = infoPtr->parts[i-1].bound.right + HORZ_GAP; 289 if (part->x == -1) 290 r->right = rect.right; 291 else 292 r->right = part->x; 293 294 if (infoPtr->hwndToolTip) { 295 TTTOOLINFOA ti; 296 297 ti.cbSize = sizeof(TTTOOLINFOA); 298 ti.hwnd = hwnd; 299 ti.uId = i; 300 ti.rect = *r; 301 SendMessageA (infoPtr->hwndToolTip, TTM_NEWTOOLRECTA, 302 0, (LPARAM)&ti); 303 } 303 304 } 304 305 } … … 307 308 static VOID 308 309 STATUSBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg, 309 WPARAM wParam, LPARAM lParam)310 WPARAM wParam, LPARAM lParam) 310 311 { 311 312 MSG msg; … … 345 346 TRACE("%d\n", nPart); 346 347 if ((nPart < -1) || (nPart >= infoPtr->numParts)) 347 return 0;348 return 0; 348 349 349 350 if (nPart == -1) … … 365 366 parts = (LPINT) lParam; 366 367 if (parts) { 367 for (i = 0; i < num_parts; i++) {368 parts[i] = infoPtr->parts[i].x;369 }368 for (i = 0; i < num_parts; i++) { 369 parts[i] = infoPtr->parts[i].x; 370 } 370 371 } 371 372 return (infoPtr->numParts); … … 376 377 STATUSBAR_GetRect (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam) 377 378 { 378 int nPart;379 int nPart; 379 380 LPRECT rect; 380 381 … … 383 384 rect = (LPRECT) lParam; 384 385 if (infoPtr->simple) 385 *rect = infoPtr->part0.bound;386 *rect = infoPtr->part0.bound; 386 387 else 387 *rect = infoPtr->parts[nPart].bound;388 *rect = infoPtr->parts[nPart].bound; 388 389 return TRUE; 389 390 } … … 400 401 TRACE("part %d\n", nPart); 401 402 if (infoPtr->simple) 402 part = &infoPtr->part0;403 part = &infoPtr->part0; 403 404 else 404 405 #ifdef __WIN32OS2__ 405 406 { 406 407 if (nPart >= infoPtr->numParts) 407 return FALSE;408 part = &infoPtr->parts[nPart];408 return FALSE; 409 part = &infoPtr->parts[nPart]; 409 410 } 410 411 #else 411 part = &infoPtr->parts[nPart];412 part = &infoPtr->parts[nPart]; 412 413 #endif 413 414 414 415 if (part->style & SBT_OWNERDRAW) 415 result = (LRESULT)part->text;416 result = (LRESULT)part->text; 416 417 else { 417 418 DWORD len = part->text ? WideCharToMultiByte( CP_ACP, 0, part->text, -1, … … 435 436 TRACE("part %d\n", nPart); 436 437 if (infoPtr->simple) 437 part = &infoPtr->part0;438 part = &infoPtr->part0; 438 439 else 439 440 #ifdef __WIN32OS2__ 440 441 { 441 442 if (nPart >= infoPtr->numParts) 442 return FALSE;443 part = &infoPtr->parts[nPart];443 return FALSE; 444 part = &infoPtr->parts[nPart]; 444 445 } 445 446 #else 446 part = &infoPtr->parts[nPart];447 part = &infoPtr->parts[nPart]; 447 448 #endif 448 449 449 450 if (part->style & SBT_OWNERDRAW) 450 result = (LRESULT)part->text;451 result = (LRESULT)part->text; 451 452 else { 452 result = part->text ? strlenW (part->text) : 0;453 result |= (part->style << 16);454 if (part->text && lParam)455 strcpyW ((LPWSTR)lParam, part->text);453 result = part->text ? strlenW (part->text) : 0; 454 result |= (part->style << 16); 455 if (part->text && lParam) 456 strcpyW ((LPWSTR)lParam, part->text); 456 457 } 457 458 return result; … … 471 472 472 473 if (infoPtr->simple) 473 part = &infoPtr->part0;474 part = &infoPtr->part0; 474 475 else 475 476 #ifdef __WIN32OS2__ 476 477 { 477 478 if (nPart >= infoPtr->numParts) 478 return FALSE;479 part = &infoPtr->parts[nPart];479 return FALSE; 480 part = &infoPtr->parts[nPart]; 480 481 } 481 482 #else 482 part = &infoPtr->parts[nPart];483 part = &infoPtr->parts[nPart]; 483 484 #endif 484 485 485 486 if (part->text) 486 result = strlenW(part->text);487 result = strlenW(part->text); 487 488 else 488 result = 0;489 result = 0; 489 490 490 491 result |= (part->style << 16); … … 526 527 buf[0]=0; 527 528 528 if (infoPtr->hwndToolTip) {529 TTTOOLINFOW ti;530 ti.cbSize = sizeof(TTTOOLINFOW);531 ti.hwnd = hwnd;532 ti.uId = LOWORD(wParam);529 if (infoPtr->hwndToolTip) { 530 TTTOOLINFOW ti; 531 ti.cbSize = sizeof(TTTOOLINFOW); 532 ti.hwnd = hwnd; 533 ti.uId = LOWORD(wParam); 533 534 ti.lpszText = buf; 534 SendMessageW(infoPtr->hwndToolTip, TTM_GETTEXTW, 0, (LPARAM)&ti);535 }536 lstrcpynW(tip, buf, HIWORD(wParam));535 SendMessageW(infoPtr->hwndToolTip, TTM_GETTEXTW, 0, (LPARAM)&ti); 536 } 537 lstrcpynW(tip, buf, HIWORD(wParam)); 537 538 } 538 539 … … 575 576 576 577 if ((nPart < -1) || (nPart >= infoPtr->numParts)) 577 return FALSE;578 return FALSE; 578 579 579 580 TRACE("setting part %d, icon %lx\n",nPart,lParam); 580 581 581 582 if (nPart == -1) { 582 if (infoPtr->part0.hIcon == (HICON)lParam) /* same as - no redraw */583 return TRUE;584 infoPtr->part0.hIcon = (HICON)lParam;585 if (infoPtr->simple)583 if (infoPtr->part0.hIcon == (HICON)lParam) /* same as - no redraw */ 584 return TRUE; 585 infoPtr->part0.hIcon = (HICON)lParam; 586 if (infoPtr->simple) 586 587 InvalidateRect(hwnd, &infoPtr->part0.bound, FALSE); 587 588 } else { 588 if (infoPtr->parts[nPart].hIcon == (HICON)lParam) /* same as - no redraw */589 return TRUE;590 591 infoPtr->parts[nPart].hIcon = (HICON)lParam;592 if (!(infoPtr->simple))589 if (infoPtr->parts[nPart].hIcon == (HICON)lParam) /* same as - no redraw */ 590 return TRUE; 591 592 infoPtr->parts[nPart].hIcon = (HICON)lParam; 593 if (!(infoPtr->simple)) 593 594 InvalidateRect(hwnd, &infoPtr->parts[nPart].bound, FALSE); 594 595 } … … 603 604 TRACE("\n"); 604 605 if (IsWindowVisible (hwnd)) { 605 HWND parent = GetParent (hwnd);606 INT width, x, y;607 RECT parent_rect;608 609 GetClientRect (parent, &parent_rect);610 infoPtr->height = (INT)wParam + VERT_BORDER;611 width = parent_rect.right - parent_rect.left;612 x = parent_rect.left;613 y = parent_rect.bottom - infoPtr->height;614 MoveWindow (hwnd, parent_rect.left,615 parent_rect.bottom - infoPtr->height,616 width, infoPtr->height, TRUE);617 STATUSBAR_SetPartBounds (infoPtr, hwnd);606 HWND parent = GetParent (hwnd); 607 INT width, x, y; 608 RECT parent_rect; 609 610 GetClientRect (parent, &parent_rect); 611 infoPtr->height = (INT)wParam + VERT_BORDER; 612 width = parent_rect.right - parent_rect.left; 613 x = parent_rect.left; 614 y = parent_rect.bottom - infoPtr->height; 615 MoveWindow (hwnd, parent_rect.left, 616 parent_rect.bottom - infoPtr->height, 617 width, infoPtr->height, TRUE); 618 STATUSBAR_SetPartBounds (infoPtr, hwnd); 618 619 } 619 620 … … 627 628 STATUSWINDOWPART *tmp; 628 629 LPINT parts; 629 int i;630 int oldNumParts;630 int i; 631 int oldNumParts; 631 632 632 633 TRACE("(%d,%p)\n",wParam,(LPVOID)lParam); … … 634 635 /* FIXME: should return FALSE sometimes (maybe when wParam == 0 ?) */ 635 636 if (infoPtr->simple) 636 infoPtr->simple = FALSE;637 infoPtr->simple = FALSE; 637 638 638 639 oldNumParts = infoPtr->numParts; … … 640 641 parts = (LPINT) lParam; 641 642 if (oldNumParts > infoPtr->numParts) { 642 for (i = infoPtr->numParts ; i < oldNumParts; i++) {643 if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW))644 COMCTL32_Free (infoPtr->parts[i].text);645 }643 for (i = infoPtr->numParts ; i < oldNumParts; i++) { 644 if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW)) 645 COMCTL32_Free (infoPtr->parts[i].text); 646 } 646 647 } 647 648 if (oldNumParts < infoPtr->numParts) { 648 tmp = COMCTL32_Alloc (sizeof(STATUSWINDOWPART) * infoPtr->numParts);649 for (i = 0; i < oldNumParts; i++) {650 tmp[i] = infoPtr->parts[i];651 }652 if (infoPtr->parts)653 COMCTL32_Free (infoPtr->parts);654 infoPtr->parts = tmp;649 tmp = COMCTL32_Alloc (sizeof(STATUSWINDOWPART) * infoPtr->numParts); 650 for (i = 0; i < oldNumParts; i++) { 651 tmp[i] = infoPtr->parts[i]; 652 } 653 if (infoPtr->parts) 654 COMCTL32_Free (infoPtr->parts); 655 infoPtr->parts = tmp; 655 656 } 656 657 if (oldNumParts == infoPtr->numParts) { 657 for (i=0;i<oldNumParts;i++)658 if (infoPtr->parts[i].x != parts[i])659 break;660 if (i==oldNumParts) /* Unchanged? no need to redraw! */661 return TRUE;662 } 663 658 for (i=0;i<oldNumParts;i++) 659 if (infoPtr->parts[i].x != parts[i]) 660 break; 661 if (i==oldNumParts) /* Unchanged? no need to redraw! */ 662 return TRUE; 663 } 664 664 665 for (i = 0; i < infoPtr->numParts; i++) 665 infoPtr->parts[i].x = parts[i];666 infoPtr->parts[i].x = parts[i]; 666 667 667 668 if (infoPtr->hwndToolTip) { 668 INT nTipCount =669 SendMessageA (infoPtr->hwndToolTip, TTM_GETTOOLCOUNT, 0, 0);670 671 if (nTipCount < infoPtr->numParts) {672 /* add tools */673 TTTOOLINFOA ti;674 INT i;675 676 ZeroMemory (&ti, sizeof(TTTOOLINFOA));677 ti.cbSize = sizeof(TTTOOLINFOA);678 ti.hwnd = hwnd;679 for (i = nTipCount; i < infoPtr->numParts; i++) {680 TRACE("add tool %d\n", i);681 ti.uId = i;682 SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA,683 0, (LPARAM)&ti);684 }685 }686 else if (nTipCount > infoPtr->numParts) {687 /* delete tools */688 INT i;689 690 for (i = nTipCount - 1; i >= infoPtr->numParts; i--) {691 FIXME("delete tool %d\n", i);692 }693 }669 INT nTipCount = 670 SendMessageA (infoPtr->hwndToolTip, TTM_GETTOOLCOUNT, 0, 0); 671 672 if (nTipCount < infoPtr->numParts) { 673 /* add tools */ 674 TTTOOLINFOA ti; 675 INT i; 676 677 ZeroMemory (&ti, sizeof(TTTOOLINFOA)); 678 ti.cbSize = sizeof(TTTOOLINFOA); 679 ti.hwnd = hwnd; 680 for (i = nTipCount; i < infoPtr->numParts; i++) { 681 TRACE("add tool %d\n", i); 682 ti.uId = i; 683 SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA, 684 0, (LPARAM)&ti); 685 } 686 } 687 else if (nTipCount > infoPtr->numParts) { 688 /* delete tools */ 689 INT i; 690 691 for (i = nTipCount - 1; i >= infoPtr->numParts; i--) { 692 FIXME("delete tool %d\n", i); 693 } 694 } 694 695 } 695 696 STATUSBAR_SetPartBounds (infoPtr, hwnd); … … 703 704 { 704 705 STATUSWINDOWPART *part=NULL; 705 int nPart;706 int style;706 int nPart; 707 int style; 707 708 LPSTR text; 708 BOOL changed = FALSE;709 BOOL changed = FALSE; 709 710 710 711 text = (LPSTR) lParam; … … 715 716 716 717 if (nPart==255) 717 part = &infoPtr->part0;718 part = &infoPtr->part0; 718 719 else if (!infoPtr->simple && infoPtr->parts!=NULL) 719 720 #ifdef __WIN32OS2__ 720 721 { 721 722 if (nPart >= infoPtr->numParts) 722 return FALSE;723 part = &infoPtr->parts[nPart];723 return FALSE; 724 part = &infoPtr->parts[nPart]; 724 725 } 725 726 #else 726 part = &infoPtr->parts[nPart];727 part = &infoPtr->parts[nPart]; 727 728 #endif 728 729 if (!part) return FALSE; 729 730 730 731 if (part->style != style) 731 changed = TRUE;732 changed = TRUE; 732 733 733 734 part->style = style; 734 735 if (style & SBT_OWNERDRAW) { 735 if (part->text == (LPWSTR)text)736 return TRUE;737 part->text = (LPWSTR)text;736 if (part->text == (LPWSTR)text) 737 return TRUE; 738 part->text = (LPWSTR)text; 738 739 } else { 739 LPWSTR ntext;740 741 /* check if text is unchanged -> no need to redraw */742 if (text) {740 LPWSTR ntext; 741 742 /* check if text is unchanged -> no need to redraw */ 743 if (text) { 743 744 DWORD len = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 ); 744 LPWSTR tmptext = COMCTL32_Alloc(len*sizeof(WCHAR));745 LPWSTR tmptext = COMCTL32_Alloc(len*sizeof(WCHAR)); 745 746 MultiByteToWideChar( CP_ACP, 0, text, -1, tmptext, len ); 746 747 747 if (!changed && part->text && !lstrcmpW(tmptext,part->text)) {748 COMCTL32_Free(tmptext);749 return TRUE;750 }751 ntext = tmptext;752 } else {753 if (!changed && !part->text) 754 return TRUE;755 ntext = 0;756 }757 758 if (part->text)759 COMCTL32_Free (part->text);760 part->text = ntext;748 if (!changed && part->text && !lstrcmpW(tmptext,part->text)) { 749 COMCTL32_Free(tmptext); 750 return TRUE; 751 } 752 ntext = tmptext; 753 } else { 754 if (!changed && !part->text) 755 return TRUE; 756 ntext = 0; 757 } 758 759 if (part->text) 760 COMCTL32_Free (part->text); 761 part->text = ntext; 761 762 } 762 763 InvalidateRect(hwnd, &part->bound, FALSE); … … 780 781 TRACE("part %d -> '%s' with style %04x\n", nPart, debugstr_w(text), style); 781 782 if ((infoPtr->simple) || (infoPtr->parts==NULL) || (nPart==255)) 782 part = &infoPtr->part0;783 part = &infoPtr->part0; 783 784 else 784 785 #ifdef __WIN32OS2__ 785 786 { 786 787 if (nPart >= infoPtr->numParts) 787 return FALSE;788 part = &infoPtr->parts[nPart];788 return FALSE; 789 part = &infoPtr->parts[nPart]; 789 790 } 790 791 #else 791 part = &infoPtr->parts[nPart];792 part = &infoPtr->parts[nPart]; 792 793 #endif 793 794 if (!part) return FALSE; … … 801 802 if (style & SBT_OWNERDRAW) 802 803 { 803 part->text = text;804 part->text = text; 804 805 bRedraw = TRUE; 805 806 } else if(!text) … … 813 814 } else if(!part->text || strcmpW(part->text, text)) /* see if the new string differs from the existing string */ 814 815 { 815 if(part->text) COMCTL32_Free(part->text);816 if(part->text) COMCTL32_Free(part->text); 816 817 817 818 len = strlenW(text); 818 819 part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 819 strcpyW(part->text, text);820 strcpyW(part->text, text); 820 821 bRedraw = TRUE; 821 822 } … … 833 834 TRACE("part %d: \"%s\"\n", (INT)wParam, (LPSTR)lParam); 834 835 if (infoPtr->hwndToolTip) { 835 TTTOOLINFOA ti;836 ti.cbSize = sizeof(TTTOOLINFOA);837 ti.hwnd = hwnd;838 ti.uId = (INT)wParam;839 ti.hinst = 0;840 ti.lpszText = (LPSTR)lParam;841 SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA,842 0, (LPARAM)&ti);836 TTTOOLINFOA ti; 837 ti.cbSize = sizeof(TTTOOLINFOA); 838 ti.hwnd = hwnd; 839 ti.uId = (INT)wParam; 840 ti.hinst = 0; 841 ti.lpszText = (LPSTR)lParam; 842 SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA, 843 0, (LPARAM)&ti); 843 844 } 844 845 … … 852 853 TRACE("part %d: \"%s\"\n", (INT)wParam, (LPSTR)lParam); 853 854 if (infoPtr->hwndToolTip) { 854 TTTOOLINFOW ti;855 ti.cbSize = sizeof(TTTOOLINFOW);856 ti.hwnd = hwnd;857 ti.uId = (INT)wParam;858 ti.hinst = 0;859 ti.lpszText = (LPWSTR)lParam;860 SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW,861 0, (LPARAM)&ti);855 TTTOOLINFOW ti; 856 ti.cbSize = sizeof(TTTOOLINFOW); 857 ti.hwnd = hwnd; 858 ti.uId = (INT)wParam; 859 ti.hinst = 0; 860 ti.lpszText = (LPWSTR)lParam; 861 SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW, 862 0, (LPARAM)&ti); 862 863 } 863 864 … … 885 886 TRACE("(is simple: %d)\n", wParam); 886 887 if (infoPtr->simple == wParam) /* no need to change */ 887 return TRUE;888 return TRUE; 888 889 889 890 infoPtr->simple = (BOOL)wParam; … … 905 906 NONCLIENTMETRICSA nclm; 906 907 DWORD dwStyle; 907 RECT rect;908 int width, len;909 HDC hdc;908 RECT rect; 909 int width, len; 910 HDC hdc; 910 911 STATUSWINDOWINFO *infoPtr; 911 912 … … 951 952 952 953 if (IsWindowUnicode (hwnd)) { 953 infoPtr->bUnicode = TRUE;954 if (lpCreate->lpszName &&955 (len = strlenW ((LPCWSTR)lpCreate->lpszName))) {956 infoPtr->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));957 strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName);958 }954 infoPtr->bUnicode = TRUE; 955 if (lpCreate->lpszName && 956 (len = strlenW ((LPCWSTR)lpCreate->lpszName))) { 957 infoPtr->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 958 strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName); 959 } 959 960 } 960 961 else { 961 if (lpCreate->lpszName &&962 (len = strlen((LPCSTR)lpCreate->lpszName))) {962 if (lpCreate->lpszName && 963 (len = strlen((LPCSTR)lpCreate->lpszName))) { 963 964 DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, NULL, 0 ); 964 infoPtr->parts[0].text = COMCTL32_Alloc (lenW*sizeof(WCHAR));965 infoPtr->parts[0].text = COMCTL32_Alloc (lenW*sizeof(WCHAR)); 965 966 MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, 966 967 infoPtr->parts[0].text, lenW ); 967 }968 } 968 969 } 969 970 … … 977 978 #endif 978 979 if ((hdc = GetDC (0))) { 979 TEXTMETRICA tm;980 HFONT hOldFont;981 982 hOldFont = SelectObject (hdc,infoPtr->hDefaultFont);983 GetTextMetricsA(hdc, &tm);984 infoPtr->textHeight = tm.tmHeight;985 SelectObject (hdc, hOldFont);986 ReleaseDC(0, hdc);980 TEXTMETRICA tm; 981 HFONT hOldFont; 982 983 hOldFont = SelectObject (hdc,infoPtr->hDefaultFont); 984 GetTextMetricsA(hdc, &tm); 985 infoPtr->textHeight = tm.tmHeight; 986 SelectObject (hdc, hOldFont); 987 ReleaseDC(0, hdc); 987 988 } 988 989 989 990 if (dwStyle & SBT_TOOLTIPS) { 990 infoPtr->hwndToolTip =991 CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0,992 CW_USEDEFAULT, CW_USEDEFAULT,993 CW_USEDEFAULT, CW_USEDEFAULT,994 hwnd, 0,995 GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);996 997 if (infoPtr->hwndToolTip) {998 NMTOOLTIPSCREATED nmttc;999 1000 nmttc.hdr.hwndFrom = hwnd;1001 nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);1002 nmttc.hdr.code = NM_TOOLTIPSCREATED;1003 nmttc.hwndToolTips = infoPtr->hwndToolTip;1004 1005 SendMessageA (lpCreate->hwndParent, WM_NOTIFY,1006 (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc);1007 }991 infoPtr->hwndToolTip = 992 CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0, 993 CW_USEDEFAULT, CW_USEDEFAULT, 994 CW_USEDEFAULT, CW_USEDEFAULT, 995 hwnd, 0, 996 GetWindowLongA (hwnd, GWL_HINSTANCE), NULL); 997 998 if (infoPtr->hwndToolTip) { 999 NMTOOLTIPSCREATED nmttc; 1000 1001 nmttc.hdr.hwndFrom = hwnd; 1002 nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1003 nmttc.hdr.code = NM_TOOLTIPSCREATED; 1004 nmttc.hwndToolTips = infoPtr->hwndToolTip; 1005 1006 SendMessageA (lpCreate->hwndParent, WM_NOTIFY, 1007 (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc); 1008 } 1008 1009 } 1009 1010 … … 1014 1015 infoPtr->height = infoPtr->textHeight + 4 + VERT_BORDER; 1015 1016 SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1, 1016 width, infoPtr->height, SWP_NOZORDER);1017 width, infoPtr->height, SWP_NOZORDER); 1017 1018 STATUSBAR_SetPartBounds (infoPtr, hwnd); 1018 1019 } … … 1025 1026 STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr, HWND hwnd) 1026 1027 { 1027 int i;1028 int i; 1028 1029 1029 1030 TRACE("\n"); 1030 1031 for (i = 0; i < infoPtr->numParts; i++) { 1031 if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW))1032 COMCTL32_Free (infoPtr->parts[i].text);1032 if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW)) 1033 COMCTL32_Free (infoPtr->parts[i].text); 1033 1034 } 1034 1035 if (infoPtr->part0.text && !(infoPtr->part0.style & SBT_OWNERDRAW)) 1035 COMCTL32_Free (infoPtr->part0.text);1036 COMCTL32_Free (infoPtr->part0.text); 1036 1037 COMCTL32_Free (infoPtr->parts); 1037 1038 1038 1039 /* delete default font */ 1039 1040 if (infoPtr->hDefaultFont) 1040 DeleteObject (infoPtr->hDefaultFont);1041 DeleteObject (infoPtr->hDefaultFont); 1041 1042 1042 1043 /* delete tool tip control */ 1043 1044 if (infoPtr->hwndToolTip) 1044 DestroyWindow (infoPtr->hwndToolTip);1045 DestroyWindow (infoPtr->hwndToolTip); 1045 1046 1046 1047 COMCTL32_Free (infoPtr); … … 1074 1075 1075 1076 if (wParam > len) { 1076 if (infoPtr->bUnicode)1077 strcpyW ((LPWSTR)lParam, infoPtr->parts[0].text);1078 else1077 if (infoPtr->bUnicode) 1078 strcpyW ((LPWSTR)lParam, infoPtr->parts[0].text); 1079 else 1079 1080 WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1, 1080 1081 (LPSTR)lParam, len+1, NULL, NULL ); 1081 return len;1082 return len; 1082 1083 } 1083 1084 … … 1090 1091 { 1091 1092 if (infoPtr->hwndToolTip) 1092 STATUSBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,1093 WM_MOUSEMOVE, wParam, lParam);1093 STATUSBAR_RelayEvent (infoPtr->hwndToolTip, hwnd, 1094 WM_MOUSEMOVE, wParam, lParam); 1094 1095 return 0; 1095 1096 } … … 1100 1101 { 1101 1102 if (GetWindowLongA (hwnd, GWL_STYLE) & SBARS_SIZEGRIP) { 1102 RECT rect;1103 POINT pt;1104 1105 GetClientRect (hwnd, &rect);1106 1107 pt.x = (INT)LOWORD(lParam);1108 pt.y = (INT)HIWORD(lParam);1109 ScreenToClient (hwnd, &pt);1110 1111 rect.left = rect.right - 13;1112 rect.top += 2;1113 1114 if (PtInRect (&rect, pt))1115 return HTBOTTOMRIGHT;1103 RECT rect; 1104 POINT pt; 1105 1106 GetClientRect (hwnd, &rect); 1107 1108 pt.x = (INT)LOWORD(lParam); 1109 pt.y = (INT)HIWORD(lParam); 1110 ScreenToClient (hwnd, &pt); 1111 1112 rect.left = rect.right - 13; 1113 rect.top += 2; 1114 1115 if (PtInRect (&rect, pt)) 1116 return HTBOTTOMRIGHT; 1116 1117 } 1117 1118 … … 1149 1150 STATUSBAR_Refresh (infoPtr, hwnd, hdc); 1150 1151 if (!wParam) 1151 EndPaint (hwnd, &ps);1152 EndPaint (hwnd, &ps); 1152 1153 1153 1154 return 0; … … 1194 1195 TRACE("\n"); 1195 1196 if (infoPtr->numParts == 0) 1196 return FALSE;1197 return FALSE; 1197 1198 1198 1199 part = &infoPtr->parts[0]; … … 1202 1203 part->text = 0; 1203 1204 if (infoPtr->bUnicode) { 1204 if (lParam && (len = strlenW((LPCWSTR)lParam))) {1205 part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));1206 strcpyW (part->text, (LPCWSTR)lParam);1207 }1205 if (lParam && (len = strlenW((LPCWSTR)lParam))) { 1206 part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1207 strcpyW (part->text, (LPCWSTR)lParam); 1208 } 1208 1209 } 1209 1210 else { 1210 if (lParam && (len = lstrlenA((LPCSTR)lParam))) {1211 if (lParam && (len = lstrlenA((LPCSTR)lParam))) { 1211 1212 DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lParam, -1, NULL, 0 ); 1212 1213 part->text = COMCTL32_Alloc (lenW*sizeof(WCHAR)); 1213 1214 MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lParam, -1, part->text, lenW ); 1214 }1215 } 1215 1216 } 1216 1217 … … 1240 1241 { 1241 1242 if (flags == SIZE_RESTORED) { 1242 /* width and height don't apply */1243 GetClientRect (infoPtr->hwndParent, &parent_rect);1244 width = parent_rect.right - parent_rect.left;1245 x = parent_rect.left;1246 y = parent_rect.bottom - infoPtr->height;1247 MoveWindow (hwnd, parent_rect.left, 1248 parent_rect.bottom - infoPtr->height,1249 width, infoPtr->height, TRUE);1250 STATUSBAR_SetPartBounds (infoPtr, hwnd);1243 /* width and height don't apply */ 1244 GetClientRect (infoPtr->hwndParent, &parent_rect); 1245 width = parent_rect.right - parent_rect.left; 1246 x = parent_rect.left; 1247 y = parent_rect.bottom - infoPtr->height; 1248 MoveWindow (hwnd, parent_rect.left, 1249 parent_rect.bottom - infoPtr->height, 1250 width, infoPtr->height, TRUE); 1251 STATUSBAR_SetPartBounds (infoPtr, hwnd); 1251 1252 } 1252 return 0; /* FIXME: ok to return here ? */1253 return 0; /* FIXME: ok to return here ? */ 1253 1254 } 1254 1255 … … 1283 1284 1284 1285 switch (msg) { 1285 case SB_GETBORDERS:1286 return STATUSBAR_GetBorders (lParam);1287 1288 case SB_GETICON:1289 return STATUSBAR_GetIcon (infoPtr, hwnd, wParam);1290 1291 case SB_GETPARTS:1292 return STATUSBAR_GetParts (infoPtr, hwnd, wParam, lParam);1293 1294 case SB_GETRECT:1295 return STATUSBAR_GetRect (infoPtr, hwnd, wParam, lParam);1296 1297 case SB_GETTEXTA:1298 return STATUSBAR_GetTextA (infoPtr, hwnd, wParam, lParam);1299 1300 case SB_GETTEXTW:1301 return STATUSBAR_GetTextW (infoPtr, hwnd, wParam, lParam);1302 1303 case SB_GETTEXTLENGTHA:1304 case SB_GETTEXTLENGTHW:1305 return STATUSBAR_GetTextLength (infoPtr, hwnd, wParam);1306 1307 case SB_GETTIPTEXTA:1308 return STATUSBAR_GetTipTextA (infoPtr, hwnd, wParam, lParam);1309 1310 case SB_GETTIPTEXTW:1311 return STATUSBAR_GetTipTextW (infoPtr, hwnd, wParam, lParam);1312 1313 case SB_GETUNICODEFORMAT:1314 return STATUSBAR_GetUnicodeFormat (infoPtr, hwnd);1315 1316 case SB_ISSIMPLE:1317 return STATUSBAR_IsSimple (infoPtr, hwnd);1318 1319 case SB_SETBKCOLOR:1320 return STATUSBAR_SetBkColor (infoPtr, hwnd, wParam, lParam);1321 1322 case SB_SETICON:1323 return STATUSBAR_SetIcon (infoPtr, hwnd, wParam, lParam);1324 1325 case SB_SETMINHEIGHT:1326 return STATUSBAR_SetMinHeight (infoPtr, hwnd, wParam, lParam);1327 1328 case SB_SETPARTS: 1329 return STATUSBAR_SetParts (infoPtr, hwnd, wParam, lParam);1330 1331 case SB_SETTEXTA:1332 return STATUSBAR_SetTextA (infoPtr, hwnd, wParam, lParam);1333 1334 case SB_SETTEXTW:1335 return STATUSBAR_SetTextW (infoPtr, hwnd, wParam, lParam);1336 1337 case SB_SETTIPTEXTA:1338 return STATUSBAR_SetTipTextA (infoPtr, hwnd, wParam, lParam);1339 1340 case SB_SETTIPTEXTW:1341 return STATUSBAR_SetTipTextW (infoPtr, hwnd, wParam, lParam);1342 1343 case SB_SETUNICODEFORMAT:1344 return STATUSBAR_SetUnicodeFormat (infoPtr, hwnd, wParam);1345 1346 case SB_SIMPLE:1347 return STATUSBAR_Simple (infoPtr, hwnd, wParam, lParam);1348 1349 1350 case WM_CREATE:1351 return STATUSBAR_WMCreate (hwnd, wParam, lParam);1352 1353 case WM_DESTROY:1354 return STATUSBAR_WMDestroy (infoPtr, hwnd);1355 1356 case WM_GETFONT:1286 case SB_GETBORDERS: 1287 return STATUSBAR_GetBorders (lParam); 1288 1289 case SB_GETICON: 1290 return STATUSBAR_GetIcon (infoPtr, hwnd, wParam); 1291 1292 case SB_GETPARTS: 1293 return STATUSBAR_GetParts (infoPtr, hwnd, wParam, lParam); 1294 1295 case SB_GETRECT: 1296 return STATUSBAR_GetRect (infoPtr, hwnd, wParam, lParam); 1297 1298 case SB_GETTEXTA: 1299 return STATUSBAR_GetTextA (infoPtr, hwnd, wParam, lParam); 1300 1301 case SB_GETTEXTW: 1302 return STATUSBAR_GetTextW (infoPtr, hwnd, wParam, lParam); 1303 1304 case SB_GETTEXTLENGTHA: 1305 case SB_GETTEXTLENGTHW: 1306 return STATUSBAR_GetTextLength (infoPtr, hwnd, wParam); 1307 1308 case SB_GETTIPTEXTA: 1309 return STATUSBAR_GetTipTextA (infoPtr, hwnd, wParam, lParam); 1310 1311 case SB_GETTIPTEXTW: 1312 return STATUSBAR_GetTipTextW (infoPtr, hwnd, wParam, lParam); 1313 1314 case SB_GETUNICODEFORMAT: 1315 return STATUSBAR_GetUnicodeFormat (infoPtr, hwnd); 1316 1317 case SB_ISSIMPLE: 1318 return STATUSBAR_IsSimple (infoPtr, hwnd); 1319 1320 case SB_SETBKCOLOR: 1321 return STATUSBAR_SetBkColor (infoPtr, hwnd, wParam, lParam); 1322 1323 case SB_SETICON: 1324 return STATUSBAR_SetIcon (infoPtr, hwnd, wParam, lParam); 1325 1326 case SB_SETMINHEIGHT: 1327 return STATUSBAR_SetMinHeight (infoPtr, hwnd, wParam, lParam); 1328 1329 case SB_SETPARTS: 1330 return STATUSBAR_SetParts (infoPtr, hwnd, wParam, lParam); 1331 1332 case SB_SETTEXTA: 1333 return STATUSBAR_SetTextA (infoPtr, hwnd, wParam, lParam); 1334 1335 case SB_SETTEXTW: 1336 return STATUSBAR_SetTextW (infoPtr, hwnd, wParam, lParam); 1337 1338 case SB_SETTIPTEXTA: 1339 return STATUSBAR_SetTipTextA (infoPtr, hwnd, wParam, lParam); 1340 1341 case SB_SETTIPTEXTW: 1342 return STATUSBAR_SetTipTextW (infoPtr, hwnd, wParam, lParam); 1343 1344 case SB_SETUNICODEFORMAT: 1345 return STATUSBAR_SetUnicodeFormat (infoPtr, hwnd, wParam); 1346 1347 case SB_SIMPLE: 1348 return STATUSBAR_Simple (infoPtr, hwnd, wParam, lParam); 1349 1350 1351 case WM_CREATE: 1352 return STATUSBAR_WMCreate (hwnd, wParam, lParam); 1353 1354 case WM_DESTROY: 1355 return STATUSBAR_WMDestroy (infoPtr, hwnd); 1356 1357 case WM_GETFONT: 1357 1358 return STATUSBAR_WMGetFont (infoPtr, hwnd); 1358 1359 1359 case WM_GETTEXT:1360 case WM_GETTEXT: 1360 1361 return STATUSBAR_WMGetText (infoPtr, hwnd, wParam, lParam); 1361 1362 1362 case WM_GETTEXTLENGTH:1363 return STATUSBAR_GetTextLength (infoPtr, hwnd, 0);1364 1365 case WM_LBUTTONDBLCLK:1363 case WM_GETTEXTLENGTH: 1364 return STATUSBAR_GetTextLength (infoPtr, hwnd, 0); 1365 1366 case WM_LBUTTONDBLCLK: 1366 1367 return STATUSBAR_SendNotify (hwnd, NM_DBLCLK); 1367 1368 1368 case WM_LBUTTONUP:1369 return STATUSBAR_SendNotify (hwnd, NM_CLICK);1370 1371 case WM_MOUSEMOVE:1369 case WM_LBUTTONUP: 1370 return STATUSBAR_SendNotify (hwnd, NM_CLICK); 1371 1372 case WM_MOUSEMOVE: 1372 1373 return STATUSBAR_WMMouseMove (infoPtr, hwnd, wParam, lParam); 1373 1374 1374 case WM_NCHITTEST:1375 case WM_NCHITTEST: 1375 1376 return STATUSBAR_WMNCHitTest (hwnd, wParam, lParam); 1376 1377 1377 case WM_NCLBUTTONDOWN:1378 return STATUSBAR_WMNCLButtonDown (hwnd, wParam, lParam);1379 1380 case WM_NCLBUTTONUP:1381 return STATUSBAR_WMNCLButtonUp (hwnd, wParam, lParam);1382 1383 case WM_PAINT:1384 return STATUSBAR_WMPaint (infoPtr, hwnd, wParam);1385 1386 case WM_RBUTTONDBLCLK:1387 return STATUSBAR_SendNotify (hwnd, NM_RDBLCLK);1388 1389 case WM_RBUTTONUP:1390 return STATUSBAR_SendNotify (hwnd, NM_RCLICK);1391 1392 case WM_SETFONT:1393 return STATUSBAR_WMSetFont (infoPtr, hwnd, wParam, lParam);1394 1395 case WM_SETTEXT:1396 return STATUSBAR_WMSetText (infoPtr, hwnd, wParam, lParam);1397 1398 case WM_SIZE:1399 return STATUSBAR_WMSize (infoPtr, hwnd, wParam, lParam);1400 1401 default:1402 if (msg >= WM_USER)1403 ERR("unknown msg %04x wp=%04x lp=%08lx\n",1404 msg, wParam, lParam);1378 case WM_NCLBUTTONDOWN: 1379 return STATUSBAR_WMNCLButtonDown (hwnd, wParam, lParam); 1380 1381 case WM_NCLBUTTONUP: 1382 return STATUSBAR_WMNCLButtonUp (hwnd, wParam, lParam); 1383 1384 case WM_PAINT: 1385 return STATUSBAR_WMPaint (infoPtr, hwnd, wParam); 1386 1387 case WM_RBUTTONDBLCLK: 1388 return STATUSBAR_SendNotify (hwnd, NM_RDBLCLK); 1389 1390 case WM_RBUTTONUP: 1391 return STATUSBAR_SendNotify (hwnd, NM_RCLICK); 1392 1393 case WM_SETFONT: 1394 return STATUSBAR_WMSetFont (infoPtr, hwnd, wParam, lParam); 1395 1396 case WM_SETTEXT: 1397 return STATUSBAR_WMSetText (infoPtr, hwnd, wParam, lParam); 1398 1399 case WM_SIZE: 1400 return STATUSBAR_WMSize (infoPtr, hwnd, wParam, lParam); 1401 1402 default: 1403 if (msg >= WM_USER) 1404 ERR("unknown msg %04x wp=%04x lp=%08lx\n", 1405 msg, wParam, lParam); 1405 1406 #ifdef __WIN32OS2__ 1406 1407 return defComCtl32ProcA (hwnd, msg, wParam, lParam); 1407 1408 #else 1408 return DefWindowProcA (hwnd, msg, wParam, lParam);1409 return DefWindowProcA (hwnd, msg, wParam, lParam); 1409 1410 #endif 1410 1411 } … … 1432 1433 wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); 1433 1434 wndClass.lpszClassName = STATUSCLASSNAMEA; 1434 1435 1435 1436 RegisterClassA (&wndClass); 1436 1437 } -
trunk/src/comctl32/tab.c
r5630 r6644 1 /* $Id: tab.c,v 1.21 2001-09-05 12:05:02 bird Exp $ */ 1 2 /* 2 3 * Tab control … … 36 37 LPARAM lParam; 37 38 RECT rect; /* bounding rectangle of the item relative to the 38 * leftmost item (the leftmost item, 0, would have a 39 * "left" member of 0 in this rectangle) 40 * 39 * leftmost item (the leftmost item, 0, would have a 40 * "left" member of 0 in this rectangle) 41 * 41 42 * additionally the top member hold the row number 42 43 * and bottom is unused and should be 0 */ … … 49 50 #endif 50 51 UINT uNumItem; /* number of tab items */ 51 UINT uNumRows; /* number of tab rows */52 UINT uNumRows; /* number of tab rows */ 52 53 INT tabHeight; /* height of the tab row */ 53 54 INT tabWidth; /* width of tabs */ … … 57 58 HWND hwndToolTip; /* handle to tab's tooltip */ 58 59 INT leftmostVisible; /* Used for scrolling, this member contains 59 * the index of the first visible item */60 * the index of the first visible item */ 60 61 INT iSelected; /* the currently selected item */ 61 62 INT iHotTracked; /* the highlighted item under the mouse */ … … 63 64 TAB_ITEM* items; /* pointer to an array of TAB_ITEM's */ 64 65 BOOL DoRedraw; /* flag for redrawing when tab contents is changed*/ 65 BOOL needsScrolling; /* TRUE if the size of the tabs is greater than 66 * the size of the control */67 BOOL fSizeSet;/* was the size of the tabs explicitly set? */66 BOOL needsScrolling; /* TRUE if the size of the tabs is greater than 67 * the size of the control */ 68 BOOL fSizeSet; /* was the size of the tabs explicitly set? */ 68 69 BOOL bUnicode; /* Unicode control? */ 69 70 HWND hwndUpDown; /* Updown control used for scrolling */ … … 81 82 #define CONTROL_BORDER_SIZEX 2 82 83 #define CONTROL_BORDER_SIZEY 2 83 #define BUTTON_SPACINGX 4 84 #define BUTTON_SPACINGX 4 84 85 #define BUTTON_SPACINGY 4 85 86 #define FLAT_BTN_SPACINGX 8 … … 137 138 { 138 139 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 139 140 140 141 return infoPtr->iSelected; 141 142 } … … 145 146 { 146 147 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 147 148 148 149 return infoPtr->uFocus; 149 150 } … … 164 165 INT iItem = (INT)wParam; 165 166 INT prevItem; 166 167 167 168 prevItem = -1; 168 169 if ((iItem >= 0) && (iItem < infoPtr->uNumItem)) { … … 180 181 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 181 182 INT iItem=(INT) wParam; 182 183 183 184 if ((iItem < 0) || (iItem >= infoPtr->uNumItem)) return 0; 184 185 185 186 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BUTTONS) { 186 187 FIXME("Should set input focus\n"); 187 } else { 188 } else { 188 189 int oldFocus = infoPtr->uFocus; 189 190 if (infoPtr->iSelected != iItem || infoPtr->uFocus == -1 ) { … … 232 233 RECT tmpItemRect,clientRect; 233 234 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 234 235 235 236 /* Perform a sanity check and a trivial visibility check. */ 236 237 if ( (infoPtr->uNumItem <= 0) || … … 245 246 if (itemRect == NULL) 246 247 itemRect = &tmpItemRect; 247 248 248 249 /* Retrieve the unmodified item rect. */ 249 250 *itemRect = infoPtr->items[itemIndex].rect; … … 280 281 else if(!(lStyle & TCS_VERTICAL) && !(lStyle & TCS_BOTTOM)) /* not TCS_BOTTOM and not TCS_VERTICAL */ 281 282 { 282 itemRect->bottom = clientRect.top + 283 itemRect->bottom = clientRect.top + 283 284 infoPtr->tabHeight + 284 285 itemRect->top * (infoPtr->tabHeight - 2) + 285 286 ((lStyle & TCS_BUTTONS) ? itemRect->top * BUTTON_SPACINGY : 0); 286 itemRect->top = clientRect.top + 287 itemRect->top = clientRect.top + 287 288 SELECTED_TAB_OFFSET + 288 289 itemRect->top * (infoPtr->tabHeight - 2) + … … 291 292 292 293 /* 293 * "scroll" it to make sure the item at the very left of the 294 * "scroll" it to make sure the item at the very left of the 294 295 * tab control is the leftmost visible tab. 295 296 */ … … 297 298 { 298 299 OffsetRect(itemRect, 299 0,300 -(clientRect.bottom - infoPtr->items[infoPtr->leftmostVisible].rect.bottom));300 0, 301 -(clientRect.bottom - infoPtr->items[infoPtr->leftmostVisible].rect.bottom)); 301 302 302 303 /* … … 305 306 */ 306 307 OffsetRect(itemRect, 307 0,308 -SELECTED_TAB_OFFSET);308 0, 309 -SELECTED_TAB_OFFSET); 309 310 310 311 } else 311 312 { 312 313 OffsetRect(itemRect, 313 -infoPtr->items[infoPtr->leftmostVisible].rect.left, 314 0);314 -infoPtr->items[infoPtr->leftmostVisible].rect.left, 315 0); 315 316 316 317 /* … … 319 320 */ 320 321 OffsetRect(itemRect, 321 SELECTED_TAB_OFFSET,322 0);322 SELECTED_TAB_OFFSET, 323 0); 323 324 } 324 325 … … 336 337 /* If it also a bit higher. */ 337 338 if ((lStyle & TCS_BOTTOM) && !(lStyle & TCS_VERTICAL)) 338 { 339 { 339 340 selectedRect->top -= 2; /* the border is thicker on the bottom */ 340 341 selectedRect->bottom += SELECTED_TAB_OFFSET; … … 362 363 static BOOL TAB_GetItemRect(HWND hwnd, WPARAM wParam, LPARAM lParam) 363 364 { 364 return TAB_InternalGetItemRect(hwnd, TAB_GetInfoPtr(hwnd), (INT)wParam, 365 return TAB_InternalGetItemRect(hwnd, TAB_GetInfoPtr(hwnd), (INT)wParam, 365 366 (LPRECT)lParam, (LPRECT)NULL); 366 367 } … … 372 373 */ 373 374 static LRESULT TAB_KeyUp( 374 HWND hwnd, 375 HWND hwnd, 375 376 WPARAM keyCode) 376 377 { … … 387 388 break; 388 389 } 389 390 390 391 /* 391 392 * If we changed to a valid item, change the selection … … 416 417 */ 417 418 static LRESULT TAB_FocusChanging( 418 HWND hwnd, 419 UINT uMsg, 420 WPARAM wParam, 419 HWND hwnd, 420 UINT uMsg, 421 WPARAM wParam, 421 422 LPARAM lParam) 422 423 { … … 429 430 */ 430 431 isVisible = TAB_InternalGetItemRect(hwnd, 431 infoPtr,432 infoPtr->uFocus,433 NULL,434 &selectedRect);435 432 infoPtr, 433 infoPtr->uFocus, 434 NULL, 435 &selectedRect); 436 436 437 /* 437 438 * If the rectangle is not completely invisible, invalidate that … … 451 452 static HWND TAB_InternalHitTest ( 452 453 HWND hwnd, 453 TAB_INFO* infoPtr, 454 POINT pt, 454 TAB_INFO* infoPtr, 455 POINT pt, 455 456 UINT* flags) 456 457 457 458 { 458 459 RECT rect; 459 int iCount; 460 460 int iCount; 461 461 462 for (iCount = 0; iCount < infoPtr->uNumItem; iCount++) 462 463 { … … 479 480 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 480 481 LPTCHITTESTINFO lptest = (LPTCHITTESTINFO) lParam; 481 482 482 483 return TAB_InternalHitTest (hwnd, infoPtr, lptest->pt, &lptest->flags); 483 484 } … … 521 522 if (infoPtr->hwndToolTip) 522 523 TAB_RelayEvent (infoPtr->hwndToolTip, hwnd, 523 WM_LBUTTONDOWN, wParam, lParam);524 WM_LBUTTONDOWN, wParam, lParam); 524 525 525 526 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_FOCUSONBUTTONDOWN ) { … … 529 530 if (infoPtr->hwndToolTip) 530 531 TAB_RelayEvent (infoPtr->hwndToolTip, hwnd, 531 WM_LBUTTONDOWN, wParam, lParam);532 532 WM_LBUTTONDOWN, wParam, lParam); 533 533 534 pt.x = (INT)LOWORD(lParam); 534 535 pt.y = (INT)HIWORD(lParam); 535 536 536 537 newItem = TAB_InternalHitTest (hwnd, infoPtr, pt, &dummy); 537 538 538 539 TRACE("On Tab, item %d\n", newItem); 539 540 … … 619 620 ** overlaps. Note also that the case where the cursor stayed within our 620 621 ** window but has moved off the hot-tracked tab will be handled by the 621 ** WM_MOUSEMOVE event. 622 ** WM_MOUSEMOVE event. 622 623 */ 623 624 if (!GetCursorPos(&pt) || WindowFromPoint(pt) != hwnd) … … 721 722 if (item >= 0) 722 723 { 723 /* Mark new hot-tracked to be redrawn to look highlighted */724 /* Mark new hot-tracked to be redrawn to look highlighted */ 724 725 if (out_redrawEnter != NULL) 725 726 *out_redrawEnter = item; … … 743 744 if (infoPtr->hwndToolTip) 744 745 TAB_RelayEvent (infoPtr->hwndToolTip, hwnd, 745 WM_LBUTTONDOWN, wParam, lParam);746 WM_LBUTTONDOWN, wParam, lParam); 746 747 747 748 /* Determine which tab to highlight. Redraw tabs which change highlight … … 764 765 */ 765 766 static LRESULT TAB_AdjustRect( 766 HWND hwnd, 767 WPARAM fLarger, 767 HWND hwnd, 768 WPARAM fLarger, 768 769 LPRECT prc) 769 770 { … … 845 846 */ 846 847 static LRESULT TAB_OnHScroll( 847 HWND hwnd, 848 HWND hwnd, 848 849 int nScrollCode, 849 850 int nPos, … … 871 872 * TAB_SetupScrolling 872 873 * 873 * This method will check the current scrolling state and make sure the 874 * This method will check the current scrolling state and make sure the 874 875 * scrolling control is displayed (or not). 875 876 */ … … 930 931 { 931 932 infoPtr->hwndUpDown = CreateWindowA("msctls_updown32", 932 "",933 WS_VISIBLE | WS_CHILD | UDS_HORZ,934 controlPos.left, controlPos.top,935 controlPos.right - controlPos.left,936 controlPos.bottom - controlPos.top,937 hwnd,938 (HMENU)NULL, 939 (HINSTANCE)NULL, 940 NULL); 933 "", 934 WS_VISIBLE | WS_CHILD | UDS_HORZ, 935 controlPos.left, controlPos.top, 936 controlPos.right - controlPos.left, 937 controlPos.bottom - controlPos.top, 938 hwnd, 939 (HMENU)NULL, 940 (HINSTANCE)NULL, 941 NULL); 941 942 } 942 943 else 943 944 { 944 SetWindowPos(infoPtr->hwndUpDown, 945 (HWND)NULL,946 controlPos.left, controlPos.top,947 controlPos.right - controlPos.left,948 controlPos.bottom - controlPos.top,949 SWP_SHOWWINDOW | SWP_NOZORDER); 945 SetWindowPos(infoPtr->hwndUpDown, 946 (HWND)NULL, 947 controlPos.left, controlPos.top, 948 controlPos.right - controlPos.left, 949 controlPos.bottom - controlPos.top, 950 SWP_SHOWWINDOW | SWP_NOZORDER); 950 951 } 951 952 … … 1010 1011 * a font. 1011 1012 */ 1012 hdc = GetDC(hwnd); 1013 1013 hdc = GetDC(hwnd); 1014 1014 1015 hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject (SYSTEM_FONT); 1015 1016 hOldFont = SelectObject (hdc, hFont); … … 1022 1023 1023 1024 /* if TCS_VERTICAL then swap the height and width so this code places the 1024 tabs along the top of the rectangle and we can just rotate them after 1025 tabs along the top of the rectangle and we can just rotate them after 1025 1026 rather than duplicate all of the below code */ 1026 1027 if(lStyle & TCS_VERTICAL) … … 1054 1055 1055 1056 /* 1056 * Make sure there is enough space for the letters + icon + growing the 1057 * selected item + extra space for the selected item. 1057 * Make sure there is enough space for the letters + icon + growing the 1058 * selected item + extra space for the selected item. 1058 1059 */ 1059 1060 infoPtr->tabHeight = item_height + 2 * VERTICAL_ITEM_PADDING + … … 1085 1086 * for button style tabs */ 1086 1087 if (lStyle & TCS_BUTTONS) 1087 size.cx = max(size.cx, 2 * (infoPtr->tabHeight - 2));1088 size.cx = max(size.cx, 2 * (infoPtr->tabHeight - 2)); 1088 1089 1089 1090 /* Add the icon width */ … … 1095 1096 1096 1097 infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left + 1097 size.cx + icon_width + 1098 size.cx + icon_width + 1098 1099 num * HORIZONTAL_ITEM_PADDING; 1099 1100 } … … 1114 1115 infoPtr->items[curItem].rect.left; 1115 1116 1116 infoPtr->items[curItem].rect.left = 0;1117 infoPtr->items[curItem].rect.left = 0; 1117 1118 curItemRowCount++; 1118 1119 } … … 1122 1123 1123 1124 TRACE("TextSize: %li\n", size.cx); 1124 TRACE("Rect: T %i, L %i, B %i, R %i\n", 1125 infoPtr->items[curItem].rect.top,1126 infoPtr->items[curItem].rect.left,1127 infoPtr->items[curItem].rect.bottom,1128 infoPtr->items[curItem].rect.right); 1125 TRACE("Rect: T %i, L %i, B %i, R %i\n", 1126 infoPtr->items[curItem].rect.top, 1127 infoPtr->items[curItem].rect.left, 1128 infoPtr->items[curItem].rect.bottom, 1129 infoPtr->items[curItem].rect.right); 1129 1130 1130 1131 /* … … 1152 1153 /* Don't need scrolling, then update infoPtr->leftmostVisible */ 1153 1154 if(!infoPtr->needsScrolling) 1154 infoPtr->leftmostVisible = 0; 1155 infoPtr->leftmostVisible = 0; 1155 1156 1156 1157 TAB_SetupScrolling(hwnd, infoPtr, &clientRect); … … 1193 1194 1194 1195 /* shift the item to the left side of the clientRect */ 1195 infoPtr->items[iItm].rect.right -= 1196 infoPtr->items[iItm].rect.right -= 1196 1197 infoPtr->items[iItm].rect.left; 1197 1198 infoPtr->items[iItm].rect.left = 0; … … 1202 1203 infoPtr->items[iItm].rect.top = iRow; 1203 1204 if (lStyle & TCS_BUTTONS) 1204 {1205 { 1205 1206 curItemLeftPos = infoPtr->items[iItm].rect.right + 1; 1206 1207 if (lStyle & TCS_FLATBUTTONS) 1207 curItemLeftPos += FLAT_BTN_SPACINGX;1208 }1208 curItemLeftPos += FLAT_BTN_SPACINGX; 1209 } 1209 1210 else 1210 1211 curItemLeftPos = infoPtr->items[iItm].rect.right; 1211 1212 } 1212 1213 1213 1214 /* 1214 1215 * Justify the rows … … 1217 1218 while(iIndexStart < infoPtr->uNumItem) 1218 1219 { 1219 /* 1220 /* 1220 1221 * find the indexs of the row 1221 1222 */ 1222 1223 /* find the first item on the next row */ 1223 1224 for (iIndexEnd=iIndexStart; 1224 (iIndexEnd < infoPtr->uNumItem) && 1225 (infoPtr->items[iIndexEnd].rect.top ==1225 (iIndexEnd < infoPtr->uNumItem) && 1226 (infoPtr->items[iIndexEnd].rect.top == 1226 1227 infoPtr->items[iIndexStart].rect.top) ; 1227 1228 iIndexEnd++) 1228 1229 /* intentionaly blank */; 1229 1230 1230 /* 1231 /* 1231 1232 * we need to justify these tabs so they fill the whole given 1232 1233 * client area … … 1246 1247 widthDiff = widthDiff / iCount; 1247 1248 /* add widthDiff/iCount, or extra space/items on row, to each item on this row */ 1248 for (iIndex=iIndexStart,iCount=0; iIndex < iIndexEnd; 1249 for (iIndex=iIndexStart,iCount=0; iIndex < iIndexEnd; 1249 1250 iIndex++,iCount++) 1250 1251 { … … 1297 1298 * This method is used to draw the interior (text and icon) of a single tab 1298 1299 * into the tab control. 1299 */ 1300 */ 1300 1301 static void 1301 1302 TAB_DrawItemInterior … … 1390 1391 id = GetWindowLongA( hwnd, GWL_ID ); 1391 1392 1392 /* 1393 /* 1393 1394 * put together the DRAWITEMSTRUCT 1394 1395 */ 1395 dis.CtlType = ODT_TAB; 1396 dis.CtlID = id; 1397 dis.itemID = iItem; 1398 dis.itemAction = ODA_DRAWENTIRE; 1396 dis.CtlType = ODT_TAB; 1397 dis.CtlID = id; 1398 dis.itemID = iItem; 1399 dis.itemAction = ODA_DRAWENTIRE; 1399 1400 if ( iItem == infoPtr->iSelected ) 1400 dis.itemState = ODS_SELECTED; 1401 else 1402 dis.itemState = 0; 1403 dis.hwndItem = hwnd; /* */1404 dis.hDC = hdc; 1405 dis.rcItem = *drawRect; /* */1401 dis.itemState = ODS_SELECTED; 1402 else 1403 dis.itemState = 0; 1404 dis.hwndItem = hwnd; /* */ 1405 dis.hDC = hdc; 1406 dis.rcItem = *drawRect; /* */ 1406 1407 dis.itemData = infoPtr->items[iItem].lParam; 1407 1408 … … 1538 1539 if(lStyle & TCS_VERTICAL) 1539 1540 { 1540 if (!GetObjectA((infoPtr->hFont) ? 1541 if (!GetObjectA((infoPtr->hFont) ? 1541 1542 infoPtr->hFont : GetStockObject(SYSTEM_FONT), 1542 1543 sizeof(LOGFONTA),&logfont)) … … 1545 1546 1546 1547 lstrcpyA(logfont.lfFaceName, "Arial"); 1547 logfont.lfHeight = -MulDiv(iPointSize, GetDeviceCaps(hdc, LOGPIXELSY), 1548 logfont.lfHeight = -MulDiv(iPointSize, GetDeviceCaps(hdc, LOGPIXELSY), 1548 1549 72); 1549 1550 logfont.lfWeight = FW_NORMAL; … … 1604 1605 * 1605 1606 * This method is used to draw a single tab into the tab control. 1606 */ 1607 */ 1607 1608 static void TAB_DrawItem( 1608 HWND hwnd, 1609 HDC hdc, 1609 HWND hwnd, 1610 HDC hdc, 1610 1611 INT iItem) 1611 1612 { … … 1621 1622 */ 1622 1623 isVisible = TAB_InternalGetItemRect(hwnd, 1623 infoPtr,1624 iItem,1625 &itemRect,1626 &selectedRect);1624 infoPtr, 1625 iItem, 1626 &itemRect, 1627 &selectedRect); 1627 1628 1628 1629 if (isVisible) 1629 1630 { 1630 HBRUSH hbr = CreateSolidBrush (GetSysColor(COLOR_BTNFACE)); 1631 HBRUSH hbr = CreateSolidBrush (GetSysColor(COLOR_BTNFACE)); 1631 1632 HPEN hwPen = GetSysColorPen (COLOR_3DHILIGHT); 1632 1633 HPEN hbPen = GetSysColorPen (COLOR_3DDKSHADOW); … … 1645 1646 /* Separators between flat buttons */ 1646 1647 /* FIXME: test and correct this if necessary for TCS_FLATBUTTONS style */ 1647 if (lStyle & TCS_FLATBUTTONS) 1648 if (lStyle & TCS_FLATBUTTONS) 1648 1649 { 1649 1650 int x = r.right + FLAT_BTN_SPACINGX - 2; … … 1669 1670 /* Background color */ 1670 1671 if (!((lStyle & TCS_OWNERDRAWFIXED) && infoPtr->fSizeSet)) 1671 {1672 { 1672 1673 COLORREF bk = GetSysColor(COLOR_3DHILIGHT); 1673 1674 DeleteObject(hbr); … … 1685 1686 1686 1687 deleteBrush = FALSE; 1687 }1688 } 1688 1689 1689 1690 /* Erase the background */ … … 1704 1705 LineTo (hdc, r.right, r.bottom); 1705 1706 LineTo (hdc, r.right, r.top + 1); 1706 1707 1707 1708 /* shadow */ 1708 1709 SelectObject(hdc, hbPen); … … 1721 1722 FillRect(hdc, &r, hbr); 1722 1723 1723 if (!(lStyle & TCS_FLATBUTTONS))1724 {1724 if (!(lStyle & TCS_FLATBUTTONS)) 1725 { 1725 1726 /* highlight */ 1726 1727 MoveToEx (hdc, r.left, r.bottom, NULL); 1727 1728 LineTo (hdc, r.left, r.top); 1728 1729 LineTo (hdc, r.right, r.top); 1729 1730 1730 1731 /* shadow */ 1731 1732 SelectObject(hdc, hbPen); … … 1738 1739 LineTo (hdc, r.right - 1, r.bottom - 1); 1739 1740 LineTo (hdc, r.left + 1, r.bottom - 1); 1740 }1741 } 1741 1742 } 1742 1743 } … … 1745 1746 /* Background color */ 1746 1747 DeleteObject(hbr); 1747 hbr = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); 1748 hbr = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); 1748 1749 1749 1750 /* We draw a rectangle of different sizes depending on the selection … … 1756 1757 /* 1757 1758 * Erase the background. 1758 * This is necessary when drawing the selected item since it is larger 1759 * than the others, it might overlap with stuff already drawn by the 1759 * This is necessary when drawing the selected item since it is larger 1760 * than the others, it might overlap with stuff already drawn by the 1760 1761 * other tabs 1761 */ 1762 */ 1762 1763 FillRect(hdc, &r, hbr); 1763 1764 … … 1770 1771 r.right--; 1771 1772 r.bottom--; 1772 1773 1773 1774 holdPen = SelectObject (hdc, hwPen); 1774 1775 if(lStyle & TCS_VERTICAL) … … 1859 1860 } 1860 1861 } 1861 1862 1862 1863 /* This modifies r to be the text rectangle. */ 1863 1864 { … … 1868 1869 /* Draw the focus rectangle */ 1869 1870 if (((lStyle & TCS_FOCUSNEVER) == 0) && 1870 (GetFocus() == hwnd) &&1871 (iItem == infoPtr->uFocus) )1871 (GetFocus() == hwnd) && 1872 (iItem == infoPtr->uFocus) ) 1872 1873 { 1873 1874 r = itemRect; … … 1888 1889 * This method is used to draw the raised border around the tab control 1889 1890 * "content" area. 1890 */ 1891 */ 1891 1892 static void TAB_DrawBorder (HWND hwnd, HDC hdc) 1892 1893 { … … 1957 1958 * 1958 1959 * This method repaints the tab control.. 1959 */ 1960 */ 1960 1961 static void TAB_Refresh (HWND hwnd, HDC hdc) 1961 1962 { … … 1971 1972 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BUTTONS) 1972 1973 { 1973 for (i = 0; i < infoPtr->uNumItem; i++) 1974 for (i = 0; i < infoPtr->uNumItem; i++) 1974 1975 TAB_DrawItem (hwnd, hdc, i); 1975 1976 } … … 1977 1978 { 1978 1979 /* Draw all the non selected item first */ 1979 for (i = 0; i < infoPtr->uNumItem; i++) 1980 for (i = 0; i < infoPtr->uNumItem; i++) 1980 1981 { 1981 1982 if (i != infoPtr->iSelected) 1982 TAB_DrawItem (hwnd, hdc, i);1983 TAB_DrawItem (hwnd, hdc, i); 1983 1984 } 1984 1985 … … 2011 2012 { 2012 2013 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 2013 2014 2014 2015 infoPtr->DoRedraw=(BOOL) wParam; 2015 2016 return 0; … … 2017 2018 2018 2019 static LRESULT TAB_EraseBackground( 2019 HWND hwnd, 2020 HWND hwnd, 2020 2021 HDC givenDC) 2021 2022 { … … 2207 2208 HDC hdc; 2208 2209 PAINTSTRUCT ps; 2209 2210 2210 2211 hdc = wParam== 0 ? BeginPaint (hwnd, &ps) : (HDC)wParam; 2211 2212 TAB_Refresh (hwnd, hdc); 2212 2213 2213 2214 if(!wParam) 2214 2215 EndPaint (hwnd, &ps); … … 2219 2220 static LRESULT 2220 2221 TAB_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 2221 { 2222 { 2222 2223 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 2223 2224 TCITEMA *pti; 2224 2225 INT iItem; 2225 2226 RECT rect; 2226 2227 2227 2228 GetClientRect (hwnd, &rect); 2228 2229 TRACE("Rect: %x T %i, L %i, B %i, R %i\n", hwnd, 2229 rect.top, rect.left, rect.bottom, rect.right); 2230 2230 rect.top, rect.left, rect.bottom, rect.right); 2231 2231 2232 pti = (TCITEMA *)lParam; 2232 2233 iItem = (INT)wParam; 2233 2234 2234 2235 if (iItem < 0) return -1; 2235 2236 if (iItem > infoPtr->uNumItem) 2236 2237 iItem = infoPtr->uNumItem; 2237 2238 2238 2239 if (infoPtr->uNumItem == 0) { 2239 2240 infoPtr->items = COMCTL32_Alloc (sizeof (TAB_ITEM)); … … 2243 2244 else { 2244 2245 TAB_ITEM *oldItems = infoPtr->items; 2245 2246 2246 2247 infoPtr->uNumItem++; 2247 2248 infoPtr->items = COMCTL32_Alloc (sizeof (TAB_ITEM) * infoPtr->uNumItem); 2248 2249 2249 2250 /* pre insert copy */ 2250 2251 if (iItem > 0) { 2251 2252 memcpy (&infoPtr->items[0], &oldItems[0], 2252 iItem * sizeof(TAB_ITEM));2253 } 2254 2253 iItem * sizeof(TAB_ITEM)); 2254 } 2255 2255 2256 /* post insert copy */ 2256 2257 if (iItem < infoPtr->uNumItem - 1) { 2257 2258 memcpy (&infoPtr->items[iItem+1], &oldItems[iItem], 2258 (infoPtr->uNumItem - iItem - 1) * sizeof(TAB_ITEM));2259 2259 (infoPtr->uNumItem - iItem - 1) * sizeof(TAB_ITEM)); 2260 2260 2261 } 2261 2262 … … 2265 2266 COMCTL32_Free (oldItems); 2266 2267 } 2267 2268 2268 2269 infoPtr->items[iItem].mask = pti->mask; 2269 2270 if (pti->mask & TCIF_TEXT) … … 2272 2273 if (pti->mask & TCIF_IMAGE) 2273 2274 infoPtr->items[iItem].iImage = pti->iImage; 2274 2275 2275 2276 if (pti->mask & TCIF_PARAM) 2276 2277 infoPtr->items[iItem].lParam = pti->lParam; 2277 2278 2278 2279 TAB_SetItemBounds(hwnd); 2279 2280 TAB_InvalidateTabArea(hwnd, infoPtr); 2280 2281 2281 2282 TRACE("[%04x]: added item %d '%s'\n", 2282 hwnd, iItem, debugstr_w(infoPtr->items[iItem].pszText));2283 hwnd, iItem, debugstr_w(infoPtr->items[iItem].pszText)); 2283 2284 2284 2285 return iItem; … … 2319 2320 if (iItem > 0) { 2320 2321 memcpy (&infoPtr->items[0], &oldItems[0], 2321 iItem * sizeof(TAB_ITEM));2322 iItem * sizeof(TAB_ITEM)); 2322 2323 } 2323 2324 … … 2325 2326 if (iItem < infoPtr->uNumItem - 1) { 2326 2327 memcpy (&infoPtr->items[iItem+1], &oldItems[iItem], 2327 (infoPtr->uNumItem - iItem - 1) * sizeof(TAB_ITEM));2328 2329 } 2330 2328 (infoPtr->uNumItem - iItem - 1) * sizeof(TAB_ITEM)); 2329 2330 } 2331 2331 2332 if (iItem <= infoPtr->iSelected) 2332 2333 infoPtr->iSelected++; … … 2341 2342 if (pti->mask & TCIF_IMAGE) 2342 2343 infoPtr->items[iItem].iImage = pti->iImage; 2343 2344 2344 2345 if (pti->mask & TCIF_PARAM) 2345 2346 infoPtr->items[iItem].lParam = pti->lParam; 2346 2347 2347 2348 TAB_SetItemBounds(hwnd); 2348 2349 TAB_InvalidateTabArea(hwnd, infoPtr); 2349 2350 2350 2351 TRACE("[%04x]: added item %d '%s'\n", 2351 hwnd, iItem, debugstr_w(infoPtr->items[iItem].pszText));2352 hwnd, iItem, debugstr_w(infoPtr->items[iItem].pszText)); 2352 2353 2353 2354 return iItem; … … 2355 2356 2356 2357 2357 static LRESULT 2358 static LRESULT 2358 2359 TAB_SetItemSize (HWND hwnd, WPARAM wParam, LPARAM lParam) 2359 2360 { … … 2373 2374 } 2374 2375 2375 static LRESULT 2376 static LRESULT 2376 2377 TAB_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 2377 2378 { 2378 2379 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 2379 TCITEMA *tabItem; 2380 TCITEMA *tabItem; 2380 2381 TAB_ITEM *wineItem; 2381 2382 INT iItem; … … 2395 2396 wineItem->lParam = tabItem->lParam; 2396 2397 2397 if (tabItem->mask & TCIF_RTLREADING) 2398 if (tabItem->mask & TCIF_RTLREADING) 2398 2399 FIXME("TCIF_RTLREADING\n"); 2399 2400 2400 if (tabItem->mask & TCIF_STATE) 2401 if (tabItem->mask & TCIF_STATE) 2401 2402 wineItem->dwState = tabItem->dwState; 2402 2403 … … 2451 2452 2452 2453 2453 static LRESULT 2454 static LRESULT 2454 2455 TAB_GetItemCount (HWND hwnd, WPARAM wParam, LPARAM lParam) 2455 2456 { … … 2460 2461 2461 2462 2462 static LRESULT 2463 static LRESULT 2463 2464 TAB_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 2464 2465 { … … 2476 2477 wineItem = &infoPtr->items[iItem]; 2477 2478 2478 if (tabItem->mask & TCIF_IMAGE) 2479 if (tabItem->mask & TCIF_IMAGE) 2479 2480 tabItem->iImage = wineItem->iImage; 2480 2481 2481 if (tabItem->mask & TCIF_PARAM) 2482 if (tabItem->mask & TCIF_PARAM) 2482 2483 tabItem->lParam = wineItem->lParam; 2483 2484 2484 if (tabItem->mask & TCIF_RTLREADING) 2485 if (tabItem->mask & TCIF_RTLREADING) 2485 2486 FIXME("TCIF_RTLREADING\n"); 2486 2487 2487 if (tabItem->mask & TCIF_STATE) 2488 if (tabItem->mask & TCIF_STATE) 2488 2489 tabItem->dwState = wineItem->dwState; 2489 2490 2490 if (tabItem->mask & TCIF_TEXT) 2491 if (tabItem->mask & TCIF_TEXT) 2491 2492 Str_GetPtrWtoA (wineItem->pszText, tabItem->pszText, tabItem->cchTextMax); 2492 2493 … … 2495 2496 2496 2497 2497 static LRESULT 2498 static LRESULT 2498 2499 TAB_GetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) 2499 2500 { … … 2530 2531 2531 2532 2532 static LRESULT 2533 static LRESULT 2533 2534 TAB_DeleteItem (HWND hwnd, WPARAM wParam, LPARAM lParam) 2534 2535 { … … 2540 2541 { 2541 2542 TAB_ITEM *oldItems = infoPtr->items; 2542 2543 2543 2544 infoPtr->uNumItem--; 2544 2545 infoPtr->items = COMCTL32_Alloc(sizeof (TAB_ITEM) * infoPtr->uNumItem); 2545 2546 if (iItem > 0) 2546 2547 if (iItem > 0) 2547 2548 memcpy(&infoPtr->items[0], &oldItems[0], iItem * sizeof(TAB_ITEM)); 2548 2549 if (iItem < infoPtr->uNumItem) 2549 2550 if (iItem < infoPtr->uNumItem) 2550 2551 memcpy(&infoPtr->items[iItem], &oldItems[iItem + 1], 2551 2552 (infoPtr->uNumItem - iItem) * sizeof(TAB_ITEM)); 2552 2553 2553 2554 COMCTL32_Free(oldItems); 2554 2555 … … 2556 2557 if ((iItem == infoPtr->iSelected) && (iItem > 0)) 2557 2558 infoPtr->iSelected--; 2558 2559 2559 2560 if (iItem < infoPtr->iSelected) 2560 2561 infoPtr->iSelected--; … … 2573 2574 } 2574 2575 2575 static LRESULT 2576 static LRESULT 2576 2577 TAB_DeleteAllItems (HWND hwnd, WPARAM wParam, LPARAM lParam) 2577 2578 { … … 2584 2585 KillTimer(hwnd, TAB_HOTTRACK_TIMER); 2585 2586 infoPtr->iHotTracked = -1; 2586 2587 2587 2588 TAB_SetItemBounds(hwnd); 2588 2589 TAB_InvalidateTabArea(hwnd,infoPtr); … … 2605 2606 { 2606 2607 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 2607 2608 2608 2609 TRACE("%x %lx\n",wParam, lParam); 2609 2610 2610 2611 infoPtr->hFont = (HFONT)wParam; 2611 2612 2612 2613 TAB_SetItemBounds(hwnd); 2613 2614 … … 2676 2677 cx=LOWORD (lParam); 2677 2678 cy=HIWORD (lParam); 2678 if (GetWindowLongA(hwnd, GWL_STYLE) & CCS_NORESIZE) 2679 if (GetWindowLongA(hwnd, GWL_STYLE) & CCS_NORESIZE) 2679 2680 uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE); 2680 2681 … … 2695 2696 2696 2697 2697 static LRESULT 2698 static LRESULT 2698 2699 TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) 2699 2700 { … … 2711 2712 2712 2713 SetWindowLongA(hwnd, 0, (DWORD)infoPtr); 2713 2714 2714 2715 infoPtr->uNumItem = 0; 2715 2716 infoPtr->uNumRows = 0; … … 2719 2720 infoPtr->iSelected = -1; 2720 2721 infoPtr->iHotTracked = -1; 2721 infoPtr->uFocus = -1; 2722 infoPtr->uFocus = -1; 2722 2723 infoPtr->hwndToolTip = 0; 2723 2724 infoPtr->DoRedraw = TRUE; … … 2725 2726 infoPtr->hwndUpDown = 0; 2726 2727 infoPtr->leftmostVisible = 0; 2727 infoPtr->fSizeSet = FALSE;2728 infoPtr->bUnicode = IsWindowUnicode (hwnd);2729 2730 TRACE("Created tab control, hwnd [%04x]\n", hwnd); 2731 2732 /* The tab control always has the WS_CLIPSIBLINGS style. Even 2733 if you don't specify it in CreateWindow. This is necessary in 2728 infoPtr->fSizeSet = FALSE; 2729 infoPtr->bUnicode = IsWindowUnicode (hwnd); 2730 2731 TRACE("Created tab control, hwnd [%04x]\n", hwnd); 2732 2733 /* The tab control always has the WS_CLIPSIBLINGS style. Even 2734 if you don't specify it in CreateWindow. This is necessary in 2734 2735 order for paint to work correctly. This follows windows behaviour. */ 2735 2736 dwStyle = GetWindowLongA(hwnd, GWL_STYLE); … … 2740 2741 infoPtr->hwndToolTip = 2741 2742 CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0, 2742 CW_USEDEFAULT, CW_USEDEFAULT,2743 CW_USEDEFAULT, CW_USEDEFAULT,2744 hwnd, 0, 0, 0);2745 2743 CW_USEDEFAULT, CW_USEDEFAULT, 2744 CW_USEDEFAULT, CW_USEDEFAULT, 2745 hwnd, 0, 0, 0); 2746 2746 2747 /* Send NM_TOOLTIPSCREATED notification */ 2747 2748 if (infoPtr->hwndToolTip) { 2748 2749 NMTOOLTIPSCREATED nmttc; 2749 2750 2750 2751 nmttc.hdr.hwndFrom = hwnd; 2751 2752 nmttc.hdr.idFrom = GetWindowLongA(hwnd, GWL_ID); 2752 2753 nmttc.hdr.code = NM_TOOLTIPSCREATED; 2753 2754 nmttc.hwndToolTips = infoPtr->hwndToolTip; 2754 2755 2755 2756 SendMessageA (GetParent (hwnd), WM_NOTIFY, 2756 (WPARAM)GetWindowLongA(hwnd, GWL_ID), (LPARAM)&nmttc);2757 } 2758 } 2759 2757 (WPARAM)GetWindowLongA(hwnd, GWL_ID), (LPARAM)&nmttc); 2758 } 2759 } 2760 2760 2761 /* 2761 2762 * We need to get text information so we need a DC and we need to select 2762 2763 * a font. 2763 2764 */ 2764 hdc = GetDC(hwnd); 2765 hdc = GetDC(hwnd); 2765 2766 hOldFont = SelectObject (hdc, GetStockObject (SYSTEM_FONT)); 2766 2767 … … 2769 2770 2770 2771 /* 2771 * Make sure there is enough space for the letters + growing the 2772 * selected item + extra space for the selected item. 2772 * Make sure there is enough space for the letters + growing the 2773 * selected item + extra space for the selected item. 2773 2774 */ 2774 2775 infoPtr->tabHeight = fontMetrics.tmHeight + 2 * VERTICAL_ITEM_PADDING + … … 2796 2797 for (iItem = 0; iItem < infoPtr->uNumItem; iItem++) { 2797 2798 if (infoPtr->items[iItem].pszText) 2798 COMCTL32_Free (infoPtr->items[iItem].pszText);2799 COMCTL32_Free (infoPtr->items[iItem].pszText); 2799 2800 } 2800 2801 COMCTL32_Free (infoPtr->items); 2801 2802 } 2802 2803 if (infoPtr->hwndToolTip) 2803 2804 if (infoPtr->hwndToolTip) 2804 2805 DestroyWindow (infoPtr->hwndToolTip); 2805 2806 2806 2807 if (infoPtr->hwndUpDown) 2807 2808 DestroyWindow(infoPtr->hwndUpDown); … … 2827 2828 case TCM_GETIMAGELIST: 2828 2829 return TAB_GetImageList (hwnd, wParam, lParam); 2829 2830 2830 2831 case TCM_SETIMAGELIST: 2831 2832 return TAB_SetImageList (hwnd, wParam, lParam); 2832 2833 2833 2834 case TCM_GETITEMCOUNT: 2834 2835 return TAB_GetItemCount (hwnd, wParam, lParam); 2835 2836 2836 2837 case TCM_GETITEMA: 2837 2838 return TAB_GetItemA (hwnd, wParam, lParam); 2838 2839 2839 2840 case TCM_GETITEMW: 2840 2841 return TAB_GetItemW (hwnd, wParam, lParam); 2841 2842 2842 2843 case TCM_SETITEMA: 2843 2844 return TAB_SetItemA (hwnd, wParam, lParam); 2844 2845 2845 2846 case TCM_SETITEMW: 2846 2847 return TAB_SetItemW (hwnd, wParam, lParam); 2847 2848 2848 2849 case TCM_DELETEITEM: 2849 2850 return TAB_DeleteItem (hwnd, wParam, lParam); 2850 2851 2851 2852 case TCM_DELETEALLITEMS: 2852 2853 return TAB_DeleteAllItems (hwnd, wParam, lParam); 2853 2854 2854 2855 case TCM_GETITEMRECT: 2855 2856 return TAB_GetItemRect (hwnd, wParam, lParam); 2856 2857 2857 2858 case TCM_GETCURSEL: 2858 2859 return TAB_GetCurSel (hwnd); 2859 2860 2860 2861 case TCM_HITTEST: 2861 2862 return TAB_HitTest (hwnd, wParam, lParam); 2862 2863 2863 2864 case TCM_SETCURSEL: 2864 2865 return TAB_SetCurSel (hwnd, wParam); 2865 2866 2866 2867 case TCM_INSERTITEMA: 2867 2868 return TAB_InsertItemA (hwnd, wParam, lParam); 2868 2869 2869 2870 case TCM_INSERTITEMW: 2870 2871 return TAB_InsertItemW (hwnd, wParam, lParam); 2871 2872 2872 2873 case TCM_SETITEMEXTRA: 2873 2874 FIXME("Unimplemented msg TCM_SETITEMEXTRA\n"); 2874 2875 return 0; 2875 2876 2876 2877 case TCM_ADJUSTRECT: 2877 2878 return TAB_AdjustRect (hwnd, (BOOL)wParam, (LPRECT)lParam); 2878 2879 2879 2880 case TCM_SETITEMSIZE: 2880 2881 return TAB_SetItemSize (hwnd, wParam, lParam); 2881 2882 2882 2883 case TCM_REMOVEIMAGE: 2883 2884 FIXME("Unimplemented msg TCM_REMOVEIMAGE\n"); 2884 2885 return 0; 2885 2886 2886 2887 case TCM_SETPADDING: 2887 2888 FIXME("Unimplemented msg TCM_SETPADDING\n"); 2888 2889 return 0; 2889 2890 2890 2891 case TCM_GETROWCOUNT: 2891 2892 return TAB_GetRowCount(hwnd); … … 2900 2901 FIXME("Unimplemented msg TCM_HIGHLIGHTITEM\n"); 2901 2902 return 0; 2902 2903 2903 2904 case TCM_GETTOOLTIPS: 2904 2905 return TAB_GetToolTips (hwnd, wParam, lParam); 2905 2906 2906 2907 case TCM_SETTOOLTIPS: 2907 2908 return TAB_SetToolTips (hwnd, wParam, lParam); 2908 2909 2909 2910 case TCM_GETCURFOCUS: 2910 2911 return TAB_GetCurFocus (hwnd); 2911 2912 2912 2913 case TCM_SETCURFOCUS: 2913 2914 return TAB_SetCurFocus (hwnd, wParam); 2914 2915 2915 2916 case TCM_SETMINTABWIDTH: 2916 2917 FIXME("Unimplemented msg TCM_SETMINTABWIDTH\n"); 2917 2918 return 0; 2918 2919 2919 2920 case TCM_DESELECTALL: 2920 2921 FIXME("Unimplemented msg TCM_DESELECTALL\n"); 2921 2922 return 0; 2922 2923 2923 2924 case TCM_GETEXTENDEDSTYLE: 2924 2925 FIXME("Unimplemented msg TCM_GETEXTENDEDSTYLE\n"); … … 2931 2932 case WM_GETFONT: 2932 2933 return TAB_GetFont (hwnd, wParam, lParam); 2933 2934 2934 2935 case WM_SETFONT: 2935 2936 return TAB_SetFont (hwnd, wParam, lParam); 2936 2937 2937 2938 case WM_CREATE: 2938 2939 return TAB_Create (hwnd, wParam, lParam); 2939 2940 2940 2941 case WM_NCDESTROY: 2941 2942 return TAB_Destroy (hwnd, wParam, lParam); 2942 2943 2943 2944 case WM_GETDLGCODE: 2944 2945 return DLGC_WANTARROWS | DLGC_WANTCHARS; 2945 2946 2946 2947 case WM_LBUTTONDOWN: 2947 2948 return TAB_LButtonDown (hwnd, wParam, lParam); 2948 2949 2949 2950 case WM_LBUTTONUP: 2950 2951 return TAB_LButtonUp (hwnd, wParam, lParam); 2951 2952 2952 2953 case WM_RBUTTONDOWN: 2953 2954 return TAB_RButtonDown (hwnd, wParam, lParam); 2954 2955 2955 2956 case WM_MOUSEMOVE: 2956 2957 return TAB_MouseMove (hwnd, wParam, lParam); 2957 2958 2958 2959 case WM_ERASEBKGND: 2959 2960 return TAB_EraseBackground (hwnd, (HDC)wParam); … … 2964 2965 case WM_SIZE: 2965 2966 return TAB_Size (hwnd, wParam, lParam); 2966 2967 2967 2968 case WM_SETREDRAW: 2968 2969 return TAB_SetRedraw (hwnd, wParam); … … 2975 2976 InvalidateRect(hwnd, NULL, TRUE); 2976 2977 return 0; 2977 2978 2978 2979 case WM_KILLFOCUS: 2979 2980 case WM_SETFOCUS: … … 2987 2988 default: 2988 2989 if (uMsg >= WM_USER) 2989 WARN("unknown msg %04x wp=%08x lp=%08lx\n",2990 uMsg, wParam, lParam);2990 WARN("unknown msg %04x wp=%08x lp=%08lx\n", 2991 uMsg, wParam, lParam); 2991 2992 #ifdef __WIN32OS2__ 2992 2993 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); … … 3013 3014 wndClass.hbrBackground = (HBRUSH)NULL; 3014 3015 wndClass.lpszClassName = WC_TABCONTROLA; 3015 3016 3016 3017 RegisterClassA (&wndClass); 3017 3018 } -
trunk/src/comctl32/toolbar.c
r6380 r6644 1 /* $Id: toolbar.c,v 1.29 2001-09-05 12:05:03 bird Exp $ */ 1 2 /* 2 3 * Toolbar control … … 62 63 INT nRow; 63 64 RECT rect; 64 } TBUTTON_INFO; 65 } TBUTTON_INFO; 65 66 66 67 #ifdef __WIN32OS2__ … … 131 132 #define TOP_BORDER 2 132 133 #define BOTTOM_BORDER 2 133 #define DDARROW_WIDTH 11 134 #define DDARROW_WIDTH 11 134 135 135 136 #define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0)) … … 147 148 else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings)) 148 149 lpText = infoPtr->strings[btnPtr->iString]; 149 150 150 151 return lpText; 151 152 } 152 153 153 static BOOL 154 static BOOL 154 155 TOOLBAR_IsValidBitmapIndex(TOOLBAR_INFO *infoPtr, INT index) 155 156 { … … 195 196 * Draw the text string for this button. 196 197 * note: infoPtr->himlDis *SHOULD* be non-zero when infoPtr->himlDef 197 * is non-zero, so we can simply check himlDef to see if we have198 * is non-zero, so we can simply check himlDef to see if we have 198 199 * an image list 199 200 */ 200 201 static void 201 202 TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, 202 HDC hdc, INT nState, DWORD dwStyle)203 HDC hdc, INT nState, DWORD dwStyle) 203 204 { 204 205 RECT rcText = btnPtr->rect; … … 219 220 if (lpText) { 220 221 221 InflateRect (&rcText, -3, -3);222 223 if (himl && TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {224 if ((dwStyle & TBSTYLE_LIST) &&225 ((btnPtr->fsStyle & TBSTYLE_AUTOSIZE) == 0) &&226 (btnPtr->iBitmap != I_IMAGENONE)) {227 rcText.left += infoPtr->nBitmapWidth;228 }229 else {230 rcText.top += infoPtr->nBitmapHeight;231 }232 }233 234 if (nState & (TBSTATE_PRESSED | TBSTATE_CHECKED))235 OffsetRect (&rcText, 1, 1);236 237 hOldFont = SelectObject (hdc, infoPtr->hFont);238 nOldBkMode = SetBkMode (hdc, TRANSPARENT);239 if (!(nState & TBSTATE_ENABLED)) {240 clrOld = SetTextColor (hdc, GetSysColor (COLOR_3DHILIGHT));241 OffsetRect (&rcText, 1, 1);242 DrawTextW (hdc, lpText, -1, &rcText, infoPtr->dwDTFlags);243 SetTextColor (hdc, GetSysColor (COLOR_3DSHADOW));244 OffsetRect (&rcText, -1, -1);245 DrawTextW (hdc, lpText, -1, &rcText, infoPtr->dwDTFlags);246 }247 else if (nState & TBSTATE_INDETERMINATE) {248 clrOld = SetTextColor (hdc, GetSysColor (COLOR_3DSHADOW));249 DrawTextW (hdc, lpText, -1, &rcText, infoPtr->dwDTFlags);250 }251 else {252 clrOld = SetTextColor (hdc, GetSysColor (COLOR_BTNTEXT));253 DrawTextW (hdc, lpText, -1, &rcText, infoPtr->dwDTFlags);254 }255 256 SetTextColor (hdc, clrOld);257 SelectObject (hdc, hOldFont);258 if (nOldBkMode != TRANSPARENT)259 SetBkMode (hdc, nOldBkMode);222 InflateRect (&rcText, -3, -3); 223 224 if (himl && TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { 225 if ((dwStyle & TBSTYLE_LIST) && 226 ((btnPtr->fsStyle & TBSTYLE_AUTOSIZE) == 0) && 227 (btnPtr->iBitmap != I_IMAGENONE)) { 228 rcText.left += infoPtr->nBitmapWidth; 229 } 230 else { 231 rcText.top += infoPtr->nBitmapHeight; 232 } 233 } 234 235 if (nState & (TBSTATE_PRESSED | TBSTATE_CHECKED)) 236 OffsetRect (&rcText, 1, 1); 237 238 hOldFont = SelectObject (hdc, infoPtr->hFont); 239 nOldBkMode = SetBkMode (hdc, TRANSPARENT); 240 if (!(nState & TBSTATE_ENABLED)) { 241 clrOld = SetTextColor (hdc, GetSysColor (COLOR_3DHILIGHT)); 242 OffsetRect (&rcText, 1, 1); 243 DrawTextW (hdc, lpText, -1, &rcText, infoPtr->dwDTFlags); 244 SetTextColor (hdc, GetSysColor (COLOR_3DSHADOW)); 245 OffsetRect (&rcText, -1, -1); 246 DrawTextW (hdc, lpText, -1, &rcText, infoPtr->dwDTFlags); 247 } 248 else if (nState & TBSTATE_INDETERMINATE) { 249 clrOld = SetTextColor (hdc, GetSysColor (COLOR_3DSHADOW)); 250 DrawTextW (hdc, lpText, -1, &rcText, infoPtr->dwDTFlags); 251 } 252 else { 253 clrOld = SetTextColor (hdc, GetSysColor (COLOR_BTNTEXT)); 254 DrawTextW (hdc, lpText, -1, &rcText, infoPtr->dwDTFlags); 255 } 256 257 SetTextColor (hdc, clrOld); 258 SelectObject (hdc, hOldFont); 259 if (nOldBkMode != TRANSPARENT) 260 SetBkMode (hdc, nOldBkMode); 260 261 } 261 262 } … … 275 276 static void 276 277 TOOLBAR_DrawMasked (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, 277 HDC hdc, INT x, INT y)278 HDC hdc, INT x, INT y) 278 279 { 279 280 /* FIXME: this function is a hack since it uses image list 280 internals directly */281 internals directly */ 281 282 282 283 HIMAGELIST himl = infoPtr->himlDef; … … 286 287 287 288 if (!himl) 288 return;289 return; 289 290 290 291 /* create new dc's */ … … 301 302 SetTextColor (hdcImageList, RGB(0, 0, 0)); 302 303 BitBlt (hdcMask, 0, 0, himl->cx, himl->cy, 303 hdcImageList, himl->cx * btnPtr->iBitmap, 0, SRCCOPY);304 hdcImageList, himl->cx * btnPtr->iBitmap, 0, SRCCOPY); 304 305 305 306 /* draw the new mask */ 306 307 SelectObject (hdc, GetSysColorBrush (COLOR_3DHILIGHT)); 307 308 BitBlt (hdc, x+1, y+1, himl->cx, himl->cy, 308 hdcMask, 0, 0, 0xB8074A);309 hdcMask, 0, 0, 0xB8074A); 309 310 310 311 SelectObject (hdc, GetSysColorBrush (COLOR_3DSHADOW)); 311 312 BitBlt (hdc, x, y, himl->cx, himl->cy, 312 hdcMask, 0, 0, 0xB8074A);313 hdcMask, 0, 0, 0xB8074A); 313 314 314 315 DeleteObject (hbmMask); … … 324 325 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 325 326 BOOL hasDropDownArrow = TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && 326 (btnPtr->fsStyle & TBSTYLE_DROPDOWN);327 (btnPtr->fsStyle & TBSTYLE_DROPDOWN); 327 328 RECT rc, rcArrow, rcBitmap; 328 329 329 330 if (btnPtr->fsState & TBSTATE_HIDDEN) 330 return;331 return; 331 332 332 333 rc = btnPtr->rect; … … 338 339 if (hasDropDownArrow) 339 340 { 340 if (dwStyle & TBSTYLE_FLAT)341 if (dwStyle & TBSTYLE_FLAT) 341 342 rc.right = max(rc.left, rc.right - DDARROW_WIDTH); 342 else343 else 343 344 rc.right = max(rc.left, rc.right - DDARROW_WIDTH - 2); 344 rcArrow.left = rc.right; 345 rcArrow.left = rc.right; 345 346 } 346 347 … … 363 364 /* when drawing the vertical bar... */ 364 365 if ((dwStyle & TBSTYLE_FLAT) /* && (btnPtr->iBitmap == 0) */) 365 TOOLBAR_DrawFlatSeparator (&rc, hdc);366 return;366 TOOLBAR_DrawFlatSeparator (&rc, hdc); 367 return; 367 368 } 368 369 369 370 /* disabled */ 370 371 if (!(btnPtr->fsState & TBSTATE_ENABLED)) { 371 if (!(dwStyle & TBSTYLE_FLAT))372 {373 DrawEdge (hdc, &rc, EDGE_RAISED,374 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);372 if (!(dwStyle & TBSTYLE_FLAT)) 373 { 374 DrawEdge (hdc, &rc, EDGE_RAISED, 375 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 375 376 if (hasDropDownArrow) 376 377 DrawEdge (hdc, &rcArrow, EDGE_RAISED, 377 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);378 }379 378 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 379 } 380 380 381 if (hasDropDownArrow) 381 {382 TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top+1, COLOR_3DHIGHLIGHT);383 TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_3DSHADOW);384 }385 386 if (infoPtr->himlDis && 382 { 383 TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top+1, COLOR_3DHIGHLIGHT); 384 TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_3DSHADOW); 385 } 386 387 if (infoPtr->himlDis && 387 388 TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) 388 ImageList_Draw (infoPtr->himlDis, btnPtr->iBitmap, hdc,389 rcBitmap.left, rcBitmap.top, ILD_NORMAL);390 else391 TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);392 393 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle);394 return;389 ImageList_Draw (infoPtr->himlDis, btnPtr->iBitmap, hdc, 390 rcBitmap.left, rcBitmap.top, ILD_NORMAL); 391 else 392 TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top); 393 394 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle); 395 return; 395 396 } 396 397 397 398 /* pressed TBSTYLE_BUTTON */ 398 399 if (btnPtr->fsState & TBSTATE_PRESSED) { 399 if (dwStyle & TBSTYLE_FLAT)400 {401 DrawEdge (hdc, &rc, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE | BF_ADJUST);400 if (dwStyle & TBSTYLE_FLAT) 401 { 402 DrawEdge (hdc, &rc, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE | BF_ADJUST); 402 403 if (hasDropDownArrow) 403 DrawEdge (hdc, &rcArrow, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE | BF_ADJUST);404 }405 else406 {407 DrawEdge (hdc, &rc, EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_ADJUST);404 DrawEdge (hdc, &rcArrow, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE | BF_ADJUST); 405 } 406 else 407 { 408 DrawEdge (hdc, &rc, EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_ADJUST); 408 409 if (hasDropDownArrow) 409 DrawEdge (hdc, &rcArrow, EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_ADJUST);410 }410 DrawEdge (hdc, &rcArrow, EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_ADJUST); 411 } 411 412 412 413 if (hasDropDownArrow) 413 TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_WINDOWFRAME);414 TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_WINDOWFRAME); 414 415 415 416 if (TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) 416 ImageList_Draw (infoPtr->himlDef, btnPtr->iBitmap, hdc,417 rcBitmap.left + 1, rcBitmap.top + 1, ILD_NORMAL);418 419 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle);420 return;417 ImageList_Draw (infoPtr->himlDef, btnPtr->iBitmap, hdc, 418 rcBitmap.left + 1, rcBitmap.top + 1, ILD_NORMAL); 419 420 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle); 421 return; 421 422 } 422 423 423 424 /* checked TBSTYLE_CHECK */ 424 425 if ((btnPtr->fsStyle & TBSTYLE_CHECK) && 425 (btnPtr->fsState & TBSTATE_CHECKED)) {426 if (dwStyle & TBSTYLE_FLAT)427 DrawEdge (hdc, &rc, BDR_SUNKENOUTER,428 BF_RECT | BF_MIDDLE | BF_ADJUST);429 else430 DrawEdge (hdc, &rc, EDGE_SUNKEN,431 BF_RECT | BF_MIDDLE | BF_ADJUST);432 433 TOOLBAR_DrawPattern (hdc, &rc);434 426 (btnPtr->fsState & TBSTATE_CHECKED)) { 427 if (dwStyle & TBSTYLE_FLAT) 428 DrawEdge (hdc, &rc, BDR_SUNKENOUTER, 429 BF_RECT | BF_MIDDLE | BF_ADJUST); 430 else 431 DrawEdge (hdc, &rc, EDGE_SUNKEN, 432 BF_RECT | BF_MIDDLE | BF_ADJUST); 433 434 TOOLBAR_DrawPattern (hdc, &rc); 435 435 436 if (TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) 436 ImageList_Draw (infoPtr->himlDef, btnPtr->iBitmap, hdc,437 rcBitmap.left + 1, rcBitmap.top + 1, ILD_NORMAL);438 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle);439 return;440 } 441 442 /* indeterminate */ 437 ImageList_Draw (infoPtr->himlDef, btnPtr->iBitmap, hdc, 438 rcBitmap.left + 1, rcBitmap.top + 1, ILD_NORMAL); 439 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle); 440 return; 441 } 442 443 /* indeterminate */ 443 444 if (btnPtr->fsState & TBSTATE_INDETERMINATE) { 444 DrawEdge (hdc, &rc, EDGE_RAISED,445 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);446 447 TOOLBAR_DrawPattern (hdc, &rc);448 TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);449 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle);450 return;445 DrawEdge (hdc, &rc, EDGE_RAISED, 446 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 447 448 TOOLBAR_DrawPattern (hdc, &rc); 449 TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top); 450 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle); 451 return; 451 452 } 452 453 … … 454 455 if (dwStyle & TBSTYLE_FLAT) 455 456 { 456 if (btnPtr->bHot)457 {458 DrawEdge (hdc, &rc, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE);457 if (btnPtr->bHot) 458 { 459 DrawEdge (hdc, &rc, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE); 459 460 if (hasDropDownArrow) 460 DrawEdge (hdc, &rcArrow, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE);461 }461 DrawEdge (hdc, &rcArrow, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE); 462 } 462 463 else 463 {464 { 464 465 FrameRect(hdc, &rc, GetSysColorBrush(COLOR_BTNFACE)); 465 466 if (hasDropDownArrow) 466 467 FrameRect(hdc, &rcArrow, GetSysColorBrush(COLOR_BTNFACE)); 467 }468 } 468 469 469 470 if (hasDropDownArrow) 470 TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top, COLOR_WINDOWFRAME);471 472 if (btnPtr->bHot && infoPtr->himlHot &&471 TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top, COLOR_WINDOWFRAME); 472 473 if (btnPtr->bHot && infoPtr->himlHot && 473 474 TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) 474 ImageList_Draw (infoPtr->himlHot, btnPtr->iBitmap, hdc,475 rcBitmap.left, rcBitmap.top, ILD_NORMAL);476 else if (TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap))477 ImageList_Draw (infoPtr->himlDef, btnPtr->iBitmap, hdc,478 rcBitmap.left, rcBitmap.top, ILD_NORMAL);475 ImageList_Draw (infoPtr->himlHot, btnPtr->iBitmap, hdc, 476 rcBitmap.left, rcBitmap.top, ILD_NORMAL); 477 else if (TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) 478 ImageList_Draw (infoPtr->himlDef, btnPtr->iBitmap, hdc, 479 rcBitmap.left, rcBitmap.top, ILD_NORMAL); 479 480 } 480 481 else 481 482 { 482 DrawEdge (hdc, &rc, EDGE_RAISED,483 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);483 DrawEdge (hdc, &rc, EDGE_RAISED, 484 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 484 485 485 486 if (hasDropDownArrow) 486 {487 DrawEdge (hdc, &rcArrow, EDGE_RAISED,488 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);489 TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_WINDOWFRAME);490 }487 { 488 DrawEdge (hdc, &rcArrow, EDGE_RAISED, 489 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 490 TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_WINDOWFRAME); 491 } 491 492 492 493 if (TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) 493 ImageList_Draw (infoPtr->himlDef, btnPtr->iBitmap, hdc,494 rcBitmap.left, rcBitmap.top, ILD_NORMAL);494 ImageList_Draw (infoPtr->himlDef, btnPtr->iBitmap, hdc, 495 rcBitmap.left, rcBitmap.top, ILD_NORMAL); 495 496 } 496 497 … … 537 538 if (!(btnPtr->fsState & TBSTATE_HIDDEN) && 538 539 (btnPtr->iString > -1) && 539 (btnPtr->iString < infoPtr->nNumStrings)) 540 (btnPtr->iString < infoPtr->nNumStrings)) 540 541 { 541 542 LPWSTR lpText = infoPtr->strings[btnPtr->iString]; … … 577 578 578 579 /*********************************************************************** 579 * TOOLBAR_WrapToolbar580 * TOOLBAR_WrapToolbar 580 581 * 581 * This function walks through the buttons and seperators in the 582 * toolbar, and sets the TBSTATE_WRAP flag only on those items where 583 * wrapping should occur based on the width of the toolbar window. 584 * It does *not* calculate button placement itself. That task 585 * takes place in TOOLBAR_CalcToolbar. If the program wants to manage 586 * the toolbar wrapping on it's own, it can use the TBSTYLE_WRAPPABLE 582 * This function walks through the buttons and seperators in the 583 * toolbar, and sets the TBSTATE_WRAP flag only on those items where 584 * wrapping should occur based on the width of the toolbar window. 585 * It does *not* calculate button placement itself. That task 586 * takes place in TOOLBAR_CalcToolbar. If the program wants to manage 587 * the toolbar wrapping on it's own, it can use the TBSTYLE_WRAPPABLE 587 588 * flag, and set the TBSTATE_WRAP flags manually on the appropriate items. 588 */ 589 */ 589 590 590 591 static void … … 597 598 BOOL bWrap, bButtonWrap; 598 599 599 /* When the toolbar window style is not TBSTYLE_WRAPABLE, */600 /* no layout is necessary. Applications may use this style */601 /* to perform their own layout on the toolbar.*/600 /* When the toolbar window style is not TBSTYLE_WRAPABLE, */ 601 /* no layout is necessary. Applications may use this style */ 602 /* to perform their own layout on the toolbar. */ 602 603 if( !(dwStyle & TBSTYLE_WRAPABLE) ) 603 return;604 return; 604 605 605 606 btnPtr = infoPtr->buttons; … … 616 617 for (i = 0; i < infoPtr->nNumButtons; i++ ) 617 618 { 618 bWrap = FALSE;619 btnPtr[i].fsState &= ~TBSTATE_WRAP;620 621 if (btnPtr[i].fsState & TBSTATE_HIDDEN)622 continue;623 624 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */625 /* it is the actual width of the separator. This is used for */626 /* custom controls in toolbars. */627 if (btnPtr[i].fsStyle & TBSTYLE_SEP)628 cx = (btnPtr[i].iBitmap > 0) ? 629 btnPtr[i].iBitmap : SEPARATOR_WIDTH;630 else631 cx = infoPtr->nButtonWidth;632 633 /* Two or more adjacent separators form a separator group. */ 634 /* The first separator in a group should be wrapped to the */635 /* next row if the previous wrapping is on a button.*/636 if( bButtonWrap &&637 (btnPtr[i].fsStyle & TBSTYLE_SEP) && 638 (i + 1 < infoPtr->nNumButtons ) &&639 (btnPtr[i + 1].fsStyle & TBSTYLE_SEP) ) 640 {641 btnPtr[i].fsState |= TBSTATE_WRAP;642 x = infoPtr->nIndent;643 i++;644 bButtonWrap = FALSE;645 continue;646 }647 648 /* The layout makes sure the bitmap is visible, but not the button. */649 if ( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 650 > infoPtr->nWidth ) 651 {652 BOOL bFound = FALSE;653 654 /* If the current button is a separator and not hidden, */ 655 /*go to the next until it reaches a non separator. */656 /*Wrap the last separator if it is before a button. */657 while( ( (btnPtr[i].fsStyle & TBSTYLE_SEP) || 658 (btnPtr[i].fsState & TBSTATE_HIDDEN) ) && 659 i < infoPtr->nNumButtons )660 {661 i++;662 bFound = TRUE;663 }664 665 if( bFound && i < infoPtr->nNumButtons )666 {667 i--;668 btnPtr[i].fsState |= TBSTATE_WRAP;669 x = infoPtr->nIndent;670 bButtonWrap = FALSE;671 continue;672 }673 else if ( i >= infoPtr->nNumButtons)674 break;675 676 /* If the current button is not a separator, find the last */ 677 /* separator and wrap it.*/678 for ( j = i - 1; j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--)679 {680 if ((btnPtr[j].fsStyle & TBSTYLE_SEP) &&681 !(btnPtr[j].fsState & TBSTATE_HIDDEN))682 {683 bFound = TRUE; 684 i = j; 685 x = infoPtr->nIndent;686 btnPtr[j].fsState |= TBSTATE_WRAP;687 bButtonWrap = FALSE; 688 break;689 }690 }691 692 /* If no separator available for wrapping, wrap one of*/693 /* non-hidden previous button.*/694 if (!bFound)695 {696 for ( j = i - 1; 697 j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--)698 {699 if (btnPtr[j].fsState & TBSTATE_HIDDEN) 700 continue;701 702 bFound = TRUE; 703 i = j; 704 x = infoPtr->nIndent;705 btnPtr[j].fsState |= TBSTATE_WRAP;706 bButtonWrap = TRUE;707 break;708 }709 }710 711 /* If all above failed, wrap the current button. */712 if (!bFound) 713 {714 btnPtr[i].fsState |= TBSTATE_WRAP;715 bFound = TRUE;716 x = infoPtr->nIndent;717 if (btnPtr[i].fsState & TBSTYLE_SEP )718 bButtonWrap = FALSE;719 else720 bButtonWrap = TRUE;721 } 722 }723 else724 x += cx;619 bWrap = FALSE; 620 btnPtr[i].fsState &= ~TBSTATE_WRAP; 621 622 if (btnPtr[i].fsState & TBSTATE_HIDDEN) 623 continue; 624 625 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ 626 /* it is the actual width of the separator. This is used for */ 627 /* custom controls in toolbars. */ 628 if (btnPtr[i].fsStyle & TBSTYLE_SEP) 629 cx = (btnPtr[i].iBitmap > 0) ? 630 btnPtr[i].iBitmap : SEPARATOR_WIDTH; 631 else 632 cx = infoPtr->nButtonWidth; 633 634 /* Two or more adjacent separators form a separator group. */ 635 /* The first separator in a group should be wrapped to the */ 636 /* next row if the previous wrapping is on a button. */ 637 if( bButtonWrap && 638 (btnPtr[i].fsStyle & TBSTYLE_SEP) && 639 (i + 1 < infoPtr->nNumButtons ) && 640 (btnPtr[i + 1].fsStyle & TBSTYLE_SEP) ) 641 { 642 btnPtr[i].fsState |= TBSTATE_WRAP; 643 x = infoPtr->nIndent; 644 i++; 645 bButtonWrap = FALSE; 646 continue; 647 } 648 649 /* The layout makes sure the bitmap is visible, but not the button. */ 650 if ( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 651 > infoPtr->nWidth ) 652 { 653 BOOL bFound = FALSE; 654 655 /* If the current button is a separator and not hidden, */ 656 /* go to the next until it reaches a non separator. */ 657 /* Wrap the last separator if it is before a button. */ 658 while( ( (btnPtr[i].fsStyle & TBSTYLE_SEP) || 659 (btnPtr[i].fsState & TBSTATE_HIDDEN) ) && 660 i < infoPtr->nNumButtons ) 661 { 662 i++; 663 bFound = TRUE; 664 } 665 666 if( bFound && i < infoPtr->nNumButtons ) 667 { 668 i--; 669 btnPtr[i].fsState |= TBSTATE_WRAP; 670 x = infoPtr->nIndent; 671 bButtonWrap = FALSE; 672 continue; 673 } 674 else if ( i >= infoPtr->nNumButtons) 675 break; 676 677 /* If the current button is not a separator, find the last */ 678 /* separator and wrap it. */ 679 for ( j = i - 1; j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) 680 { 681 if ((btnPtr[j].fsStyle & TBSTYLE_SEP) && 682 !(btnPtr[j].fsState & TBSTATE_HIDDEN)) 683 { 684 bFound = TRUE; 685 i = j; 686 x = infoPtr->nIndent; 687 btnPtr[j].fsState |= TBSTATE_WRAP; 688 bButtonWrap = FALSE; 689 break; 690 } 691 } 692 693 /* If no separator available for wrapping, wrap one of */ 694 /* non-hidden previous button. */ 695 if (!bFound) 696 { 697 for ( j = i - 1; 698 j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) 699 { 700 if (btnPtr[j].fsState & TBSTATE_HIDDEN) 701 continue; 702 703 bFound = TRUE; 704 i = j; 705 x = infoPtr->nIndent; 706 btnPtr[j].fsState |= TBSTATE_WRAP; 707 bButtonWrap = TRUE; 708 break; 709 } 710 } 711 712 /* If all above failed, wrap the current button. */ 713 if (!bFound) 714 { 715 btnPtr[i].fsState |= TBSTATE_WRAP; 716 bFound = TRUE; 717 x = infoPtr->nIndent; 718 if (btnPtr[i].fsState & TBSTYLE_SEP ) 719 bButtonWrap = FALSE; 720 else 721 bButtonWrap = TRUE; 722 } 723 } 724 else 725 x += cx; 725 726 } 726 727 } … … 728 729 729 730 /*********************************************************************** 730 * TOOLBAR_CalcToolbar731 * TOOLBAR_CalcToolbar 731 732 * 732 * This function calculates button and separator placement. It first 733 * calculates the button sizes, gets the toolbar window width and then 734 * calls TOOLBAR_WrapToolbar to determine which buttons we need to wrap 733 * This function calculates button and separator placement. It first 734 * calculates the button sizes, gets the toolbar window width and then 735 * calls TOOLBAR_WrapToolbar to determine which buttons we need to wrap 735 736 * on. It assigns a new location to each item and sends this location to 736 * the tooltip window if appropriate. Finally, it updates the rcBound 737 * rect and calculates the new required toolbar window height. 738 */ 737 * the tooltip window if appropriate. Finally, it updates the rcBound 738 * rect and calculates the new required toolbar window height. 739 */ 739 740 740 741 static void … … 755 756 if (dwStyle & TBSTYLE_LIST) 756 757 { 757 infoPtr->nButtonHeight = max(infoPtr->nBitmapHeight, sizeString.cy) + 6;758 infoPtr->nButtonWidth = infoPtr->nBitmapWidth + sizeString.cx + 6;758 infoPtr->nButtonHeight = max(infoPtr->nBitmapHeight, sizeString.cy) + 6; 759 infoPtr->nButtonWidth = infoPtr->nBitmapWidth + sizeString.cx + 6; 759 760 } 760 761 else { 761 762 for (i = 0; i < infoPtr->nNumButtons && !usesBitmaps; i++) 762 763 { 763 if (TOOLBAR_IsValidBitmapIndex(infoPtr,infoPtr->buttons[i].iBitmap))764 usesBitmaps = TRUE;764 if (TOOLBAR_IsValidBitmapIndex(infoPtr,infoPtr->buttons[i].iBitmap)) 765 usesBitmaps = TRUE; 765 766 } 766 767 … … 768 769 { 769 770 if (usesBitmaps) 770 infoPtr->nButtonHeight = sizeString.cy +771 infoPtr->nButtonHeight = sizeString.cy + 771 772 infoPtr->nBitmapHeight + 6; 772 else 773 else 773 774 infoPtr->nButtonHeight = sizeString.cy + 6; 774 775 } 775 776 else if (infoPtr->nButtonHeight < infoPtr->nBitmapHeight + 6) 776 infoPtr->nButtonHeight = infoPtr->nBitmapHeight + 6;777 infoPtr->nButtonHeight = infoPtr->nBitmapHeight + 6; 777 778 778 779 if (sizeString.cx > infoPtr->nBitmapWidth) 779 infoPtr->nButtonWidth = sizeString.cx + 6;780 infoPtr->nButtonWidth = sizeString.cx + 6; 780 781 else if (infoPtr->nButtonWidth < infoPtr->nBitmapWidth + 6) 781 infoPtr->nButtonWidth = infoPtr->nBitmapWidth + 6;782 infoPtr->nButtonWidth = infoPtr->nBitmapWidth + 6; 782 783 } 783 784 … … 793 794 794 795 /* 795 * We will set the height below, and we set the width on entry 796 * so we do not reset them here.. 796 * We will set the height below, and we set the width on entry 797 * so we do not reset them here.. 797 798 */ 798 799 #if 0 … … 829 830 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++ ) 830 831 { 831 bWrap = FALSE;832 if (btnPtr->fsState & TBSTATE_HIDDEN)833 {834 SetRectEmpty (&btnPtr->rect);835 continue;836 }837 838 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */839 /* it is the actual width of the separator. This is used for */840 /* custom controls in toolbars. */841 if (btnPtr->fsStyle & TBSTYLE_SEP)842 cx = (btnPtr->iBitmap > 0) ?843 btnPtr->iBitmap : SEPARATOR_WIDTH;844 else845 {846 if (btnPtr->fsStyle & TBSTYLE_AUTOSIZE) 832 bWrap = FALSE; 833 if (btnPtr->fsState & TBSTATE_HIDDEN) 834 { 835 SetRectEmpty (&btnPtr->rect); 836 continue; 837 } 838 839 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ 840 /* it is the actual width of the separator. This is used for */ 841 /* custom controls in toolbars. */ 842 if (btnPtr->fsStyle & TBSTYLE_SEP) 843 cx = (btnPtr->iBitmap > 0) ? 844 btnPtr->iBitmap : SEPARATOR_WIDTH; 845 else 846 { 847 if (btnPtr->fsStyle & TBSTYLE_AUTOSIZE) 847 848 { 848 849 SIZE sz; … … 851 852 } 852 853 else 853 cx = infoPtr->nButtonWidth;854 855 if (hasDropDownArrows && (btnPtr->fsStyle & TBSTYLE_DROPDOWN))856 cx += DDARROW_WIDTH; 857 }858 cy = infoPtr->nHeight;859 860 if (btnPtr->fsState & TBSTATE_WRAP )861 bWrap = TRUE;862 863 SetRect (&btnPtr->rect, x, y, x + cx, y + cy);864 865 if (infoPtr->rcBound.left > x)866 infoPtr->rcBound.left = x;867 if (infoPtr->rcBound.right < x + cx)868 infoPtr->rcBound.right = x + cx;869 if (infoPtr->rcBound.bottom < y + cy)870 infoPtr->rcBound.bottom = y + cy;871 872 /* Set the toolTip only for non-hidden, non-separator button */873 if (infoPtr->hwndToolTip && !(btnPtr->fsStyle & TBSTYLE_SEP )) 874 {875 TTTOOLINFOA ti;876 877 ZeroMemory (&ti, sizeof(TTTOOLINFOA));878 ti.cbSize = sizeof(TTTOOLINFOA);879 ti.hwnd = hwnd;880 ti.uId = btnPtr->idCommand;881 ti.rect = btnPtr->rect;882 SendMessageA (infoPtr->hwndToolTip, TTM_NEWTOOLRECTA,883 0, (LPARAM)&ti);884 }885 886 /* btnPtr->nRow is zero based. The space between the rows is*/887 /* also considered as a row.*/888 btnPtr->nRow = nRows + nSepRows;889 if( bWrap )890 {891 if ( !(btnPtr->fsStyle & TBSTYLE_SEP) )892 y += cy;893 else 894 { 895 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */896 /* it is the actual width of the separator. This is used for */897 /* custom controls in toolbars.*/898 y += cy + ( (btnPtr->iBitmap > 0 ) ? 899 btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3; 900 901 /* nSepRows is used to calculate the extra height follwoing */ 902 /* the last row.*/903 nSepRows++;904 }905 x = infoPtr->nIndent;906 nRows++;907 }908 else909 x += cx;854 cx = infoPtr->nButtonWidth; 855 856 if (hasDropDownArrows && (btnPtr->fsStyle & TBSTYLE_DROPDOWN)) 857 cx += DDARROW_WIDTH; 858 } 859 cy = infoPtr->nHeight; 860 861 if (btnPtr->fsState & TBSTATE_WRAP ) 862 bWrap = TRUE; 863 864 SetRect (&btnPtr->rect, x, y, x + cx, y + cy); 865 866 if (infoPtr->rcBound.left > x) 867 infoPtr->rcBound.left = x; 868 if (infoPtr->rcBound.right < x + cx) 869 infoPtr->rcBound.right = x + cx; 870 if (infoPtr->rcBound.bottom < y + cy) 871 infoPtr->rcBound.bottom = y + cy; 872 873 /* Set the toolTip only for non-hidden, non-separator button */ 874 if (infoPtr->hwndToolTip && !(btnPtr->fsStyle & TBSTYLE_SEP )) 875 { 876 TTTOOLINFOA ti; 877 878 ZeroMemory (&ti, sizeof(TTTOOLINFOA)); 879 ti.cbSize = sizeof(TTTOOLINFOA); 880 ti.hwnd = hwnd; 881 ti.uId = btnPtr->idCommand; 882 ti.rect = btnPtr->rect; 883 SendMessageA (infoPtr->hwndToolTip, TTM_NEWTOOLRECTA, 884 0, (LPARAM)&ti); 885 } 886 887 /* btnPtr->nRow is zero based. The space between the rows is */ 888 /* also considered as a row. */ 889 btnPtr->nRow = nRows + nSepRows; 890 if( bWrap ) 891 { 892 if ( !(btnPtr->fsStyle & TBSTYLE_SEP) ) 893 y += cy; 894 else 895 { 896 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ 897 /* it is the actual width of the separator. This is used for */ 898 /* custom controls in toolbars. */ 899 y += cy + ( (btnPtr->iBitmap > 0 ) ? 900 btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3; 901 902 /* nSepRows is used to calculate the extra height follwoing */ 903 /* the last row. */ 904 nSepRows++; 905 } 906 x = infoPtr->nIndent; 907 nRows++; 908 } 909 else 910 x += cx; 910 911 } 911 912 … … 913 914 infoPtr->nRows = nRows + nSepRows + 1; 914 915 915 /* nSepRows * (infoPtr->nBitmapHeight + 1) is the space following */916 /* the last row. */917 infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight + 918 nSepRows * (SEPARATOR_WIDTH * 2 / 3) +919 nSepRows * (infoPtr->nBitmapHeight + 1) + 920 BOTTOM_BORDER; 916 /* nSepRows * (infoPtr->nBitmapHeight + 1) is the space following */ 917 /* the last row. */ 918 infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight + 919 nSepRows * (SEPARATOR_WIDTH * 2 / 3) + 920 nSepRows * (infoPtr->nBitmapHeight + 1) + 921 BOTTOM_BORDER; 921 922 TRACE("toolbar height %d, button width %d\n", infoPtr->nHeight, infoPtr->nButtonWidth); 922 923 } … … 929 930 TBUTTON_INFO *btnPtr; 930 931 INT i; 931 932 932 933 btnPtr = infoPtr->buttons; 933 934 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) { 934 if (btnPtr->fsState & TBSTATE_HIDDEN)935 continue;936 937 if (btnPtr->fsStyle & TBSTYLE_SEP) {938 if (PtInRect (&btnPtr->rect, *lpPt)) {939 TRACE(" ON SEPARATOR %d!\n", i);940 return -i;941 }942 }943 else {944 if (PtInRect (&btnPtr->rect, *lpPt)) {945 TRACE(" ON BUTTON %d!\n", i);946 return i;947 }948 }935 if (btnPtr->fsState & TBSTATE_HIDDEN) 936 continue; 937 938 if (btnPtr->fsStyle & TBSTYLE_SEP) { 939 if (PtInRect (&btnPtr->rect, *lpPt)) { 940 TRACE(" ON SEPARATOR %d!\n", i); 941 return -i; 942 } 943 } 944 else { 945 if (PtInRect (&btnPtr->rect, *lpPt)) { 946 TRACE(" ON BUTTON %d!\n", i); 947 return i; 948 } 949 } 949 950 } 950 951 … … 962 963 btnPtr = infoPtr->buttons; 963 964 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) { 964 if (btnPtr->idCommand == idCommand) {965 TRACE("command=%d index=%d\n", idCommand, i);966 return i;967 }965 if (btnPtr->idCommand == idCommand) { 966 TRACE("command=%d index=%d\n", idCommand, i); 967 return i; 968 } 968 969 } 969 970 TRACE("no index found for command=%d\n", idCommand); … … 979 980 980 981 if ((nIndex < 0) || (nIndex > infoPtr->nNumButtons)) 981 return -1;982 return -1; 982 983 983 984 /* check index button */ 984 985 btnPtr = &infoPtr->buttons[nIndex]; 985 986 if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) { 986 if (btnPtr->fsState & TBSTATE_CHECKED)987 return nIndex;987 if (btnPtr->fsState & TBSTATE_CHECKED) 988 return nIndex; 988 989 } 989 990 … … 991 992 nRunIndex = nIndex - 1; 992 993 while (nRunIndex >= 0) { 993 btnPtr = &infoPtr->buttons[nRunIndex];994 if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) {995 if (btnPtr->fsState & TBSTATE_CHECKED)996 return nRunIndex;997 }998 else999 break;1000 nRunIndex--;994 btnPtr = &infoPtr->buttons[nRunIndex]; 995 if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) { 996 if (btnPtr->fsState & TBSTATE_CHECKED) 997 return nRunIndex; 998 } 999 else 1000 break; 1001 nRunIndex--; 1001 1002 } 1002 1003 … … 1004 1005 nRunIndex = nIndex + 1; 1005 1006 while (nRunIndex < infoPtr->nNumButtons) { 1006 btnPtr = &infoPtr->buttons[nRunIndex]; 1007 if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) {1008 if (btnPtr->fsState & TBSTATE_CHECKED)1009 return nRunIndex;1010 }1011 else1012 break;1013 nRunIndex++;1007 btnPtr = &infoPtr->buttons[nRunIndex]; 1008 if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) { 1009 if (btnPtr->fsState & TBSTATE_CHECKED) 1010 return nRunIndex; 1011 } 1012 else 1013 break; 1014 nRunIndex++; 1014 1015 } 1015 1016 … … 1020 1021 static VOID 1021 1022 TOOLBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg, 1022 WPARAM wParam, LPARAM lParam)1023 WPARAM wParam, LPARAM lParam) 1023 1024 { 1024 1025 MSG msg; … … 1049 1050 switch (uMsg) 1050 1051 { 1051 case WM_INITDIALOG: 1052 custInfo = (PCUSTDLG_INFO)lParam; 1053 SetWindowLongA (hwnd, DWL_USER, (DWORD)custInfo); 1054 1055 if (custInfo) 1056 { 1057 char Buffer[256]; 1058 int i = 0; 1059 int index; 1060 1061 /* send TBN_QUERYINSERT notification */ 1062 nmtb.hdr.hwndFrom = hwnd; 1063 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1064 nmtb.hdr.code = TBN_QUERYINSERT; 1065 nmtb.iItem = custInfo->tbInfo->nNumButtons; 1066 1067 if (!SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1068 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb)) 1069 return FALSE; 1070 1071 /* add items to 'toolbar buttons' list and check if removable */ 1072 for (i = 0; i < custInfo->tbInfo->nNumButtons; i++) 1073 { 1074 btnInfo = (PCUSTOMBUTTON)COMCTL32_Alloc(sizeof(CUSTOMBUTTON)); 1075 memset (&btnInfo->btn, 0, sizeof(TBBUTTON)); 1076 btnInfo->btn.fsStyle = TBSTYLE_SEP; 1077 btnInfo->bVirtual = FALSE; 1078 LoadStringA (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64); 1079 1080 /* send TBN_QUERYDELETE notification */ 1081 nmtb.hdr.hwndFrom = hwnd; 1082 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1083 nmtb.hdr.code = TBN_QUERYDELETE; 1084 nmtb.iItem = i; 1085 1086 btnInfo->bRemovable = SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1087 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb); 1088 1089 index = (int)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, 0); 1090 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1091 } 1092 1093 /* insert separator button into 'available buttons' list */ 1094 btnInfo = (PCUSTOMBUTTON)COMCTL32_Alloc(sizeof(CUSTOMBUTTON)); 1095 memset (&btnInfo->btn, 0, sizeof(TBBUTTON)); 1096 btnInfo->btn.fsStyle = TBSTYLE_SEP; 1097 btnInfo->bVirtual = FALSE; 1098 btnInfo->bRemovable = TRUE; 1099 LoadStringA (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64); 1100 index = (int)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)btnInfo); 1101 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1102 1103 /* insert all buttons into dsa */ 1104 for (i = 0;; i++) 1105 { 1106 /* send TBN_GETBUTTONINFO notification */ 1107 nmtb.hdr.hwndFrom = hwnd; 1108 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1109 nmtb.hdr.code = TBN_GETBUTTONINFOA; 1110 nmtb.iItem = i; 1111 nmtb.pszText = Buffer; 1112 nmtb.cchText = 256; 1113 1114 if (!SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1115 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb)) 1116 break; 1117 1118 TRACE("style: %x\n", nmtb.tbButton.fsStyle); 1119 1120 /* insert button into the apropriate list */ 1121 index = TOOLBAR_GetButtonIndex (custInfo->tbInfo, nmtb.tbButton.idCommand); 1122 if (index == -1) 1123 { 1124 btnInfo = (PCUSTOMBUTTON)COMCTL32_Alloc(sizeof(CUSTOMBUTTON)); 1125 memcpy (&btnInfo->btn, &nmtb.tbButton, sizeof(TBBUTTON)); 1126 btnInfo->bVirtual = FALSE; 1127 btnInfo->bRemovable = TRUE; 1128 if (!(nmtb.tbButton.fsStyle & TBSTYLE_SEP)) 1129 strcpy (btnInfo->text, nmtb.pszText); 1130 1131 index = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, 0); 1132 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1133 } 1134 else 1135 { 1136 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); 1137 memcpy (&btnInfo->btn, &nmtb.tbButton, sizeof(TBBUTTON)); 1138 if (!(nmtb.tbButton.fsStyle & TBSTYLE_SEP)) 1139 strcpy (btnInfo->text, nmtb.pszText); 1140 1141 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1142 } 1143 } 1144 1145 /* select first item in the 'available' list */ 1146 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, 0, 0); 1147 1148 /* append 'virtual' separator button to the 'toolbar buttons' list */ 1149 btnInfo = (PCUSTOMBUTTON)COMCTL32_Alloc(sizeof(CUSTOMBUTTON)); 1150 memset (&btnInfo->btn, 0, sizeof(TBBUTTON)); 1151 btnInfo->btn.fsStyle = TBSTYLE_SEP; 1152 btnInfo->bVirtual = TRUE; 1153 btnInfo->bRemovable = FALSE; 1154 LoadStringA (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64); 1155 index = (int)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)btnInfo); 1156 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1157 1158 /* select last item in the 'toolbar' list */ 1159 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index, 0); 1160 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETTOPINDEX, index, 0); 1161 1162 /* set focus and disable buttons */ 1163 PostMessageA (hwnd, WM_USER, 0, 0); 1164 } 1165 return TRUE; 1166 1167 case WM_USER: 1168 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), FALSE); 1169 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), FALSE); 1170 EnableWindow (GetDlgItem (hwnd,IDC_REMOVE_BTN), FALSE); 1171 SetFocus (GetDlgItem (hwnd, IDC_TOOLBARBTN_LBOX)); 1172 return TRUE; 1173 1174 case WM_CLOSE: 1175 EndDialog(hwnd, FALSE); 1176 return TRUE; 1177 1178 case WM_COMMAND: 1179 switch (LOWORD(wParam)) 1180 { 1181 case IDC_TOOLBARBTN_LBOX: 1182 if (HIWORD(wParam) == LBN_SELCHANGE) 1183 { 1184 PCUSTOMBUTTON btnInfo; 1185 NMTOOLBARA nmtb; 1186 int count; 1187 int index; 1188 1189 count = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCOUNT, 0, 0); 1190 index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); 1191 1192 /* send TBN_QUERYINSERT notification */ 1193 nmtb.hdr.hwndFrom = hwnd; 1194 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1195 nmtb.hdr.code = TBN_QUERYINSERT; 1196 nmtb.iItem = index; 1197 1198 SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1199 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb); 1200 1201 /* get list box item */ 1202 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); 1203 1204 if (index == (count - 1)) 1205 { 1206 /* last item (virtual separator) */ 1207 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), FALSE); 1208 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), FALSE); 1209 } 1210 else if (index == (count - 2)) 1211 { 1212 /* second last item (last non-virtual item) */ 1213 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), TRUE); 1214 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), FALSE); 1215 } 1216 else if (index == 0) 1217 { 1218 /* first item */ 1219 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), FALSE); 1220 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), TRUE); 1221 } 1222 else 1223 { 1224 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), TRUE); 1225 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), TRUE); 1226 } 1227 1228 EnableWindow (GetDlgItem (hwnd,IDC_REMOVE_BTN), btnInfo->bRemovable); 1229 } 1230 break; 1231 1232 case IDC_MOVEUP_BTN: 1233 { 1234 PCUSTOMBUTTON btnInfo; 1235 int index; 1236 int count; 1237 1238 count = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCOUNT, 0, 0); 1239 index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); 1240 TRACE("Move up: index %d\n", index); 1241 1242 /* send TBN_QUERYINSERT notification */ 1243 nmtb.hdr.hwndFrom = hwnd; 1244 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1245 nmtb.hdr.code = TBN_QUERYINSERT; 1246 nmtb.iItem = index; 1247 1248 if (SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1249 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb)) 1250 { 1251 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); 1252 1253 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_DELETESTRING, index, 0); 1254 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_INSERTSTRING, index-1, 0); 1255 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index-1, (LPARAM)btnInfo); 1256 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index-1 , 0); 1257 1258 if (index <= 1) 1259 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), FALSE); 1260 else if (index >= (count - 3)) 1261 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), TRUE); 1262 1263 SendMessageA (custInfo->tbHwnd, TB_DELETEBUTTON, index, 0); 1264 SendMessageA (custInfo->tbHwnd, TB_INSERTBUTTONA, index-1, (LPARAM)&(btnInfo->btn)); 1265 } 1266 } 1267 break; 1268 1269 case IDC_MOVEDN_BTN: /* move down */ 1270 { 1271 PCUSTOMBUTTON btnInfo; 1272 int index; 1273 int count; 1274 1275 count = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCOUNT, 0, 0); 1276 index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); 1277 TRACE("Move up: index %d\n", index); 1278 1279 /* send TBN_QUERYINSERT notification */ 1280 nmtb.hdr.hwndFrom = hwnd; 1281 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1282 nmtb.hdr.code = TBN_QUERYINSERT; 1283 nmtb.iItem = index; 1284 1285 if (SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1286 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb)) 1287 { 1288 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); 1289 1290 /* move button down */ 1291 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_DELETESTRING, index, 0); 1292 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_INSERTSTRING, index+1, 0); 1293 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index+1, (LPARAM)btnInfo); 1294 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index+1 , 0); 1295 1296 if (index == 0) 1297 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), TRUE); 1298 else if (index >= (count - 3)) 1299 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), FALSE); 1300 1301 SendMessageA (custInfo->tbHwnd, TB_DELETEBUTTON, index, 0); 1302 SendMessageA (custInfo->tbHwnd, TB_INSERTBUTTONA, index+1, (LPARAM)&(btnInfo->btn)); 1303 } 1304 } 1305 break; 1306 1307 case IDC_REMOVE_BTN: /* remove button */ 1308 { 1309 PCUSTOMBUTTON btnInfo; 1310 int index; 1311 1312 index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); 1313 TRACE("Remove: index %d\n", index); 1314 1315 /* send TBN_QUERYDELETE notification */ 1316 nmtb.hdr.hwndFrom = hwnd; 1317 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1318 nmtb.hdr.code = TBN_QUERYDELETE; 1319 nmtb.iItem = index; 1320 1321 if (SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1322 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb)) 1323 { 1324 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); 1325 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_DELETESTRING, index, 0); 1326 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index , 0); 1327 1328 SendMessageA (custInfo->tbHwnd, TB_DELETEBUTTON, index, 0); 1329 1330 /* insert into 'available button' list */ 1331 if (!(btnInfo->btn.fsStyle & TBSTYLE_SEP)) 1332 { 1333 index = (int)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, 0); 1334 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1335 } 1336 else 1337 COMCTL32_Free (btnInfo); 1338 } 1339 } 1340 break; 1341 1342 case IDOK: /* Add button */ 1343 { 1344 int index; 1345 int count; 1346 1347 count = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETCOUNT, 0, 0); 1348 index = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETCURSEL, 0, 0); 1349 TRACE("Add: index %d\n", index); 1350 1351 /* send TBN_QUERYINSERT notification */ 1352 nmtb.hdr.hwndFrom = hwnd; 1353 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1354 nmtb.hdr.code = TBN_QUERYINSERT; 1355 nmtb.iItem = index; 1356 1357 if (SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1358 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb)) 1359 { 1360 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETITEMDATA, index, 0); 1361 1362 if (index != 0) 1363 { 1364 /* remove from 'available buttons' list */ 1365 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_DELETESTRING, index, 0); 1366 if (index == count-1) 1367 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, index-1 , 0); 1368 else 1369 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, index , 0); 1370 } 1371 else 1372 { 1373 PCUSTOMBUTTON btnNew; 1374 1375 /* duplicate 'separator' button */ 1376 btnNew = (PCUSTOMBUTTON)COMCTL32_Alloc (sizeof(CUSTOMBUTTON)); 1377 memcpy (btnNew, btnInfo, sizeof(CUSTOMBUTTON)); 1378 btnInfo = btnNew; 1379 } 1380 1381 /* insert into 'toolbar button' list */ 1382 index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); 1383 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_INSERTSTRING, index, 0); 1384 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1385 1386 SendMessageA (custInfo->tbHwnd, TB_INSERTBUTTONA, index, (LPARAM)&(btnInfo->btn)); 1387 } 1388 } 1389 break; 1390 1391 case IDCANCEL: 1392 EndDialog(hwnd, FALSE); 1393 break; 1394 } 1395 return TRUE; 1396 1397 case WM_DESTROY: 1398 { 1399 int count; 1400 int i; 1401 1402 /* delete items from 'toolbar buttons' listbox*/ 1403 count = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCOUNT, 0, 0); 1404 for (i = 0; i < count; i++) 1405 { 1406 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, i, 0); 1407 COMCTL32_Free(btnInfo); 1408 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, 0, 0); 1409 } 1410 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_RESETCONTENT, 0, 0); 1411 1412 1413 /* delete items from 'available buttons' listbox*/ 1414 count = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETCOUNT, 0, 0); 1415 for (i = 0; i < count; i++) 1416 { 1417 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETITEMDATA, i, 0); 1418 COMCTL32_Free(btnInfo); 1419 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, i, 0); 1420 } 1421 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_RESETCONTENT, 0, 0); 1052 case WM_INITDIALOG: 1053 custInfo = (PCUSTDLG_INFO)lParam; 1054 SetWindowLongA (hwnd, DWL_USER, (DWORD)custInfo); 1055 1056 if (custInfo) 1057 { 1058 char Buffer[256]; 1059 int i = 0; 1060 int index; 1061 1062 /* send TBN_QUERYINSERT notification */ 1063 nmtb.hdr.hwndFrom = hwnd; 1064 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1065 nmtb.hdr.code = TBN_QUERYINSERT; 1066 nmtb.iItem = custInfo->tbInfo->nNumButtons; 1067 1068 if (!SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1069 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb)) 1070 return FALSE; 1071 1072 /* add items to 'toolbar buttons' list and check if removable */ 1073 for (i = 0; i < custInfo->tbInfo->nNumButtons; i++) 1074 { 1075 btnInfo = (PCUSTOMBUTTON)COMCTL32_Alloc(sizeof(CUSTOMBUTTON)); 1076 memset (&btnInfo->btn, 0, sizeof(TBBUTTON)); 1077 btnInfo->btn.fsStyle = TBSTYLE_SEP; 1078 btnInfo->bVirtual = FALSE; 1079 LoadStringA (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64); 1080 1081 /* send TBN_QUERYDELETE notification */ 1082 nmtb.hdr.hwndFrom = hwnd; 1083 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1084 nmtb.hdr.code = TBN_QUERYDELETE; 1085 nmtb.iItem = i; 1086 1087 btnInfo->bRemovable = SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1088 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb); 1089 1090 index = (int)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, 0); 1091 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1092 } 1093 1094 /* insert separator button into 'available buttons' list */ 1095 btnInfo = (PCUSTOMBUTTON)COMCTL32_Alloc(sizeof(CUSTOMBUTTON)); 1096 memset (&btnInfo->btn, 0, sizeof(TBBUTTON)); 1097 btnInfo->btn.fsStyle = TBSTYLE_SEP; 1098 btnInfo->bVirtual = FALSE; 1099 btnInfo->bRemovable = TRUE; 1100 LoadStringA (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64); 1101 index = (int)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)btnInfo); 1102 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1103 1104 /* insert all buttons into dsa */ 1105 for (i = 0;; i++) 1106 { 1107 /* send TBN_GETBUTTONINFO notification */ 1108 nmtb.hdr.hwndFrom = hwnd; 1109 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1110 nmtb.hdr.code = TBN_GETBUTTONINFOA; 1111 nmtb.iItem = i; 1112 nmtb.pszText = Buffer; 1113 nmtb.cchText = 256; 1114 1115 if (!SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1116 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb)) 1117 break; 1118 1119 TRACE("style: %x\n", nmtb.tbButton.fsStyle); 1120 1121 /* insert button into the apropriate list */ 1122 index = TOOLBAR_GetButtonIndex (custInfo->tbInfo, nmtb.tbButton.idCommand); 1123 if (index == -1) 1124 { 1125 btnInfo = (PCUSTOMBUTTON)COMCTL32_Alloc(sizeof(CUSTOMBUTTON)); 1126 memcpy (&btnInfo->btn, &nmtb.tbButton, sizeof(TBBUTTON)); 1127 btnInfo->bVirtual = FALSE; 1128 btnInfo->bRemovable = TRUE; 1129 if (!(nmtb.tbButton.fsStyle & TBSTYLE_SEP)) 1130 strcpy (btnInfo->text, nmtb.pszText); 1131 1132 index = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, 0); 1133 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1422 1134 } 1423 return TRUE; 1424 1425 case WM_DRAWITEM: 1426 if (wParam == IDC_AVAILBTN_LBOX || wParam == IDC_TOOLBARBTN_LBOX) 1427 { 1428 LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam; 1429 RECT rcButton; 1430 RECT rcText; 1431 HPEN hOldPen; 1432 HBRUSH hOldBrush; 1433 COLORREF oldText = 0; 1434 COLORREF oldBk = 0; 1435 1436 /* get item data */ 1437 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, wParam, LB_GETITEMDATA, (WPARAM)lpdis->itemID, 0); 1438 if (btnInfo == NULL) 1439 { 1440 FIXME("btnInfo invalid!\n"); 1441 return TRUE; 1442 } 1443 1444 /* set colors and select objects */ 1445 oldBk = SetBkColor (lpdis->hDC, GetSysColor((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 1446 if (btnInfo->bVirtual) 1447 oldText = SetTextColor (lpdis->hDC, GetSysColor(COLOR_GRAYTEXT)); 1448 else 1449 oldText = SetTextColor (lpdis->hDC, GetSysColor((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHTTEXT:COLOR_WINDOWTEXT)); 1450 hOldPen = SelectObject (lpdis->hDC, GetSysColorPen ((lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 1451 hOldBrush = SelectObject (lpdis->hDC, GetSysColorBrush ((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 1452 1453 /* fill background rectangle */ 1454 Rectangle (lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, 1455 lpdis->rcItem.right, lpdis->rcItem.bottom); 1456 1457 /* calculate button and text rectangles */ 1458 CopyRect (&rcButton, &lpdis->rcItem); 1459 InflateRect (&rcButton, -1, -1); 1460 CopyRect (&rcText, &rcButton); 1461 rcButton.right = rcButton.left + custInfo->tbInfo->nBitmapWidth + 6; 1462 rcText.left = rcButton.right + 2; 1463 1464 /* draw focus rectangle */ 1465 if (lpdis->itemState & ODS_FOCUS) 1466 DrawFocusRect (lpdis->hDC, &lpdis->rcItem); 1467 1468 /* draw button */ 1469 DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT); 1470 1471 /* draw image and text */ 1472 if ((btnInfo->btn.fsStyle & TBSTYLE_SEP) == 0) 1473 ImageList_Draw (custInfo->tbInfo->himlDef, btnInfo->btn.iBitmap, lpdis->hDC, 1474 rcButton.left+3, rcButton.top+3, ILD_NORMAL); 1475 DrawTextA (lpdis->hDC, btnInfo->text, -1, &rcText, 1476 DT_LEFT | DT_VCENTER | DT_SINGLELINE); 1477 1478 /* delete objects and reset colors */ 1479 SelectObject (lpdis->hDC, hOldBrush); 1480 SelectObject (lpdis->hDC, hOldPen); 1481 SetBkColor (lpdis->hDC, oldBk); 1482 SetTextColor (lpdis->hDC, oldText); 1483 1484 return TRUE; 1485 } 1486 return FALSE; 1487 1488 case WM_MEASUREITEM: 1489 if (wParam == IDC_AVAILBTN_LBOX || wParam == IDC_TOOLBARBTN_LBOX) 1490 { 1491 MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*)lParam; 1492 1493 if (custInfo && custInfo->tbInfo) 1494 lpmis->itemHeight = custInfo->tbInfo->nBitmapHeight + 8; 1495 else 1496 lpmis->itemHeight = 15 + 8; /* default height */ 1497 1498 return TRUE; 1499 } 1500 return FALSE; 1501 1502 default: 1503 return FALSE; 1135 else 1136 { 1137 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); 1138 memcpy (&btnInfo->btn, &nmtb.tbButton, sizeof(TBBUTTON)); 1139 if (!(nmtb.tbButton.fsStyle & TBSTYLE_SEP)) 1140 strcpy (btnInfo->text, nmtb.pszText); 1141 1142 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1143 } 1144 } 1145 1146 /* select first item in the 'available' list */ 1147 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, 0, 0); 1148 1149 /* append 'virtual' separator button to the 'toolbar buttons' list */ 1150 btnInfo = (PCUSTOMBUTTON)COMCTL32_Alloc(sizeof(CUSTOMBUTTON)); 1151 memset (&btnInfo->btn, 0, sizeof(TBBUTTON)); 1152 btnInfo->btn.fsStyle = TBSTYLE_SEP; 1153 btnInfo->bVirtual = TRUE; 1154 btnInfo->bRemovable = FALSE; 1155 LoadStringA (COMCTL32_hModule, IDS_SEPARATOR, btnInfo->text, 64); 1156 index = (int)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)btnInfo); 1157 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1158 1159 /* select last item in the 'toolbar' list */ 1160 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index, 0); 1161 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETTOPINDEX, index, 0); 1162 1163 /* set focus and disable buttons */ 1164 PostMessageA (hwnd, WM_USER, 0, 0); 1165 } 1166 return TRUE; 1167 1168 case WM_USER: 1169 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), FALSE); 1170 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), FALSE); 1171 EnableWindow (GetDlgItem (hwnd,IDC_REMOVE_BTN), FALSE); 1172 SetFocus (GetDlgItem (hwnd, IDC_TOOLBARBTN_LBOX)); 1173 return TRUE; 1174 1175 case WM_CLOSE: 1176 EndDialog(hwnd, FALSE); 1177 return TRUE; 1178 1179 case WM_COMMAND: 1180 switch (LOWORD(wParam)) 1181 { 1182 case IDC_TOOLBARBTN_LBOX: 1183 if (HIWORD(wParam) == LBN_SELCHANGE) 1184 { 1185 PCUSTOMBUTTON btnInfo; 1186 NMTOOLBARA nmtb; 1187 int count; 1188 int index; 1189 1190 count = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCOUNT, 0, 0); 1191 index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); 1192 1193 /* send TBN_QUERYINSERT notification */ 1194 nmtb.hdr.hwndFrom = hwnd; 1195 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1196 nmtb.hdr.code = TBN_QUERYINSERT; 1197 nmtb.iItem = index; 1198 1199 SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1200 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb); 1201 1202 /* get list box item */ 1203 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); 1204 1205 if (index == (count - 1)) 1206 { 1207 /* last item (virtual separator) */ 1208 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), FALSE); 1209 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), FALSE); 1210 } 1211 else if (index == (count - 2)) 1212 { 1213 /* second last item (last non-virtual item) */ 1214 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), TRUE); 1215 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), FALSE); 1216 } 1217 else if (index == 0) 1218 { 1219 /* first item */ 1220 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), FALSE); 1221 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), TRUE); 1222 } 1223 else 1224 { 1225 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), TRUE); 1226 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), TRUE); 1227 } 1228 1229 EnableWindow (GetDlgItem (hwnd,IDC_REMOVE_BTN), btnInfo->bRemovable); 1230 } 1231 break; 1232 1233 case IDC_MOVEUP_BTN: 1234 { 1235 PCUSTOMBUTTON btnInfo; 1236 int index; 1237 int count; 1238 1239 count = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCOUNT, 0, 0); 1240 index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); 1241 TRACE("Move up: index %d\n", index); 1242 1243 /* send TBN_QUERYINSERT notification */ 1244 nmtb.hdr.hwndFrom = hwnd; 1245 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1246 nmtb.hdr.code = TBN_QUERYINSERT; 1247 nmtb.iItem = index; 1248 1249 if (SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1250 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb)) 1251 { 1252 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); 1253 1254 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_DELETESTRING, index, 0); 1255 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_INSERTSTRING, index-1, 0); 1256 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index-1, (LPARAM)btnInfo); 1257 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index-1 , 0); 1258 1259 if (index <= 1) 1260 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), FALSE); 1261 else if (index >= (count - 3)) 1262 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), TRUE); 1263 1264 SendMessageA (custInfo->tbHwnd, TB_DELETEBUTTON, index, 0); 1265 SendMessageA (custInfo->tbHwnd, TB_INSERTBUTTONA, index-1, (LPARAM)&(btnInfo->btn)); 1266 } 1267 } 1268 break; 1269 1270 case IDC_MOVEDN_BTN: /* move down */ 1271 { 1272 PCUSTOMBUTTON btnInfo; 1273 int index; 1274 int count; 1275 1276 count = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCOUNT, 0, 0); 1277 index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); 1278 TRACE("Move up: index %d\n", index); 1279 1280 /* send TBN_QUERYINSERT notification */ 1281 nmtb.hdr.hwndFrom = hwnd; 1282 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1283 nmtb.hdr.code = TBN_QUERYINSERT; 1284 nmtb.iItem = index; 1285 1286 if (SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1287 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb)) 1288 { 1289 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); 1290 1291 /* move button down */ 1292 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_DELETESTRING, index, 0); 1293 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_INSERTSTRING, index+1, 0); 1294 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index+1, (LPARAM)btnInfo); 1295 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index+1 , 0); 1296 1297 if (index == 0) 1298 EnableWindow (GetDlgItem (hwnd,IDC_MOVEUP_BTN), TRUE); 1299 else if (index >= (count - 3)) 1300 EnableWindow (GetDlgItem (hwnd,IDC_MOVEDN_BTN), FALSE); 1301 1302 SendMessageA (custInfo->tbHwnd, TB_DELETEBUTTON, index, 0); 1303 SendMessageA (custInfo->tbHwnd, TB_INSERTBUTTONA, index+1, (LPARAM)&(btnInfo->btn)); 1304 } 1305 } 1306 break; 1307 1308 case IDC_REMOVE_BTN: /* remove button */ 1309 { 1310 PCUSTOMBUTTON btnInfo; 1311 int index; 1312 1313 index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); 1314 TRACE("Remove: index %d\n", index); 1315 1316 /* send TBN_QUERYDELETE notification */ 1317 nmtb.hdr.hwndFrom = hwnd; 1318 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1319 nmtb.hdr.code = TBN_QUERYDELETE; 1320 nmtb.iItem = index; 1321 1322 if (SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1323 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb)) 1324 { 1325 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0); 1326 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_DELETESTRING, index, 0); 1327 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETCURSEL, index , 0); 1328 1329 SendMessageA (custInfo->tbHwnd, TB_DELETEBUTTON, index, 0); 1330 1331 /* insert into 'available button' list */ 1332 if (!(btnInfo->btn.fsStyle & TBSTYLE_SEP)) 1333 { 1334 index = (int)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, 0); 1335 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1336 } 1337 else 1338 COMCTL32_Free (btnInfo); 1339 } 1340 } 1341 break; 1342 1343 case IDOK: /* Add button */ 1344 { 1345 int index; 1346 int count; 1347 1348 count = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETCOUNT, 0, 0); 1349 index = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETCURSEL, 0, 0); 1350 TRACE("Add: index %d\n", index); 1351 1352 /* send TBN_QUERYINSERT notification */ 1353 nmtb.hdr.hwndFrom = hwnd; 1354 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1355 nmtb.hdr.code = TBN_QUERYINSERT; 1356 nmtb.iItem = index; 1357 1358 if (SendMessageA (custInfo->tbInfo->hwndNotify, WM_NOTIFY, 1359 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb)) 1360 { 1361 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETITEMDATA, index, 0); 1362 1363 if (index != 0) 1364 { 1365 /* remove from 'available buttons' list */ 1366 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_DELETESTRING, index, 0); 1367 if (index == count-1) 1368 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, index-1 , 0); 1369 else 1370 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, index , 0); 1371 } 1372 else 1373 { 1374 PCUSTOMBUTTON btnNew; 1375 1376 /* duplicate 'separator' button */ 1377 btnNew = (PCUSTOMBUTTON)COMCTL32_Alloc (sizeof(CUSTOMBUTTON)); 1378 memcpy (btnNew, btnInfo, sizeof(CUSTOMBUTTON)); 1379 btnInfo = btnNew; 1380 } 1381 1382 /* insert into 'toolbar button' list */ 1383 index = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCURSEL, 0, 0); 1384 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_INSERTSTRING, index, 0); 1385 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); 1386 1387 SendMessageA (custInfo->tbHwnd, TB_INSERTBUTTONA, index, (LPARAM)&(btnInfo->btn)); 1388 } 1389 } 1390 break; 1391 1392 case IDCANCEL: 1393 EndDialog(hwnd, FALSE); 1394 break; 1395 } 1396 return TRUE; 1397 1398 case WM_DESTROY: 1399 { 1400 int count; 1401 int i; 1402 1403 /* delete items from 'toolbar buttons' listbox*/ 1404 count = SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETCOUNT, 0, 0); 1405 for (i = 0; i < count; i++) 1406 { 1407 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, i, 0); 1408 COMCTL32_Free(btnInfo); 1409 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, 0, 0); 1410 } 1411 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_RESETCONTENT, 0, 0); 1412 1413 1414 /* delete items from 'available buttons' listbox*/ 1415 count = SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETCOUNT, 0, 0); 1416 for (i = 0; i < count; i++) 1417 { 1418 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_GETITEMDATA, i, 0); 1419 COMCTL32_Free(btnInfo); 1420 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMDATA, i, 0); 1421 } 1422 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_RESETCONTENT, 0, 0); 1423 } 1424 return TRUE; 1425 1426 case WM_DRAWITEM: 1427 if (wParam == IDC_AVAILBTN_LBOX || wParam == IDC_TOOLBARBTN_LBOX) 1428 { 1429 LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam; 1430 RECT rcButton; 1431 RECT rcText; 1432 HPEN hOldPen; 1433 HBRUSH hOldBrush; 1434 COLORREF oldText = 0; 1435 COLORREF oldBk = 0; 1436 1437 /* get item data */ 1438 btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageA (hwnd, wParam, LB_GETITEMDATA, (WPARAM)lpdis->itemID, 0); 1439 if (btnInfo == NULL) 1440 { 1441 FIXME("btnInfo invalid!\n"); 1442 return TRUE; 1443 } 1444 1445 /* set colors and select objects */ 1446 oldBk = SetBkColor (lpdis->hDC, GetSysColor((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 1447 if (btnInfo->bVirtual) 1448 oldText = SetTextColor (lpdis->hDC, GetSysColor(COLOR_GRAYTEXT)); 1449 else 1450 oldText = SetTextColor (lpdis->hDC, GetSysColor((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHTTEXT:COLOR_WINDOWTEXT)); 1451 hOldPen = SelectObject (lpdis->hDC, GetSysColorPen ((lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 1452 hOldBrush = SelectObject (lpdis->hDC, GetSysColorBrush ((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 1453 1454 /* fill background rectangle */ 1455 Rectangle (lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, 1456 lpdis->rcItem.right, lpdis->rcItem.bottom); 1457 1458 /* calculate button and text rectangles */ 1459 CopyRect (&rcButton, &lpdis->rcItem); 1460 InflateRect (&rcButton, -1, -1); 1461 CopyRect (&rcText, &rcButton); 1462 rcButton.right = rcButton.left + custInfo->tbInfo->nBitmapWidth + 6; 1463 rcText.left = rcButton.right + 2; 1464 1465 /* draw focus rectangle */ 1466 if (lpdis->itemState & ODS_FOCUS) 1467 DrawFocusRect (lpdis->hDC, &lpdis->rcItem); 1468 1469 /* draw button */ 1470 DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT); 1471 1472 /* draw image and text */ 1473 if ((btnInfo->btn.fsStyle & TBSTYLE_SEP) == 0) 1474 ImageList_Draw (custInfo->tbInfo->himlDef, btnInfo->btn.iBitmap, lpdis->hDC, 1475 rcButton.left+3, rcButton.top+3, ILD_NORMAL); 1476 DrawTextA (lpdis->hDC, btnInfo->text, -1, &rcText, 1477 DT_LEFT | DT_VCENTER | DT_SINGLELINE); 1478 1479 /* delete objects and reset colors */ 1480 SelectObject (lpdis->hDC, hOldBrush); 1481 SelectObject (lpdis->hDC, hOldPen); 1482 SetBkColor (lpdis->hDC, oldBk); 1483 SetTextColor (lpdis->hDC, oldText); 1484 1485 return TRUE; 1486 } 1487 return FALSE; 1488 1489 case WM_MEASUREITEM: 1490 if (wParam == IDC_AVAILBTN_LBOX || wParam == IDC_TOOLBARBTN_LBOX) 1491 { 1492 MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*)lParam; 1493 1494 if (custInfo && custInfo->tbInfo) 1495 lpmis->itemHeight = custInfo->tbInfo->nBitmapHeight + 8; 1496 else 1497 lpmis->itemHeight = 15 + 8; /* default height */ 1498 1499 return TRUE; 1500 } 1501 return FALSE; 1502 1503 default: 1504 return FALSE; 1504 1505 } 1505 1506 } … … 1520 1521 TRACE("hwnd=%x wParam=%x lParam=%lx\n", hwnd, wParam, lParam); 1521 1522 if (!lpAddBmp) 1522 return -1;1523 return -1; 1523 1524 1524 1525 if (lpAddBmp->hInst == HINST_COMMCTRL) 1525 1526 { 1526 if ((lpAddBmp->nID & ~1) == IDB_STD_SMALL_COLOR)1527 nButtons = 15;1528 else if ((lpAddBmp->nID & ~1) == IDB_VIEW_SMALL_COLOR)1529 nButtons = 13;1530 else if ((lpAddBmp->nID & ~1) == IDB_HIST_SMALL_COLOR)1531 nButtons = 5;1532 else1533 return -1;1534 1535 TRACE ("adding %d internal bitmaps!\n", nButtons);1536 1537 /* Windows resize all the buttons to the size of a newly added standard image */1538 if (lpAddBmp->nID & 1) 1539 {1540 /* large icons */1541 /* FIXME: on windows the size of the images is 25x24 but the size of the bitmap 1542 * in rsrc is only 24x24. Fix the bitmap (how?) and then fix this 1527 if ((lpAddBmp->nID & ~1) == IDB_STD_SMALL_COLOR) 1528 nButtons = 15; 1529 else if ((lpAddBmp->nID & ~1) == IDB_VIEW_SMALL_COLOR) 1530 nButtons = 13; 1531 else if ((lpAddBmp->nID & ~1) == IDB_HIST_SMALL_COLOR) 1532 nButtons = 5; 1533 else 1534 return -1; 1535 1536 TRACE ("adding %d internal bitmaps!\n", nButtons); 1537 1538 /* Windows resize all the buttons to the size of a newly added standard image */ 1539 if (lpAddBmp->nID & 1) 1540 { 1541 /* large icons */ 1542 /* FIXME: on windows the size of the images is 25x24 but the size of the bitmap 1543 * in rsrc is only 24x24. Fix the bitmap (how?) and then fix this 1543 1544 */ 1544 SendMessageA (hwnd, TB_SETBITMAPSIZE, 0, 1545 MAKELPARAM((WORD)24, (WORD)24)); 1546 SendMessageA (hwnd, TB_SETBUTTONSIZE, 0, 1547 MAKELPARAM((WORD)31, (WORD)30)); 1548 } 1549 else 1550 { 1551 /* small icons */ 1552 SendMessageA (hwnd, TB_SETBITMAPSIZE, 0, 1553 MAKELPARAM((WORD)16, (WORD)16)); 1554 SendMessageA (hwnd, TB_SETBUTTONSIZE, 0, 1555 MAKELPARAM((WORD)22, (WORD)22)); 1556 } 1557 1558 TOOLBAR_CalcToolbar (hwnd); 1545 SendMessageA (hwnd, TB_SETBITMAPSIZE, 0, 1546 MAKELPARAM((WORD)24, (WORD)24)); 1547 SendMessageA (hwnd, TB_SETBUTTONSIZE, 0, 1548 MAKELPARAM((WORD)31, (WORD)30)); 1559 1549 } 1560 1550 else 1561 1551 { 1562 nButtons = (INT)wParam; 1563 if (nButtons <= 0) 1564 return -1; 1565 1566 TRACE ("adding %d bitmaps!\n", nButtons); 1567 } 1568 1552 /* small icons */ 1553 SendMessageA (hwnd, TB_SETBITMAPSIZE, 0, 1554 MAKELPARAM((WORD)16, (WORD)16)); 1555 SendMessageA (hwnd, TB_SETBUTTONSIZE, 0, 1556 MAKELPARAM((WORD)22, (WORD)22)); 1557 } 1558 1559 TOOLBAR_CalcToolbar (hwnd); 1560 } 1561 else 1562 { 1563 nButtons = (INT)wParam; 1564 if (nButtons <= 0) 1565 return -1; 1566 1567 TRACE ("adding %d bitmaps!\n", nButtons); 1568 } 1569 1569 1570 if (!(infoPtr->himlDef)) { 1570 /* create new default image list */1571 TRACE ("creating default image list!\n");1572 1573 infoPtr->himlDef =1574 ImageList_Create (infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,1575 ILC_COLOR | ILC_MASK, nButtons, 2);1576 infoPtr->himlInt = infoPtr->himlDef;1571 /* create new default image list */ 1572 TRACE ("creating default image list!\n"); 1573 1574 infoPtr->himlDef = 1575 ImageList_Create (infoPtr->nBitmapWidth, infoPtr->nBitmapHeight, 1576 ILC_COLOR | ILC_MASK, nButtons, 2); 1577 infoPtr->himlInt = infoPtr->himlDef; 1577 1578 } 1578 1579 … … 1582 1583 if (lpAddBmp->hInst == (HINSTANCE)0) 1583 1584 { 1584 nIndex = 1585 ImageList_AddMasked (infoPtr->himlDef, (HBITMAP)lpAddBmp->nID,1586 CLR_DEFAULT);1585 nIndex = 1586 ImageList_AddMasked (infoPtr->himlDef, (HBITMAP)lpAddBmp->nID, 1587 CLR_DEFAULT); 1587 1588 } 1588 1589 else if (lpAddBmp->hInst == HINST_COMMCTRL) 1589 1590 { 1590 /* Add system bitmaps */1591 switch (lpAddBmp->nID)1592 { 1593 case IDB_STD_SMALL_COLOR:1594 hbmLoad = LoadBitmapA (COMCTL32_hModule,1595 MAKEINTRESOURCEA(IDB_STD_SMALL));1596 nIndex = ImageList_AddMasked (infoPtr->himlDef,1597 hbmLoad, CLR_DEFAULT);1598 DeleteObject (hbmLoad);1599 break;1600 1601 case IDB_STD_LARGE_COLOR:1602 hbmLoad = LoadBitmapA (COMCTL32_hModule,1603 MAKEINTRESOURCEA(IDB_STD_LARGE));1604 nIndex = ImageList_AddMasked (infoPtr->himlDef,1605 hbmLoad, CLR_DEFAULT);1606 DeleteObject (hbmLoad);1607 break;1608 1609 case IDB_VIEW_SMALL_COLOR:1610 hbmLoad = LoadBitmapA (COMCTL32_hModule,1611 MAKEINTRESOURCEA(IDB_VIEW_SMALL));1612 nIndex = ImageList_AddMasked (infoPtr->himlDef,1613 hbmLoad, CLR_DEFAULT);1614 DeleteObject (hbmLoad);1615 break;1616 1617 case IDB_VIEW_LARGE_COLOR:1618 hbmLoad = LoadBitmapA (COMCTL32_hModule,1619 MAKEINTRESOURCEA(IDB_VIEW_LARGE));1620 nIndex = ImageList_AddMasked (infoPtr->himlDef,1621 hbmLoad, CLR_DEFAULT);1622 DeleteObject (hbmLoad);1623 break;1624 1625 case IDB_HIST_SMALL_COLOR:1626 hbmLoad = LoadBitmapA (COMCTL32_hModule,1627 MAKEINTRESOURCEA(IDB_HIST_SMALL));1628 nIndex = ImageList_AddMasked (infoPtr->himlDef,1629 hbmLoad, CLR_DEFAULT);1630 DeleteObject (hbmLoad);1631 break;1632 1633 case IDB_HIST_LARGE_COLOR:1634 hbmLoad = LoadBitmapA (COMCTL32_hModule,1635 MAKEINTRESOURCEA(IDB_HIST_LARGE));1636 nIndex = ImageList_AddMasked (infoPtr->himlDef,1637 hbmLoad, CLR_DEFAULT);1638 DeleteObject (hbmLoad);1639 break;1640 1641 default:1642 nIndex = ImageList_GetImageCount (infoPtr->himlDef);1643 ERR ("invalid imagelist!\n");1644 break;1645 }1591 /* Add system bitmaps */ 1592 switch (lpAddBmp->nID) 1593 { 1594 case IDB_STD_SMALL_COLOR: 1595 hbmLoad = LoadBitmapA (COMCTL32_hModule, 1596 MAKEINTRESOURCEA(IDB_STD_SMALL)); 1597 nIndex = ImageList_AddMasked (infoPtr->himlDef, 1598 hbmLoad, CLR_DEFAULT); 1599 DeleteObject (hbmLoad); 1600 break; 1601 1602 case IDB_STD_LARGE_COLOR: 1603 hbmLoad = LoadBitmapA (COMCTL32_hModule, 1604 MAKEINTRESOURCEA(IDB_STD_LARGE)); 1605 nIndex = ImageList_AddMasked (infoPtr->himlDef, 1606 hbmLoad, CLR_DEFAULT); 1607 DeleteObject (hbmLoad); 1608 break; 1609 1610 case IDB_VIEW_SMALL_COLOR: 1611 hbmLoad = LoadBitmapA (COMCTL32_hModule, 1612 MAKEINTRESOURCEA(IDB_VIEW_SMALL)); 1613 nIndex = ImageList_AddMasked (infoPtr->himlDef, 1614 hbmLoad, CLR_DEFAULT); 1615 DeleteObject (hbmLoad); 1616 break; 1617 1618 case IDB_VIEW_LARGE_COLOR: 1619 hbmLoad = LoadBitmapA (COMCTL32_hModule, 1620 MAKEINTRESOURCEA(IDB_VIEW_LARGE)); 1621 nIndex = ImageList_AddMasked (infoPtr->himlDef, 1622 hbmLoad, CLR_DEFAULT); 1623 DeleteObject (hbmLoad); 1624 break; 1625 1626 case IDB_HIST_SMALL_COLOR: 1627 hbmLoad = LoadBitmapA (COMCTL32_hModule, 1628 MAKEINTRESOURCEA(IDB_HIST_SMALL)); 1629 nIndex = ImageList_AddMasked (infoPtr->himlDef, 1630 hbmLoad, CLR_DEFAULT); 1631 DeleteObject (hbmLoad); 1632 break; 1633 1634 case IDB_HIST_LARGE_COLOR: 1635 hbmLoad = LoadBitmapA (COMCTL32_hModule, 1636 MAKEINTRESOURCEA(IDB_HIST_LARGE)); 1637 nIndex = ImageList_AddMasked (infoPtr->himlDef, 1638 hbmLoad, CLR_DEFAULT); 1639 DeleteObject (hbmLoad); 1640 break; 1641 1642 default: 1643 nIndex = ImageList_GetImageCount (infoPtr->himlDef); 1644 ERR ("invalid imagelist!\n"); 1645 break; 1646 } 1646 1647 } 1647 1648 else 1648 1649 { 1649 hbmLoad = LoadBitmapA (lpAddBmp->hInst, (LPSTR)lpAddBmp->nID);1650 nIndex = ImageList_AddMasked (infoPtr->himlDef, hbmLoad, CLR_DEFAULT);1651 DeleteObject (hbmLoad);1650 hbmLoad = LoadBitmapA (lpAddBmp->hInst, (LPSTR)lpAddBmp->nID); 1651 nIndex = ImageList_AddMasked (infoPtr->himlDef, hbmLoad, CLR_DEFAULT); 1652 DeleteObject (hbmLoad); 1652 1653 } 1653 1654 … … 1659 1660 { 1660 1661 WARN("Desired images do not match received images : Previous image number %i Previous images in list %i added %i expecting total %i, Images in list %i\n", 1661 infoPtr->nNumBitmaps, nCount, imagecount - nCount,1662 infoPtr->nNumBitmaps+nButtons,imagecount);1663 1664 infoPtr->nNumBitmaps = imagecount;1662 infoPtr->nNumBitmaps, nCount, imagecount - nCount, 1663 infoPtr->nNumBitmaps+nButtons,imagecount); 1664 1665 infoPtr->nNumBitmaps = imagecount; 1665 1666 } 1666 1667 else … … 1688 1689 1689 1690 if (infoPtr->nNumButtons == 0) { 1690 infoPtr->buttons =1691 COMCTL32_Alloc (sizeof(TBUTTON_INFO) * nNewButtons);1691 infoPtr->buttons = 1692 COMCTL32_Alloc (sizeof(TBUTTON_INFO) * nNewButtons); 1692 1693 } 1693 1694 else { 1694 TBUTTON_INFO *oldButtons = infoPtr->buttons;1695 infoPtr->buttons =1696 COMCTL32_Alloc (sizeof(TBUTTON_INFO) * nNewButtons);1697 memcpy (&infoPtr->buttons[0], &oldButtons[0],1698 nOldButtons * sizeof(TBUTTON_INFO));1695 TBUTTON_INFO *oldButtons = infoPtr->buttons; 1696 infoPtr->buttons = 1697 COMCTL32_Alloc (sizeof(TBUTTON_INFO) * nNewButtons); 1698 memcpy (&infoPtr->buttons[0], &oldButtons[0], 1699 nOldButtons * sizeof(TBUTTON_INFO)); 1699 1700 COMCTL32_Free (oldButtons); 1700 1701 } … … 1704 1705 /* insert new button data */ 1705 1706 for (nCount = 0; nCount < nAddButtons; nCount++) { 1706 TBUTTON_INFO *btnPtr = &infoPtr->buttons[nOldButtons+nCount];1707 btnPtr->iBitmap = lpTbb[nCount].iBitmap;1708 btnPtr->idCommand = lpTbb[nCount].idCommand;1709 btnPtr->fsState = lpTbb[nCount].fsState;1710 btnPtr->fsStyle = lpTbb[nCount].fsStyle;1711 btnPtr->dwData = lpTbb[nCount].dwData;1712 btnPtr->iString = lpTbb[nCount].iString;1713 btnPtr->bHot = FALSE;1714 1715 if ((infoPtr->hwndToolTip) && !(btnPtr->fsStyle & TBSTYLE_SEP)) {1716 TTTOOLINFOA ti;1717 1718 ZeroMemory (&ti, sizeof(TTTOOLINFOA));1719 ti.cbSize = sizeof (TTTOOLINFOA);1720 ti.hwnd = hwnd;1721 ti.uId = btnPtr->idCommand;1722 ti.hinst = 0;1723 ti.lpszText = LPSTR_TEXTCALLBACKA;1724 1725 SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA,1726 0, (LPARAM)&ti);1727 }1707 TBUTTON_INFO *btnPtr = &infoPtr->buttons[nOldButtons+nCount]; 1708 btnPtr->iBitmap = lpTbb[nCount].iBitmap; 1709 btnPtr->idCommand = lpTbb[nCount].idCommand; 1710 btnPtr->fsState = lpTbb[nCount].fsState; 1711 btnPtr->fsStyle = lpTbb[nCount].fsStyle; 1712 btnPtr->dwData = lpTbb[nCount].dwData; 1713 btnPtr->iString = lpTbb[nCount].iString; 1714 btnPtr->bHot = FALSE; 1715 1716 if ((infoPtr->hwndToolTip) && !(btnPtr->fsStyle & TBSTYLE_SEP)) { 1717 TTTOOLINFOA ti; 1718 1719 ZeroMemory (&ti, sizeof(TTTOOLINFOA)); 1720 ti.cbSize = sizeof (TTTOOLINFOA); 1721 ti.hwnd = hwnd; 1722 ti.uId = btnPtr->idCommand; 1723 ti.hinst = 0; 1724 ti.lpszText = LPSTR_TEXTCALLBACKA; 1725 1726 SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA, 1727 0, (LPARAM)&ti); 1728 } 1728 1729 } 1729 1730 … … 1750 1751 1751 1752 if (infoPtr->nNumButtons == 0) { 1752 infoPtr->buttons =1753 COMCTL32_Alloc (sizeof(TBUTTON_INFO) * nNewButtons);1753 infoPtr->buttons = 1754 COMCTL32_Alloc (sizeof(TBUTTON_INFO) * nNewButtons); 1754 1755 } 1755 1756 else { 1756 TBUTTON_INFO *oldButtons = infoPtr->buttons;1757 infoPtr->buttons =1758 COMCTL32_Alloc (sizeof(TBUTTON_INFO) * nNewButtons);1759 memcpy (&infoPtr->buttons[0], &oldButtons[0],1760 nOldButtons * sizeof(TBUTTON_INFO));1757 TBUTTON_INFO *oldButtons = infoPtr->buttons; 1758 infoPtr->buttons = 1759 COMCTL32_Alloc (sizeof(TBUTTON_INFO) * nNewButtons); 1760 memcpy (&infoPtr->buttons[0], &oldButtons[0], 1761 nOldButtons * sizeof(TBUTTON_INFO)); 1761 1762 COMCTL32_Free (oldButtons); 1762 1763 } … … 1766 1767 /* insert new button data */ 1767 1768 for (nCount = 0; nCount < nAddButtons; nCount++) { 1768 TBUTTON_INFO *btnPtr = &infoPtr->buttons[nOldButtons+nCount];1769 btnPtr->iBitmap = lpTbb[nCount].iBitmap;1770 btnPtr->idCommand = lpTbb[nCount].idCommand;1771 btnPtr->fsState = lpTbb[nCount].fsState;1772 btnPtr->fsStyle = lpTbb[nCount].fsStyle;1773 btnPtr->dwData = lpTbb[nCount].dwData;1774 btnPtr->iString = lpTbb[nCount].iString;1775 btnPtr->bHot = FALSE;1776 1777 if ((infoPtr->hwndToolTip) && !(btnPtr->fsStyle & TBSTYLE_SEP)) {1778 TTTOOLINFOW ti;1779 1780 ZeroMemory (&ti, sizeof(TTTOOLINFOW));1781 ti.cbSize = sizeof (TTTOOLINFOW);1782 ti.hwnd = hwnd;1783 ti.uId = btnPtr->idCommand;1784 ti.hinst = 0;1785 ti.lpszText = LPSTR_TEXTCALLBACKW;1786 1787 SendMessageW (infoPtr->hwndToolTip, TTM_ADDTOOLW,1788 0, (LPARAM)&ti);1789 }1769 TBUTTON_INFO *btnPtr = &infoPtr->buttons[nOldButtons+nCount]; 1770 btnPtr->iBitmap = lpTbb[nCount].iBitmap; 1771 btnPtr->idCommand = lpTbb[nCount].idCommand; 1772 btnPtr->fsState = lpTbb[nCount].fsState; 1773 btnPtr->fsStyle = lpTbb[nCount].fsStyle; 1774 btnPtr->dwData = lpTbb[nCount].dwData; 1775 btnPtr->iString = lpTbb[nCount].iString; 1776 btnPtr->bHot = FALSE; 1777 1778 if ((infoPtr->hwndToolTip) && !(btnPtr->fsStyle & TBSTYLE_SEP)) { 1779 TTTOOLINFOW ti; 1780 1781 ZeroMemory (&ti, sizeof(TTTOOLINFOW)); 1782 ti.cbSize = sizeof (TTTOOLINFOW); 1783 ti.hwnd = hwnd; 1784 ti.uId = btnPtr->idCommand; 1785 ti.hinst = 0; 1786 ti.lpszText = LPSTR_TEXTCALLBACKW; 1787 1788 SendMessageW (infoPtr->hwndToolTip, TTM_ADDTOOLW, 1789 0, (LPARAM)&ti); 1790 } 1790 1791 } 1791 1792 … … 1805 1806 1806 1807 if ((wParam) && (HIWORD(lParam) == 0)) { 1807 char szString[256];1808 INT len, lenW;1809 TRACE("adding string from resource!\n");1810 1811 len = LoadStringA ((HINSTANCE)wParam, (UINT)lParam,1812 szString, 256);1813 1814 TRACE("len=%d \"%s\"\n", len, szString);1815 nIndex = infoPtr->nNumStrings;1816 if (infoPtr->nNumStrings == 0) {1817 infoPtr->strings =1818 COMCTL32_Alloc (sizeof(LPWSTR));1819 }1820 else {1821 LPWSTR *oldStrings = infoPtr->strings;1822 infoPtr->strings =1823 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));1824 memcpy (&infoPtr->strings[0], &oldStrings[0],1825 sizeof(LPWSTR) * infoPtr->nNumStrings);1826 COMCTL32_Free (oldStrings);1827 }1808 char szString[256]; 1809 INT len, lenW; 1810 TRACE("adding string from resource!\n"); 1811 1812 len = LoadStringA ((HINSTANCE)wParam, (UINT)lParam, 1813 szString, 256); 1814 1815 TRACE("len=%d \"%s\"\n", len, szString); 1816 nIndex = infoPtr->nNumStrings; 1817 if (infoPtr->nNumStrings == 0) { 1818 infoPtr->strings = 1819 COMCTL32_Alloc (sizeof(LPWSTR)); 1820 } 1821 else { 1822 LPWSTR *oldStrings = infoPtr->strings; 1823 infoPtr->strings = 1824 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); 1825 memcpy (&infoPtr->strings[0], &oldStrings[0], 1826 sizeof(LPWSTR) * infoPtr->nNumStrings); 1827 COMCTL32_Free (oldStrings); 1828 } 1828 1829 1829 1830 lenW = MultiByteToWideChar( CP_ACP, 0, szString, -1, NULL, 0 ); … … 1831 1832 MultiByteToWideChar( CP_ACP, 0, szString, -1, 1832 1833 infoPtr->strings[infoPtr->nNumStrings], lenW ); 1833 infoPtr->nNumStrings++;1834 infoPtr->nNumStrings++; 1834 1835 } 1835 1836 else { 1836 LPSTR p = (LPSTR)lParam;1837 INT len, lenW;1838 1839 if (p == NULL)1840 return -1;1841 TRACE("adding string(s) from array!\n");1842 1843 nIndex = infoPtr->nNumStrings;1844 while (*p) {1845 len = strlen (p);1846 TRACE("len=%d \"%s\"\n", len, p);1847 1848 if (infoPtr->nNumStrings == 0) {1849 infoPtr->strings =1850 COMCTL32_Alloc (sizeof(LPWSTR));1851 }1852 else {1853 LPWSTR *oldStrings = infoPtr->strings;1854 infoPtr->strings =1855 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));1856 memcpy (&infoPtr->strings[0], &oldStrings[0],1857 sizeof(LPWSTR) * infoPtr->nNumStrings);1858 COMCTL32_Free (oldStrings);1859 }1837 LPSTR p = (LPSTR)lParam; 1838 INT len, lenW; 1839 1840 if (p == NULL) 1841 return -1; 1842 TRACE("adding string(s) from array!\n"); 1843 1844 nIndex = infoPtr->nNumStrings; 1845 while (*p) { 1846 len = strlen (p); 1847 TRACE("len=%d \"%s\"\n", len, p); 1848 1849 if (infoPtr->nNumStrings == 0) { 1850 infoPtr->strings = 1851 COMCTL32_Alloc (sizeof(LPWSTR)); 1852 } 1853 else { 1854 LPWSTR *oldStrings = infoPtr->strings; 1855 infoPtr->strings = 1856 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); 1857 memcpy (&infoPtr->strings[0], &oldStrings[0], 1858 sizeof(LPWSTR) * infoPtr->nNumStrings); 1859 COMCTL32_Free (oldStrings); 1860 } 1860 1861 1861 1862 lenW = MultiByteToWideChar( CP_ACP, 0, p, -1, NULL, 0 ); … … 1863 1864 MultiByteToWideChar( CP_ACP, 0, p, -1, 1864 1865 infoPtr->strings[infoPtr->nNumStrings], lenW ); 1865 infoPtr->nNumStrings++;1866 1867 p += (len+1);1868 }1866 infoPtr->nNumStrings++; 1867 1868 p += (len+1); 1869 } 1869 1870 } 1870 1871 … … 1881 1882 1882 1883 if ((wParam) && (HIWORD(lParam) == 0)) { 1883 WCHAR szString[MAX_RESOURCE_STRING_LENGTH];1884 INT len;1885 TRACE("adding string from resource!\n");1886 1887 len = LoadStringW ((HINSTANCE)wParam, (UINT)lParam,1888 szString, MAX_RESOURCE_STRING_LENGTH);1889 1890 TRACE("len=%d %s\n", len, debugstr_w(szString));1891 TRACE("First char: 0x%x\n", *szString);1892 if (szString[0] == L'|')1893 {1894 PWSTR p = szString + 1;1895 1896 nIndex = infoPtr->nNumStrings;1897 while (*p != L'|') {1898 1899 if (infoPtr->nNumStrings == 0) {1900 infoPtr->strings =1901 COMCTL32_Alloc (sizeof(LPWSTR));1902 }1903 else {1904 LPWSTR *oldStrings = infoPtr->strings;1905 infoPtr->strings =1906 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));1907 memcpy (&infoPtr->strings[0], &oldStrings[0],1908 sizeof(LPWSTR) * infoPtr->nNumStrings);1909 COMCTL32_Free (oldStrings);1910 }1911 1912 len = COMCTL32_StrChrW (p, L'|') - p;1913 TRACE("len=%d %s\n", len, debugstr_w(p));1914 infoPtr->strings[infoPtr->nNumStrings] =1915 COMCTL32_Alloc (sizeof(WCHAR)*(len+1));1916 lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len);1917 infoPtr->nNumStrings++;1918 1919 p += (len+1);1920 }1921 }1922 else1923 {1884 WCHAR szString[MAX_RESOURCE_STRING_LENGTH]; 1885 INT len; 1886 TRACE("adding string from resource!\n"); 1887 1888 len = LoadStringW ((HINSTANCE)wParam, (UINT)lParam, 1889 szString, MAX_RESOURCE_STRING_LENGTH); 1890 1891 TRACE("len=%d %s\n", len, debugstr_w(szString)); 1892 TRACE("First char: 0x%x\n", *szString); 1893 if (szString[0] == L'|') 1894 { 1895 PWSTR p = szString + 1; 1896 1897 nIndex = infoPtr->nNumStrings; 1898 while (*p != L'|') { 1899 1900 if (infoPtr->nNumStrings == 0) { 1901 infoPtr->strings = 1902 COMCTL32_Alloc (sizeof(LPWSTR)); 1903 } 1904 else { 1905 LPWSTR *oldStrings = infoPtr->strings; 1906 infoPtr->strings = 1907 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); 1908 memcpy (&infoPtr->strings[0], &oldStrings[0], 1909 sizeof(LPWSTR) * infoPtr->nNumStrings); 1910 COMCTL32_Free (oldStrings); 1911 } 1912 1913 len = COMCTL32_StrChrW (p, L'|') - p; 1914 TRACE("len=%d %s\n", len, debugstr_w(p)); 1915 infoPtr->strings[infoPtr->nNumStrings] = 1916 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 1917 lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len); 1918 infoPtr->nNumStrings++; 1919 1920 p += (len+1); 1921 } 1922 } 1923 else 1924 { 1924 1925 nIndex = infoPtr->nNumStrings; 1925 1926 if (infoPtr->nNumStrings == 0) { … … 1943 1944 } 1944 1945 else { 1945 LPWSTR p = (LPWSTR)lParam;1946 INT len;1947 1948 if (p == NULL)1949 return -1;1950 TRACE("adding string(s) from array!\n");1951 nIndex = infoPtr->nNumStrings;1952 while (*p) {1953 len = strlenW (p);1954 1955 TRACE("len=%d %s\n", len, debugstr_w(p));1956 if (infoPtr->nNumStrings == 0) {1957 infoPtr->strings =1958 COMCTL32_Alloc (sizeof(LPWSTR));1959 }1960 else {1961 LPWSTR *oldStrings = infoPtr->strings;1962 infoPtr->strings =1963 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));1964 memcpy (&infoPtr->strings[0], &oldStrings[0],1965 sizeof(LPWSTR) * infoPtr->nNumStrings);1966 COMCTL32_Free (oldStrings);1967 }1968 1969 infoPtr->strings[infoPtr->nNumStrings] =1970 COMCTL32_Alloc (sizeof(WCHAR)*(len+1));1971 strcpyW (infoPtr->strings[infoPtr->nNumStrings], p);1972 infoPtr->nNumStrings++;1973 1974 p += (len+1);1975 }1946 LPWSTR p = (LPWSTR)lParam; 1947 INT len; 1948 1949 if (p == NULL) 1950 return -1; 1951 TRACE("adding string(s) from array!\n"); 1952 nIndex = infoPtr->nNumStrings; 1953 while (*p) { 1954 len = strlenW (p); 1955 1956 TRACE("len=%d %s\n", len, debugstr_w(p)); 1957 if (infoPtr->nNumStrings == 0) { 1958 infoPtr->strings = 1959 COMCTL32_Alloc (sizeof(LPWSTR)); 1960 } 1961 else { 1962 LPWSTR *oldStrings = infoPtr->strings; 1963 infoPtr->strings = 1964 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); 1965 memcpy (&infoPtr->strings[0], &oldStrings[0], 1966 sizeof(LPWSTR) * infoPtr->nNumStrings); 1967 COMCTL32_Free (oldStrings); 1968 } 1969 1970 infoPtr->strings[infoPtr->nNumStrings] = 1971 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 1972 strcpyW (infoPtr->strings[infoPtr->nNumStrings], p); 1973 infoPtr->nNumStrings++; 1974 1975 p += (len+1); 1976 } 1976 1977 } 1977 1978 … … 2004 2005 2005 2006 if (dwStyle & CCS_NORESIZE) { 2006 uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE);2007 cx = 0;2008 cy = 0;2007 uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE); 2008 cx = 0; 2009 cy = 0; 2009 2010 } 2010 2011 else { 2011 infoPtr->nWidth = parent_rect.right - parent_rect.left;2012 TOOLBAR_CalcToolbar (hwnd);2013 InvalidateRect( hwnd, NULL, TRUE );2014 cy = infoPtr->nHeight;2015 cx = infoPtr->nWidth;2016 2017 if (dwStyle & CCS_NOMOVEY) {2018 GetWindowRect(hwnd, &window_rect);2019 ScreenToClient(parent, (LPPOINT)&window_rect.left);2020 y = window_rect.top;2021 }2012 infoPtr->nWidth = parent_rect.right - parent_rect.left; 2013 TOOLBAR_CalcToolbar (hwnd); 2014 InvalidateRect( hwnd, NULL, TRUE ); 2015 cy = infoPtr->nHeight; 2016 cx = infoPtr->nWidth; 2017 2018 if (dwStyle & CCS_NOMOVEY) { 2019 GetWindowRect(hwnd, &window_rect); 2020 ScreenToClient(parent, (LPPOINT)&window_rect.left); 2021 y = window_rect.top; 2022 } 2022 2023 } 2023 2024 2024 2025 if (dwStyle & CCS_NOPARENTALIGN) 2025 uPosFlags |= SWP_NOMOVE;2026 uPosFlags |= SWP_NOMOVE; 2026 2027 2027 2028 if (!(dwStyle & CCS_NODIVIDER)) 2028 cy += GetSystemMetrics(SM_CYEDGE);2029 cy += GetSystemMetrics(SM_CYEDGE); 2029 2030 2030 2031 if (dwStyle & WS_BORDER) … … 2061 2062 2062 2063 if (infoPtr == NULL) { 2063 ERR("(0x%x, 0x%x, 0x%lx)\n", hwnd, wParam, lParam);2064 ERR("infoPtr == NULL!\n");2065 return 0;2064 ERR("(0x%x, 0x%x, 0x%lx)\n", hwnd, wParam, lParam); 2065 ERR("infoPtr == NULL!\n"); 2066 return 0; 2066 2067 } 2067 2068 … … 2081 2082 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2082 2083 if (nIndex == -1) 2083 return FALSE;2084 return FALSE; 2084 2085 2085 2086 btnPtr = &infoPtr->buttons[nIndex]; … … 2105 2106 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2106 2107 if (nIndex == -1) 2107 return FALSE;2108 return FALSE; 2108 2109 2109 2110 btnPtr = &infoPtr->buttons[nIndex]; 2110 2111 2111 2112 if (!(btnPtr->fsStyle & TBSTYLE_CHECK)) 2112 return FALSE;2113 return FALSE; 2113 2114 2114 2115 bChecked = (btnPtr->fsState & TBSTATE_CHECKED) ? TRUE : FALSE; 2115 2116 2116 2117 if (LOWORD(lParam) == FALSE) 2117 btnPtr->fsState &= ~TBSTATE_CHECKED;2118 btnPtr->fsState &= ~TBSTATE_CHECKED; 2118 2119 else { 2119 if (btnPtr->fsStyle & TBSTYLE_GROUP) {2120 nOldIndex = 2121 TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, nIndex);2122 if (nOldIndex == nIndex)2123 return 0;2124 if (nOldIndex != -1)2125 infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED;2126 }2127 btnPtr->fsState |= TBSTATE_CHECKED;2120 if (btnPtr->fsStyle & TBSTYLE_GROUP) { 2121 nOldIndex = 2122 TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, nIndex); 2123 if (nOldIndex == nIndex) 2124 return 0; 2125 if (nOldIndex != -1) 2126 infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED; 2127 } 2128 btnPtr->fsState |= TBSTATE_CHECKED; 2128 2129 } 2129 2130 2130 2131 if( bChecked != LOWORD(lParam) ) 2131 2132 { 2132 if (nOldIndex != -1)2133 if (nOldIndex != -1) 2133 2134 { 2134 2135 InvalidateRect(hwnd, &infoPtr->buttons[nOldIndex].rect, … … 2171 2172 2172 2173 SendMessageA (custInfo.tbInfo->hwndNotify, WM_NOTIFY, 2173 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);2174 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); 2174 2175 2175 2176 if (!(hRes = FindResourceA (COMCTL32_hModule, 2176 2177 MAKEINTRESOURCEA(IDD_TBCUSTOMIZE), 2177 2178 RT_DIALOGA))) 2178 return FALSE;2179 return FALSE; 2179 2180 2180 2181 if(!(template = (LPVOID)LoadResource (COMCTL32_hModule, hRes))) 2181 return FALSE;2182 return FALSE; 2182 2183 2183 2184 ret = DialogBoxIndirectParamA (GetWindowLongA (hwnd, GWL_HINSTANCE), … … 2190 2191 nmhdr.code = TBN_ENDADJUST; 2191 2192 SendMessageA (custInfo.tbInfo->hwndNotify, WM_NOTIFY, 2192 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);2193 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); 2193 2194 2194 2195 return ret; … … 2203 2204 2204 2205 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) 2205 return FALSE;2206 2207 if ((infoPtr->hwndToolTip) && 2208 !(infoPtr->buttons[nIndex].fsStyle & TBSTYLE_SEP)) {2209 TTTOOLINFOA ti;2210 2211 ZeroMemory (&ti, sizeof(TTTOOLINFOA));2212 ti.cbSize = sizeof (TTTOOLINFOA);2213 ti.hwnd = hwnd;2214 ti.uId = infoPtr->buttons[nIndex].idCommand;2215 2216 SendMessageA (infoPtr->hwndToolTip, TTM_DELTOOLA, 0, (LPARAM)&ti);2206 return FALSE; 2207 2208 if ((infoPtr->hwndToolTip) && 2209 !(infoPtr->buttons[nIndex].fsStyle & TBSTYLE_SEP)) { 2210 TTTOOLINFOA ti; 2211 2212 ZeroMemory (&ti, sizeof(TTTOOLINFOA)); 2213 ti.cbSize = sizeof (TTTOOLINFOA); 2214 ti.hwnd = hwnd; 2215 ti.uId = infoPtr->buttons[nIndex].idCommand; 2216 2217 SendMessageA (infoPtr->hwndToolTip, TTM_DELTOOLA, 0, (LPARAM)&ti); 2217 2218 } 2218 2219 2219 2220 if (infoPtr->nNumButtons == 1) { 2220 TRACE(" simple delete!\n");2221 COMCTL32_Free (infoPtr->buttons);2222 infoPtr->buttons = NULL;2223 infoPtr->nNumButtons = 0;2221 TRACE(" simple delete!\n"); 2222 COMCTL32_Free (infoPtr->buttons); 2223 infoPtr->buttons = NULL; 2224 infoPtr->nNumButtons = 0; 2224 2225 } 2225 2226 else { 2226 TBUTTON_INFO *oldButtons = infoPtr->buttons;2227 TBUTTON_INFO *oldButtons = infoPtr->buttons; 2227 2228 TRACE("complex delete! [nIndex=%d]\n", nIndex); 2228 2229 2229 infoPtr->nNumButtons--;2230 infoPtr->buttons = COMCTL32_Alloc (sizeof (TBUTTON_INFO) * infoPtr->nNumButtons);2230 infoPtr->nNumButtons--; 2231 infoPtr->buttons = COMCTL32_Alloc (sizeof (TBUTTON_INFO) * infoPtr->nNumButtons); 2231 2232 if (nIndex > 0) { 2232 2233 memcpy (&infoPtr->buttons[0], &oldButtons[0], … … 2239 2240 } 2240 2241 2241 COMCTL32_Free (oldButtons);2242 COMCTL32_Free (oldButtons); 2242 2243 } 2243 2244 … … 2260 2261 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2261 2262 if (nIndex == -1) 2262 return FALSE;2263 return FALSE; 2263 2264 2264 2265 btnPtr = &infoPtr->buttons[nIndex]; … … 2268 2269 /* update the toolbar button state */ 2269 2270 if(LOWORD(lParam) == FALSE) { 2270 btnPtr->fsState &= ~(TBSTATE_ENABLED | TBSTATE_PRESSED);2271 btnPtr->fsState &= ~(TBSTATE_ENABLED | TBSTATE_PRESSED); 2271 2272 } else { 2272 btnPtr->fsState |= TBSTATE_ENABLED;2273 btnPtr->fsState |= TBSTATE_ENABLED; 2273 2274 } 2274 2275 … … 2301 2302 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2302 2303 if (nIndex == -1) 2303 return -1;2304 return -1; 2304 2305 2305 2306 return infoPtr->buttons[nIndex].iBitmap; … … 2323 2324 2324 2325 if (infoPtr == NULL) 2325 return FALSE;2326 return FALSE; 2326 2327 2327 2328 if (lpTbb == NULL) 2328 return FALSE;2329 return FALSE; 2329 2330 2330 2331 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) 2331 return FALSE;2332 return FALSE; 2332 2333 2333 2334 btnPtr = &infoPtr->buttons[nIndex]; … … 2352 2353 2353 2354 if (infoPtr == NULL) 2354 return -1;2355 return -1; 2355 2356 if (lpTbInfo == NULL) 2356 return -1;2357 return -1; 2357 2358 if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOA)) 2358 return -1;2359 return -1; 2359 2360 2360 2361 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2361 2362 if (nIndex == -1) 2362 return -1;2363 return -1; 2363 2364 2364 2365 btnPtr = &infoPtr->buttons[nIndex]; 2365 2366 2366 2367 if (lpTbInfo->dwMask & TBIF_COMMAND) 2367 lpTbInfo->idCommand = btnPtr->idCommand;2368 lpTbInfo->idCommand = btnPtr->idCommand; 2368 2369 if (lpTbInfo->dwMask & TBIF_IMAGE) 2369 lpTbInfo->iImage = btnPtr->iBitmap;2370 lpTbInfo->iImage = btnPtr->iBitmap; 2370 2371 if (lpTbInfo->dwMask & TBIF_LPARAM) 2371 lpTbInfo->lParam = btnPtr->dwData;2372 lpTbInfo->lParam = btnPtr->dwData; 2372 2373 if (lpTbInfo->dwMask & TBIF_SIZE) 2373 lpTbInfo->cx = (WORD)(btnPtr->rect.right - btnPtr->rect.left);2374 lpTbInfo->cx = (WORD)(btnPtr->rect.right - btnPtr->rect.left); 2374 2375 if (lpTbInfo->dwMask & TBIF_STATE) 2375 lpTbInfo->fsState = btnPtr->fsState;2376 lpTbInfo->fsState = btnPtr->fsState; 2376 2377 if (lpTbInfo->dwMask & TBIF_STYLE) 2377 lpTbInfo->fsStyle = btnPtr->fsStyle;2378 lpTbInfo->fsStyle = btnPtr->fsStyle; 2378 2379 if (lpTbInfo->dwMask & TBIF_TEXT) { 2379 2380 if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings)) 2380 { 2381 { 2381 2382 if (!WideCharToMultiByte( CP_ACP, 0, (LPWSTR)infoPtr->strings[btnPtr->iString], -1, 2382 2383 lpTbInfo->pszText, lpTbInfo->cchText, NULL, NULL )) … … 2398 2399 2399 2400 if (infoPtr == NULL) 2400 return -1;2401 return -1; 2401 2402 if (lpTbInfo == NULL) 2402 return -1;2403 return -1; 2403 2404 if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOW)) 2404 return -1;2405 return -1; 2405 2406 2406 2407 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2407 2408 if (nIndex == -1) 2408 return -1;2409 return -1; 2409 2410 2410 2411 btnPtr = &infoPtr->buttons[nIndex]; 2411 2412 2412 2413 if (lpTbInfo->dwMask & TBIF_COMMAND) 2413 lpTbInfo->idCommand = btnPtr->idCommand;2414 lpTbInfo->idCommand = btnPtr->idCommand; 2414 2415 if (lpTbInfo->dwMask & TBIF_IMAGE) 2415 lpTbInfo->iImage = btnPtr->iBitmap;2416 lpTbInfo->iImage = btnPtr->iBitmap; 2416 2417 if (lpTbInfo->dwMask & TBIF_LPARAM) 2417 lpTbInfo->lParam = btnPtr->dwData;2418 lpTbInfo->lParam = btnPtr->dwData; 2418 2419 if (lpTbInfo->dwMask & TBIF_SIZE) 2419 lpTbInfo->cx = (WORD)(btnPtr->rect.right - btnPtr->rect.left);2420 lpTbInfo->cx = (WORD)(btnPtr->rect.right - btnPtr->rect.left); 2420 2421 if (lpTbInfo->dwMask & TBIF_STATE) 2421 lpTbInfo->fsState = btnPtr->fsState;2422 lpTbInfo->fsState = btnPtr->fsState; 2422 2423 if (lpTbInfo->dwMask & TBIF_STYLE) 2423 lpTbInfo->fsStyle = btnPtr->fsStyle;2424 lpTbInfo->fsStyle = btnPtr->fsStyle; 2424 2425 if (lpTbInfo->dwMask & TBIF_TEXT) { 2425 if ((btnPtr->iString >= 0) || (btnPtr->iString < infoPtr->nNumStrings))2426 lstrcpynW (lpTbInfo->pszText,2427 (LPWSTR)infoPtr->strings[btnPtr->iString],2428 lpTbInfo->cchText);2426 if ((btnPtr->iString >= 0) || (btnPtr->iString < infoPtr->nNumStrings)) 2427 lstrcpynW (lpTbInfo->pszText, 2428 (LPWSTR)infoPtr->strings[btnPtr->iString], 2429 lpTbInfo->cchText); 2429 2430 } 2430 2431 … … 2439 2440 2440 2441 return MAKELONG((WORD)infoPtr->nButtonWidth, 2441 (WORD)infoPtr->nButtonHeight);2442 (WORD)infoPtr->nButtonHeight); 2442 2443 } 2443 2444 … … 2451 2452 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2452 2453 if (nIndex == -1) 2453 return -1;2454 return -1; 2454 2455 2455 2456 nStringIndex = infoPtr->buttons[nIndex].iString; … … 2458 2459 2459 2460 if ((nStringIndex < 0) || (nStringIndex >= infoPtr->nNumStrings)) 2460 return -1;2461 return -1; 2461 2462 2462 2463 if (lParam == 0) 2463 return -1;2464 return -1; 2464 2465 2465 2466 return WideCharToMultiByte( CP_ACP, 0, (LPWSTR)infoPtr->strings[nStringIndex], -1, … … 2476 2477 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2477 2478 if (nIndex == -1) 2478 return -1;2479 return -1; 2479 2480 2480 2481 nStringIndex = infoPtr->buttons[nIndex].iString; … … 2483 2484 2484 2485 if ((nStringIndex < 0) || (nStringIndex >= infoPtr->nNumStrings)) 2485 return -1;2486 return -1; 2486 2487 2487 2488 if (lParam == 0) 2488 return -1;2489 return -1; 2489 2490 2490 2491 strcpyW ((LPWSTR)lParam, (LPWSTR)infoPtr->strings[nStringIndex]); … … 2530 2531 2531 2532 if (!(GetWindowLongA (hwnd, GWL_STYLE) & TBSTYLE_FLAT)) 2532 return -1;2533 return -1; 2533 2534 2534 2535 if (infoPtr->nHotItem < 0) 2535 return -1;2536 return -1; 2536 2537 2537 2538 return (LRESULT)infoPtr->nHotItem; … … 2561 2562 2562 2563 if (infoPtr == NULL) 2563 return FALSE;2564 return FALSE; 2564 2565 nIndex = (INT)wParam; 2565 2566 btnPtr = &infoPtr->buttons[nIndex]; 2566 2567 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) 2567 return FALSE;2568 return FALSE; 2568 2569 lpRect = (LPRECT)lParam; 2569 2570 if (lpRect == NULL) 2570 return FALSE;2571 return FALSE; 2571 2572 if (btnPtr->fsState & TBSTATE_HIDDEN) 2572 return FALSE;2573 2573 return FALSE; 2574 2574 2575 lpRect->left = btnPtr->rect.left; 2575 2576 lpRect->right = btnPtr->rect.right; … … 2588 2589 2589 2590 if (lpSize == NULL) 2590 return FALSE;2591 return FALSE; 2591 2592 2592 2593 lpSize->cx = infoPtr->rcBound.right - infoPtr->rcBound.left; … … 2594 2595 2595 2596 TRACE("maximum size %d x %d\n", 2596 infoPtr->rcBound.right - infoPtr->rcBound.left,2597 infoPtr->rcBound.bottom - infoPtr->rcBound.top);2597 infoPtr->rcBound.right - infoPtr->rcBound.left, 2598 infoPtr->rcBound.bottom - infoPtr->rcBound.top); 2598 2599 2599 2600 return TRUE; … … 2614 2615 2615 2616 if (infoPtr == NULL) 2616 return FALSE;2617 return FALSE; 2617 2618 nIndex = (INT)wParam; 2618 2619 btnPtr = &infoPtr->buttons[nIndex]; 2619 2620 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) 2620 return FALSE;2621 return FALSE; 2621 2622 lpRect = (LPRECT)lParam; 2622 2623 if (lpRect == NULL) 2623 return FALSE;2624 2624 return FALSE; 2625 2625 2626 lpRect->left = btnPtr->rect.left; 2626 2627 lpRect->right = btnPtr->rect.right; … … 2638 2639 2639 2640 if (GetWindowLongA (hwnd, GWL_STYLE) & TBSTYLE_WRAPABLE) 2640 return infoPtr->nRows;2641 return infoPtr->nRows; 2641 2642 else 2642 return 1;2643 return 1; 2643 2644 } 2644 2645 … … 2652 2653 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2653 2654 if (nIndex == -1) 2654 return -1;2655 return -1; 2655 2656 2656 2657 return infoPtr->buttons[nIndex].fsState; … … 2666 2667 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2667 2668 if (nIndex == -1) 2668 return -1;2669 return -1; 2669 2670 2670 2671 return infoPtr->buttons[nIndex].fsStyle; … … 2678 2679 2679 2680 if (infoPtr == NULL) 2680 return 0;2681 return 0; 2681 2682 2682 2683 return infoPtr->nMaxTextRows; … … 2690 2691 2691 2692 if (infoPtr == NULL) 2692 return 0;2693 return 0; 2693 2694 return infoPtr->hwndToolTip; 2694 2695 } … … 2700 2701 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 2701 2702 2702 TRACE("%s hwnd=0x%x stub!\n", 2703 infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd);2703 TRACE("%s hwnd=0x%x stub!\n", 2704 infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd); 2704 2705 2705 2706 return infoPtr->bUnicode; … … 2726 2727 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2727 2728 if (nIndex == -1) 2728 return FALSE;2729 return FALSE; 2729 2730 2730 2731 btnPtr = &infoPtr->buttons[nIndex]; 2731 2732 if (LOWORD(lParam) == FALSE) 2732 btnPtr->fsState &= ~TBSTATE_HIDDEN;2733 btnPtr->fsState &= ~TBSTATE_HIDDEN; 2733 2734 else 2734 btnPtr->fsState |= TBSTATE_HIDDEN;2735 btnPtr->fsState |= TBSTATE_HIDDEN; 2735 2736 2736 2737 TOOLBAR_CalcToolbar (hwnd); … … 2758 2759 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2759 2760 if (nIndex == -1) 2760 return FALSE;2761 return FALSE; 2761 2762 2762 2763 btnPtr = &infoPtr->buttons[nIndex]; 2763 2764 if (LOWORD(lParam) == FALSE) 2764 btnPtr->fsState &= ~TBSTATE_INDETERMINATE;2765 btnPtr->fsState &= ~TBSTATE_INDETERMINATE; 2765 2766 else 2766 btnPtr->fsState |= TBSTATE_INDETERMINATE;2767 btnPtr->fsState |= TBSTATE_INDETERMINATE; 2767 2768 2768 2769 InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr)); … … 2781 2782 2782 2783 if (lpTbb == NULL) 2783 return FALSE;2784 return FALSE; 2784 2785 2785 2786 if (nIndex == -1) { 2786 2787 /* EPP: this seems to be an undocumented call (from my IE4) 2787 * I assume in that case that:2788 * - lpTbb->iString is a string pointer (not a string index in strings[] table2789 * - index of insertion is at the end of existing buttons2790 * I only see this happen with nIndex == -1, but it could have a special2791 * meaning (like -nIndex (or ~nIndex) to get the real position of insertion).2792 */2793 int len;2794 LPSTR ptr;2788 * I assume in that case that: 2789 * - lpTbb->iString is a string pointer (not a string index in strings[] table 2790 * - index of insertion is at the end of existing buttons 2791 * I only see this happen with nIndex == -1, but it could have a special 2792 * meaning (like -nIndex (or ~nIndex) to get the real position of insertion). 2793 */ 2794 int len; 2795 LPSTR ptr; 2795 2796 2796 2797 /* FIXME: iString == -1 is undocumented */ … … 2814 2815 TRACE("inserting button index=%d\n", nIndex); 2815 2816 if (nIndex > infoPtr->nNumButtons) { 2816 nIndex = infoPtr->nNumButtons;2817 TRACE("adjust index=%d\n", nIndex);2817 nIndex = infoPtr->nNumButtons; 2818 TRACE("adjust index=%d\n", nIndex); 2818 2819 } 2819 2820 … … 2823 2824 /* pre insert copy */ 2824 2825 if (nIndex > 0) { 2825 memcpy (&infoPtr->buttons[0], &oldButtons[0],2826 nIndex * sizeof(TBUTTON_INFO));2826 memcpy (&infoPtr->buttons[0], &oldButtons[0], 2827 nIndex * sizeof(TBUTTON_INFO)); 2827 2828 } 2828 2829 … … 2836 2837 2837 2838 if ((infoPtr->hwndToolTip) && !(lpTbb->fsStyle & TBSTYLE_SEP)) { 2838 TTTOOLINFOA ti;2839 2840 ZeroMemory (&ti, sizeof(TTTOOLINFOA));2841 ti.cbSize = sizeof (TTTOOLINFOA);2842 ti.hwnd = hwnd;2843 ti.uId = lpTbb->idCommand;2844 ti.hinst = 0;2845 ti.lpszText = LPSTR_TEXTCALLBACKA;2846 2847 SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA,2848 0, (LPARAM)&ti);2839 TTTOOLINFOA ti; 2840 2841 ZeroMemory (&ti, sizeof(TTTOOLINFOA)); 2842 ti.cbSize = sizeof (TTTOOLINFOA); 2843 ti.hwnd = hwnd; 2844 ti.uId = lpTbb->idCommand; 2845 ti.hinst = 0; 2846 ti.lpszText = LPSTR_TEXTCALLBACKA; 2847 2848 SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA, 2849 0, (LPARAM)&ti); 2849 2850 } 2850 2851 2851 2852 /* post insert copy */ 2852 2853 if (nIndex < infoPtr->nNumButtons - 1) { 2853 memcpy (&infoPtr->buttons[nIndex+1], &oldButtons[nIndex],2854 (infoPtr->nNumButtons - nIndex - 1) * sizeof(TBUTTON_INFO));2854 memcpy (&infoPtr->buttons[nIndex+1], &oldButtons[nIndex], 2855 (infoPtr->nNumButtons - nIndex - 1) * sizeof(TBUTTON_INFO)); 2855 2856 } 2856 2857 … … 2874 2875 2875 2876 if (lpTbb == NULL) 2876 return FALSE;2877 return FALSE; 2877 2878 if (nIndex < 0) 2878 return FALSE;2879 return FALSE; 2879 2880 2880 2881 TRACE("inserting button index=%d\n", nIndex); 2881 2882 if (nIndex > infoPtr->nNumButtons) { 2882 nIndex = infoPtr->nNumButtons;2883 TRACE("adjust index=%d\n", nIndex);2883 nIndex = infoPtr->nNumButtons; 2884 TRACE("adjust index=%d\n", nIndex); 2884 2885 } 2885 2886 … … 2889 2890 /* pre insert copy */ 2890 2891 if (nIndex > 0) { 2891 memcpy (&infoPtr->buttons[0], &oldButtons[0],2892 nIndex * sizeof(TBUTTON_INFO));2892 memcpy (&infoPtr->buttons[0], &oldButtons[0], 2893 nIndex * sizeof(TBUTTON_INFO)); 2893 2894 } 2894 2895 … … 2902 2903 2903 2904 if ((infoPtr->hwndToolTip) && !(lpTbb->fsStyle & TBSTYLE_SEP)) { 2904 TTTOOLINFOW ti;2905 2906 ZeroMemory (&ti, sizeof(TTTOOLINFOW));2907 ti.cbSize = sizeof (TTTOOLINFOW);2908 ti.hwnd = hwnd;2909 ti.uId = lpTbb->idCommand;2910 ti.hinst = 0;2911 ti.lpszText = LPSTR_TEXTCALLBACKW;2912 2913 SendMessageW (infoPtr->hwndToolTip, TTM_ADDTOOLW,2914 0, (LPARAM)&ti);2905 TTTOOLINFOW ti; 2906 2907 ZeroMemory (&ti, sizeof(TTTOOLINFOW)); 2908 ti.cbSize = sizeof (TTTOOLINFOW); 2909 ti.hwnd = hwnd; 2910 ti.uId = lpTbb->idCommand; 2911 ti.hinst = 0; 2912 ti.lpszText = LPSTR_TEXTCALLBACKW; 2913 2914 SendMessageW (infoPtr->hwndToolTip, TTM_ADDTOOLW, 2915 0, (LPARAM)&ti); 2915 2916 } 2916 2917 2917 2918 /* post insert copy */ 2918 2919 if (nIndex < infoPtr->nNumButtons - 1) { 2919 memcpy (&infoPtr->buttons[nIndex+1], &oldButtons[nIndex],2920 (infoPtr->nNumButtons - nIndex - 1) * sizeof(TBUTTON_INFO));2920 memcpy (&infoPtr->buttons[nIndex+1], &oldButtons[nIndex], 2921 (infoPtr->nNumButtons - nIndex - 1) * sizeof(TBUTTON_INFO)); 2921 2922 } 2922 2923 … … 2940 2941 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2941 2942 if (nIndex == -1) 2942 return FALSE;2943 return FALSE; 2943 2944 2944 2945 return (infoPtr->buttons[nIndex].fsState & TBSTATE_CHECKED); … … 2954 2955 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2955 2956 if (nIndex == -1) 2956 return FALSE;2957 return FALSE; 2957 2958 2958 2959 return (infoPtr->buttons[nIndex].fsState & TBSTATE_ENABLED); … … 2968 2969 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2969 2970 if (nIndex == -1) 2970 return TRUE;2971 return TRUE; 2971 2972 2972 2973 return (infoPtr->buttons[nIndex].fsState & TBSTATE_HIDDEN); … … 2982 2983 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2983 2984 if (nIndex == -1) 2984 return FALSE;2985 return FALSE; 2985 2986 2986 2987 return (infoPtr->buttons[nIndex].fsState & TBSTATE_MARKED); … … 2996 2997 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2997 2998 if (nIndex == -1) 2998 return FALSE;2999 return FALSE; 2999 3000 3000 3001 return (infoPtr->buttons[nIndex].fsState & TBSTATE_INDETERMINATE); … … 3010 3011 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 3011 3012 if (nIndex == -1) 3012 return FALSE;3013 return FALSE; 3013 3014 3014 3015 return (infoPtr->buttons[nIndex].fsState & TBSTATE_PRESSED); … … 3031 3032 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 3032 3033 if (nIndex == -1) 3033 return FALSE;3034 return FALSE; 3034 3035 3035 3036 btnPtr = &infoPtr->buttons[nIndex]; 3036 3037 if (LOWORD(lParam) == FALSE) 3037 btnPtr->fsState &= ~TBSTATE_PRESSED;3038 btnPtr->fsState &= ~TBSTATE_PRESSED; 3038 3039 else 3039 btnPtr->fsState |= TBSTATE_PRESSED;3040 btnPtr->fsState |= TBSTATE_PRESSED; 3040 3041 3041 3042 InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr)); … … 3058 3059 3059 3060 if ((BOOL)wParam) { 3060 /* save toolbar information */3061 FIXME("save to \"%s\" \"%s\"\n",3062 lpSave->pszSubKey, lpSave->pszValueName);3061 /* save toolbar information */ 3062 FIXME("save to \"%s\" \"%s\"\n", 3063 lpSave->pszSubKey, lpSave->pszValueName); 3063 3064 3064 3065 3065 3066 } 3066 3067 else { 3067 /* restore toolbar information */3068 3069 FIXME("restore from \"%s\" \"%s\"\n",3070 lpSave->pszSubKey, lpSave->pszValueName);3068 /* restore toolbar information */ 3069 3070 FIXME("restore from \"%s\" \"%s\"\n", 3071 lpSave->pszSubKey, lpSave->pszValueName); 3071 3072 3072 3073 … … 3086 3087 3087 3088 if (lpSave == NULL) 3088 return 0;3089 return 0; 3089 3090 3090 3091 if ((BOOL)wParam) { 3091 /* save toolbar information */3092 FIXME("save to \"%s\" \"%s\"\n",3093 lpSave->pszSubKey, lpSave->pszValueName);3092 /* save toolbar information */ 3093 FIXME("save to \"%s\" \"%s\"\n", 3094 lpSave->pszSubKey, lpSave->pszValueName); 3094 3095 3095 3096 3096 3097 } 3097 3098 else { 3098 /* restore toolbar information */3099 3100 FIXME("restore from \"%s\" \"%s\"\n",3101 lpSave->pszSubKey, lpSave->pszValueName);3099 /* restore toolbar information */ 3100 3101 FIXME("restore from \"%s\" \"%s\"\n", 3102 lpSave->pszSubKey, lpSave->pszValueName); 3102 3103 3103 3104 … … 3127 3128 3128 3129 if ((LOWORD(lParam) <= 0) || (HIWORD(lParam)<=0)) 3129 return FALSE;3130 return FALSE; 3130 3131 3131 3132 if (infoPtr->nNumButtons > 0) … … 3157 3158 3158 3159 if (lptbbi == NULL) 3159 return FALSE;3160 return FALSE; 3160 3161 if (lptbbi->cbSize < sizeof(TBBUTTONINFOA)) 3161 return FALSE;3162 3162 return FALSE; 3163 3163 3164 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 3164 3165 if (nIndex == -1) 3165 return FALSE;3166 return FALSE; 3166 3167 3167 3168 btnPtr = &infoPtr->buttons[nIndex]; 3168 3169 if (lptbbi->dwMask & TBIF_COMMAND) 3169 btnPtr->idCommand = lptbbi->idCommand;3170 btnPtr->idCommand = lptbbi->idCommand; 3170 3171 if (lptbbi->dwMask & TBIF_IMAGE) 3171 btnPtr->iBitmap = lptbbi->iImage;3172 btnPtr->iBitmap = lptbbi->iImage; 3172 3173 if (lptbbi->dwMask & TBIF_LPARAM) 3173 btnPtr->dwData = lptbbi->lParam;3174 btnPtr->dwData = lptbbi->lParam; 3174 3175 /* if (lptbbi->dwMask & TBIF_SIZE) */ 3175 /* btnPtr->cx = lptbbi->cx; */3176 /* btnPtr->cx = lptbbi->cx; */ 3176 3177 if (lptbbi->dwMask & TBIF_STATE) 3177 btnPtr->fsState = lptbbi->fsState;3178 btnPtr->fsState = lptbbi->fsState; 3178 3179 if (lptbbi->dwMask & TBIF_STYLE) 3179 btnPtr->fsStyle = lptbbi->fsStyle;3180 btnPtr->fsStyle = lptbbi->fsStyle; 3180 3181 3181 3182 if (lptbbi->dwMask & TBIF_TEXT) { 3182 if ((btnPtr->iString >= 0) || 3183 (btnPtr->iString < infoPtr->nNumStrings)) {3184 TRACE("Ooooooch\n");3183 if ((btnPtr->iString >= 0) || 3184 (btnPtr->iString < infoPtr->nNumStrings)) { 3185 TRACE("Ooooooch\n"); 3185 3186 #if 0 3186 WCHAR **lpString = &infoPtr->strings[btnPtr->iString];3187 INT len = lstrlenA (lptbbi->pszText);3188 *lpString = COMCTL32_ReAlloc (lpString, sizeof(WCHAR)*(len+1));3187 WCHAR **lpString = &infoPtr->strings[btnPtr->iString]; 3188 INT len = lstrlenA (lptbbi->pszText); 3189 *lpString = COMCTL32_ReAlloc (lpString, sizeof(WCHAR)*(len+1)); 3189 3190 #endif 3190 3191 3191 /* this is the ultimate sollution */3192 /* Str_SetPtrA (&infoPtr->strings[btnPtr->iString], lptbbi->pszText); */3193 }3192 /* this is the ultimate sollution */ 3193 /* Str_SetPtrA (&infoPtr->strings[btnPtr->iString], lptbbi->pszText); */ 3194 } 3194 3195 } 3195 3196 … … 3207 3208 3208 3209 if (lptbbi == NULL) 3209 return FALSE;3210 return FALSE; 3210 3211 if (lptbbi->cbSize < sizeof(TBBUTTONINFOW)) 3211 return FALSE;3212 return FALSE; 3212 3213 3213 3214 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 3214 3215 if (nIndex == -1) 3215 return FALSE;3216 return FALSE; 3216 3217 3217 3218 btnPtr = &infoPtr->buttons[nIndex]; 3218 3219 if (lptbbi->dwMask & TBIF_COMMAND) 3219 btnPtr->idCommand = lptbbi->idCommand;3220 btnPtr->idCommand = lptbbi->idCommand; 3220 3221 if (lptbbi->dwMask & TBIF_IMAGE) 3221 btnPtr->iBitmap = lptbbi->iImage;3222 btnPtr->iBitmap = lptbbi->iImage; 3222 3223 if (lptbbi->dwMask & TBIF_LPARAM) 3223 btnPtr->dwData = lptbbi->lParam;3224 btnPtr->dwData = lptbbi->lParam; 3224 3225 /* if (lptbbi->dwMask & TBIF_SIZE) */ 3225 /* btnPtr->cx = lptbbi->cx; */3226 /* btnPtr->cx = lptbbi->cx; */ 3226 3227 if (lptbbi->dwMask & TBIF_STATE) 3227 btnPtr->fsState = lptbbi->fsState;3228 btnPtr->fsState = lptbbi->fsState; 3228 3229 if (lptbbi->dwMask & TBIF_STYLE) 3229 btnPtr->fsStyle = lptbbi->fsStyle;3230 btnPtr->fsStyle = lptbbi->fsStyle; 3230 3231 3231 3232 if (lptbbi->dwMask & TBIF_TEXT) { 3232 if ((btnPtr->iString >= 0) ||3233 (btnPtr->iString < infoPtr->nNumStrings)) {3233 if ((btnPtr->iString >= 0) || 3234 (btnPtr->iString < infoPtr->nNumStrings)) { 3234 3235 #if 0 3235 WCHAR **lpString = &infoPtr->strings[btnPtr->iString];3236 INT len = lstrlenW (lptbbi->pszText);3237 *lpString = COMCTL32_ReAlloc (lpString, sizeof(WCHAR)*(len+1));3236 WCHAR **lpString = &infoPtr->strings[btnPtr->iString]; 3237 INT len = lstrlenW (lptbbi->pszText); 3238 *lpString = COMCTL32_ReAlloc (lpString, sizeof(WCHAR)*(len+1)); 3238 3239 #endif 3239 3240 3240 /* this is the ultimate solution */3241 /* Str_SetPtrA (&infoPtr->strings[btnPtr->iString], lptbbi->pszText); */3242 }3241 /* this is the ultimate solution */ 3242 /* Str_SetPtrA (&infoPtr->strings[btnPtr->iString], lptbbi->pszText); */ 3243 } 3243 3244 } 3244 3245 … … 3255 3256 { 3256 3257 ERR("invalid parameter\n"); 3257 return FALSE;3258 return FALSE; 3258 3259 } 3259 3260 3260 3261 /* The documentation claims you can only change the button size before 3261 * any button has been added. But this is wrong. 3262 * WINZIP32.EXE (ver 8) calls this on one of its buttons after adding 3262 * any button has been added. But this is wrong. 3263 * WINZIP32.EXE (ver 8) calls this on one of its buttons after adding 3263 3264 * it to the toolbar, and it checks that the return value is nonzero - mjm 3264 3265 * Further testing shows that we must actually perform the change too. … … 3276 3277 3277 3278 if (infoPtr == NULL) { 3278 TRACE("Toolbar not initialized yet?????\n");3279 return FALSE;3279 TRACE("Toolbar not initialized yet?????\n"); 3280 return FALSE; 3280 3281 } 3281 3282 3282 3283 /* if setting to current values, ignore */ 3283 3284 if ((infoPtr->cxMin == (INT)LOWORD(lParam)) && 3284 (infoPtr->cxMax == (INT)HIWORD(lParam))) {3285 TRACE("matches current width, min=%d, max=%d, no recalc\n",3286 infoPtr->cxMin, infoPtr->cxMax);3287 return TRUE; 3285 (infoPtr->cxMax == (INT)HIWORD(lParam))) { 3286 TRACE("matches current width, min=%d, max=%d, no recalc\n", 3287 infoPtr->cxMin, infoPtr->cxMax); 3288 return TRUE; 3288 3289 } 3289 3290 … … 3294 3295 /* if both values are 0 then we are done */ 3295 3296 if (lParam == 0) { 3296 TRACE("setting both min and max to 0, norecalc\n"); 3297 return TRUE;3297 TRACE("setting both min and max to 0, norecalc\n"); 3298 return TRUE; 3298 3299 } 3299 3300 … … 3301 3302 recalc the bounding rectangle (does DrawText w/ DT_CALCRECT 3302 3303 which doesn't actually draw - GA). */ 3303 TRACE("number of buttons %d, cx=%d, cy=%d, recalcing\n", 3304 infoPtr->nNumButtons, infoPtr->cxMin, infoPtr->cxMax);3304 TRACE("number of buttons %d, cx=%d, cy=%d, recalcing\n", 3305 infoPtr->nNumButtons, infoPtr->cxMin, infoPtr->cxMax); 3305 3306 3306 3307 TOOLBAR_CalcToolbar (hwnd); … … 3319 3320 3320 3321 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) 3321 return FALSE;3322 return FALSE; 3322 3323 3323 3324 infoPtr->buttons[nIndex].idCommand = (INT)lParam; … … 3325 3326 if (infoPtr->hwndToolTip) { 3326 3327 3327 FIXME("change tool tip!\n");3328 FIXME("change tool tip!\n"); 3328 3329 3329 3330 } … … 3348 3349 /* FIXME: redraw ? */ 3349 3350 3350 return (LRESULT)himlTemp; 3351 return (LRESULT)himlTemp; 3351 3352 } 3352 3353 … … 3360 3361 dwTemp = infoPtr->dwDTFlags; 3361 3362 infoPtr->dwDTFlags = 3362 (infoPtr->dwDTFlags & (DWORD)wParam) | (DWORD)lParam;3363 (infoPtr->dwDTFlags & (DWORD)wParam) | (DWORD)lParam; 3363 3364 3364 3365 return (LRESULT)dwTemp; … … 3375 3376 infoPtr->dwExStyle = (DWORD)lParam; 3376 3377 3377 return (LRESULT)dwTemp; 3378 return (LRESULT)dwTemp; 3378 3379 } 3379 3380 … … 3390 3391 /* FIXME: redraw ? */ 3391 3392 3392 return (LRESULT)himlTemp; 3393 return (LRESULT)himlTemp; 3393 3394 } 3394 3395 … … 3407 3408 { 3408 3409 3409 infoPtr->nHotItem = (INT)wParam;3410 infoPtr->nHotItem = (INT)wParam; 3410 3411 if ((INT)wParam >=0) 3411 3412 { 3412 3413 btnPtr = &infoPtr->buttons[(INT)wParam]; 3413 3414 btnPtr->bHot = TRUE; 3414 InvalidateRect (hwnd, &btnPtr->rect,3415 InvalidateRect (hwnd, &btnPtr->rect, 3415 3416 TOOLBAR_HasText(infoPtr, btnPtr)); 3416 3417 } … … 3419 3420 btnPtr = &infoPtr->buttons[nOldHotItem]; 3420 3421 btnPtr->bHot = FALSE; 3421 InvalidateRect (hwnd, &btnPtr->rect,3422 InvalidateRect (hwnd, &btnPtr->rect, 3422 3423 TOOLBAR_HasText(infoPtr, btnPtr)); 3423 3424 } … … 3425 3426 3426 3427 if (nOldHotItem < 0) 3427 return -1;3428 return -1; 3428 3429 3429 3430 return (LRESULT)nOldHotItem; … … 3443 3444 /* FIXME: redraw ? */ 3444 3445 3445 return (LRESULT)himlTemp; 3446 return (LRESULT)himlTemp; 3446 3447 } 3447 3448 … … 3490 3491 3491 3492 if (infoPtr == NULL) 3492 return FALSE;3493 return FALSE; 3493 3494 3494 3495 infoPtr->nMaxTextRows = (INT)wParam; … … 3510 3511 3511 3512 if (infoPtr == NULL) 3512 return 0;3513 return 0; 3513 3514 hwndOldNotify = infoPtr->hwndNotify; 3514 3515 infoPtr->hwndNotify = (HWND)wParam; … … 3527 3528 3528 3529 if (LOWORD(wParam) > 1) { 3529 FIXME("multiple rows not supported!\n");3530 FIXME("multiple rows not supported!\n"); 3530 3531 } 3531 3532 … … 3543 3544 /* return bounding rectangle */ 3544 3545 if (lprc) { 3545 lprc->left = infoPtr->rcBound.left;3546 lprc->right = infoPtr->rcBound.right;3547 lprc->top = infoPtr->rcBound.top;3548 lprc->bottom = infoPtr->rcBound.bottom;3546 lprc->left = infoPtr->rcBound.left; 3547 lprc->right = infoPtr->rcBound.right; 3548 lprc->top = infoPtr->rcBound.top; 3549 lprc->bottom = infoPtr->rcBound.bottom; 3549 3550 } 3550 3551 … … 3562 3563 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 3563 3564 if (nIndex == -1) 3564 return FALSE;3565 return FALSE; 3565 3566 3566 3567 btnPtr = &infoPtr->buttons[nIndex]; … … 3587 3588 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 3588 3589 if (nIndex == -1) 3589 return FALSE;3590 return FALSE; 3590 3591 3591 3592 btnPtr = &infoPtr->buttons[nIndex]; … … 3599 3600 3600 3601 if (infoPtr->hwndToolTip) { 3601 FIXME("change tool tip!\n");3602 FIXME("change tool tip!\n"); 3602 3603 } 3603 3604 } … … 3613 3614 3614 3615 if (infoPtr == NULL) 3615 return 0;3616 return 0; 3616 3617 infoPtr->hwndToolTip = (HWND)wParam; 3617 3618 return 0; … … 3625 3626 BOOL bTemp; 3626 3627 3627 TRACE("%s hwnd=0x%04x stub!\n", 3628 ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd);3628 TRACE("%s hwnd=0x%04x stub!\n", 3629 ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd); 3629 3630 3630 3631 bTemp = infoPtr->bUnicode; … … 3683 3684 3684 3685 if (dwStyle & TBSTYLE_TOOLTIPS) { 3685 /* Create tooltip control */3686 infoPtr->hwndToolTip =3687 CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0,3688 CW_USEDEFAULT, CW_USEDEFAULT,3689 CW_USEDEFAULT, CW_USEDEFAULT,3690 hwnd, 0, 0, 0);3691 3692 /* Send NM_TOOLTIPSCREATED notification */3693 if (infoPtr->hwndToolTip) {3694 NMTOOLTIPSCREATED nmttc;3695 3696 nmttc.hdr.hwndFrom = hwnd;3697 nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);3698 nmttc.hdr.code = NM_TOOLTIPSCREATED;3699 nmttc.hwndToolTips = infoPtr->hwndToolTip;3700 3701 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,3702 (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc);3703 }3686 /* Create tooltip control */ 3687 infoPtr->hwndToolTip = 3688 CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0, 3689 CW_USEDEFAULT, CW_USEDEFAULT, 3690 CW_USEDEFAULT, CW_USEDEFAULT, 3691 hwnd, 0, 0, 0); 3692 3693 /* Send NM_TOOLTIPSCREATED notification */ 3694 if (infoPtr->hwndToolTip) { 3695 NMTOOLTIPSCREATED nmttc; 3696 3697 nmttc.hdr.hwndFrom = hwnd; 3698 nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 3699 nmttc.hdr.code = NM_TOOLTIPSCREATED; 3700 nmttc.hwndToolTips = infoPtr->hwndToolTip; 3701 3702 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 3703 (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc); 3704 } 3704 3705 } 3705 3706 … … 3717 3718 /* delete tooltip control */ 3718 3719 if (infoPtr->hwndToolTip) 3719 DestroyWindow (infoPtr->hwndToolTip);3720 DestroyWindow (infoPtr->hwndToolTip); 3720 3721 3721 3722 /* delete button data */ 3722 3723 if (infoPtr->buttons) 3723 COMCTL32_Free (infoPtr->buttons);3724 COMCTL32_Free (infoPtr->buttons); 3724 3725 3725 3726 /* delete strings */ 3726 3727 if (infoPtr->strings) { 3727 INT i;3728 for (i = 0; i < infoPtr->nNumStrings; i++)3729 if (infoPtr->strings[i])3730 COMCTL32_Free (infoPtr->strings[i]);3731 3732 COMCTL32_Free (infoPtr->strings);3728 INT i; 3729 for (i = 0; i < infoPtr->nNumStrings; i++) 3730 if (infoPtr->strings[i]) 3731 COMCTL32_Free (infoPtr->strings[i]); 3732 3733 COMCTL32_Free (infoPtr->strings); 3733 3734 } 3734 3735 3735 3736 /* destroy internal image list */ 3736 3737 if (infoPtr->himlInt) 3737 ImageList_Destroy (infoPtr->himlInt);3738 ImageList_Destroy (infoPtr->himlInt); 3738 3739 3739 3740 /* delete default font */ 3740 3741 if (infoPtr->hFont) 3741 DeleteObject (infoPtr->hFont);3742 DeleteObject (infoPtr->hFont); 3742 3743 3743 3744 /* free toolbar info data */ … … 3755 3756 3756 3757 if (infoPtr->bTransparent) 3757 return SendMessageA (GetParent (hwnd), WM_ERASEBKGND, wParam, lParam);3758 return SendMessageA (GetParent (hwnd), WM_ERASEBKGND, wParam, lParam); 3758 3759 3759 3760 return DefWindowProcA (hwnd, WM_ERASEBKGND, wParam, lParam); … … 3783 3784 3784 3785 if (nHit >= 0) { 3785 btnPtr = &infoPtr->buttons[nHit];3786 if (!(btnPtr->fsState & TBSTATE_ENABLED))3787 return 0;3788 SetCapture (hwnd);3789 infoPtr->bCaptured = TRUE;3790 infoPtr->nButtonDown = nHit;3791 3792 btnPtr->fsState |= TBSTATE_PRESSED;3786 btnPtr = &infoPtr->buttons[nHit]; 3787 if (!(btnPtr->fsState & TBSTATE_ENABLED)) 3788 return 0; 3789 SetCapture (hwnd); 3790 infoPtr->bCaptured = TRUE; 3791 infoPtr->nButtonDown = nHit; 3792 3793 btnPtr->fsState |= TBSTATE_PRESSED; 3793 3794 3794 3795 InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, … … 3796 3797 } 3797 3798 else if (GetWindowLongA (hwnd, GWL_STYLE) & CCS_ADJUSTABLE) 3798 TOOLBAR_Customize (hwnd);3799 TOOLBAR_Customize (hwnd); 3799 3800 3800 3801 return 0; … … 3811 3812 3812 3813 if (infoPtr->hwndToolTip) 3813 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,3814 WM_LBUTTONDOWN, wParam, lParam);3814 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd, 3815 WM_LBUTTONDOWN, wParam, lParam); 3815 3816 3816 3817 pt.x = (INT)LOWORD(lParam); … … 3819 3820 3820 3821 if (nHit >= 0) { 3821 RECT arrowRect;3822 btnPtr = &infoPtr->buttons[nHit];3823 if (!(btnPtr->fsState & TBSTATE_ENABLED))3824 return 0;3825 3826 infoPtr->nOldHit = nHit;3827 3828 CopyRect(&arrowRect, &btnPtr->rect);3829 arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH);3830 3831 /* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */3832 if ((btnPtr->fsStyle & TBSTYLE_DROPDOWN) &&3833 ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) ||3834 (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle))))3835 {3836 NMTOOLBARA nmtb;3837 /*3838 * this time we must force a Redraw, so the btn is3839 * painted down before CaptureChanged repaints it up3840 */3841 RedrawWindow(hwnd,&btnPtr->rect,0,3842 RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);3843 3844 nmtb.hdr.hwndFrom = hwnd;3845 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);3846 nmtb.hdr.code = TBN_DROPDOWN;3847 nmtb.iItem = btnPtr->idCommand;3848 3849 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,3850 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb);3851 }3852 else3853 {3854 SetCapture (hwnd);3855 infoPtr->bCaptured = TRUE;3856 infoPtr->nButtonDown = nHit;3857 3858 btnPtr->fsState |= TBSTATE_PRESSED;3859 btnPtr->bHot = FALSE;3860 3861 InvalidateRect(hwnd, &btnPtr->rect,3862 TOOLBAR_HasText(infoPtr, btnPtr));3863 }3822 RECT arrowRect; 3823 btnPtr = &infoPtr->buttons[nHit]; 3824 if (!(btnPtr->fsState & TBSTATE_ENABLED)) 3825 return 0; 3826 3827 infoPtr->nOldHit = nHit; 3828 3829 CopyRect(&arrowRect, &btnPtr->rect); 3830 arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH); 3831 3832 /* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */ 3833 if ((btnPtr->fsStyle & TBSTYLE_DROPDOWN) && 3834 ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) || 3835 (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle)))) 3836 { 3837 NMTOOLBARA nmtb; 3838 /* 3839 * this time we must force a Redraw, so the btn is 3840 * painted down before CaptureChanged repaints it up 3841 */ 3842 RedrawWindow(hwnd,&btnPtr->rect,0, 3843 RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); 3844 3845 nmtb.hdr.hwndFrom = hwnd; 3846 nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 3847 nmtb.hdr.code = TBN_DROPDOWN; 3848 nmtb.iItem = btnPtr->idCommand; 3849 3850 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 3851 (WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb); 3852 } 3853 else 3854 { 3855 SetCapture (hwnd); 3856 infoPtr->bCaptured = TRUE; 3857 infoPtr->nButtonDown = nHit; 3858 3859 btnPtr->fsState |= TBSTATE_PRESSED; 3860 btnPtr->bHot = FALSE; 3861 3862 InvalidateRect(hwnd, &btnPtr->rect, 3863 TOOLBAR_HasText(infoPtr, btnPtr)); 3864 } 3864 3865 } 3865 3866 … … 3878 3879 3879 3880 if (infoPtr->hwndToolTip) 3880 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,3881 WM_LBUTTONUP, wParam, lParam);3881 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd, 3882 WM_LBUTTONUP, wParam, lParam); 3882 3883 3883 3884 pt.x = (INT)LOWORD(lParam); … … 3891 3892 3892 3893 if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0)) { 3893 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];3894 btnPtr->fsState &= ~TBSTATE_PRESSED;3895 3896 if (nHit == infoPtr->nButtonDown) {3897 if (btnPtr->fsStyle & TBSTYLE_CHECK) {3898 if (btnPtr->fsStyle & TBSTYLE_GROUP) {3899 nOldIndex = TOOLBAR_GetCheckedGroupButtonIndex (infoPtr,3900 infoPtr->nButtonDown);3901 if (nOldIndex == infoPtr->nButtonDown)3902 bSendMessage = FALSE;3903 if ((nOldIndex != infoPtr->nButtonDown) && 3904 (nOldIndex != -1))3905 infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED;3906 btnPtr->fsState |= TBSTATE_CHECKED;3907 }3908 else {3909 if (btnPtr->fsState & TBSTATE_CHECKED)3910 btnPtr->fsState &= ~TBSTATE_CHECKED;3911 else3912 btnPtr->fsState |= TBSTATE_CHECKED;3913 }3914 }3915 }3916 else3917 bSendMessage = FALSE;3918 3919 if (nOldIndex != -1)3894 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; 3895 btnPtr->fsState &= ~TBSTATE_PRESSED; 3896 3897 if (nHit == infoPtr->nButtonDown) { 3898 if (btnPtr->fsStyle & TBSTYLE_CHECK) { 3899 if (btnPtr->fsStyle & TBSTYLE_GROUP) { 3900 nOldIndex = TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, 3901 infoPtr->nButtonDown); 3902 if (nOldIndex == infoPtr->nButtonDown) 3903 bSendMessage = FALSE; 3904 if ((nOldIndex != infoPtr->nButtonDown) && 3905 (nOldIndex != -1)) 3906 infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED; 3907 btnPtr->fsState |= TBSTATE_CHECKED; 3908 } 3909 else { 3910 if (btnPtr->fsState & TBSTATE_CHECKED) 3911 btnPtr->fsState &= ~TBSTATE_CHECKED; 3912 else 3913 btnPtr->fsState |= TBSTATE_CHECKED; 3914 } 3915 } 3916 } 3917 else 3918 bSendMessage = FALSE; 3919 3920 if (nOldIndex != -1) 3920 3921 { 3921 3922 InvalidateRect(hwnd, &infoPtr->buttons[nOldIndex].rect, … … 3923 3924 } 3924 3925 3925 /*3926 * now we can ReleaseCapture, which triggers CAPTURECHANGED msg,3927 * that resets bCaptured and btn TBSTATE_PRESSED flags,3928 * and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged) 3929 */3930 ReleaseCapture ();3931 3932 if (bSendMessage)3933 SendMessageA (GetParent(hwnd), WM_COMMAND,3934 MAKEWPARAM(btnPtr->idCommand, 0), (LPARAM)hwnd);3926 /* 3927 * now we can ReleaseCapture, which triggers CAPTURECHANGED msg, 3928 * that resets bCaptured and btn TBSTATE_PRESSED flags, 3929 * and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged) 3930 */ 3931 ReleaseCapture (); 3932 3933 if (bSendMessage) 3934 SendMessageA (GetParent(hwnd), WM_COMMAND, 3935 MAKEWPARAM(btnPtr->idCommand, 0), (LPARAM)hwnd); 3935 3936 } 3936 3937 … … 3949 3950 { 3950 3951 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; 3951 btnPtr->fsState &= ~TBSTATE_PRESSED;3952 btnPtr->fsState &= ~TBSTATE_PRESSED; 3952 3953 3953 3954 infoPtr->nButtonDown = -1; … … 3975 3976 if((infoPtr->nOldHit == infoPtr->nHotItem) && (hotBtnPtr->fsState & TBSTATE_ENABLED)) 3976 3977 { 3977 hotBtnPtr->bHot = FALSE;3978 hotBtnPtr->bHot = FALSE; 3978 3979 3979 3980 InvalidateRect (hwnd, &hotBtnPtr->rect, TOOLBAR_HasText(infoPtr, … … 4019 4020 if(!(trackinfo.dwFlags & TME_LEAVE)) { 4020 4021 trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */ 4021 4022 4022 4023 /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */ 4023 4024 /* and can properly deactivate the hot toolbar button */ … … 4026 4027 4027 4028 if (infoPtr->hwndToolTip) 4028 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,4029 WM_MOUSEMOVE, wParam, lParam);4029 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd, 4030 WM_MOUSEMOVE, wParam, lParam); 4030 4031 4031 4032 pt.x = (INT)LOWORD(lParam); … … 4036 4037 if (infoPtr->nOldHit != nHit) 4037 4038 { 4038 /* Remove the effect of an old hot button if the button was enabled and was4039 drawn with the hot button effect */4040 if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem && 4041 (infoPtr->buttons[infoPtr->nOldHit].fsState & TBSTATE_ENABLED))4042 {4043 oldBtnPtr = &infoPtr->buttons[infoPtr->nOldHit];4044 oldBtnPtr->bHot = FALSE;4045 4046 InvalidateRect (hwnd, &oldBtnPtr->rect,4039 /* Remove the effect of an old hot button if the button was enabled and was 4040 drawn with the hot button effect */ 4041 if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem && 4042 (infoPtr->buttons[infoPtr->nOldHit].fsState & TBSTATE_ENABLED)) 4043 { 4044 oldBtnPtr = &infoPtr->buttons[infoPtr->nOldHit]; 4045 oldBtnPtr->bHot = FALSE; 4046 4047 InvalidateRect (hwnd, &oldBtnPtr->rect, 4047 4048 TOOLBAR_HasText(infoPtr, oldBtnPtr)); 4048 }4049 4050 /* It's not a separator or in nowhere. It's a hot button. */4051 if (nHit >= 0)4052 {4053 btnPtr = &infoPtr->buttons[nHit];4054 btnPtr->bHot = TRUE;4055 4056 infoPtr->nHotItem = nHit;4057 4058 /* only enabled buttons show hot effect */ 4049 } 4050 4051 /* It's not a separator or in nowhere. It's a hot button. */ 4052 if (nHit >= 0) 4053 { 4054 btnPtr = &infoPtr->buttons[nHit]; 4055 btnPtr->bHot = TRUE; 4056 4057 infoPtr->nHotItem = nHit; 4058 4059 /* only enabled buttons show hot effect */ 4059 4060 if(infoPtr->buttons[nHit].fsState & TBSTATE_ENABLED) 4060 4061 { … … 4063 4064 } 4064 4065 4065 }4066 } 4066 4067 4067 4068 if (infoPtr->bCaptured) { 4068 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];4069 if (infoPtr->nOldHit == infoPtr->nButtonDown) {4070 btnPtr->fsState &= ~TBSTATE_PRESSED;4069 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; 4070 if (infoPtr->nOldHit == infoPtr->nButtonDown) { 4071 btnPtr->fsState &= ~TBSTATE_PRESSED; 4071 4072 InvalidateRect(hwnd, &btnPtr->rect, TRUE); 4072 }4073 else if (nHit == infoPtr->nButtonDown) {4074 btnPtr->fsState |= TBSTATE_PRESSED;4073 } 4074 else if (nHit == infoPtr->nButtonDown) { 4075 btnPtr->fsState |= TBSTATE_PRESSED; 4075 4076 InvalidateRect(hwnd, &btnPtr->rect, TRUE); 4076 }4077 }4078 infoPtr->nOldHit = nHit;4077 } 4078 } 4079 infoPtr->nOldHit = nHit; 4079 4080 } 4080 4081 return 0; … … 4086 4087 { 4087 4088 /* if (wndPtr->dwStyle & CCS_NODIVIDER) */ 4088 return DefWindowProcA (hwnd, WM_NCACTIVATE, wParam, lParam);4089 return DefWindowProcA (hwnd, WM_NCACTIVATE, wParam, lParam); 4089 4090 /* else */ 4090 /* return TOOLBAR_NCPaint (wndPtr, wParam, lParam); */4091 /* return TOOLBAR_NCPaint (wndPtr, wParam, lParam); */ 4091 4092 } 4092 4093 … … 4096 4097 { 4097 4098 if (!(GetWindowLongA (hwnd, GWL_STYLE) & CCS_NODIVIDER)) 4098 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE);4099 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE); 4099 4100 4100 4101 return DefWindowProcA (hwnd, WM_NCCALCSIZE, wParam, lParam); … … 4117 4118 if (!GetWindowLongA (hwnd, GWL_HINSTANCE)) { 4118 4119 HINSTANCE hInst = (HINSTANCE)GetWindowLongA (GetParent (hwnd), GWL_HINSTANCE); 4119 SetWindowLongA (hwnd, GWL_HINSTANCE, (DWORD)hInst);4120 SetWindowLongA (hwnd, GWL_HINSTANCE, (DWORD)hInst); 4120 4121 } 4121 4122 … … 4132 4133 4133 4134 if (dwStyle & WS_MINIMIZE) 4134 return 0; /* Nothing to do */4135 return 0; /* Nothing to do */ 4135 4136 4136 4137 DefWindowProcA (hwnd, WM_NCPAINT, wParam, lParam); 4137 4138 4138 4139 if (!(hdc = GetDCEx (hwnd, 0, DCX_USESTYLE | DCX_WINDOW))) 4139 return 0;4140 return 0; 4140 4141 4141 4142 if (!(dwStyle & CCS_NODIVIDER)) 4142 4143 { 4143 GetWindowRect (hwnd, &rcWindow);4144 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);4145 if( dwStyle & WS_BORDER )4146 OffsetRect (&rcWindow, 1, 1);4147 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_TOP);4144 GetWindowRect (hwnd, &rcWindow); 4145 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top); 4146 if( dwStyle & WS_BORDER ) 4147 OffsetRect (&rcWindow, 1, 1); 4148 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_TOP); 4148 4149 } 4149 4150 … … 4163 4164 4164 4165 if ((infoPtr->hwndToolTip) && (lpnmh->hwndFrom == infoPtr->hwndToolTip)) { 4165 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,wParam, lParam);4166 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, wParam, lParam); 4166 4167 4167 4168 #if 0 4168 if (lpnmh->code == TTN_GETDISPINFOA) {4169 LPNMTTDISPINFOA lpdi = (LPNMTTDISPINFOA)lParam;4170 4171 FIXME("retrieving ASCII string\n");4172 4173 }4174 else if (lpnmh->code == TTN_GETDISPINFOW) {4175 LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam;4176 4177 FIXME("retrieving UNICODE string\n");4178 4179 }4169 if (lpnmh->code == TTN_GETDISPINFOA) { 4170 LPNMTTDISPINFOA lpdi = (LPNMTTDISPINFOA)lParam; 4171 4172 FIXME("retrieving ASCII string\n"); 4173 4174 } 4175 else if (lpnmh->code == TTN_GETDISPINFOW) { 4176 LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam; 4177 4178 FIXME("retrieving UNICODE string\n"); 4179 4180 } 4180 4181 #endif 4181 4182 } … … 4193 4194 4194 4195 /* fill ps.rcPaint with a default rect */ 4195 memcpy(&(ps.rcPaint), &(infoPtr->rcBound), sizeof(infoPtr->rcBound)); 4196 memcpy(&(ps.rcPaint), &(infoPtr->rcBound), sizeof(infoPtr->rcBound)); 4196 4197 4197 4198 hdc = wParam==0 ? BeginPaint(hwnd, &ps) : (HDC)wParam; 4198 4199 4199 4200 TRACE("psrect=(%d,%d)-(%d,%d)\n", 4200 ps.rcPaint.left, ps.rcPaint.top,4201 ps.rcPaint.right, ps.rcPaint.bottom);4201 ps.rcPaint.left, ps.rcPaint.top, 4202 ps.rcPaint.right, ps.rcPaint.bottom); 4202 4203 4203 4204 TOOLBAR_Refresh (hwnd, hdc, &ps); … … 4223 4224 /* Resize deadlock check */ 4224 4225 if (infoPtr->bAutoSize) { 4225 infoPtr->bAutoSize = FALSE;4226 return 0;4226 infoPtr->bAutoSize = FALSE; 4227 return 0; 4227 4228 } 4228 4229 … … 4239 4240 4240 4241 if (flags == SIZE_RESTORED) { 4241 /* width and height don't apply */4242 parent = GetParent (hwnd);4243 GetClientRect(parent, &parent_rect);4244 x = parent_rect.left;4245 y = parent_rect.top;4246 4247 if (dwStyle & CCS_NORESIZE) {4248 uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE);4249 4250 /*4242 /* width and height don't apply */ 4243 parent = GetParent (hwnd); 4244 GetClientRect(parent, &parent_rect); 4245 x = parent_rect.left; 4246 y = parent_rect.top; 4247 4248 if (dwStyle & CCS_NORESIZE) { 4249 uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE); 4250 4251 /* 4251 4252 * this sets the working width of the toolbar, and 4252 4253 * Calc Toolbar will not adjust it, only the height 4253 4254 */ 4254 infoPtr->nWidth = parent_rect.right - parent_rect.left; 4255 cy = infoPtr->nHeight;4256 cx = infoPtr->nWidth;4257 TOOLBAR_CalcToolbar (hwnd);4258 infoPtr->nWidth = cx;4259 infoPtr->nHeight = cy;4260 }4261 else {4262 infoPtr->nWidth = parent_rect.right - parent_rect.left;4263 TOOLBAR_CalcToolbar (hwnd);4264 cy = infoPtr->nHeight;4265 cx = infoPtr->nWidth;4266 4267 if (dwStyle & CCS_NOMOVEY) {4268 GetWindowRect(hwnd, &window_rect);4269 ScreenToClient(parent, (LPPOINT)&window_rect.left);4270 y = window_rect.top;4271 }4272 }4273 4274 if (dwStyle & CCS_NOPARENTALIGN) {4275 uPosFlags |= SWP_NOMOVE;4276 cy = infoPtr->nHeight;4277 cx = infoPtr->nWidth;4278 }4279 4280 if (!(dwStyle & CCS_NODIVIDER))4281 cy += GetSystemMetrics(SM_CYEDGE);4282 4283 if (dwStyle & WS_BORDER)4284 {4285 x = y = 1;4286 cy += GetSystemMetrics(SM_CYEDGE);4287 cx += GetSystemMetrics(SM_CYEDGE);4288 }4289 4290 SetWindowPos (hwnd, 0, parent_rect.left - x, parent_rect.top - y,4291 cx, cy, uPosFlags | SWP_NOZORDER);4255 infoPtr->nWidth = parent_rect.right - parent_rect.left; 4256 cy = infoPtr->nHeight; 4257 cx = infoPtr->nWidth; 4258 TOOLBAR_CalcToolbar (hwnd); 4259 infoPtr->nWidth = cx; 4260 infoPtr->nHeight = cy; 4261 } 4262 else { 4263 infoPtr->nWidth = parent_rect.right - parent_rect.left; 4264 TOOLBAR_CalcToolbar (hwnd); 4265 cy = infoPtr->nHeight; 4266 cx = infoPtr->nWidth; 4267 4268 if (dwStyle & CCS_NOMOVEY) { 4269 GetWindowRect(hwnd, &window_rect); 4270 ScreenToClient(parent, (LPPOINT)&window_rect.left); 4271 y = window_rect.top; 4272 } 4273 } 4274 4275 if (dwStyle & CCS_NOPARENTALIGN) { 4276 uPosFlags |= SWP_NOMOVE; 4277 cy = infoPtr->nHeight; 4278 cx = infoPtr->nWidth; 4279 } 4280 4281 if (!(dwStyle & CCS_NODIVIDER)) 4282 cy += GetSystemMetrics(SM_CYEDGE); 4283 4284 if (dwStyle & WS_BORDER) 4285 { 4286 x = y = 1; 4287 cy += GetSystemMetrics(SM_CYEDGE); 4288 cx += GetSystemMetrics(SM_CYEDGE); 4289 } 4290 4291 SetWindowPos (hwnd, 0, parent_rect.left - x, parent_rect.top - y, 4292 cx, cy, uPosFlags | SWP_NOZORDER); 4292 4293 } 4293 4294 return 0; … … 4301 4302 4302 4303 if (nType == GWL_STYLE) { 4303 if (lpStyle->styleNew & TBSTYLE_LIST) {4304 infoPtr->dwDTFlags = DT_LEFT | DT_VCENTER | DT_SINGLELINE;4305 }4306 else {4307 infoPtr->dwDTFlags = DT_CENTER;4308 }4304 if (lpStyle->styleNew & TBSTYLE_LIST) { 4305 infoPtr->dwDTFlags = DT_LEFT | DT_VCENTER | DT_SINGLELINE; 4306 } 4307 else { 4308 infoPtr->dwDTFlags = DT_CENTER; 4309 } 4309 4310 } 4310 4311 … … 4322 4323 { 4323 4324 if (!TOOLBAR_GetInfoPtr(hwnd) && (uMsg != WM_NCCREATE)) 4324 return DefWindowProcA( hwnd, uMsg, wParam, lParam );4325 return DefWindowProcA( hwnd, uMsg, wParam, lParam ); 4325 4326 4326 4327 switch (uMsg) 4327 4328 { 4328 case TB_ADDBITMAP:4329 return TOOLBAR_AddBitmap (hwnd, wParam, lParam);4330 4331 case TB_ADDBUTTONSA:4332 return TOOLBAR_AddButtonsA (hwnd, wParam, lParam);4333 4334 case TB_ADDBUTTONSW:4335 return TOOLBAR_AddButtonsW (hwnd, wParam, lParam);4336 4337 case TB_ADDSTRINGA:4338 return TOOLBAR_AddStringA (hwnd, wParam, lParam);4339 4340 case TB_ADDSTRINGW:4341 return TOOLBAR_AddStringW (hwnd, wParam, lParam);4342 4343 case TB_AUTOSIZE:4344 return TOOLBAR_AutoSize (hwnd);4345 4346 case TB_BUTTONCOUNT:4347 return TOOLBAR_ButtonCount (hwnd, wParam, lParam);4348 4349 case TB_BUTTONSTRUCTSIZE:4350 return TOOLBAR_ButtonStructSize (hwnd, wParam, lParam);4351 4352 case TB_CHANGEBITMAP:4353 return TOOLBAR_ChangeBitmap (hwnd, wParam, lParam);4354 4355 case TB_CHECKBUTTON:4356 return TOOLBAR_CheckButton (hwnd, wParam, lParam);4357 4358 case TB_COMMANDTOINDEX:4359 return TOOLBAR_CommandToIndex (hwnd, wParam, lParam);4360 4361 case TB_CUSTOMIZE:4362 return TOOLBAR_Customize (hwnd);4363 4364 case TB_DELETEBUTTON:4365 return TOOLBAR_DeleteButton (hwnd, wParam, lParam);4366 4367 case TB_ENABLEBUTTON:4368 return TOOLBAR_EnableButton (hwnd, wParam, lParam);4369 4370 case TB_GETANCHORHIGHLIGHT:4371 return TOOLBAR_GetAnchorHighlight (hwnd);4372 4373 case TB_GETBITMAP:4374 return TOOLBAR_GetBitmap (hwnd, wParam, lParam);4375 4376 case TB_GETBITMAPFLAGS:4377 return TOOLBAR_GetBitmapFlags (hwnd, wParam, lParam);4378 4379 case TB_GETBUTTON:4380 return TOOLBAR_GetButton (hwnd, wParam, lParam);4381 4382 case TB_GETBUTTONINFOA:4383 return TOOLBAR_GetButtonInfoA (hwnd, wParam, lParam);4384 4385 case TB_GETBUTTONINFOW:4386 return TOOLBAR_GetButtonInfoW (hwnd, wParam, lParam);4387 4388 case TB_GETBUTTONSIZE:4389 return TOOLBAR_GetButtonSize (hwnd);4390 4391 case TB_GETBUTTONTEXTA:4392 return TOOLBAR_GetButtonTextA (hwnd, wParam, lParam);4393 4394 case TB_GETBUTTONTEXTW:4395 return TOOLBAR_GetButtonTextW (hwnd, wParam, lParam);4396 4397 /* case TB_GETCOLORSCHEME:*/ /* 4.71 */4398 4399 case TB_GETDISABLEDIMAGELIST:4400 return TOOLBAR_GetDisabledImageList (hwnd, wParam, lParam);4401 4402 case TB_GETEXTENDEDSTYLE:4403 return TOOLBAR_GetExtendedStyle (hwnd);4404 4405 case TB_GETHOTIMAGELIST:4406 return TOOLBAR_GetHotImageList (hwnd, wParam, lParam);4407 4408 case TB_GETHOTITEM:4409 return TOOLBAR_GetHotItem (hwnd);4410 4411 case TB_GETIMAGELIST:4412 return TOOLBAR_GetImageList (hwnd, wParam, lParam);4413 4414 /* case TB_GETINSERTMARK:*/ /* 4.71 */4415 /* case TB_GETINSERTMARKCOLOR:*/ /* 4.71 */4416 4417 case TB_GETITEMRECT:4418 return TOOLBAR_GetItemRect (hwnd, wParam, lParam);4419 4420 case TB_GETMAXSIZE:4421 return TOOLBAR_GetMaxSize (hwnd, wParam, lParam);4422 4423 /* case TB_GETOBJECT:*/ /* 4.71 */4424 /* case TB_GETPADDING:*/ /* 4.71 */4425 4426 case TB_GETRECT:4427 return TOOLBAR_GetRect (hwnd, wParam, lParam);4428 4429 case TB_GETROWS:4430 return TOOLBAR_GetRows (hwnd, wParam, lParam);4431 4432 case TB_GETSTATE:4433 return TOOLBAR_GetState (hwnd, wParam, lParam);4434 4435 case TB_GETSTYLE:4436 return TOOLBAR_GetStyle (hwnd, wParam, lParam);4437 4438 case TB_GETTEXTROWS:4439 return TOOLBAR_GetTextRows (hwnd, wParam, lParam);4440 4441 case TB_GETTOOLTIPS:4442 return TOOLBAR_GetToolTips (hwnd, wParam, lParam);4443 4444 case TB_GETUNICODEFORMAT:4445 return TOOLBAR_GetUnicodeFormat (hwnd, wParam, lParam);4446 4447 case CCM_GETVERSION:4448 return TOOLBAR_GetVersion (hwnd);4449 4450 case TB_HIDEBUTTON:4451 return TOOLBAR_HideButton (hwnd, wParam, lParam);4452 4453 case TB_HITTEST:4454 return TOOLBAR_HitTest (hwnd, wParam, lParam);4455 4456 case TB_INDETERMINATE:4457 return TOOLBAR_Indeterminate (hwnd, wParam, lParam);4458 4459 case TB_INSERTBUTTONA:4460 return TOOLBAR_InsertButtonA (hwnd, wParam, lParam);4461 4462 case TB_INSERTBUTTONW:4463 return TOOLBAR_InsertButtonW (hwnd, wParam, lParam);4464 4465 /* case TB_INSERTMARKHITTEST:*/ /* 4.71 */4466 4467 case TB_ISBUTTONCHECKED:4468 return TOOLBAR_IsButtonChecked (hwnd, wParam, lParam);4469 4470 case TB_ISBUTTONENABLED:4471 return TOOLBAR_IsButtonEnabled (hwnd, wParam, lParam);4472 4473 case TB_ISBUTTONHIDDEN:4474 return TOOLBAR_IsButtonHidden (hwnd, wParam, lParam);4475 4476 case TB_ISBUTTONHIGHLIGHTED:4477 return TOOLBAR_IsButtonHighlighted (hwnd, wParam, lParam);4478 4479 case TB_ISBUTTONINDETERMINATE:4480 return TOOLBAR_IsButtonIndeterminate (hwnd, wParam, lParam);4481 4482 case TB_ISBUTTONPRESSED:4483 return TOOLBAR_IsButtonPressed (hwnd, wParam, lParam);4484 4485 case TB_LOADIMAGES:/* 4.70 */4486 FIXME("missing standard imagelists\n");4487 return 0;4488 4489 /* case TB_MAPACCELERATORA:*/ /* 4.71 */4490 /* case TB_MAPACCELERATORW:*/ /* 4.71 */4491 /* case TB_MARKBUTTON:*/ /* 4.71 */4492 /* case TB_MOVEBUTTON:*/ /* 4.71 */4493 4494 case TB_PRESSBUTTON:4495 return TOOLBAR_PressButton (hwnd, wParam, lParam);4496 4497 /* case TB_REPLACEBITMAP: */4498 4499 case TB_SAVERESTOREA:4500 return TOOLBAR_SaveRestoreA (hwnd, wParam, lParam);4501 4502 case TB_SAVERESTOREW:4503 return TOOLBAR_SaveRestoreW (hwnd, wParam, lParam);4504 4505 case TB_SETANCHORHIGHLIGHT:4506 return TOOLBAR_SetAnchorHighlight (hwnd, wParam);4507 4508 case TB_SETBITMAPSIZE:4509 return TOOLBAR_SetBitmapSize (hwnd, wParam, lParam);4510 4511 case TB_SETBUTTONINFOA:4512 return TOOLBAR_SetButtonInfoA (hwnd, wParam, lParam);4513 4514 case TB_SETBUTTONINFOW:4515 return TOOLBAR_SetButtonInfoW (hwnd, wParam, lParam);4516 4517 case TB_SETBUTTONSIZE:4518 return TOOLBAR_SetButtonSize (hwnd, wParam, lParam);4519 4520 case TB_SETBUTTONWIDTH:4521 return TOOLBAR_SetButtonWidth (hwnd, wParam, lParam);4522 4523 case TB_SETCMDID:4524 return TOOLBAR_SetCmdId (hwnd, wParam, lParam);4525 4526 /* case TB_SETCOLORSCHEME:*/ /* 4.71 */4527 4528 case TB_SETDISABLEDIMAGELIST:4529 return TOOLBAR_SetDisabledImageList (hwnd, wParam, lParam);4530 4531 case TB_SETDRAWTEXTFLAGS:4532 return TOOLBAR_SetDrawTextFlags (hwnd, wParam, lParam);4533 4534 case TB_SETEXTENDEDSTYLE:4535 return TOOLBAR_SetExtendedStyle (hwnd, wParam, lParam);4536 4537 case TB_SETHOTIMAGELIST:4538 return TOOLBAR_SetHotImageList (hwnd, wParam, lParam);4539 4540 case TB_SETHOTITEM:4541 return TOOLBAR_SetHotItem (hwnd, wParam);4542 4543 case TB_SETIMAGELIST:4544 return TOOLBAR_SetImageList (hwnd, wParam, lParam);4545 4546 case TB_SETINDENT:4547 return TOOLBAR_SetIndent (hwnd, wParam, lParam);4548 4549 /* case TB_SETINSERTMARK:*/ /* 4.71 */4550 4551 case TB_SETINSERTMARKCOLOR:4552 return TOOLBAR_SetInsertMarkColor (hwnd, wParam, lParam);4553 4554 case TB_SETMAXTEXTROWS:4555 return TOOLBAR_SetMaxTextRows (hwnd, wParam, lParam);4556 4557 /* case TB_SETPADDING:*/ /* 4.71 */4558 4559 case TB_SETPARENT:4560 return TOOLBAR_SetParent (hwnd, wParam, lParam);4561 4562 case TB_SETROWS:4563 return TOOLBAR_SetRows (hwnd, wParam, lParam);4564 4565 case TB_SETSTATE:4566 return TOOLBAR_SetState (hwnd, wParam, lParam);4567 4568 case TB_SETSTYLE:4569 return TOOLBAR_SetStyle (hwnd, wParam, lParam);4570 4571 case TB_SETTOOLTIPS:4572 return TOOLBAR_SetToolTips (hwnd, wParam, lParam);4573 4574 case TB_SETUNICODEFORMAT:4575 return TOOLBAR_SetUnicodeFormat (hwnd, wParam, lParam);4576 4577 case CCM_SETVERSION:4578 return TOOLBAR_SetVersion (hwnd, (INT)wParam);4579 4580 4581 /* case WM_CHAR: */4582 4583 case WM_CREATE:4584 return TOOLBAR_Create (hwnd, wParam, lParam);4585 4586 case WM_DESTROY:4587 return TOOLBAR_Destroy (hwnd, wParam, lParam);4588 4589 case WM_ERASEBKGND:4590 return TOOLBAR_EraseBackground (hwnd, wParam, lParam);4591 4592 case WM_GETFONT:4593 return TOOLBAR_GetFont (hwnd, wParam, lParam);4594 4595 /* case WM_KEYDOWN: */4596 /* case WM_KILLFOCUS: */4597 4598 case WM_LBUTTONDBLCLK:4599 return TOOLBAR_LButtonDblClk (hwnd, wParam, lParam);4600 4601 case WM_LBUTTONDOWN:4602 return TOOLBAR_LButtonDown (hwnd, wParam, lParam);4603 4604 case WM_LBUTTONUP:4605 return TOOLBAR_LButtonUp (hwnd, wParam, lParam);4606 4607 case WM_MOUSEMOVE:4608 return TOOLBAR_MouseMove (hwnd, wParam, lParam);4609 4610 case WM_MOUSELEAVE:4611 return TOOLBAR_MouseLeave (hwnd, wParam, lParam); 4612 4613 case WM_CAPTURECHANGED:4614 return TOOLBAR_CaptureChanged(hwnd); 4615 4616 case WM_NCACTIVATE:4617 return TOOLBAR_NCActivate (hwnd, wParam, lParam);4618 4619 case WM_NCCALCSIZE:4620 return TOOLBAR_NCCalcSize (hwnd, wParam, lParam);4621 4622 case WM_NCCREATE:4623 return TOOLBAR_NCCreate (hwnd, wParam, lParam);4624 4625 case WM_NCPAINT:4626 return TOOLBAR_NCPaint (hwnd, wParam, lParam);4627 4628 case WM_NOTIFY:4629 return TOOLBAR_Notify (hwnd, wParam, lParam);4630 4631 /* case WM_NOTIFYFORMAT: */4632 4633 case WM_PAINT:4634 return TOOLBAR_Paint (hwnd, wParam);4635 4636 case WM_SIZE:4637 return TOOLBAR_Size (hwnd, wParam, lParam);4638 4639 case WM_STYLECHANGED:4640 return TOOLBAR_StyleChanged (hwnd, (INT)wParam, (LPSTYLESTRUCT)lParam);4641 4642 /* case WM_SYSCOLORCHANGE: */4643 4644 /* case WM_WININICHANGE: */4645 4646 case WM_CHARTOITEM:4647 case WM_COMMAND:4648 case WM_DRAWITEM:4649 case WM_MEASUREITEM:4650 case WM_VKEYTOITEM:4651 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);4652 4653 default:4654 if (uMsg >= WM_USER)4655 ERR("unknown msg %04x wp=%08x lp=%08lx\n",4656 uMsg, wParam, lParam);4657 return DefWindowProcA (hwnd, uMsg, wParam, lParam);4329 case TB_ADDBITMAP: 4330 return TOOLBAR_AddBitmap (hwnd, wParam, lParam); 4331 4332 case TB_ADDBUTTONSA: 4333 return TOOLBAR_AddButtonsA (hwnd, wParam, lParam); 4334 4335 case TB_ADDBUTTONSW: 4336 return TOOLBAR_AddButtonsW (hwnd, wParam, lParam); 4337 4338 case TB_ADDSTRINGA: 4339 return TOOLBAR_AddStringA (hwnd, wParam, lParam); 4340 4341 case TB_ADDSTRINGW: 4342 return TOOLBAR_AddStringW (hwnd, wParam, lParam); 4343 4344 case TB_AUTOSIZE: 4345 return TOOLBAR_AutoSize (hwnd); 4346 4347 case TB_BUTTONCOUNT: 4348 return TOOLBAR_ButtonCount (hwnd, wParam, lParam); 4349 4350 case TB_BUTTONSTRUCTSIZE: 4351 return TOOLBAR_ButtonStructSize (hwnd, wParam, lParam); 4352 4353 case TB_CHANGEBITMAP: 4354 return TOOLBAR_ChangeBitmap (hwnd, wParam, lParam); 4355 4356 case TB_CHECKBUTTON: 4357 return TOOLBAR_CheckButton (hwnd, wParam, lParam); 4358 4359 case TB_COMMANDTOINDEX: 4360 return TOOLBAR_CommandToIndex (hwnd, wParam, lParam); 4361 4362 case TB_CUSTOMIZE: 4363 return TOOLBAR_Customize (hwnd); 4364 4365 case TB_DELETEBUTTON: 4366 return TOOLBAR_DeleteButton (hwnd, wParam, lParam); 4367 4368 case TB_ENABLEBUTTON: 4369 return TOOLBAR_EnableButton (hwnd, wParam, lParam); 4370 4371 case TB_GETANCHORHIGHLIGHT: 4372 return TOOLBAR_GetAnchorHighlight (hwnd); 4373 4374 case TB_GETBITMAP: 4375 return TOOLBAR_GetBitmap (hwnd, wParam, lParam); 4376 4377 case TB_GETBITMAPFLAGS: 4378 return TOOLBAR_GetBitmapFlags (hwnd, wParam, lParam); 4379 4380 case TB_GETBUTTON: 4381 return TOOLBAR_GetButton (hwnd, wParam, lParam); 4382 4383 case TB_GETBUTTONINFOA: 4384 return TOOLBAR_GetButtonInfoA (hwnd, wParam, lParam); 4385 4386 case TB_GETBUTTONINFOW: 4387 return TOOLBAR_GetButtonInfoW (hwnd, wParam, lParam); 4388 4389 case TB_GETBUTTONSIZE: 4390 return TOOLBAR_GetButtonSize (hwnd); 4391 4392 case TB_GETBUTTONTEXTA: 4393 return TOOLBAR_GetButtonTextA (hwnd, wParam, lParam); 4394 4395 case TB_GETBUTTONTEXTW: 4396 return TOOLBAR_GetButtonTextW (hwnd, wParam, lParam); 4397 4398 /* case TB_GETCOLORSCHEME: */ /* 4.71 */ 4399 4400 case TB_GETDISABLEDIMAGELIST: 4401 return TOOLBAR_GetDisabledImageList (hwnd, wParam, lParam); 4402 4403 case TB_GETEXTENDEDSTYLE: 4404 return TOOLBAR_GetExtendedStyle (hwnd); 4405 4406 case TB_GETHOTIMAGELIST: 4407 return TOOLBAR_GetHotImageList (hwnd, wParam, lParam); 4408 4409 case TB_GETHOTITEM: 4410 return TOOLBAR_GetHotItem (hwnd); 4411 4412 case TB_GETIMAGELIST: 4413 return TOOLBAR_GetImageList (hwnd, wParam, lParam); 4414 4415 /* case TB_GETINSERTMARK: */ /* 4.71 */ 4416 /* case TB_GETINSERTMARKCOLOR: */ /* 4.71 */ 4417 4418 case TB_GETITEMRECT: 4419 return TOOLBAR_GetItemRect (hwnd, wParam, lParam); 4420 4421 case TB_GETMAXSIZE: 4422 return TOOLBAR_GetMaxSize (hwnd, wParam, lParam); 4423 4424 /* case TB_GETOBJECT: */ /* 4.71 */ 4425 /* case TB_GETPADDING: */ /* 4.71 */ 4426 4427 case TB_GETRECT: 4428 return TOOLBAR_GetRect (hwnd, wParam, lParam); 4429 4430 case TB_GETROWS: 4431 return TOOLBAR_GetRows (hwnd, wParam, lParam); 4432 4433 case TB_GETSTATE: 4434 return TOOLBAR_GetState (hwnd, wParam, lParam); 4435 4436 case TB_GETSTYLE: 4437 return TOOLBAR_GetStyle (hwnd, wParam, lParam); 4438 4439 case TB_GETTEXTROWS: 4440 return TOOLBAR_GetTextRows (hwnd, wParam, lParam); 4441 4442 case TB_GETTOOLTIPS: 4443 return TOOLBAR_GetToolTips (hwnd, wParam, lParam); 4444 4445 case TB_GETUNICODEFORMAT: 4446 return TOOLBAR_GetUnicodeFormat (hwnd, wParam, lParam); 4447 4448 case CCM_GETVERSION: 4449 return TOOLBAR_GetVersion (hwnd); 4450 4451 case TB_HIDEBUTTON: 4452 return TOOLBAR_HideButton (hwnd, wParam, lParam); 4453 4454 case TB_HITTEST: 4455 return TOOLBAR_HitTest (hwnd, wParam, lParam); 4456 4457 case TB_INDETERMINATE: 4458 return TOOLBAR_Indeterminate (hwnd, wParam, lParam); 4459 4460 case TB_INSERTBUTTONA: 4461 return TOOLBAR_InsertButtonA (hwnd, wParam, lParam); 4462 4463 case TB_INSERTBUTTONW: 4464 return TOOLBAR_InsertButtonW (hwnd, wParam, lParam); 4465 4466 /* case TB_INSERTMARKHITTEST: */ /* 4.71 */ 4467 4468 case TB_ISBUTTONCHECKED: 4469 return TOOLBAR_IsButtonChecked (hwnd, wParam, lParam); 4470 4471 case TB_ISBUTTONENABLED: 4472 return TOOLBAR_IsButtonEnabled (hwnd, wParam, lParam); 4473 4474 case TB_ISBUTTONHIDDEN: 4475 return TOOLBAR_IsButtonHidden (hwnd, wParam, lParam); 4476 4477 case TB_ISBUTTONHIGHLIGHTED: 4478 return TOOLBAR_IsButtonHighlighted (hwnd, wParam, lParam); 4479 4480 case TB_ISBUTTONINDETERMINATE: 4481 return TOOLBAR_IsButtonIndeterminate (hwnd, wParam, lParam); 4482 4483 case TB_ISBUTTONPRESSED: 4484 return TOOLBAR_IsButtonPressed (hwnd, wParam, lParam); 4485 4486 case TB_LOADIMAGES: /* 4.70 */ 4487 FIXME("missing standard imagelists\n"); 4488 return 0; 4489 4490 /* case TB_MAPACCELERATORA: */ /* 4.71 */ 4491 /* case TB_MAPACCELERATORW: */ /* 4.71 */ 4492 /* case TB_MARKBUTTON: */ /* 4.71 */ 4493 /* case TB_MOVEBUTTON: */ /* 4.71 */ 4494 4495 case TB_PRESSBUTTON: 4496 return TOOLBAR_PressButton (hwnd, wParam, lParam); 4497 4498 /* case TB_REPLACEBITMAP: */ 4499 4500 case TB_SAVERESTOREA: 4501 return TOOLBAR_SaveRestoreA (hwnd, wParam, lParam); 4502 4503 case TB_SAVERESTOREW: 4504 return TOOLBAR_SaveRestoreW (hwnd, wParam, lParam); 4505 4506 case TB_SETANCHORHIGHLIGHT: 4507 return TOOLBAR_SetAnchorHighlight (hwnd, wParam); 4508 4509 case TB_SETBITMAPSIZE: 4510 return TOOLBAR_SetBitmapSize (hwnd, wParam, lParam); 4511 4512 case TB_SETBUTTONINFOA: 4513 return TOOLBAR_SetButtonInfoA (hwnd, wParam, lParam); 4514 4515 case TB_SETBUTTONINFOW: 4516 return TOOLBAR_SetButtonInfoW (hwnd, wParam, lParam); 4517 4518 case TB_SETBUTTONSIZE: 4519 return TOOLBAR_SetButtonSize (hwnd, wParam, lParam); 4520 4521 case TB_SETBUTTONWIDTH: 4522 return TOOLBAR_SetButtonWidth (hwnd, wParam, lParam); 4523 4524 case TB_SETCMDID: 4525 return TOOLBAR_SetCmdId (hwnd, wParam, lParam); 4526 4527 /* case TB_SETCOLORSCHEME: */ /* 4.71 */ 4528 4529 case TB_SETDISABLEDIMAGELIST: 4530 return TOOLBAR_SetDisabledImageList (hwnd, wParam, lParam); 4531 4532 case TB_SETDRAWTEXTFLAGS: 4533 return TOOLBAR_SetDrawTextFlags (hwnd, wParam, lParam); 4534 4535 case TB_SETEXTENDEDSTYLE: 4536 return TOOLBAR_SetExtendedStyle (hwnd, wParam, lParam); 4537 4538 case TB_SETHOTIMAGELIST: 4539 return TOOLBAR_SetHotImageList (hwnd, wParam, lParam); 4540 4541 case TB_SETHOTITEM: 4542 return TOOLBAR_SetHotItem (hwnd, wParam); 4543 4544 case TB_SETIMAGELIST: 4545 return TOOLBAR_SetImageList (hwnd, wParam, lParam); 4546 4547 case TB_SETINDENT: 4548 return TOOLBAR_SetIndent (hwnd, wParam, lParam); 4549 4550 /* case TB_SETINSERTMARK: */ /* 4.71 */ 4551 4552 case TB_SETINSERTMARKCOLOR: 4553 return TOOLBAR_SetInsertMarkColor (hwnd, wParam, lParam); 4554 4555 case TB_SETMAXTEXTROWS: 4556 return TOOLBAR_SetMaxTextRows (hwnd, wParam, lParam); 4557 4558 /* case TB_SETPADDING: */ /* 4.71 */ 4559 4560 case TB_SETPARENT: 4561 return TOOLBAR_SetParent (hwnd, wParam, lParam); 4562 4563 case TB_SETROWS: 4564 return TOOLBAR_SetRows (hwnd, wParam, lParam); 4565 4566 case TB_SETSTATE: 4567 return TOOLBAR_SetState (hwnd, wParam, lParam); 4568 4569 case TB_SETSTYLE: 4570 return TOOLBAR_SetStyle (hwnd, wParam, lParam); 4571 4572 case TB_SETTOOLTIPS: 4573 return TOOLBAR_SetToolTips (hwnd, wParam, lParam); 4574 4575 case TB_SETUNICODEFORMAT: 4576 return TOOLBAR_SetUnicodeFormat (hwnd, wParam, lParam); 4577 4578 case CCM_SETVERSION: 4579 return TOOLBAR_SetVersion (hwnd, (INT)wParam); 4580 4581 4582 /* case WM_CHAR: */ 4583 4584 case WM_CREATE: 4585 return TOOLBAR_Create (hwnd, wParam, lParam); 4586 4587 case WM_DESTROY: 4588 return TOOLBAR_Destroy (hwnd, wParam, lParam); 4589 4590 case WM_ERASEBKGND: 4591 return TOOLBAR_EraseBackground (hwnd, wParam, lParam); 4592 4593 case WM_GETFONT: 4594 return TOOLBAR_GetFont (hwnd, wParam, lParam); 4595 4596 /* case WM_KEYDOWN: */ 4597 /* case WM_KILLFOCUS: */ 4598 4599 case WM_LBUTTONDBLCLK: 4600 return TOOLBAR_LButtonDblClk (hwnd, wParam, lParam); 4601 4602 case WM_LBUTTONDOWN: 4603 return TOOLBAR_LButtonDown (hwnd, wParam, lParam); 4604 4605 case WM_LBUTTONUP: 4606 return TOOLBAR_LButtonUp (hwnd, wParam, lParam); 4607 4608 case WM_MOUSEMOVE: 4609 return TOOLBAR_MouseMove (hwnd, wParam, lParam); 4610 4611 case WM_MOUSELEAVE: 4612 return TOOLBAR_MouseLeave (hwnd, wParam, lParam); 4613 4614 case WM_CAPTURECHANGED: 4615 return TOOLBAR_CaptureChanged(hwnd); 4616 4617 case WM_NCACTIVATE: 4618 return TOOLBAR_NCActivate (hwnd, wParam, lParam); 4619 4620 case WM_NCCALCSIZE: 4621 return TOOLBAR_NCCalcSize (hwnd, wParam, lParam); 4622 4623 case WM_NCCREATE: 4624 return TOOLBAR_NCCreate (hwnd, wParam, lParam); 4625 4626 case WM_NCPAINT: 4627 return TOOLBAR_NCPaint (hwnd, wParam, lParam); 4628 4629 case WM_NOTIFY: 4630 return TOOLBAR_Notify (hwnd, wParam, lParam); 4631 4632 /* case WM_NOTIFYFORMAT: */ 4633 4634 case WM_PAINT: 4635 return TOOLBAR_Paint (hwnd, wParam); 4636 4637 case WM_SIZE: 4638 return TOOLBAR_Size (hwnd, wParam, lParam); 4639 4640 case WM_STYLECHANGED: 4641 return TOOLBAR_StyleChanged (hwnd, (INT)wParam, (LPSTYLESTRUCT)lParam); 4642 4643 /* case WM_SYSCOLORCHANGE: */ 4644 4645 /* case WM_WININICHANGE: */ 4646 4647 case WM_CHARTOITEM: 4648 case WM_COMMAND: 4649 case WM_DRAWITEM: 4650 case WM_MEASUREITEM: 4651 case WM_VKEYTOITEM: 4652 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); 4653 4654 default: 4655 if (uMsg >= WM_USER) 4656 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 4657 uMsg, wParam, lParam); 4658 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 4658 4659 } 4659 4660 return 0; … … 4674 4675 wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); 4675 4676 wndClass.lpszClassName = TOOLBARCLASSNAMEA; 4676 4677 4677 4678 RegisterClassA (&wndClass); 4678 4679 }
Note:
See TracChangeset
for help on using the changeset viewer.
