- Timestamp:
- Jun 28, 1999, 5:46:28 PM (26 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 10 edited
-
header.c (modified) (39 diffs)
-
listview.c (modified) (366 diffs)
-
progress.c (modified) (4 diffs)
-
rebar.c (modified) (53 diffs)
-
status.c (modified) (9 diffs)
-
tab.c (modified) (98 diffs)
-
toolbar.c (modified) (9 diffs)
-
tooltips.c (modified) (22 diffs)
-
trackbar.c (modified) (3 diffs)
-
treeview.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/header.c
r94 r236 1 /* $Id: header.c,v 1. 5 1999-06-10 16:21:58 achimhaExp $ */1 /* $Id: header.c,v 1.6 1999-06-28 15:46:24 cbratschi Exp $ */ 2 2 /* 3 3 * Header control … … 5 5 * Copyright 1998 Eric Kohl 6 6 * Copyright 1999 Achim Hasenmueller 7 * Copyright 1999 Christoph Bratschi 7 8 * 8 9 * TODO: … … 49 50 r = phdi->rect; 50 51 if (r.right - r.left == 0) 51 return phdi->rect.right;52 return phdi->rect.right; 52 53 53 54 if (GetWindowLongA (hwnd, GWL_STYLE) & HDS_BUTTONS) { 54 if (phdi->bDown) {55 DrawEdge (hdc, &r, BDR_RAISEDOUTER,56 BF_RECT | BF_FLAT | BF_MIDDLE | BF_ADJUST);57 r.left += 2;55 if (phdi->bDown) { 56 DrawEdge (hdc, &r, BDR_RAISEDOUTER, 57 BF_RECT | BF_FLAT | BF_MIDDLE | BF_ADJUST); 58 r.left += 2; 58 59 r.top += 2; 59 }60 else61 DrawEdge (hdc, &r, EDGE_RAISED,62 BF_RECT | BF_SOFT | BF_MIDDLE | BF_ADJUST);60 } 61 else 62 DrawEdge (hdc, &r, EDGE_RAISED, 63 BF_RECT | BF_SOFT | BF_MIDDLE | BF_ADJUST); 63 64 } 64 65 else … … 66 67 67 68 if (phdi->fmt & HDF_OWNERDRAW) { 68 DRAWITEMSTRUCT dis;69 dis.CtlType = ODT_HEADER;70 dis.CtlID = GetWindowLongA (hwnd, GWL_ID);71 dis.itemID = iItem;72 dis.itemAction = ODA_DRAWENTIRE;73 dis.itemState = phdi->bDown ? ODS_SELECTED : 0;74 dis.hwndItem = hwnd;75 dis.hDC = hdc;76 dis.rcItem = r;77 dis.itemData = phdi->lParam;78 SendMessageA (GetParent (hwnd), WM_DRAWITEM,79 (WPARAM)dis.CtlID, (LPARAM)&dis);69 DRAWITEMSTRUCT dis; 70 dis.CtlType = ODT_HEADER; 71 dis.CtlID = GetWindowLongA (hwnd, GWL_ID); 72 dis.itemID = iItem; 73 dis.itemAction = ODA_DRAWENTIRE; 74 dis.itemState = phdi->bDown ? ODS_SELECTED : 0; 75 dis.hwndItem = hwnd; 76 dis.hDC = hdc; 77 dis.rcItem = r; 78 dis.itemData = phdi->lParam; 79 SendMessageA (GetParent (hwnd), WM_DRAWITEM, 80 (WPARAM)dis.CtlID, (LPARAM)&dis); 80 81 } 81 82 else { … … 87 88 uTextJustify = DT_RIGHT; 88 89 89 if ((phdi->fmt & HDF_BITMAP) && (phdi->hbm)) {90 BITMAP bmp;91 HDC hdcBitmap;92 INT yD, yS, cx, cy, rx, ry;93 94 GetObjectA (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp);95 96 ry = r.bottom - r.top;97 rx = r.right - r.left;98 99 if (ry >= bmp.bmHeight) {100 cy = bmp.bmHeight;101 yD = r.top + (ry - bmp.bmHeight) / 2;102 yS = 0;103 }104 else {105 cy = ry;106 yD = r.top;107 yS = (bmp.bmHeight - ry) / 2;108 109 }110 111 if (rx >= bmp.bmWidth + 6) {112 cx = bmp.bmWidth;113 }114 else {115 cx = rx - 6;116 }117 118 hdcBitmap = CreateCompatibleDC (hdc);119 SelectObject (hdcBitmap, phdi->hbm);120 BitBlt (hdc, r.left + 3, yD, cx, cy, hdcBitmap, 0, yS, SRCCOPY);121 DeleteDC (hdcBitmap);122 123 r.left += (bmp.bmWidth + 3);124 }125 126 127 if ((phdi->fmt & HDF_BITMAP_ON_RIGHT) && (phdi->hbm)) {128 BITMAP bmp;129 HDC hdcBitmap;130 INT xD, yD, yS, cx, cy, rx, ry, tx;131 RECT textRect;132 133 GetObjectA (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp);134 135 textRect = r;90 if ((phdi->fmt & HDF_BITMAP) && (phdi->hbm)) { 91 BITMAP bmp; 92 HDC hdcBitmap; 93 INT yD, yS, cx, cy, rx, ry; 94 95 GetObjectA (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp); 96 97 ry = r.bottom - r.top; 98 rx = r.right - r.left; 99 100 if (ry >= bmp.bmHeight) { 101 cy = bmp.bmHeight; 102 yD = r.top + (ry - bmp.bmHeight) / 2; 103 yS = 0; 104 } 105 else { 106 cy = ry; 107 yD = r.top; 108 yS = (bmp.bmHeight - ry) / 2; 109 110 } 111 112 if (rx >= bmp.bmWidth + 6) { 113 cx = bmp.bmWidth; 114 } 115 else { 116 cx = rx - 6; 117 } 118 119 hdcBitmap = CreateCompatibleDC (hdc); 120 SelectObject (hdcBitmap, phdi->hbm); 121 BitBlt (hdc, r.left + 3, yD, cx, cy, hdcBitmap, 0, yS, SRCCOPY); 122 DeleteDC (hdcBitmap); 123 124 r.left += (bmp.bmWidth + 3); 125 } 126 127 128 if ((phdi->fmt & HDF_BITMAP_ON_RIGHT) && (phdi->hbm)) { 129 BITMAP bmp; 130 HDC hdcBitmap; 131 INT xD, yD, yS, cx, cy, rx, ry, tx; 132 RECT textRect; 133 134 GetObjectA (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp); 135 136 textRect = r; 136 137 DrawTextW (hdc, phdi->pszText, lstrlenW (phdi->pszText), 137 &textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT);138 tx = textRect.right - textRect.left;139 ry = r.bottom - r.top;140 rx = r.right - r.left;141 142 if (ry >= bmp.bmHeight) {143 cy = bmp.bmHeight;144 yD = r.top + (ry - bmp.bmHeight) / 2;145 yS = 0;146 }147 else {148 cy = ry;149 yD = r.top;150 yS = (bmp.bmHeight - ry) / 2;151 152 }153 154 if (r.left + tx + bmp.bmWidth + 9 <= r.right) {155 cx = bmp.bmWidth;156 xD = r.left + tx + 6;157 }158 else {159 if (rx >= bmp.bmWidth + 6) {160 cx = bmp.bmWidth;161 xD = r.right - bmp.bmWidth - 3;162 r.right = xD - 3;163 }164 else {165 cx = rx - 3;166 xD = r.left;167 r.right = r.left;168 }169 }170 171 hdcBitmap = CreateCompatibleDC (hdc);172 SelectObject (hdcBitmap, phdi->hbm);173 BitBlt (hdc, xD, yD, cx, cy, hdcBitmap, 0, yS, SRCCOPY);174 DeleteDC (hdcBitmap);175 }176 177 if (phdi->fmt & HDF_IMAGE) {178 179 180 /* ImageList_Draw (infoPtr->himl, phdi->iImage,...); */181 }138 &textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT); 139 tx = textRect.right - textRect.left; 140 ry = r.bottom - r.top; 141 rx = r.right - r.left; 142 143 if (ry >= bmp.bmHeight) { 144 cy = bmp.bmHeight; 145 yD = r.top + (ry - bmp.bmHeight) / 2; 146 yS = 0; 147 } 148 else { 149 cy = ry; 150 yD = r.top; 151 yS = (bmp.bmHeight - ry) / 2; 152 153 } 154 155 if (r.left + tx + bmp.bmWidth + 9 <= r.right) { 156 cx = bmp.bmWidth; 157 xD = r.left + tx + 6; 158 } 159 else { 160 if (rx >= bmp.bmWidth + 6) { 161 cx = bmp.bmWidth; 162 xD = r.right - bmp.bmWidth - 3; 163 r.right = xD - 3; 164 } 165 else { 166 cx = rx - 3; 167 xD = r.left; 168 r.right = r.left; 169 } 170 } 171 172 hdcBitmap = CreateCompatibleDC (hdc); 173 SelectObject (hdcBitmap, phdi->hbm); 174 BitBlt (hdc, xD, yD, cx, cy, hdcBitmap, 0, yS, SRCCOPY); 175 DeleteDC (hdcBitmap); 176 } 177 178 if (phdi->fmt & HDF_IMAGE) { 179 180 181 /* ImageList_Draw (infoPtr->himl, phdi->iImage,...); */ 182 } 182 183 183 184 if ((phdi->fmt & HDF_STRING) && (phdi->pszText)) { 184 185 oldBkMode = SetBkMode(hdc, TRANSPARENT); 185 186 r.left += 3; 186 r.right -= 3;187 SetTextColor (hdc, bHotTrack ? COLOR_HIGHLIGHT : COLOR_BTNTEXT);187 r.right -= 3; 188 SetTextColor (hdc, bHotTrack ? COLOR_HIGHLIGHT : COLOR_BTNTEXT); 188 189 DrawTextW (hdc, phdi->pszText, lstrlenW (phdi->pszText), 189 &r, uTextJustify|DT_VCENTER|DT_SINGLELINE);190 &r, uTextJustify|DT_VCENTER|DT_SINGLELINE); 190 191 if (oldBkMode != TRANSPARENT) 191 192 SetBkMode(hdc, oldBkMode); … … 197 198 198 199 199 static void 200 static void 200 201 HEADER_Refresh (HWND hwnd, HDC hdc) 201 202 { … … 279 280 280 281 if (infoPtr->uNumItem == 0) 281 return;282 return; 282 283 283 284 x = 0; 284 285 for (i = 0; i < infoPtr->uNumItem; i++) { 285 phdi = &infoPtr->items[i];286 phdi->rect.top = 0;287 phdi->rect.bottom = cy;288 phdi->rect.left = x;289 phdi->rect.right = phdi->rect.left + phdi->cxy;290 x = phdi->rect.right;286 phdi = &infoPtr->items[i]; 287 phdi->rect.top = 0; 288 phdi->rect.bottom = cy; 289 phdi->rect.left = x; 290 phdi->rect.right = phdi->rect.left + phdi->cxy; 291 x = phdi->rect.right; 291 292 } 292 293 } … … 307 308 if (PtInRect (&rect, *lpPt)) 308 309 { 309 if (infoPtr->uNumItem == 0) {310 *pFlags |= HHT_NOWHERE;311 *pItem = 1;312 // TRACE (header, "NOWHERE\n");313 return;314 }315 else {316 /* somewhere inside */317 for (iCount = 0; iCount < infoPtr->uNumItem; iCount++) {318 rect = infoPtr->items[iCount].rect;319 width = rect.right - rect.left;320 if (width == 0) {321 bNoWidth = TRUE;322 continue;323 }324 if (PtInRect (&rect, *lpPt)) {325 if (width <= 2 * DIVIDER_WIDTH) {326 *pFlags |= HHT_ONHEADER;327 *pItem = iCount;328 // TRACE (header, "ON HEADER %d\n", iCount);329 return;330 }331 if (iCount > 0) {332 rcTest = rect;333 rcTest.right = rcTest.left + DIVIDER_WIDTH;334 if (PtInRect (&rcTest, *lpPt)) {335 if (bNoWidth) {336 *pFlags |= HHT_ONDIVOPEN;337 *pItem = iCount - 1;338 // TRACE (header, "ON DIVOPEN %d\n", *pItem);339 return;340 }341 else {342 *pFlags |= HHT_ONDIVIDER;343 *pItem = iCount - 1;344 // TRACE (header, "ON DIVIDER %d\n", *pItem);345 return;346 }347 }348 }349 rcTest = rect;350 rcTest.left = rcTest.right - DIVIDER_WIDTH;351 if (PtInRect (&rcTest, *lpPt)) {352 *pFlags |= HHT_ONDIVIDER;353 *pItem = iCount;354 // TRACE (header, "ON DIVIDER %d\n", *pItem);355 return;356 }357 358 *pFlags |= HHT_ONHEADER;359 *pItem = iCount;360 // TRACE (header, "ON HEADER %d\n", iCount);361 return;362 }363 }364 365 /* check for last divider part (on nowhere) */366 rect = infoPtr->items[infoPtr->uNumItem-1].rect;367 rect.left = rect.right;368 rect.right += DIVIDER_WIDTH;369 if (PtInRect (&rect, *lpPt)) {370 if (bNoWidth) {371 *pFlags |= HHT_ONDIVOPEN;372 *pItem = infoPtr->uNumItem - 1;373 // TRACE (header, "ON DIVOPEN %d\n", *pItem);374 return;375 }376 else {377 *pFlags |= HHT_ONDIVIDER;378 *pItem = infoPtr->uNumItem-1;379 // TRACE (header, "ON DIVIDER %d\n", *pItem);380 return;381 }382 }383 384 *pFlags |= HHT_NOWHERE;385 *pItem = 1;386 // TRACE (header, "NOWHERE\n");387 return;388 }310 if (infoPtr->uNumItem == 0) { 311 *pFlags |= HHT_NOWHERE; 312 *pItem = 1; 313 // TRACE (header, "NOWHERE\n"); 314 return; 315 } 316 else { 317 /* somewhere inside */ 318 for (iCount = 0; iCount < infoPtr->uNumItem; iCount++) { 319 rect = infoPtr->items[iCount].rect; 320 width = rect.right - rect.left; 321 if (width == 0) { 322 bNoWidth = TRUE; 323 continue; 324 } 325 if (PtInRect (&rect, *lpPt)) { 326 if (width <= 2 * DIVIDER_WIDTH) { 327 *pFlags |= HHT_ONHEADER; 328 *pItem = iCount; 329 // TRACE (header, "ON HEADER %d\n", iCount); 330 return; 331 } 332 if (iCount > 0) { 333 rcTest = rect; 334 rcTest.right = rcTest.left + DIVIDER_WIDTH; 335 if (PtInRect (&rcTest, *lpPt)) { 336 if (bNoWidth) { 337 *pFlags |= HHT_ONDIVOPEN; 338 *pItem = iCount - 1; 339 // TRACE (header, "ON DIVOPEN %d\n", *pItem); 340 return; 341 } 342 else { 343 *pFlags |= HHT_ONDIVIDER; 344 *pItem = iCount - 1; 345 // TRACE (header, "ON DIVIDER %d\n", *pItem); 346 return; 347 } 348 } 349 } 350 rcTest = rect; 351 rcTest.left = rcTest.right - DIVIDER_WIDTH; 352 if (PtInRect (&rcTest, *lpPt)) { 353 *pFlags |= HHT_ONDIVIDER; 354 *pItem = iCount; 355 // TRACE (header, "ON DIVIDER %d\n", *pItem); 356 return; 357 } 358 359 *pFlags |= HHT_ONHEADER; 360 *pItem = iCount; 361 // TRACE (header, "ON HEADER %d\n", iCount); 362 return; 363 } 364 } 365 366 /* check for last divider part (on nowhere) */ 367 rect = infoPtr->items[infoPtr->uNumItem-1].rect; 368 rect.left = rect.right; 369 rect.right += DIVIDER_WIDTH; 370 if (PtInRect (&rect, *lpPt)) { 371 if (bNoWidth) { 372 *pFlags |= HHT_ONDIVOPEN; 373 *pItem = infoPtr->uNumItem - 1; 374 // TRACE (header, "ON DIVOPEN %d\n", *pItem); 375 return; 376 } 377 else { 378 *pFlags |= HHT_ONDIVIDER; 379 *pItem = infoPtr->uNumItem-1; 380 // TRACE (header, "ON DIVIDER %d\n", *pItem); 381 return; 382 } 383 } 384 385 *pFlags |= HHT_NOWHERE; 386 *pItem = 1; 387 // TRACE (header, "NOWHERE\n"); 388 return; 389 } 389 390 } 390 391 else { 391 if (lpPt->x < rect.left) {392 // TRACE (header, "TO LEFT\n");393 *pFlags |= HHT_TOLEFT;394 }395 else if (lpPt->x > rect.right) {396 // TRACE (header, "TO LEFT\n");397 *pFlags |= HHT_TORIGHT;398 }399 400 if (lpPt->y < rect.top) {401 // TRACE (header, "ABOVE\n");402 *pFlags |= HHT_ABOVE;403 }404 else if (lpPt->y > rect.bottom) {405 // TRACE (header, "BELOW\n");406 *pFlags |= HHT_BELOW;407 }392 if (lpPt->x < rect.left) { 393 // TRACE (header, "TO LEFT\n"); 394 *pFlags |= HHT_TOLEFT; 395 } 396 else if (lpPt->x > rect.right) { 397 // TRACE (header, "TO LEFT\n"); 398 *pFlags |= HHT_TORIGHT; 399 } 400 401 if (lpPt->y < rect.top) { 402 // TRACE (header, "ABOVE\n"); 403 *pFlags |= HHT_ABOVE; 404 } 405 else if (lpPt->y > rect.bottom) { 406 // TRACE (header, "BELOW\n"); 407 *pFlags |= HHT_BELOW; 408 } 408 409 } 409 410 … … 442 443 443 444 return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY, 444 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);445 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); 445 446 } 446 447 … … 472 473 473 474 return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY, 474 (WPARAM)nmhdr.hdr.idFrom, (LPARAM)&nmhdr);475 (WPARAM)nmhdr.hdr.idFrom, (LPARAM)&nmhdr); 475 476 } 476 477 … … 489 490 490 491 return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY, 491 (WPARAM)nmhdr.hdr.idFrom, (LPARAM)&nmhdr);492 (WPARAM)nmhdr.hdr.idFrom, (LPARAM)&nmhdr); 492 493 } 493 494 … … 509 510 510 511 // TRACE(header, "[iItem=%d]\n", iItem); 511 512 512 513 if ((iItem < 0) || (iItem >= (INT)infoPtr->uNumItem)) 513 514 return FALSE; … … 550 551 HEADER_Refresh (hwnd, hdc); 551 552 ReleaseDC (hwnd, hdc); 552 553 553 554 return TRUE; 554 555 } … … 573 574 574 575 if (!phdi) 575 return FALSE;576 return FALSE; 576 577 if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) 577 578 return FALSE; … … 580 581 581 582 if (phdi->mask == 0) 582 return TRUE;583 return TRUE; 583 584 584 585 lpItem = (HEADER_ITEM*)&infoPtr->items[nItem]; 585 586 if (phdi->mask & HDI_BITMAP) 586 phdi->hbm = lpItem->hbm;587 phdi->hbm = lpItem->hbm; 587 588 588 589 if (phdi->mask & HDI_FORMAT) 589 phdi->fmt = lpItem->fmt;590 phdi->fmt = lpItem->fmt; 590 591 591 592 if (phdi->mask & HDI_WIDTH) 592 phdi->cxy = lpItem->cxy;593 phdi->cxy = lpItem->cxy; 593 594 594 595 if (phdi->mask & HDI_LPARAM) 595 phdi->lParam = lpItem->lParam;596 phdi->lParam = lpItem->lParam; 596 597 597 598 if (phdi->mask & HDI_TEXT) { 598 if (lpItem->pszText != LPSTR_TEXTCALLBACKW)599 lstrcpynWtoA (phdi->pszText, lpItem->pszText, phdi->cchTextMax);600 else601 phdi->pszText = LPSTR_TEXTCALLBACKA;599 if (lpItem->pszText != LPSTR_TEXTCALLBACKW) 600 lstrcpynWtoA (phdi->pszText, lpItem->pszText, MIN(phdi->cchTextMax,lstrlenW(lpItem->pszText))); 601 else 602 phdi->pszText = LPSTR_TEXTCALLBACKA; 602 603 } 603 604 604 605 if (phdi->mask & HDI_IMAGE) 605 phdi->iImage = lpItem->iImage;606 phdi->iImage = lpItem->iImage; 606 607 607 608 if (phdi->mask & HDI_ORDER) 608 phdi->iOrder = lpItem->iOrder;609 phdi->iOrder = lpItem->iOrder; 609 610 610 611 return TRUE; … … 621 622 622 623 if (!phdi) 623 return FALSE;624 return FALSE; 624 625 if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) 625 626 return FALSE; … … 628 629 629 630 if (phdi->mask == 0) 630 return TRUE;631 return TRUE; 631 632 632 633 lpItem = (HEADER_ITEM*)&infoPtr->items[nItem]; 633 634 if (phdi->mask & HDI_BITMAP) 634 phdi->hbm = lpItem->hbm;635 phdi->hbm = lpItem->hbm; 635 636 636 637 if (phdi->mask & HDI_FORMAT) 637 phdi->fmt = lpItem->fmt;638 phdi->fmt = lpItem->fmt; 638 639 639 640 if (phdi->mask & HDI_WIDTH) 640 phdi->cxy = lpItem->cxy;641 phdi->cxy = lpItem->cxy; 641 642 642 643 if (phdi->mask & HDI_LPARAM) 643 phdi->lParam = lpItem->lParam;644 phdi->lParam = lpItem->lParam; 644 645 645 646 if (phdi->mask & HDI_TEXT) { 646 if (lpItem->pszText != LPSTR_TEXTCALLBACKW)647 lstrcpynW (phdi->pszText, lpItem->pszText, phdi->cchTextMax);648 else649 phdi->pszText = LPSTR_TEXTCALLBACKW;647 if (lpItem->pszText != LPSTR_TEXTCALLBACKW) 648 lstrcpynW (phdi->pszText, lpItem->pszText, MIN(phdi->cchTextMax,lstrlenW(lpItem->pszText))); 649 else 650 phdi->pszText = LPSTR_TEXTCALLBACKW; 650 651 } 651 652 652 653 if (phdi->mask & HDI_IMAGE) 653 phdi->iImage = lpItem->iImage;654 phdi->iImage = lpItem->iImage; 654 655 655 656 if (phdi->mask & HDI_ORDER) 656 phdi->iOrder = lpItem->iOrder;657 phdi->iOrder = lpItem->iOrder; 657 658 658 659 return TRUE; … … 720 721 721 722 if ((phdi == NULL) || (nItem < 0)) 722 return -1;723 return -1; 723 724 724 725 if (nItem > infoPtr->uNumItem) … … 752 753 } 753 754 } 754 755 755 756 COMCTL32_Free (oldItems); 756 757 } … … 760 761 761 762 if (phdi->mask & HDI_WIDTH) 762 lpItem->cxy = phdi->cxy;763 lpItem->cxy = phdi->cxy; 763 764 764 765 if (phdi->mask & HDI_TEXT) { 765 if (!phdi->pszText) /* null pointer check */766 phdi->pszText = "";767 if (phdi->pszText != LPSTR_TEXTCALLBACKA) {768 len = lstrlenA (phdi->pszText);769 lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));770 lstrcpyAtoW (lpItem->pszText, phdi->pszText);771 }772 else773 lpItem->pszText = LPSTR_TEXTCALLBACKW;766 if (!phdi->pszText) /* null pointer check */ 767 phdi->pszText = ""; 768 if (phdi->pszText != LPSTR_TEXTCALLBACKA) { 769 len = lstrlenA (phdi->pszText); 770 lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 771 lstrcpyAtoW (lpItem->pszText, phdi->pszText); 772 } 773 else 774 lpItem->pszText = LPSTR_TEXTCALLBACKW; 774 775 } 775 776 776 777 if (phdi->mask & HDI_FORMAT) 777 lpItem->fmt = phdi->fmt;778 lpItem->fmt = phdi->fmt; 778 779 779 780 if (lpItem->fmt == 0) 780 lpItem->fmt = HDF_LEFT;781 lpItem->fmt = HDF_LEFT; 781 782 782 783 if (phdi->mask & HDI_BITMAP) … … 813 814 814 815 if ((phdi == NULL) || (nItem < 0)) 815 return -1;816 return -1; 816 817 817 818 if (nItem > infoPtr->uNumItem) … … 839 840 } 840 841 841 COMCTL32_Free (oldItems);842 COMCTL32_Free (oldItems); 842 843 } 843 844 … … 846 847 847 848 if (phdi->mask & HDI_WIDTH) 848 lpItem->cxy = phdi->cxy;849 lpItem->cxy = phdi->cxy; 849 850 850 851 if (phdi->mask & HDI_TEXT) { 851 WCHAR wide_null_char = 0;852 if (!phdi->pszText) /* null pointer check */853 phdi->pszText = &wide_null_char; 854 if (phdi->pszText != LPSTR_TEXTCALLBACKW) {855 len = lstrlenW (phdi->pszText);856 lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));857 lstrcpyW (lpItem->pszText, phdi->pszText);858 }859 else860 lpItem->pszText = LPSTR_TEXTCALLBACKW;852 WCHAR wide_null_char = 0; 853 if (!phdi->pszText) /* null pointer check */ 854 phdi->pszText = &wide_null_char; 855 if (phdi->pszText != LPSTR_TEXTCALLBACKW) { 856 len = lstrlenW (phdi->pszText); 857 lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 858 lstrcpyW (lpItem->pszText, phdi->pszText); 859 } 860 else 861 lpItem->pszText = LPSTR_TEXTCALLBACKW; 861 862 } 862 863 863 864 if (phdi->mask & HDI_FORMAT) 864 lpItem->fmt = phdi->fmt;865 lpItem->fmt = phdi->fmt; 865 866 866 867 if (lpItem->fmt == 0) 867 lpItem->fmt = HDF_LEFT;868 lpItem->fmt = HDF_LEFT; 868 869 869 870 if (phdi->mask & HDI_BITMAP) … … 947 948 948 949 if (phdi == NULL) 949 return FALSE;950 return FALSE; 950 951 if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) 951 952 return FALSE; … … 954 955 955 956 if (HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGINGA, nItem)) 956 return FALSE;957 return FALSE; 957 958 958 959 lpItem = (HEADER_ITEM*)&infoPtr->items[nItem]; 959 960 if (phdi->mask & HDI_BITMAP) 960 lpItem->hbm = phdi->hbm;961 lpItem->hbm = phdi->hbm; 961 962 962 963 if (phdi->mask & HDI_FORMAT) 963 lpItem->fmt = phdi->fmt;964 lpItem->fmt = phdi->fmt; 964 965 965 966 if (phdi->mask & HDI_LPARAM) 966 lpItem->lParam = phdi->lParam;967 lpItem->lParam = phdi->lParam; 967 968 968 969 if (phdi->mask & HDI_TEXT) { 969 if (phdi->pszText != LPSTR_TEXTCALLBACKA) {970 if (lpItem->pszText) {971 COMCTL32_Free (lpItem->pszText);972 lpItem->pszText = NULL;973 }974 if (phdi->pszText) {975 INT len = lstrlenA (phdi->pszText);976 lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));977 lstrcpyAtoW (lpItem->pszText, phdi->pszText);978 }979 }980 else981 lpItem->pszText = LPSTR_TEXTCALLBACKW;970 if (phdi->pszText != LPSTR_TEXTCALLBACKA) { 971 if (lpItem->pszText) { 972 COMCTL32_Free (lpItem->pszText); 973 lpItem->pszText = NULL; 974 } 975 if (phdi->pszText) { 976 INT len = lstrlenA (phdi->pszText); 977 lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 978 lstrcpyAtoW (lpItem->pszText, phdi->pszText); 979 } 980 } 981 else 982 lpItem->pszText = LPSTR_TEXTCALLBACKW; 982 983 } 983 984 984 985 if (phdi->mask & HDI_WIDTH) 985 lpItem->cxy = phdi->cxy;986 lpItem->cxy = phdi->cxy; 986 987 987 988 if (phdi->mask & HDI_IMAGE) 988 lpItem->iImage = phdi->iImage;989 lpItem->iImage = phdi->iImage; 989 990 990 991 if (phdi->mask & HDI_ORDER) 991 lpItem->iOrder = phdi->iOrder;992 lpItem->iOrder = phdi->iOrder; 992 993 993 994 HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGEDA, nItem); … … 1012 1013 1013 1014 if (phdi == NULL) 1014 return FALSE;1015 return FALSE; 1015 1016 if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) 1016 1017 return FALSE; … … 1019 1020 1020 1021 if (HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGINGA, nItem)) 1021 return FALSE;1022 return FALSE; 1022 1023 1023 1024 lpItem = (HEADER_ITEM*)&infoPtr->items[nItem]; 1024 1025 if (phdi->mask & HDI_BITMAP) 1025 lpItem->hbm = phdi->hbm;1026 lpItem->hbm = phdi->hbm; 1026 1027 1027 1028 if (phdi->mask & HDI_FORMAT) 1028 lpItem->fmt = phdi->fmt;1029 lpItem->fmt = phdi->fmt; 1029 1030 1030 1031 if (phdi->mask & HDI_LPARAM) 1031 lpItem->lParam = phdi->lParam;1032 lpItem->lParam = phdi->lParam; 1032 1033 1033 1034 if (phdi->mask & HDI_TEXT) { 1034 if (phdi->pszText != LPSTR_TEXTCALLBACKW) {1035 if (lpItem->pszText) {1036 COMCTL32_Free (lpItem->pszText);1037 lpItem->pszText = NULL;1038 }1039 if (phdi->pszText) {1040 INT len = lstrlenW (phdi->pszText);1041 lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));1042 lstrcpyW (lpItem->pszText, phdi->pszText);1043 }1044 }1045 else1046 lpItem->pszText = LPSTR_TEXTCALLBACKW;1035 if (phdi->pszText != LPSTR_TEXTCALLBACKW) { 1036 if (lpItem->pszText) { 1037 COMCTL32_Free (lpItem->pszText); 1038 lpItem->pszText = NULL; 1039 } 1040 if (phdi->pszText) { 1041 INT len = lstrlenW (phdi->pszText); 1042 lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1043 lstrcpyW (lpItem->pszText, phdi->pszText); 1044 } 1045 } 1046 else 1047 lpItem->pszText = LPSTR_TEXTCALLBACKW; 1047 1048 } 1048 1049 1049 1050 if (phdi->mask & HDI_WIDTH) 1050 lpItem->cxy = phdi->cxy;1051 lpItem->cxy = phdi->cxy; 1051 1052 1052 1053 if (phdi->mask & HDI_IMAGE) 1053 lpItem->iImage = phdi->iImage;1054 lpItem->iImage = phdi->iImage; 1054 1055 1055 1056 if (phdi->mask & HDI_ORDER) 1056 lpItem->iOrder = phdi->iOrder;1057 lpItem->iOrder = phdi->iOrder; 1057 1058 1058 1059 HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGEDA, nItem); … … 1126 1127 1127 1128 if (infoPtr->items) { 1128 lpItem = (HEADER_ITEM*)infoPtr->items;1129 lpItem = (HEADER_ITEM*)infoPtr->items; 1129 1130 for (nItem = 0; nItem < infoPtr->uNumItem; nItem++, lpItem++) { 1130 if ((lpItem->pszText) && (lpItem->pszText != LPSTR_TEXTCALLBACKW))1131 COMCTL32_Free (lpItem->pszText);1131 if ((lpItem->pszText) && (lpItem->pszText != LPSTR_TEXTCALLBACKW)) 1132 COMCTL32_Free (lpItem->pszText); 1132 1133 } 1133 1134 COMCTL32_Free (infoPtr->items); … … 1135 1136 1136 1137 if (infoPtr->himl) 1137 ImageList_Destroy (infoPtr->himl);1138 ImageList_Destroy (infoPtr->himl); 1138 1139 1139 1140 COMCTL32_Free (infoPtr); … … 1159 1160 INT nItem; 1160 1161 1161 pt.x = (INT)LOWORD(lParam); 1162 pt.x = (INT)LOWORD(lParam); 1162 1163 pt.y = (INT)HIWORD(lParam); 1163 1164 HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem); 1164 1165 1165 1166 if ((GetWindowLongA (hwnd, GWL_STYLE) & HDS_BUTTONS) && (flags == HHT_ONHEADER)) 1166 HEADER_SendHeaderNotify (hwnd, HDN_ITEMDBLCLICKA, nItem);1167 HEADER_SendHeaderNotify (hwnd, HDN_ITEMDBLCLICKA, nItem); 1167 1168 else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) 1168 HEADER_SendHeaderNotify (hwnd, HDN_DIVIDERDBLCLICKA, nItem);1169 HEADER_SendHeaderNotify (hwnd, HDN_DIVIDERDBLCLICKA, nItem); 1169 1170 1170 1171 return 0; … … 1182 1183 HDC hdc; 1183 1184 1184 pt.x = (INT)LOWORD(lParam); 1185 pt.x = (INT)LOWORD(lParam); 1185 1186 pt.y = (INT)HIWORD(lParam); 1186 1187 HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem); 1187 1188 1188 1189 if ((dwStyle & HDS_BUTTONS) && (flags == HHT_ONHEADER)) { 1189 SetCapture (hwnd);1190 infoPtr->bCaptured = TRUE; 1191 infoPtr->bPressed = TRUE;1192 infoPtr->iMoveItem = nItem;1193 1194 infoPtr->items[nItem].bDown = TRUE;1195 1196 /* Send WM_CUSTOMDRAW */1197 hdc = GetDC (hwnd);1198 HEADER_RefreshItem (hwnd, hdc, nItem);1199 ReleaseDC (hwnd, hdc);1200 1201 // TRACE (header, "Pressed item %d!\n", nItem);1202 } 1190 SetCapture (hwnd); 1191 infoPtr->bCaptured = TRUE; 1192 infoPtr->bPressed = TRUE; 1193 infoPtr->iMoveItem = nItem; 1194 1195 infoPtr->items[nItem].bDown = TRUE; 1196 1197 /* Send WM_CUSTOMDRAW */ 1198 hdc = GetDC (hwnd); 1199 HEADER_RefreshItem (hwnd, hdc, nItem); 1200 ReleaseDC (hwnd, hdc); 1201 1202 // TRACE (header, "Pressed item %d!\n", nItem); 1203 } 1203 1204 else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) { 1204 if (!(HEADER_SendHeaderNotify (hwnd, HDN_BEGINTRACKA, nItem))) {1205 SetCapture (hwnd);1206 infoPtr->bCaptured = TRUE; 1207 infoPtr->bTracking = TRUE;1208 infoPtr->iMoveItem = nItem;1209 infoPtr->nOldWidth = infoPtr->items[nItem].cxy;1210 infoPtr->xTrackOffset = infoPtr->items[nItem].rect.right - pt.x;1211 1212 if (!(dwStyle & HDS_FULLDRAG)) {1213 infoPtr->xOldTrack = infoPtr->items[nItem].rect.right;1214 hdc = GetDC (hwnd);1215 HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);1216 ReleaseDC (hwnd, hdc);1217 }1218 1219 // TRACE (header, "Begin tracking item %d!\n", nItem);1220 }1205 if (!(HEADER_SendHeaderNotify (hwnd, HDN_BEGINTRACKA, nItem))) { 1206 SetCapture (hwnd); 1207 infoPtr->bCaptured = TRUE; 1208 infoPtr->bTracking = TRUE; 1209 infoPtr->iMoveItem = nItem; 1210 infoPtr->nOldWidth = infoPtr->items[nItem].cxy; 1211 infoPtr->xTrackOffset = infoPtr->items[nItem].rect.right - pt.x; 1212 1213 if (!(dwStyle & HDS_FULLDRAG)) { 1214 infoPtr->xOldTrack = infoPtr->items[nItem].rect.right; 1215 hdc = GetDC (hwnd); 1216 HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack); 1217 ReleaseDC (hwnd, hdc); 1218 } 1219 1220 // TRACE (header, "Begin tracking item %d!\n", nItem); 1221 } 1221 1222 } 1222 1223 … … 1240 1241 1241 1242 if (infoPtr->bPressed) { 1242 if ((nItem == infoPtr->iMoveItem) && (flags == HHT_ONHEADER)) {1243 infoPtr->items[infoPtr->iMoveItem].bDown = FALSE;1244 hdc = GetDC (hwnd);1245 HEADER_RefreshItem (hwnd, hdc, infoPtr->iMoveItem);1246 ReleaseDC (hwnd, hdc);1247 1248 HEADER_SendClickNotify (hwnd, HDN_ITEMCLICKA, infoPtr->iMoveItem);1249 }1250 // TRACE (header, "Released item %d!\n", infoPtr->iMoveItem);1251 infoPtr->bPressed = FALSE;1243 if ((nItem == infoPtr->iMoveItem) && (flags == HHT_ONHEADER)) { 1244 infoPtr->items[infoPtr->iMoveItem].bDown = FALSE; 1245 hdc = GetDC (hwnd); 1246 HEADER_RefreshItem (hwnd, hdc, infoPtr->iMoveItem); 1247 ReleaseDC (hwnd, hdc); 1248 1249 HEADER_SendClickNotify (hwnd, HDN_ITEMCLICKA, infoPtr->iMoveItem); 1250 } 1251 // TRACE (header, "Released item %d!\n", infoPtr->iMoveItem); 1252 infoPtr->bPressed = FALSE; 1252 1253 } 1253 1254 else if (infoPtr->bTracking) { 1254 // TRACE (header, "End tracking item %d!\n", infoPtr->iMoveItem);1255 infoPtr->bTracking = FALSE;1256 1257 HEADER_SendHeaderNotify (hwnd, HDN_ENDTRACKA, infoPtr->iMoveItem);1258 1259 if (!(dwStyle & HDS_FULLDRAG)) {1260 hdc = GetDC (hwnd);1261 HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);1262 ReleaseDC (hwnd, hdc);1263 if (HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGINGA, infoPtr->iMoveItem))1264 infoPtr->items[infoPtr->iMoveItem].cxy = infoPtr->nOldWidth;1265 else {1266 nWidth = pt.x - infoPtr->items[infoPtr->iMoveItem].rect.left + infoPtr->xTrackOffset;1267 if (nWidth < 0)1268 nWidth = 0;1269 infoPtr->items[infoPtr->iMoveItem].cxy = nWidth;1270 HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGEDA, infoPtr->iMoveItem);1271 }1272 1273 HEADER_SetItemBounds (hwnd);1274 hdc = GetDC (hwnd);1275 HEADER_Refresh (hwnd, hdc);1276 ReleaseDC (hwnd, hdc);1277 }1255 // TRACE (header, "End tracking item %d!\n", infoPtr->iMoveItem); 1256 infoPtr->bTracking = FALSE; 1257 1258 HEADER_SendHeaderNotify (hwnd, HDN_ENDTRACKA, infoPtr->iMoveItem); 1259 1260 if (!(dwStyle & HDS_FULLDRAG)) { 1261 hdc = GetDC (hwnd); 1262 HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack); 1263 ReleaseDC (hwnd, hdc); 1264 if (HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGINGA, infoPtr->iMoveItem)) 1265 infoPtr->items[infoPtr->iMoveItem].cxy = infoPtr->nOldWidth; 1266 else { 1267 nWidth = pt.x - infoPtr->items[infoPtr->iMoveItem].rect.left + infoPtr->xTrackOffset; 1268 if (nWidth < 0) 1269 nWidth = 0; 1270 infoPtr->items[infoPtr->iMoveItem].cxy = nWidth; 1271 HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGEDA, infoPtr->iMoveItem); 1272 } 1273 1274 HEADER_SetItemBounds (hwnd); 1275 hdc = GetDC (hwnd); 1276 HEADER_Refresh (hwnd, hdc); 1277 ReleaseDC (hwnd, hdc); 1278 } 1278 1279 } 1279 1280 1280 1281 if (infoPtr->bCaptured) { 1281 infoPtr->bCaptured = FALSE;1282 ReleaseCapture ();1283 HEADER_SendSimpleNotify (hwnd, NM_RELEASEDCAPTURE);1282 infoPtr->bCaptured = FALSE; 1283 ReleaseCapture (); 1284 HEADER_SendSimpleNotify (hwnd, NM_RELEASEDCAPTURE); 1284 1285 } 1285 1286 … … 1303 1304 1304 1305 if ((dwStyle & HDS_BUTTONS) && (dwStyle & HDS_HOTTRACK)) { 1305 if (flags & (HHT_ONHEADER | HHT_ONDIVIDER | HHT_ONDIVOPEN))1306 infoPtr->iHotItem = nItem;1307 else1308 infoPtr->iHotItem = -1;1309 hdc = GetDC (hwnd);1310 HEADER_Refresh (hwnd, hdc);1311 ReleaseDC (hwnd, hdc);1306 if (flags & (HHT_ONHEADER | HHT_ONDIVIDER | HHT_ONDIVOPEN)) 1307 infoPtr->iHotItem = nItem; 1308 else 1309 infoPtr->iHotItem = -1; 1310 hdc = GetDC (hwnd); 1311 HEADER_Refresh (hwnd, hdc); 1312 ReleaseDC (hwnd, hdc); 1312 1313 } 1313 1314 1314 1315 if (infoPtr->bCaptured) { 1315 if (infoPtr->bPressed) {1316 if ((nItem == infoPtr->iMoveItem) && (flags == HHT_ONHEADER))1317 infoPtr->items[infoPtr->iMoveItem].bDown = TRUE;1318 else1319 infoPtr->items[infoPtr->iMoveItem].bDown = FALSE;1320 hdc = GetDC (hwnd);1321 HEADER_RefreshItem (hwnd, hdc, infoPtr->iMoveItem);1322 ReleaseDC (hwnd, hdc);1323 1324 // TRACE (header, "Moving pressed item %d!\n", infoPtr->iMoveItem);1325 }1326 else if (infoPtr->bTracking) {1327 if (dwStyle & HDS_FULLDRAG) {1328 if (HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGINGA, infoPtr->iMoveItem))1329 infoPtr->items[infoPtr->iMoveItem].cxy = infoPtr->nOldWidth;1330 else {1331 nWidth = pt.x - infoPtr->items[infoPtr->iMoveItem].rect.left + infoPtr->xTrackOffset;1332 if (nWidth < 0)1333 nWidth = 0;1334 infoPtr->items[infoPtr->iMoveItem].cxy = nWidth;1335 HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGEDA,1336 infoPtr->iMoveItem);1337 }1338 HEADER_SetItemBounds (hwnd);1339 hdc = GetDC (hwnd);1340 HEADER_Refresh (hwnd, hdc);1341 ReleaseDC (hwnd, hdc);1342 }1343 else {1344 hdc = GetDC (hwnd);1345 HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);1346 infoPtr->xOldTrack = pt.x + infoPtr->xTrackOffset;1347 if (infoPtr->xOldTrack < infoPtr->items[infoPtr->iMoveItem].rect.left)1348 infoPtr->xOldTrack = infoPtr->items[infoPtr->iMoveItem].rect.left;1349 infoPtr->items[infoPtr->iMoveItem].cxy = 1350 infoPtr->xOldTrack - infoPtr->items[infoPtr->iMoveItem].rect.left;1351 HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);1352 ReleaseDC (hwnd, hdc);1353 }1354 1355 HEADER_SendHeaderNotify (hwnd, HDN_TRACKA, infoPtr->iMoveItem);1356 // TRACE (header, "Tracking item %d!\n", infoPtr->iMoveItem);1357 }1316 if (infoPtr->bPressed) { 1317 if ((nItem == infoPtr->iMoveItem) && (flags == HHT_ONHEADER)) 1318 infoPtr->items[infoPtr->iMoveItem].bDown = TRUE; 1319 else 1320 infoPtr->items[infoPtr->iMoveItem].bDown = FALSE; 1321 hdc = GetDC (hwnd); 1322 HEADER_RefreshItem (hwnd, hdc, infoPtr->iMoveItem); 1323 ReleaseDC (hwnd, hdc); 1324 1325 // TRACE (header, "Moving pressed item %d!\n", infoPtr->iMoveItem); 1326 } 1327 else if (infoPtr->bTracking) { 1328 if (dwStyle & HDS_FULLDRAG) { 1329 if (HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGINGA, infoPtr->iMoveItem)) 1330 infoPtr->items[infoPtr->iMoveItem].cxy = infoPtr->nOldWidth; 1331 else { 1332 nWidth = pt.x - infoPtr->items[infoPtr->iMoveItem].rect.left + infoPtr->xTrackOffset; 1333 if (nWidth < 0) 1334 nWidth = 0; 1335 infoPtr->items[infoPtr->iMoveItem].cxy = nWidth; 1336 HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGEDA, 1337 infoPtr->iMoveItem); 1338 } 1339 HEADER_SetItemBounds (hwnd); 1340 hdc = GetDC (hwnd); 1341 HEADER_Refresh (hwnd, hdc); 1342 ReleaseDC (hwnd, hdc); 1343 } 1344 else { 1345 hdc = GetDC (hwnd); 1346 HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack); 1347 infoPtr->xOldTrack = pt.x + infoPtr->xTrackOffset; 1348 if (infoPtr->xOldTrack < infoPtr->items[infoPtr->iMoveItem].rect.left) 1349 infoPtr->xOldTrack = infoPtr->items[infoPtr->iMoveItem].rect.left; 1350 infoPtr->items[infoPtr->iMoveItem].cxy = 1351 infoPtr->xOldTrack - infoPtr->items[infoPtr->iMoveItem].rect.left; 1352 HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack); 1353 ReleaseDC (hwnd, hdc); 1354 } 1355 1356 HEADER_SendHeaderNotify (hwnd, HDN_TRACKA, infoPtr->iMoveItem); 1357 // TRACE (header, "Tracking item %d!\n", infoPtr->iMoveItem); 1358 } 1358 1359 } 1359 1360 1360 1361 if ((dwStyle & HDS_BUTTONS) && (dwStyle & HDS_HOTTRACK)) { 1361 // FIXME (header, "hot track support!\n");1362 // FIXME (header, "hot track support!\n"); 1362 1363 } 1363 1364 … … 1375 1376 HEADER_Refresh (hwnd, hdc); 1376 1377 if(!wParam) 1377 EndPaint (hwnd, &ps);1378 EndPaint (hwnd, &ps); 1378 1379 return 0; 1379 1380 } … … 1447 1448 { 1448 1449 switch (msg) { 1449 case HDM_CREATEDRAGIMAGE:1450 return HEADER_CreateDragImage (hwnd, wParam);1451 1452 case HDM_DELETEITEM:1453 return HEADER_DeleteItem (hwnd, wParam);1454 1455 case HDM_GETIMAGELIST:1456 return HEADER_GetImageList (hwnd);1457 1458 case HDM_GETITEMA:1459 return HEADER_GetItemA (hwnd, wParam, lParam);1460 1461 case HDM_GETITEMW:1462 return HEADER_GetItemW (hwnd, wParam, lParam);1463 1464 case HDM_GETITEMCOUNT:1465 return HEADER_GetItemCount (hwnd);1466 1467 case HDM_GETITEMRECT:1468 return HEADER_GetItemRect (hwnd, wParam, lParam);1469 1470 /* case HDM_GETORDERARRAY: */1471 1472 case HDM_GETUNICODEFORMAT:1473 return HEADER_GetUnicodeFormat (hwnd);1474 1475 case HDM_HITTEST:1476 return HEADER_HitTest (hwnd, wParam, lParam);1477 1478 case HDM_INSERTITEMA:1479 return HEADER_InsertItemA (hwnd, wParam, lParam);1480 1481 case HDM_INSERTITEMW:1482 return HEADER_InsertItemW (hwnd, wParam, lParam);1483 1484 case HDM_LAYOUT:1485 return HEADER_Layout (hwnd, wParam, lParam);1486 1487 case HDM_SETIMAGELIST:1488 return HEADER_SetImageList (hwnd, wParam, lParam);1489 1490 case HDM_SETITEMA:1491 return HEADER_SetItemA (hwnd, wParam, lParam);1492 1493 case HDM_SETITEMW:1494 return HEADER_SetItemW (hwnd, wParam, lParam);1495 1496 /* case HDM_SETORDERARRAY: */1497 1498 case HDM_SETUNICODEFORMAT:1499 return HEADER_SetUnicodeFormat (hwnd, wParam);1450 case HDM_CREATEDRAGIMAGE: 1451 return HEADER_CreateDragImage (hwnd, wParam); 1452 1453 case HDM_DELETEITEM: 1454 return HEADER_DeleteItem (hwnd, wParam); 1455 1456 case HDM_GETIMAGELIST: 1457 return HEADER_GetImageList (hwnd); 1458 1459 case HDM_GETITEMA: 1460 return HEADER_GetItemA (hwnd, wParam, lParam); 1461 1462 case HDM_GETITEMW: 1463 return HEADER_GetItemW (hwnd, wParam, lParam); 1464 1465 case HDM_GETITEMCOUNT: 1466 return HEADER_GetItemCount (hwnd); 1467 1468 case HDM_GETITEMRECT: 1469 return HEADER_GetItemRect (hwnd, wParam, lParam); 1470 1471 /* case HDM_GETORDERARRAY: */ 1472 1473 case HDM_GETUNICODEFORMAT: 1474 return HEADER_GetUnicodeFormat (hwnd); 1475 1476 case HDM_HITTEST: 1477 return HEADER_HitTest (hwnd, wParam, lParam); 1478 1479 case HDM_INSERTITEMA: 1480 return HEADER_InsertItemA (hwnd, wParam, lParam); 1481 1482 case HDM_INSERTITEMW: 1483 return HEADER_InsertItemW (hwnd, wParam, lParam); 1484 1485 case HDM_LAYOUT: 1486 return HEADER_Layout (hwnd, wParam, lParam); 1487 1488 case HDM_SETIMAGELIST: 1489 return HEADER_SetImageList (hwnd, wParam, lParam); 1490 1491 case HDM_SETITEMA: 1492 return HEADER_SetItemA (hwnd, wParam, lParam); 1493 1494 case HDM_SETITEMW: 1495 return HEADER_SetItemW (hwnd, wParam, lParam); 1496 1497 /* case HDM_SETORDERARRAY: */ 1498 1499 case HDM_SETUNICODEFORMAT: 1500 return HEADER_SetUnicodeFormat (hwnd, wParam); 1500 1501 1501 1502 … … 1527 1528 return HEADER_MouseMove (hwnd, wParam, lParam); 1528 1529 1529 /* case WM_NOTIFYFORMAT: */1530 /* case WM_NOTIFYFORMAT: */ 1530 1531 1531 1532 case WM_PAINT: … … 1542 1543 1543 1544 default: 1544 // if (msg >= WM_USER) 1545 // ERR (header, "unknown msg %04x wp=%04x lp=%08lx\n",1546 // msg, wParam, lParam );1547 return DefWindowProcA (hwnd, msg, wParam, lParam);1545 // if (msg >= WM_USER) 1546 // ERR (header, "unknown msg %04x wp=%04x lp=%08lx\n", 1547 // msg, wParam, lParam ); 1548 return DefWindowProcA (hwnd, msg, wParam, lParam); 1548 1549 } 1549 1550 return 0; … … 1565 1566 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA); 1566 1567 wndClass.lpszClassName = WC_HEADERA; 1567 1568 1568 1569 RegisterClassA (&wndClass); 1569 1570 } … … 1574 1575 { 1575 1576 if (GlobalFindAtomA (WC_HEADERA)) 1576 UnregisterClassA (WC_HEADERA, (HINSTANCE)NULL);1577 } 1578 1577 UnregisterClassA (WC_HEADERA, (HINSTANCE)NULL); 1578 } 1579 -
trunk/src/comctl32/listview.c
r164 r236 5 5 * Copyright 1999 Luc Tourangeau 6 6 * Copyright 1999 Achim Hasenmueller 7 * Copyright 1999 Christoph Bratschi 7 8 * 8 9 * NOTES 9 * Listview control implementation. 10 * Listview control implementation. 10 11 * 11 12 * TODO: … … 17 18 * 18 19 * Data structure: 19 * LISTVIEW_SetItemCount : empty stub 20 * 20 * LISTVIEW_SetItemCount : empty stub 21 * 21 22 * Unicode: 22 23 * LISTVIEW_SetItem32W : no unicode support … … 30 31 * LISTVIEW_GetHotItem : not implemented 31 32 * LISTVIEW_GetHoverTime : not implemented 32 * LISTVIEW_GetISearchString : not implemented 33 * LISTVIEW_GetISearchString : not implemented 33 34 * LISTVIEW_GetBkImage : not implemented 34 35 * LISTVIEW_EditLabel : REPORT (need to implement a timer) … … 36 37 * LISTVIEW_Arrange : empty stub 37 38 * LISTVIEW_ApproximateViewRect : incomplete 38 * LISTVIEW_Scroll : not implemented 39 * LISTVIEW_Scroll : not implemented 39 40 * LISTVIEW_RedrawItems : empty stub 40 41 * LISTVIEW_Update : not completed … … 48 49 49 50 /* 50 * constants 51 * constants 51 52 */ 52 53 … … 74 75 75 76 /* default column width for items in list display mode */ 76 #define DEFAULT_COLUMN_WIDTH 96 77 78 /* 77 #define DEFAULT_COLUMN_WIDTH 96 78 79 /* 79 80 * macros 80 81 */ … … 87 88 #define GETITEMCOUNT(infoPtr) ((infoPtr)->hdpaItems->nItemCount) 88 89 89 /* 90 * forward declarations 90 /* 91 * forward declarations 91 92 */ 92 93 static INT LISTVIEW_HitTestItem(HWND, LPLVHITTESTINFO); … … 127 128 /*** 128 129 * DESCRIPTION: 129 * Update the scrollbars. This functions should be called whenever 130 * Update the scrollbars. This functions should be called whenever 130 131 * the content, size or view changes. 131 * 132 * 132 133 * PARAMETER(S): 133 134 * [I] HWND : window handle … … 138 139 static VOID LISTVIEW_UpdateScroll(HWND hwnd) 139 140 { 140 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 141 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 141 142 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 142 143 UINT uView = lStyle & LVS_TYPEMASK; … … 164 165 scrollInfo.nMax = nHiddenItemCount / nCountPerColumn + 1; 165 166 } 166 167 167 168 scrollInfo.nPos = ListView_GetTopIndex(hwnd) / nCountPerColumn; 168 169 /*scrollInfo.nPage = LISTVIEW_GetCountPerRow(hwnd);*/ … … 175 176 if (lStyle & WS_HSCROLL) 176 177 { 177 ShowScrollBar(hwnd, SB_HORZ, FALSE);178 ShowScrollBar(hwnd, SB_HORZ, FALSE); 178 179 } 179 180 } … … 196 197 /* } */ 197 198 198 /* horizontal scrolling has not been implemented yet! I experienced some 199 /* horizontal scrolling has not been implemented yet! I experienced some 199 200 problems when performing child window scrolling. */ 200 201 } … … 228 229 scrollInfo.nPos = 0; 229 230 } 230 231 231 232 if (nHiddenWidth % nScrollPosWidth == 0) 232 233 { 233 scrollInfo.nMax = nHiddenWidth / nScrollPosWidth; 234 scrollInfo.nMax = nHiddenWidth / nScrollPosWidth; 234 235 } 235 236 else 236 237 { 237 scrollInfo.nMax = nHiddenWidth / nScrollPosWidth + 1; 238 } 239 238 scrollInfo.nMax = nHiddenWidth / nScrollPosWidth + 1; 239 } 240 240 241 scrollInfo.nMin = 0; 241 242 /*scrollInfo.nPage = 10;*/ … … 274 275 if (nHiddenHeight % nScrollPosHeight == 0) 275 276 { 276 scrollInfo.nMax = nHiddenHeight / nScrollPosHeight; 277 scrollInfo.nMax = nHiddenHeight / nScrollPosHeight; 277 278 } 278 279 else 279 280 { 280 scrollInfo.nMax = nHiddenHeight / nScrollPosHeight + 1; 281 scrollInfo.nMax = nHiddenHeight / nScrollPosHeight + 1; 281 282 } 282 283 … … 301 302 * Prints a message for unsupported window styles. 302 303 * A kind of TODO list for window styles. 303 * 304 * 304 305 * PARAMETER(S): 305 306 * [I] LONG : window style … … 354 355 * DESCRIPTION: 355 356 * Aligns the items with the top edge of the window. 356 * 357 * 357 358 * PARAMETER(S): 358 359 * [I] HWND : window handle … … 369 370 RECT rcView; 370 371 INT i; 371 372 372 373 if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 373 374 { 374 375 ZeroMemory(&ptItem, sizeof(POINT)); 375 376 ZeroMemory(&rcView, sizeof(RECT)); 376 377 377 378 if (nListWidth > infoPtr->nItemWidth) 378 379 { … … 384 385 ptItem.y += infoPtr->nItemHeight; 385 386 } 386 387 387 388 ListView_SetItemPosition(hwnd, i, ptItem.x, ptItem.y); 388 389 ptItem.x += infoPtr->nItemWidth; … … 411 412 * DESCRIPTION: 412 413 * Aligns the items with the left edge of the window. 413 * 414 * 414 415 * PARAMETER(S): 415 416 * [I] HWND : window handle … … 426 427 RECT rcView; 427 428 INT i; 428 429 429 430 if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 430 431 { … … 468 469 * DESCRIPTION: 469 470 * Set the bounding rectangle of all the items. 470 * 471 * 471 472 * PARAMETER(S): 472 473 * [I] HWND : window handle … … 482 483 BOOL bResult = FALSE; 483 484 484 // TRACE("(hwnd=%x, left=%d, top=%d, right=%d, bottom=%d)\n", hwnd, 485 // TRACE("(hwnd=%x, left=%d, top=%d, right=%d, bottom=%d)\n", hwnd, 485 486 // lprcView->left, lprcView->top, lprcView->right, lprcView->bottom); 486 487 487 488 if (lprcView != NULL) 488 489 { … … 500 501 * DESCRIPTION: 501 502 * Retrieves the bounding rectangle of all the items. 502 * 503 * 503 504 * PARAMETER(S): 504 505 * [I] HWND : window handle … … 528 529 } 529 530 530 // TRACE("(left=%d, top=%d, right=%d, bottom=%d)\n", 531 // TRACE("(left=%d, top=%d, right=%d, bottom=%d)\n", 531 532 // lprcView->left, lprcView->top, lprcView->right, lprcView->bottom); 532 533 } … … 538 539 * DESCRIPTION: 539 540 * Retrieves the subitem pointer associated with the subitem index. 540 * 541 * 541 542 * PARAMETER(S): 542 543 * [I] HDPA : DPA handle for a specific item … … 547 548 * FAILURE : NULL 548 549 */ 549 static LISTVIEW_SUBITEM* LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems, 550 static LISTVIEW_SUBITEM* LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems, 550 551 INT nSubItem) 551 552 { … … 571 572 * DESCRIPTION: 572 573 * Calculates the width of an item. 573 * 574 * 574 575 * PARAMETER(S): 575 576 * [I] HWND : window handle … … 610 611 { 611 612 for (i = 0; i < GETITEMCOUNT(infoPtr); i++) 612 { 613 { 613 614 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, i); 614 615 nItemWidth = max(nItemWidth, nLabelWidth); 615 616 } 616 617 617 618 /* default label size */ 618 619 if (GETITEMCOUNT(infoPtr) == 0) … … 630 631 /* add padding */ 631 632 nItemWidth += WIDTH_PADDING; 632 633 633 634 if (infoPtr->himlSmall != NULL) 634 635 { … … 643 644 } 644 645 } 645 646 646 647 return nItemWidth; 647 648 } … … 650 651 * DESCRIPTION: 651 652 * Calculates the height of an item. 652 * 653 * 653 654 * PARAMETER(S): 654 655 * [I] HWND : window handle … … 668 669 nItemHeight = infoPtr->iconSpacing.cy; 669 670 } 670 else 671 { 672 TEXTMETRICA tm; 671 else 672 { 673 TEXTMETRICA tm; 673 674 HDC hdc = GetDC(hwnd); 674 675 HFONT hOldFont = SelectObject(hdc, infoPtr->hFont); … … 685 686 * DESCRIPTION: 686 687 * Adds a block of selections. 687 * 688 * PARAMETER(S): 689 * [I] HWND : window handle 690 * [I] INT : item index 688 * 689 * PARAMETER(S): 690 * [I] HWND : window handle 691 * [I] INT : item index 691 692 * 692 693 * RETURN: … … 703 704 lvItem.state = LVIS_SELECTED; 704 705 lvItem.stateMask= LVIS_SELECTED; 705 706 706 707 for (i = nFirst; i <= nLast; i++) 707 708 { 708 709 ListView_SetItemState(hwnd, i, &lvItem); 709 710 } 710 711 711 712 LISTVIEW_SetItemFocus(hwnd, nItem); 712 713 infoPtr->nSelectionMark = nItem; … … 716 717 * DESCRIPTION: 717 718 * Adds a single selection. 718 * 719 * PARAMETER(S): 720 * [I] HWND : window handle 721 * [I] INT : item index 719 * 720 * PARAMETER(S): 721 * [I] HWND : window handle 722 * [I] INT : item index 722 723 * 723 724 * RETURN: … … 741 742 * DESCRIPTION: 742 743 * Selects or unselects an item. 743 * 744 * PARAMETER(S): 745 * [I] HWND : window handle 746 * [I] INT : item index 747 * 748 * RETURN: 749 * SELECT: TRUE 744 * 745 * PARAMETER(S): 746 * [I] HWND : window handle 747 * [I] INT : item index 748 * 749 * RETURN: 750 * SELECT: TRUE 750 751 * UNSELECT : FALSE 751 752 */ … … 779 780 /*** 780 781 * DESCRIPTION: 781 * Selects items based on view coorddiantes. 782 * 783 * PARAMETER(S): 784 * [I] HWND : window handle 785 * [I] RECT : selection rectangle 782 * Selects items based on view coorddiantes. 783 * 784 * PARAMETER(S): 785 * [I] HWND : window handle 786 * [I] RECT : selection rectangle 786 787 * 787 788 * RETURN: … … 816 817 * DESCRIPTION: 817 818 * Sets a single group selection. 818 * 819 * PARAMETER(S): 820 * [I] HWND : window handle 821 * [I] INT : item index 822 * 823 * RETURN: 824 * None 819 * 820 * PARAMETER(S): 821 * [I] HWND : window handle 822 * [I] INT : item index 823 * 824 * RETURN: 825 * None 825 826 */ 826 827 static VOID LISTVIEW_SetGroupSelection(HWND hwnd, INT nItem) … … 836 837 INT nLast = max(infoPtr->nSelectionMark, nItem); 837 838 lvItem.stateMask = LVIS_SELECTED; 838 839 839 840 for (i = 0; i <= GETITEMCOUNT(infoPtr); i++) 840 841 { … … 871 872 * DESCRIPTION: 872 873 * Manages the item focus. 873 * 874 * PARAMETER(S): 875 * [I] HWND : window handle 876 * [I] INT : item index 874 * 875 * PARAMETER(S): 876 * [I] HWND : window handle 877 * [I] INT : item index 877 878 * 878 879 * RETURN: … … 891 892 ZeroMemory(&lvItem, sizeof(LVITEMA)); 892 893 lvItem.stateMask = LVIS_FOCUSED; 893 ListView_SetItemState(hwnd, infoPtr->nFocusedItem, &lvItem); 894 ListView_SetItemState(hwnd, infoPtr->nFocusedItem, &lvItem); 894 895 895 896 lvItem.state = LVIS_FOCUSED; … … 900 901 ListView_EnsureVisible(hwnd, nItem, FALSE); 901 902 } 902 903 return bResult; 903 904 return bResult; 904 905 } 905 906 … … 907 908 * DESCRIPTION: 908 909 * Sets a single selection. 909 * 910 * PARAMETER(S): 911 * [I] HWND : window handle 912 * [I] INT : item index 910 * 911 * PARAMETER(S): 912 * [I] HWND : window handle 913 * [I] INT : item index 913 914 * 914 915 * RETURN: … … 932 933 ZeroMemory(&lvItem, sizeof(LVITEMA)); 933 934 lvItem.stateMask = LVIS_FOCUSED; 934 ListView_SetItemState(hwnd, infoPtr->nFocusedItem, &lvItem); 935 935 ListView_SetItemState(hwnd, infoPtr->nFocusedItem, &lvItem); 936 936 937 lvItem.state = LVIS_SELECTED | LVIS_FOCUSED; 937 938 lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED; … … 945 946 * DESCRIPTION: 946 947 * Set selection(s) with keyboard. 947 * 948 * PARAMETER(S): 949 * [I] HWND : window handle 950 * [I] INT : item index 948 * 949 * PARAMETER(S): 950 * [I] HWND : window handle 951 * [I] INT : item index 951 952 * 952 953 * RETURN: … … 967 968 { 968 969 bResult = TRUE; 969 LISTVIEW_SetSelection(hwnd, nItem); 970 LISTVIEW_SetSelection(hwnd, nItem); 970 971 ListView_EnsureVisible(hwnd, nItem, FALSE); 971 972 } … … 975 976 { 976 977 bResult = TRUE; 977 LISTVIEW_SetGroupSelection(hwnd, nItem); 978 LISTVIEW_SetGroupSelection(hwnd, nItem); 978 979 } 979 980 else if (wCtrl) … … 984 985 { 985 986 bResult = TRUE; 986 LISTVIEW_SetSelection(hwnd, nItem); 987 LISTVIEW_SetSelection(hwnd, nItem); 987 988 ListView_EnsureVisible(hwnd, nItem, FALSE); 988 989 } … … 992 993 return bResult; 993 994 } 994 995 995 996 /*** 996 997 * DESCRIPTION: 997 998 * Selects an item based on coordinates. 998 * 999 * 999 1000 * PARAMETER(S): 1000 1001 * [I] HWND : window handle … … 1010 1011 RECT rcItem; 1011 1012 INT i; 1012 1013 1013 1014 for (i = 0; i < GETITEMCOUNT(infoPtr); i++) 1014 1015 { … … 1029 1030 * DESCRIPTION: 1030 1031 * Removes all selection states. 1031 * 1032 * PARAMETER(S): 1033 * [I] HWND : window handle 1034 * [I] INT : item index 1032 * 1033 * PARAMETER(S): 1034 * [I] HWND : window handle 1035 * [I] INT : item index 1035 1036 * 1036 1037 * RETURN: … … 1055 1056 * DESCRIPTION: 1056 1057 * Removes a column. 1057 * 1058 * 1058 1059 * PARAMETER(S): 1059 1060 * [IO] HDPA : dynamic pointer array handle … … 1081 1082 } 1082 1083 } 1083 1084 1084 1085 return bResult; 1085 1086 } … … 1088 1089 * DESCRIPTION: 1089 1090 * Removes a subitem at a given position. 1090 * 1091 * 1091 1092 * PARAMETER(S): 1092 1093 * [IO] HDPA : dynamic pointer array handle … … 1110 1111 { 1111 1112 /* free string */ 1112 if ((lpSubItem->pszText != NULL) && 1113 if ((lpSubItem->pszText != NULL) && 1113 1114 (lpSubItem->pszText != LPSTR_TEXTCALLBACKA)) 1114 1115 { 1115 1116 COMCTL32_Free(lpSubItem->pszText); 1116 1117 } 1117 1118 1118 1119 /* free item */ 1119 1120 COMCTL32_Free(lpSubItem); … … 1130 1131 } 1131 1132 } 1132 } 1133 1133 } 1134 1134 1135 return TRUE; 1135 1136 } … … 1138 1139 * DESCRIPTION: 1139 1140 * Compares the item information. 1140 * 1141 * PARAMETER(S): 1142 * [I] LISTVIEW_ITEM *: destination item 1143 * [I] LPLVITEM : source item 1141 * 1142 * PARAMETER(S): 1143 * [I] LISTVIEW_ITEM *: destination item 1144 * [I] LPLVITEM : source item 1144 1145 * 1145 1146 * RETURN: … … 1155 1156 if (lpLVItem->mask & LVIF_STATE) 1156 1157 { 1157 if ((lpItem->state & lpLVItem->stateMask) != 1158 if ((lpItem->state & lpLVItem->stateMask) != 1158 1159 (lpLVItem->state & lpLVItem->stateMask)) 1159 1160 { 1160 uChanged |= LVIF_STATE; 1161 uChanged |= LVIF_STATE; 1161 1162 } 1162 1163 } … … 1166 1167 if (lpItem->iImage != lpLVItem->iImage) 1167 1168 { 1168 uChanged |= LVIF_IMAGE; 1169 } 1170 } 1171 1169 uChanged |= LVIF_IMAGE; 1170 } 1171 } 1172 1172 1173 if (lpLVItem->mask & LVIF_PARAM) 1173 1174 { 1174 1175 if (lpItem->lParam != lpLVItem->lParam) 1175 1176 { 1176 uChanged |= LVIF_PARAM; 1177 } 1178 } 1179 1177 uChanged |= LVIF_PARAM; 1178 } 1179 } 1180 1180 1181 if (lpLVItem->mask & LVIF_INDENT) 1181 1182 { 1182 1183 if (lpItem->iIndent != lpLVItem->iIndent) 1183 1184 { 1184 uChanged |= LVIF_INDENT; 1185 } 1186 } 1187 1188 if (lpLVItem->mask & LVIF_TEXT) 1189 { 1190 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 1185 uChanged |= LVIF_INDENT; 1186 } 1187 } 1188 1189 if (lpLVItem->mask & LVIF_TEXT) 1190 { 1191 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 1191 1192 { 1192 1193 if (lpItem->pszText != LPSTR_TEXTCALLBACKA) 1193 1194 { 1194 uChanged |= LVIF_TEXT; 1195 uChanged |= LVIF_TEXT; 1195 1196 } 1196 1197 } … … 1199 1200 if (lpItem->pszText == LPSTR_TEXTCALLBACKA) 1200 1201 { 1201 uChanged |= LVIF_TEXT; 1202 } 1203 else1204 {1205 if (lpLVItem->pszText)1206 {1207 if (lpItem->pszText)1208 {1209 if (strcmp(lpLVItem->pszText, lpItem->pszText) != 0)1210 {1211 uChanged |= LVIF_TEXT;1212 }1213 }1214 else1215 {1216 uChanged |= LVIF_TEXT;1217 }1218 }1219 else1220 {1221 if (lpItem->pszText)1222 {1223 uChanged |= LVIF_TEXT;1224 }1225 }1226 }1202 uChanged |= LVIF_TEXT; 1203 } 1204 else 1205 { 1206 if (lpLVItem->pszText) 1207 { 1208 if (lpItem->pszText) 1209 { 1210 if (strcmp(lpLVItem->pszText, lpItem->pszText) != 0) 1211 { 1212 uChanged |= LVIF_TEXT; 1213 } 1214 } 1215 else 1216 { 1217 uChanged |= LVIF_TEXT; 1218 } 1219 } 1220 else 1221 { 1222 if (lpItem->pszText) 1223 { 1224 uChanged |= LVIF_TEXT; 1225 } 1226 } 1227 } 1227 1228 } 1228 1229 } … … 1234 1235 * DESCRIPTION: 1235 1236 * Initializes item attributes. 1236 * 1237 * PARAMETER(S): 1238 * [I] HWND : window handle 1239 * [O] LISTVIEW_ITEM *: destination item 1240 * [I] LPLVITEM : source item 1237 * 1238 * PARAMETER(S): 1239 * [I] HWND : window handle 1240 * [O] LISTVIEW_ITEM *: destination item 1241 * [I] LPLVITEM : source item 1241 1242 * 1242 1243 * RETURN: … … 1244 1245 * FAILURE : FALSE 1245 1246 */ 1246 static BOOL LISTVIEW_InitItem(HWND hwnd, LISTVIEW_ITEM *lpItem, 1247 static BOOL LISTVIEW_InitItem(HWND hwnd, LISTVIEW_ITEM *lpItem, 1247 1248 LPLVITEMA lpLVItem) 1248 1249 { … … 1253 1254 { 1254 1255 bResult = TRUE; 1255 1256 1256 1257 if (lpLVItem->mask & LVIF_STATE) 1257 1258 { … … 1259 1260 lpItem->state |= (lpLVItem->state & lpLVItem->stateMask); 1260 1261 } 1261 1262 1262 1263 if (lpLVItem->mask & LVIF_IMAGE) 1263 1264 { 1264 1265 lpItem->iImage = lpLVItem->iImage; 1265 1266 } 1266 1267 1267 1268 if (lpLVItem->mask & LVIF_PARAM) 1268 1269 { 1269 1270 lpItem->lParam = lpLVItem->lParam; 1270 1271 } 1271 1272 1272 1273 if (lpLVItem->mask & LVIF_INDENT) 1273 1274 { … … 1275 1276 } 1276 1277 1277 if (lpLVItem->mask & LVIF_TEXT) 1278 { 1279 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 1278 if (lpLVItem->mask & LVIF_TEXT) 1279 { 1280 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 1280 1281 { 1281 1282 if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) … … 1284 1285 } 1285 1286 1286 if ((lpItem->pszText != NULL) && 1287 if ((lpItem->pszText != NULL) && 1287 1288 (lpItem->pszText != LPSTR_TEXTCALLBACKA)) 1288 1289 { 1289 1290 COMCTL32_Free(lpItem->pszText); 1290 1291 } 1291 1292 1292 1293 lpItem->pszText = LPSTR_TEXTCALLBACKA; 1293 1294 } 1294 else 1295 else 1295 1296 { 1296 1297 if (lpItem->pszText == LPSTR_TEXTCALLBACKA) … … 1298 1299 lpItem->pszText = NULL; 1299 1300 } 1300 1301 1301 1302 bResult = Str_SetPtrA(&lpItem->pszText, lpLVItem->pszText); 1302 1303 } … … 1323 1324 * FAILURE : FALSE 1324 1325 */ 1325 static BOOL LISTVIEW_InitSubItem(HWND hwnd, LISTVIEW_SUBITEM *lpSubItem, 1326 static BOOL LISTVIEW_InitSubItem(HWND hwnd, LISTVIEW_SUBITEM *lpSubItem, 1326 1327 LPLVITEMA lpLVItem) 1327 1328 { 1328 1329 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 1329 1330 BOOL bResult = FALSE; 1330 1331 1331 1332 if ((lpSubItem != NULL) && (lpLVItem != NULL)) 1332 1333 { … … 1342 1343 lpSubItem->iImage = lpLVItem->iImage; 1343 1344 } 1344 1345 if (lpLVItem->mask & LVIF_TEXT) 1346 { 1347 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 1345 1346 if (lpLVItem->mask & LVIF_TEXT) 1347 { 1348 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 1348 1349 { 1349 1350 if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) 1350 1351 { 1351 1352 return FALSE; 1352 } 1353 1354 if ((lpSubItem->pszText != NULL) && 1353 } 1354 1355 if ((lpSubItem->pszText != NULL) && 1355 1356 (lpSubItem->pszText != LPSTR_TEXTCALLBACKA)) 1356 1357 { 1357 1358 COMCTL32_Free(lpSubItem->pszText); 1358 1359 } 1359 1360 1360 1361 lpSubItem->pszText = LPSTR_TEXTCALLBACKA; 1361 1362 } 1362 else 1363 else 1363 1364 { 1364 1365 if (lpSubItem->pszText == LPSTR_TEXTCALLBACKA) … … 1366 1367 lpSubItem->pszText = NULL; 1367 1368 } 1368 1369 1369 1370 bResult = Str_SetPtrA(&lpSubItem->pszText, lpLVItem->pszText); 1370 1371 } … … 1379 1380 * DESCRIPTION: 1380 1381 * Adds a subitem at a given position (column index). 1381 * 1382 * PARAMETER(S): 1383 * [I] HWND : window handle 1384 * [I] LPLVITEM : new subitem atttributes 1382 * 1383 * PARAMETER(S): 1384 * [I] HWND : window handle 1385 * [I] LPLVITEM : new subitem atttributes 1385 1386 * 1386 1387 * RETURN: … … 1406 1407 if (LISTVIEW_InitSubItem(hwnd, lpSubItem, lpLVItem) != FALSE) 1407 1408 { 1408 nPosition = LISTVIEW_FindInsertPosition(hdpaSubItems, 1409 nPosition = LISTVIEW_FindInsertPosition(hdpaSubItems, 1409 1410 lpSubItem->iSubItem); 1410 1411 nItem = DPA_InsertPtr(hdpaSubItems, nPosition, lpSubItem); … … 1412 1413 { 1413 1414 bResult = TRUE; 1414 } 1415 } 1416 } 1417 } 1418 } 1419 1420 /* cleanup if unsuccessful */ 1415 } 1416 } 1417 } 1418 } 1419 } 1420 1421 /* cleanup if unsuccessful */ 1421 1422 if ((bResult == FALSE) && (lpSubItem != NULL)) 1422 1423 { 1423 1424 COMCTL32_Free(lpSubItem); 1424 1425 } 1425 1426 1426 1427 return bResult; 1427 1428 } … … 1430 1431 * DESCRIPTION: 1431 1432 * Finds the dpa insert position (array index). 1432 * 1433 * 1433 1434 * PARAMETER(S): 1434 1435 * [I] HWND : window handle … … 1453 1454 return i; 1454 1455 } 1455 } 1456 } 1456 1457 } 1457 1458 … … 1462 1463 * DESCRIPTION: 1463 1464 * Retrieves a listview subitem at a given position (column index). 1464 * 1465 * 1465 1466 * PARAMETER(S): 1466 1467 * [I] HWND : window handle … … 1488 1489 { 1489 1490 return NULL; 1490 } 1491 } 1492 } 1493 1491 } 1492 } 1493 } 1494 1494 1495 return NULL; 1495 1496 } … … 1498 1499 * DESCRIPTION: 1499 1500 * Sets item attributes. 1500 * 1501 * PARAMETER(S): 1502 * [I] HWND : window handle 1503 * [I] LPLVITEM : new item atttributes 1501 * 1502 * PARAMETER(S): 1503 * [I] HWND : window handle 1504 * [I] LPLVITEM : new item atttributes 1504 1505 * 1505 1506 * RETURN: … … 1540 1541 nmlv.uOldState = lpItem->state & lpLVItem->stateMask; 1541 1542 } 1542 1543 1543 1544 nmlv.uChanged = uChanged; 1544 1545 nmlv.iItem = lpLVItem->iItem; … … 1571 1572 * DESCRIPTION: 1572 1573 * Sets subitem attributes. 1573 * 1574 * PARAMETER(S): 1575 * [I] HWND : window handle 1576 * [I] LPLVITEM : new subitem atttributes 1574 * 1575 * PARAMETER(S): 1576 * [I] HWND : window handle 1577 * [I] LPLVITEM : new subitem atttributes 1577 1578 * 1578 1579 * RETURN: … … 1606 1607 bResult = LISTVIEW_AddSubItem(hwnd, lpLVItem); 1607 1608 } 1608 1609 1609 1610 InvalidateRect(hwnd, NULL, FALSE); 1610 } 1611 } 1611 1612 } 1612 1613 } … … 1619 1620 * DESCRIPTION: 1620 1621 * Retrieves the index of the item at coordinate (0, 0) of the client area. 1621 * 1622 * 1622 1623 * PARAMETER(S): 1623 1624 * [I] HWND : window handle … … 1636 1637 scrollInfo.cbSize = sizeof(SCROLLINFO); 1637 1638 scrollInfo.fMask = SIF_POS; 1638 1639 1639 1640 if (uView == LVS_LIST) 1640 1641 { … … 1657 1658 } 1658 1659 } 1659 1660 1660 1661 return nItem; 1661 1662 } … … 1664 1665 * DESCRIPTION: 1665 1666 * Draws a subitem. 1666 * 1667 * 1667 1668 * PARAMETER(S): 1668 1669 * [I] HWND : window handle … … 1675 1676 * None 1676 1677 */ 1677 static VOID LISTVIEW_DrawSubItem(HWND hwnd, HDC hdc, INT nItem, INT nSubItem, 1678 static VOID LISTVIEW_DrawSubItem(HWND hwnd, HDC hdc, INT nItem, INT nSubItem, 1678 1679 RECT rcItem) 1679 1680 { 1680 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 1681 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 1681 1682 CHAR szDispText[DISP_TEXT_SIZE]; 1682 1683 LVITEMA lvItem; 1683 1684 1684 TRACE("(hwnd=%x, hdc=%x, nItem=%d, nSubItem=%d\n", hwnd, hdc, 1685 TRACE("(hwnd=%x, hdc=%x, nItem=%d, nSubItem=%d\n", hwnd, hdc, 1685 1686 nItem, nSubItem); 1686 1687 … … 1697 1698 SetBkColor(hdc, infoPtr->clrTextBk); 1698 1699 SetTextColor(hdc, infoPtr->clrText); 1699 1700 ExtTextOutA(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 1700 1701 ExtTextOutA(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 1701 1702 &rcItem, lvItem.pszText, lstrlenA(lvItem.pszText), NULL); 1702 1703 } … … 1706 1707 * DESCRIPTION: 1707 1708 * Draws an item. 1708 * 1709 * 1709 1710 * PARAMETER(S): 1710 1711 * [I] HWND : window handle … … 1718 1719 static VOID LISTVIEW_DrawItem(HWND hwnd, HDC hdc, INT nItem, RECT rcItem) 1719 1720 { 1720 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 1721 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 1721 1722 CHAR szDispText[DISP_TEXT_SIZE]; 1722 1723 INT nLabelWidth; … … 1741 1742 if (infoPtr->himlState != NULL) 1742 1743 { 1743 UINT uStateImage = (lvItem.state & LVIS_STATEIMAGEMASK) >> 12; 1744 UINT uStateImage = (lvItem.state & LVIS_STATEIMAGEMASK) >> 12; 1744 1745 if (uStateImage != 0) 1745 1746 { 1746 ImageList_Draw(infoPtr->himlState, uStateImage - 1, hdc, rcItem.left, 1747 ImageList_Draw(infoPtr->himlState, uStateImage - 1, hdc, rcItem.left, 1747 1748 rcItem.top, ILD_NORMAL); 1748 1749 } 1749 1750 rcItem.left += infoPtr->iconSize.cx; 1751 } 1752 1750 1751 rcItem.left += infoPtr->iconSize.cx; 1752 } 1753 1753 1754 /* small icons */ 1754 1755 if (infoPtr->himlSmall != NULL) … … 1757 1758 { 1758 1759 ImageList_SetBkColor(infoPtr->himlSmall, CLR_NONE); 1759 ImageList_Draw(infoPtr->himlSmall, lvItem.iImage, hdc, rcItem.left, 1760 ImageList_Draw(infoPtr->himlSmall, lvItem.iImage, hdc, rcItem.left, 1760 1761 rcItem.top, ILD_SELECTED); 1761 1762 } … … 1763 1764 { 1764 1765 ImageList_SetBkColor(infoPtr->himlSmall, CLR_NONE); 1765 ImageList_Draw(infoPtr->himlSmall, lvItem.iImage, hdc, rcItem.left, 1766 ImageList_Draw(infoPtr->himlSmall, lvItem.iImage, hdc, rcItem.left, 1766 1767 rcItem.top, ILD_NORMAL); 1767 1768 } 1768 1769 rcItem.left += infoPtr->iconSize.cx; 1769 1770 rcItem.left += infoPtr->iconSize.cx; 1770 1771 } 1771 1772 1772 1773 if ((lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus != FALSE)) 1773 1774 { 1774 /* set item colors */ 1775 /* set item colors */ 1775 1776 dwBkColor = SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT)); 1776 1777 dwTextColor = SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); … … 1778 1779 nMixMode = SetROP2(hdc, R2_XORPEN); 1779 1780 } 1780 else if ((GetWindowLongA(hwnd, GWL_STYLE) & LVS_SHOWSELALWAYS) && 1781 else if ((GetWindowLongA(hwnd, GWL_STYLE) & LVS_SHOWSELALWAYS) && 1781 1782 (lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus == FALSE)) 1782 1783 { … … 1794 1795 nMixMode = SetROP2(hdc, R2_COPYPEN); 1795 1796 } 1796 1797 1797 1798 nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText); 1798 1799 if (rcItem.left + nLabelWidth < rcItem.right) … … 1800 1801 rcItem.right = rcItem.left + nLabelWidth; 1801 1802 } 1802 1803 /* draw label */ 1804 ExtTextOutA(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 1803 1804 /* draw label */ 1805 ExtTextOutA(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 1805 1806 &rcItem, lvItem.pszText, lstrlenA(lvItem.pszText), NULL); 1806 1807 1807 1808 if ((lvItem.state & LVIS_FOCUSED) && (infoPtr->bFocus == TRUE)) 1808 1809 { 1809 Rectangle(hdc, rcItem.left, rcItem.top, rcItem.right, rcItem.bottom); 1810 Rectangle(hdc, rcItem.left, rcItem.top, rcItem.right, rcItem.bottom); 1810 1811 } 1811 1812 … … 1821 1822 * DESCRIPTION: 1822 1823 * Draws an item when in large icon display mode. 1823 * 1824 * 1824 1825 * PARAMETER(S): 1825 1826 * [I] HWND : window handle … … 1834 1835 static VOID LISTVIEW_DrawLargeItem(HWND hwnd, HDC hdc, INT nItem, RECT rcItem) 1835 1836 { 1836 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 1837 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 1837 1838 CHAR szDispText[DISP_TEXT_SIZE]; 1838 1839 INT nDrawPosX = rcItem.left; … … 1842 1843 1843 1844 TRACE("(hwnd=%x, hdc=%x, nItem=%d, left=%d, top=%d, right=%d, \ 1844 bottom=%d)\n", hwnd, hdc, nItem, rcItem.left, rcItem.top, rcItem.right, 1845 bottom=%d)\n", hwnd, hdc, nItem, rcItem.left, rcItem.top, rcItem.right, 1845 1846 rcItem.bottom); 1846 1847 … … 1857 1858 if (lvItem.state & LVIS_SELECTED) 1858 1859 { 1859 /* set item colors */ 1860 /* set item colors */ 1860 1861 SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT)); 1861 1862 SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); … … 1878 1879 if (lvItem.state & LVIS_SELECTED) 1879 1880 { 1880 ImageList_Draw(infoPtr->himlNormal, lvItem.iImage, hdc, nDrawPosX, 1881 ImageList_Draw(infoPtr->himlNormal, lvItem.iImage, hdc, nDrawPosX, 1881 1882 rcItem.top, ILD_SELECTED); 1882 1883 } 1883 1884 else 1884 1885 { 1885 ImageList_Draw(infoPtr->himlNormal, lvItem.iImage, hdc, nDrawPosX, 1886 ImageList_Draw(infoPtr->himlNormal, lvItem.iImage, hdc, nDrawPosX, 1886 1887 rcItem.top, ILD_NORMAL); 1887 1888 } 1888 1889 } 1889 1890 1890 rcItem.top += infoPtr->iconSize.cy + ICON_BOTTOM_PADDING; 1891 rcItem.top += infoPtr->iconSize.cy + ICON_BOTTOM_PADDING; 1891 1892 nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText); 1892 1893 nDrawPosX = infoPtr->iconSpacing.cx - nLabelWidth; … … 1902 1903 } 1903 1904 1904 /* draw label */ 1905 /* draw label */ 1905 1906 GetTextMetricsA(hdc, &tm); 1906 rcItem.bottom = rcItem.top + tm.tmHeight + HEIGHT_PADDING; 1907 ExtTextOutA(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 1907 rcItem.bottom = rcItem.top + tm.tmHeight + HEIGHT_PADDING; 1908 ExtTextOutA(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 1908 1909 &rcItem, lvItem.pszText, lstrlenA(lvItem.pszText), NULL); 1909 1910 1910 1911 if (lvItem.state & LVIS_FOCUSED) 1911 1912 { 1912 Rectangle(hdc, rcItem.left, rcItem.top, rcItem.right, rcItem.bottom); 1913 Rectangle(hdc, rcItem.left, rcItem.top, rcItem.right, rcItem.bottom); 1913 1914 } 1914 1915 } … … 1917 1918 * DESCRIPTION: 1918 1919 * Draws listview items when in report display mode. 1919 * 1920 * PARAMETER(S): 1921 * [I] HWND : window handle 1922 * [I] HDC : device context handle 1920 * 1921 * PARAMETER(S): 1922 * [I] HWND : window handle 1923 * [I] HDC : device context handle 1923 1924 * 1924 1925 * RETURN: … … 1952 1953 if (j == 0) 1953 1954 { 1954 LISTVIEW_DrawItem(hwnd, hdc, nItem, rcItem); 1955 } 1956 else 1955 LISTVIEW_DrawItem(hwnd, hdc, nItem, rcItem); 1956 } 1957 else 1957 1958 { 1958 1959 LISTVIEW_DrawSubItem(hwnd, hdc, nItem, j, rcItem); 1959 1960 } 1960 1961 } 1961 1962 1962 1963 nDrawPosY += infoPtr->nItemHeight; 1963 1964 } … … 1967 1968 * DESCRIPTION: 1968 1969 * Retrieves the number of items that can fit vertically in the client area. 1969 * 1970 * 1970 1971 * PARAMETER(S): 1971 1972 * [I] HWND : window handle … … 2002 2003 /*** 2003 2004 * DESCRIPTION: 2004 * Retrieves the number of items that can fit horizontally in the client 2005 * Retrieves the number of items that can fit horizontally in the client 2005 2006 * area. 2006 * 2007 * 2007 2008 * PARAMETER(S): 2008 2009 * [I] HWND : window handle … … 2031 2032 /*** 2032 2033 * DESCRIPTION: 2033 * Retrieves the number of columns needed to display all the items when in 2034 * Retrieves the number of columns needed to display all the items when in 2034 2035 * list display mode. 2035 * 2036 * 2036 2037 * PARAMETER(S): 2037 2038 * [I] HWND : window handle … … 2040 2041 * Number of columns. 2041 2042 */ 2042 static INT LISTVIEW_GetColumnCount( hwnd)2043 static INT LISTVIEW_GetColumnCount(HWND hwnd) 2043 2044 { 2044 2045 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); … … 2059 2060 2060 2061 return nColumnCount; 2061 } 2062 2062 } 2063 2063 2064 2064 2065 /*** 2065 2066 * DESCRIPTION: 2066 2067 * Draws listview items when in list display mode. 2067 * 2068 * PARAMETER(S): 2069 * [I] HWND : window handle 2070 * [I] HDC : device context handle 2068 * 2069 * PARAMETER(S): 2070 * [I] HWND : window handle 2071 * [I] HDC : device context handle 2071 2072 * 2072 2073 * RETURN: … … 2081 2082 INT nColumnCount; 2082 2083 INT nCountPerColumn; 2083 2084 2084 2085 /* get number of fully visible columns */ 2085 2086 nColumnCount = LISTVIEW_GetColumnCount(hwnd); … … 2106 2107 * DESCRIPTION: 2107 2108 * Draws listview items when in icon or small icon display mode. 2108 * 2109 * PARAMETER(S): 2110 * [I] HWND : window handle 2111 * [I] HDC : device context handle 2109 * 2110 * PARAMETER(S): 2111 * [I] HWND : window handle 2112 * [I] HDC : device context handle 2112 2113 * 2113 2114 * RETURN: … … 2128 2129 ptPosition.x += ptOrigin.x; 2129 2130 ptPosition.y += ptOrigin.y; 2130 2131 2131 2132 if (ptPosition.y + infoPtr->nItemHeight > infoPtr->rcList.top) 2132 2133 { … … 2159 2160 * DESCRIPTION: 2160 2161 * Draws listview items. 2161 * 2162 * PARAMETER(S): 2163 * [I] HWND : window handle 2164 * [I] HDC : device context handle 2162 * 2163 * PARAMETER(S): 2164 * [I] HWND : window handle 2165 * [I] HDC : device context handle 2165 2166 * 2166 2167 * RETURN: … … 2182 2183 2183 2184 /* select transparent brush (for drawing the focus box) */ 2184 SelectObject(hdc, GetStockObject(NULL_BRUSH)); 2185 SelectObject(hdc, GetStockObject(NULL_BRUSH)); 2185 2186 2186 2187 if (uView == LVS_LIST) 2187 2188 { 2188 LISTVIEW_RefreshList(hwnd, hdc); 2189 LISTVIEW_RefreshList(hwnd, hdc); 2189 2190 } 2190 2191 else if (uView == LVS_REPORT) … … 2204 2205 SelectObject(hdc, hOldFont); 2205 2206 SelectObject(hdc, hOldPen); 2206 2207 2207 2208 /* delete pen */ 2208 2209 DeleteObject(hPen); … … 2213 2214 * DESCRIPTION: 2214 2215 * Calculates the approximate width and height of a given number of items. 2215 * 2216 * 2216 2217 * PARAMETER(S): 2217 2218 * [I] HWND : window handle … … 2223 2224 * Returns a DWORD. The width in the low word and the height in high word. 2224 2225 */ 2225 static LRESULT LISTVIEW_ApproximateViewRect(HWND hwnd, INT nItemCount, 2226 static LRESULT LISTVIEW_ApproximateViewRect(HWND hwnd, INT nItemCount, 2226 2227 WORD wWidth, WORD wHeight) 2227 2228 { … … 2259 2260 nItemCountPerColumn = 1; 2260 2261 } 2261 2262 2262 2263 if (nItemCount % nItemCountPerColumn != 0) 2263 2264 { … … 2289 2290 /* TO DO */ 2290 2291 } 2291 2292 2292 2293 return dwViewRect; 2293 2294 } … … 2296 2297 * DESCRIPTION: 2297 2298 * Arranges listview items in icon display mode. 2298 * 2299 * 2299 2300 * PARAMETER(S): 2300 2301 * [I] HWND : window handle … … 2307 2308 static LRESULT LISTVIEW_Arrange(HWND hwnd, INT nAlignCode) 2308 2309 { 2309 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 2310 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 2310 2311 BOOL bResult = FALSE; 2311 2312 … … 2337 2338 * DESCRIPTION: 2338 2339 * Removes all listview items and subitems. 2339 * 2340 * 2340 2341 * PARAMETER(S): 2341 2342 * [I] HWND : window handle … … 2366 2367 /* initialize memory */ 2367 2368 ZeroMemory(&nmlv, sizeof(NMLISTVIEW)); 2368 2369 2369 2370 /* send LVN_DELETEALLITEMS notification */ 2370 2371 nmlv.hdr.hwndFrom = hwnd; … … 2373 2374 nmlv.iItem = -1; 2374 2375 2375 /* verify if subsequent LVN_DELETEITEM notifications should be 2376 /* verify if subsequent LVN_DELETEITEM notifications should be 2376 2377 suppressed */ 2377 2378 bSuppress = ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv); … … 2388 2389 { 2389 2390 /* free subitem string */ 2390 if ((lpSubItem->pszText != NULL) && 2391 if ((lpSubItem->pszText != NULL) && 2391 2392 (lpSubItem->pszText != LPSTR_TEXTCALLBACKA)) 2392 2393 { 2393 2394 COMCTL32_Free(lpSubItem->pszText); 2394 2395 } 2395 2396 2396 2397 /* free subitem */ 2397 2398 COMCTL32_Free(lpSubItem); 2398 } 2399 } 2400 2399 } 2400 } 2401 2401 2402 lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0); 2402 2403 if (lpItem != NULL) … … 2412 2413 2413 2414 /* free item string */ 2414 if ((lpItem->pszText != NULL) && 2415 if ((lpItem->pszText != NULL) && 2415 2416 (lpItem->pszText != LPSTR_TEXTCALLBACKA)) 2416 2417 { 2417 2418 COMCTL32_Free(lpItem->pszText); 2418 2419 } 2419 2420 2420 2421 /* free item */ 2421 2422 COMCTL32_Free(lpItem); 2422 2423 } 2423 2424 2424 2425 DPA_Destroy(hdpaSubItems); 2425 2426 } … … 2428 2429 /* reinitialize listview memory */ 2429 2430 bResult = DPA_DeleteAllPtrs(infoPtr->hdpaItems); 2430 2431 2431 2432 /* align items (set position of each item) */ 2432 2433 if ((uView == LVS_ICON) || (uView == LVS_SMALLICON)) … … 2441 2442 } 2442 2443 } 2443 2444 2444 2445 LISTVIEW_UpdateScroll(hwnd); 2445 2446 … … 2447 2448 InvalidateRect(hwnd, NULL, TRUE); 2448 2449 } 2449 2450 2450 2451 return bResult; 2451 2452 } … … 2454 2455 * DESCRIPTION: 2455 2456 * Removes a column from the listview control. 2456 * 2457 * 2457 2458 * PARAMETER(S): 2458 2459 * [I] HWND : window handle … … 2468 2469 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 2469 2470 BOOL bResult = FALSE; 2470 2471 2471 2472 if (Header_DeleteItem(infoPtr->hwndHeader, nColumn) != FALSE) 2472 2473 { … … 2490 2491 * DESCRIPTION: 2491 2492 * Removes an item from the listview control. 2492 * 2493 * PARAMETER(S): 2494 * [I] HWND : window handle 2495 * [I] INT : item index 2493 * 2494 * PARAMETER(S): 2495 * [I] HWND : window handle 2496 * [I] INT : item index 2496 2497 * 2497 2498 * RETURN: … … 2528 2529 { 2529 2530 /* free item string */ 2530 if ((lpSubItem->pszText != NULL) && 2531 if ((lpSubItem->pszText != NULL) && 2531 2532 (lpSubItem->pszText != LPSTR_TEXTCALLBACKA)) 2532 2533 { 2533 2534 COMCTL32_Free(lpSubItem->pszText); 2534 2535 } 2535 2536 2536 2537 /* free item */ 2537 2538 COMCTL32_Free(lpSubItem); 2538 } 2539 } 2540 2539 } 2540 } 2541 2541 2542 lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0); 2542 2543 if (lpItem != NULL) … … 2548 2549 nmlv.iItem = nItem; 2549 2550 nmlv.lParam = lpItem->lParam; 2550 SendMessageA(GetParent(hwnd), WM_NOTIFY, (WPARAM)lCtrlId, 2551 SendMessageA(GetParent(hwnd), WM_NOTIFY, (WPARAM)lCtrlId, 2551 2552 (LPARAM)&nmlv); 2552 2553 2553 2554 /* free item string */ 2554 if ((lpItem->pszText != NULL) && 2555 if ((lpItem->pszText != NULL) && 2555 2556 (lpItem->pszText != LPSTR_TEXTCALLBACKA)) 2556 2557 { 2557 2558 COMCTL32_Free(lpItem->pszText); 2558 2559 } 2559 2560 2560 2561 /* free item */ 2561 2562 COMCTL32_Free(lpItem); 2562 2563 } 2563 2564 2564 2565 bResult = DPA_Destroy(hdpaSubItems); 2565 2566 } … … 2583 2584 InvalidateRect(hwnd, NULL, TRUE); 2584 2585 } 2585 2586 2586 2587 return bResult; 2587 2588 } … … 2592 2593 * DESCRIPTION: 2593 2594 * Ensures the specified item is visible, scrolling into view if necessary. 2594 * 2595 * 2595 2596 * PARAMETER(S): 2596 2597 * [I] HWND : window handle … … 2637 2638 rcItem.left += infoPtr->rcList.left; 2638 2639 } 2639 2640 2640 2641 if (rcItem.left % nScrollPosWidth == 0) 2641 2642 { … … 2646 2647 scrollInfo.nPos += rcItem.left / nScrollPosWidth - 1; 2647 2648 } 2648 2649 2649 2650 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 2650 2651 } … … 2678 2679 } 2679 2680 } 2680 2681 2681 2682 if (rcItem.top < infoPtr->rcList.top) 2682 2683 { … … 2686 2687 if (uView == LVS_REPORT) 2687 2688 { 2688 rcItem.top -= infoPtr->rcList.top; 2689 rcItem.top -= infoPtr->rcList.top; 2689 2690 nScrollPosHeight = infoPtr->nItemHeight; 2690 2691 } … … 2703 2704 scrollInfo.nPos += rcItem.top / nScrollPosHeight - 1; 2704 2705 } 2705 2706 2706 2707 SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE); 2707 2708 } … … 2731 2732 scrollInfo.nPos += rcItem.bottom / nScrollPosHeight + 1; 2732 2733 } 2733 2734 2734 2735 SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE); 2735 2736 } 2736 2737 } 2737 2738 } 2738 2739 2739 2740 return TRUE; 2740 2741 } … … 2743 2744 * DESCRIPTION: 2744 2745 * Retrieves the nearest item, given a position and a direction. 2745 * 2746 * 2746 2747 * PARAMETER(S): 2747 2748 * [I] HWND : window handle … … 2765 2766 lvHitTestInfo.pt.x += pt.x; 2766 2767 lvHitTestInfo.pt.y += pt.y; 2767 2768 2768 2769 do 2769 { 2770 { 2770 2771 if (vkDirection == VK_DOWN) 2771 2772 { 2772 2773 lvHitTestInfo.pt.y += infoPtr->nItemHeight; 2773 } 2774 } 2774 2775 else if (vkDirection == VK_UP) 2775 2776 { … … 2799 2800 2800 2801 return nItem; 2801 } 2802 } 2802 2803 2803 2804 /*** 2804 2805 * DESCRIPTION: 2805 2806 * Searches for an item with specific characteristics. 2806 * 2807 * 2807 2808 * PARAMETER(S): 2808 2809 * [I] HWND : window handle 2809 2810 * [I] INT : base item index 2810 2811 * [I] LPLVFINDINFO : item information to look for 2811 * 2812 * 2812 2813 * RETURN: 2813 2814 * SUCCESS : index of item 2814 2815 * FAILURE : -1 2815 2816 */ 2816 static LRESULT LISTVIEW_FindItem(HWND hwnd, INT nStart, 2817 static LRESULT LISTVIEW_FindItem(HWND hwnd, INT nStart, 2817 2818 LPLVFINDINFO lpFindInfo) 2818 2819 { … … 2833 2834 lvItem.mask |= LVIF_PARAM; 2834 2835 } 2835 2836 2836 2837 if (lpFindInfo->flags & LVFI_STRING) 2837 2838 { … … 2865 2866 if (lpFindInfo->flags & LVFI_NEARESTXY) 2866 2867 { 2867 nItem = LISTVIEW_GetNearestItem(hwnd, ptItem, 2868 nItem = LISTVIEW_GetNearestItem(hwnd, ptItem, 2868 2869 lpFindInfo->vkDirection); 2869 2870 if (nItem != -1) … … 2880 2881 nItem++; 2881 2882 } 2882 2883 2883 2884 lvItem.iItem = nItem; 2884 2885 lvItem.iSubItem = 0; … … 2898 2899 } 2899 2900 } 2900 2901 2901 2902 if (lvItem.mask & LVIF_PARAM) 2902 2903 { … … 2904 2905 continue; 2905 2906 } 2906 2907 2907 2908 return nItem; 2908 2909 } … … 2918 2919 { 2919 2920 return -1; 2920 } 2921 } 2922 } 2923 2924 return -1; 2921 } 2922 } 2923 } 2924 2925 return -1; 2925 2926 } 2926 2927 … … 2928 2929 * DESCRIPTION: 2929 2930 * Retrieves the background color of the listview control. 2930 * 2931 * 2931 2932 * PARAMETER(S): 2932 2933 * [I] HWND : window handle … … 2945 2946 * DESCRIPTION: 2946 2947 * Retrieves the background image of the listview control. 2947 * 2948 * 2948 2949 * PARAMETER(S): 2949 2950 * [I] HWND : window handle … … 2963 2964 * DESCRIPTION: 2964 2965 * Retrieves the callback mask. 2965 * 2966 * 2966 2967 * PARAMETER(S): 2967 2968 * [I] HWND : window handle … … 2980 2981 * DESCRIPTION: 2981 2982 * Retrieves column attributes. 2982 * 2983 * 2983 2984 * PARAMETER(S): 2984 2985 * [I] HWND : window handle … … 2995 2996 HDITEMA hdi; 2996 2997 BOOL bResult = FALSE; 2997 2998 2998 2999 if (lpColumn != NULL) 2999 3000 { 3000 3001 /* initialize memory */ 3001 3002 ZeroMemory(&hdi, sizeof(HDITEMA)); 3002 3003 3003 3004 if (lpColumn->mask & LVCF_FMT) 3004 3005 { … … 3029 3030 if (bResult != FALSE) 3030 3031 { 3031 if (lpColumn->mask & LVCF_FMT) 3032 if (lpColumn->mask & LVCF_FMT) 3032 3033 { 3033 3034 lpColumn->fmt = 0; … … 3056 3057 lpColumn->cx = hdi.cxy; 3057 3058 } 3058 3059 3059 3060 if ((lpColumn->mask & LVCF_TEXT) && (lpColumn->pszText) && (hdi.pszText)) 3060 3061 { 3061 lstrcpynA (lpColumn->pszText, hdi.pszText, lpColumn->cchTextMax);3062 lstrcpynA (lpColumn->pszText, hdi.pszText, MIN(lpColumn->cchTextMax,lstrlenA(hdi.pszText))); 3062 3063 } 3063 3064 … … 3083 3084 * DESCRIPTION: 3084 3085 * Retrieves the column width. 3085 * 3086 * 3086 3087 * PARAMETER(S): 3087 3088 * [I] HWND : window handle … … 3090 3091 * RETURN: 3091 3092 * SUCCESS : column width 3092 * FAILURE : zero 3093 * FAILURE : zero 3093 3094 */ 3094 3095 static LRESULT LISTVIEW_GetColumnWidth(HWND hwnd, INT nColumn) … … 3119 3120 /*** 3120 3121 * DESCRIPTION: 3121 * In list or report display mode, retrieves the number of items that can fit 3122 * vertically in the visible area. In icon or small icon display mode, 3122 * In list or report display mode, retrieves the number of items that can fit 3123 * vertically in the visible area. In icon or small icon display mode, 3123 3124 * retrieves the total number of visible items. 3124 * 3125 * 3125 3126 * PARAMETER(S): 3126 3127 * [I] HWND : window handle … … 3139 3140 if (infoPtr->rcList.right > infoPtr->nItemWidth) 3140 3141 { 3141 nItemCount = LISTVIEW_GetCountPerRow(hwnd) * 3142 nItemCount = LISTVIEW_GetCountPerRow(hwnd) * 3142 3143 LISTVIEW_GetCountPerColumn(hwnd); 3143 3144 } … … 3161 3162 * DESCRIPTION: 3162 3163 * Retrieves the handle to the header control. 3163 * 3164 * 3164 3165 * PARAMETER(S): 3165 3166 * [I] HWND : window handle … … 3182 3183 * DESCRIPTION: 3183 3184 * Retrieves an image list handle. 3184 * 3185 * PARAMETER(S): 3186 * [I] HWND : window handle 3187 * [I] INT : image list identifier 3188 * 3185 * 3186 * PARAMETER(S): 3187 * [I] HWND : window handle 3188 * [I] INT : image list identifier 3189 * 3189 3190 * RETURN: 3190 3191 * SUCCESS : image list handle … … 3196 3197 HIMAGELIST himl = NULL; 3197 3198 3198 switch (nImageList) 3199 switch (nImageList) 3199 3200 { 3200 3201 case LVSIL_NORMAL: … … 3217 3218 * DESCRIPTION: 3218 3219 * Retrieves item attributes. 3219 * 3220 * 3220 3221 * PARAMETER(S): 3221 3222 * [I] HWND : window handle 3222 3223 * [IO] LPLVITEMA : item info 3223 * 3224 * RETURN: 3225 * SUCCESS : TRUE 3224 * 3225 * RETURN: 3226 * SUCCESS : TRUE 3226 3227 * FAILURE : FALSE 3227 3228 */ … … 3257 3258 dispInfo.item.mask |= LVIF_IMAGE; 3258 3259 } 3259 3260 if ((lpItem->pszText == LPSTR_TEXTCALLBACKA) && 3260 3261 if ((lpItem->pszText == LPSTR_TEXTCALLBACKA) && 3261 3262 (lpLVItem->mask & LVIF_TEXT)) 3262 3263 { … … 3266 3267 dispInfo.item.cchTextMax = lpLVItem->cchTextMax; 3267 3268 } 3268 3269 3269 3270 if ((infoPtr->uCallbackMask != 0) && (lpLVItem->mask & LVIF_STATE)) 3270 { 3271 { 3271 3272 dispInfo.item.mask |= LVIF_STATE; 3272 dispInfo.item.stateMask = infoPtr->uCallbackMask; 3273 dispInfo.item.stateMask = infoPtr->uCallbackMask; 3273 3274 } 3274 3275 3275 3276 if (dispInfo.item.mask != 0) 3276 3277 { … … 3283 3284 ListView_Notify(GetParent(hwnd), lCtrlId, &dispInfo); 3284 3285 } 3285 3286 3286 3287 if (dispInfo.item.mask & LVIF_IMAGE) 3287 3288 { … … 3292 3293 lpLVItem->iImage = lpItem->iImage; 3293 3294 } 3294 3295 3295 3296 if (dispInfo.item.mask & LVIF_TEXT) 3296 3297 { … … 3305 3306 lpLVItem->pszText = lpItem->pszText; 3306 3307 } 3307 3308 3308 3309 if (dispInfo.item.mask & LVIF_STATE) 3309 3310 { 3310 3311 lpLVItem->state = lpItem->state; 3311 3312 lpLVItem->state &= ~dispInfo.item.stateMask; 3312 lpLVItem->state |= (dispInfo.item.state & 3313 lpLVItem->state |= (dispInfo.item.state & 3313 3314 dispInfo.item.stateMask); 3314 3315 } … … 3322 3323 lpLVItem->lParam = lpItem->lParam; 3323 3324 } 3324 3325 3325 3326 if (lpLVItem->mask & LVIF_INDENT) 3326 3327 { … … 3330 3331 else 3331 3332 { 3332 lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, 3333 lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, 3333 3334 lpLVItem->iSubItem); 3334 3335 if (lpSubItem != NULL) … … 3339 3340 dispInfo.item.mask |= LVIF_IMAGE; 3340 3341 } 3341 3342 if ((lpSubItem->pszText == LPSTR_TEXTCALLBACKA) && 3342 3343 if ((lpSubItem->pszText == LPSTR_TEXTCALLBACKA) && 3343 3344 (lpLVItem->mask & LVIF_TEXT)) 3344 3345 { 3345 3346 dispInfo.item.mask |= LVIF_TEXT; 3346 ZeroMemory(lpLVItem->pszText, 3347 ZeroMemory(lpLVItem->pszText, 3347 3348 sizeof(CHAR)*lpLVItem->cchTextMax); 3348 3349 dispInfo.item.pszText = lpLVItem->pszText; … … 3356 3357 dispInfo.item.mask |= LVIF_IMAGE; 3357 3358 } 3358 3359 3359 3360 if (lpLVItem->mask & LVIF_TEXT) 3360 3361 { 3361 3362 dispInfo.item.mask |= LVIF_TEXT; 3362 ZeroMemory(lpLVItem->pszText, 3363 ZeroMemory(lpLVItem->pszText, 3363 3364 sizeof(CHAR)*lpLVItem->cchTextMax); 3364 3365 dispInfo.item.pszText = lpLVItem->pszText; … … 3416 3417 * DESCRIPTION: 3417 3418 * Retrieves the number of items in the listview control. 3418 * 3419 * PARAMETER(S): 3420 * [I] HWND : window handle 3421 * 3419 * 3420 * PARAMETER(S): 3421 * [I] HWND : window handle 3422 * 3422 3423 * RETURN: 3423 3424 * Number of items. … … 3433 3434 * DESCRIPTION: 3434 3435 * Retrieves the position (upper-left) of the listview control item. 3435 * 3436 * 3436 3437 * PARAMETER(S): 3437 3438 * [I] HWND : window handle … … 3443 3444 * FAILURE : FALSE 3444 3445 */ 3445 static BOOL LISTVIEW_GetItemPosition(HWND hwnd, INT nItem, 3446 static BOOL LISTVIEW_GetItemPosition(HWND hwnd, INT nItem, 3446 3447 LPPOINT lpptPosition) 3447 3448 { … … 3454 3455 INT nRow; 3455 3456 3456 TRACE("(hwnd=%x,nItem=%d,lpptPosition=%p)\n", hwnd, nItem, 3457 TRACE("(hwnd=%x,nItem=%d,lpptPosition=%p)\n", hwnd, nItem, 3457 3458 lpptPosition); 3458 3459 3459 if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr)) && 3460 if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr)) && 3460 3461 (lpptPosition != NULL)) 3461 3462 { … … 3476 3477 { 3477 3478 lpptPosition->x = (nItem / nCountPerColumn -1) * infoPtr->nItemWidth; 3478 lpptPosition->y = (nRow + nCountPerColumn) * infoPtr->nItemHeight; 3479 lpptPosition->y = (nRow + nCountPerColumn) * infoPtr->nItemHeight; 3479 3480 } 3480 3481 } … … 3489 3490 bResult = TRUE; 3490 3491 lpptPosition->x = REPORT_MARGINX; 3491 lpptPosition->y = ((nItem - ListView_GetTopIndex(hwnd)) * 3492 lpptPosition->y = ((nItem - ListView_GetTopIndex(hwnd)) * 3492 3493 infoPtr->nItemHeight) + infoPtr->rcList.top; 3493 3494 } … … 3507 3508 } 3508 3509 } 3509 3510 3510 3511 return bResult; 3511 3512 } … … 3514 3515 * DESCRIPTION: 3515 3516 * Retrieves the bounding rectangle for a listview control item. 3516 * 3517 * 3517 3518 * PARAMETER(S): 3518 3519 * [I] HWND : window handle 3519 3520 * [I] INT : item index 3520 3521 * [IO] LPRECT : bounding rectangle coordinates 3521 * 3522 * 3522 3523 * RETURN: 3523 3524 * SUCCESS : TRUE … … 3538 3539 3539 3540 TRACE("(hwnd=%x, nItem=%d, lprc=%p)\n", hwnd, nItem, lprc); 3540 3541 3541 3542 if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr)) && (lprc != NULL)) 3542 3543 { 3543 3544 if (ListView_GetItemPosition(hwnd, nItem, &ptItem) != FALSE) 3544 3545 { 3545 switch(lprc->left) 3546 { 3547 case LVIR_ICON: 3546 switch(lprc->left) 3547 { 3548 case LVIR_ICON: 3548 3549 if (uView == LVS_ICON) 3549 3550 { … … 3556 3557 lprc->top = ptItem.y + ptOrigin.y; 3557 3558 lprc->right = lprc->left + infoPtr->iconSize.cx; 3558 lprc->bottom = (lprc->top + infoPtr->iconSize.cy + 3559 lprc->bottom = (lprc->top + infoPtr->iconSize.cy + 3559 3560 ICON_BOTTOM_PADDING + ICON_TOP_PADDING); 3560 3561 } … … 3572 3573 if (infoPtr->himlState != NULL) 3573 3574 lprc->left += infoPtr->iconSize.cx; 3574 3575 3575 3576 if (infoPtr->himlSmall != NULL) 3576 3577 lprc->right = lprc->left + infoPtr->iconSize.cx; … … 3579 3580 } 3580 3581 } 3581 else 3582 else 3582 3583 { 3583 3584 bResult = TRUE; … … 3590 3591 lprc->left += infoPtr->iconSize.cx; 3591 3592 } 3592 3593 3593 3594 if (infoPtr->himlSmall != NULL) 3594 3595 { … … 3602 3603 break; 3603 3604 3604 case LVIR_LABEL: 3605 case LVIR_LABEL: 3605 3606 if (uView == LVS_ICON) 3606 3607 { … … 3624 3625 lprc->right = lprc->left + infoPtr->iconSpacing.cx - 1; 3625 3626 } 3626 3627 3627 3628 hdc = GetDC(hwnd); 3628 3629 hOldFont = SelectObject(hdc, infoPtr->hFont); … … 3631 3632 SelectObject(hdc, hOldFont); 3632 3633 ReleaseDC(hwnd, hdc); 3633 } 3634 } 3634 3635 } 3635 3636 } … … 3639 3640 { 3640 3641 bResult = TRUE; 3641 nMaxWidth = lprc->left = ptItem.x + ptOrigin.x; 3642 nMaxWidth = lprc->left = ptItem.x + ptOrigin.x; 3642 3643 lprc->top = ptItem.y + ptOrigin.y; 3643 3644 lprc->bottom = lprc->top + infoPtr->nItemHeight; 3644 3645 3645 3646 if (infoPtr->himlState != NULL) 3646 3647 { 3647 3648 lprc->left += infoPtr->iconSize.cx; 3648 3649 } 3649 3650 3650 3651 if (infoPtr->himlSmall != NULL) 3651 3652 { 3652 3653 lprc->left += infoPtr->iconSize.cx; 3653 3654 } 3654 3655 3655 3656 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 3656 3657 if (lprc->left + nLabelWidth < nMaxWidth + infoPtr->nItemWidth) … … 3667 3668 { 3668 3669 bResult = TRUE; 3669 lprc->left = ptItem.x; 3670 lprc->left = ptItem.x; 3670 3671 lprc->top = ptItem.y; 3671 3672 lprc->bottom = lprc->top + infoPtr->nItemHeight; … … 3686 3687 3687 3688 case LVIR_BOUNDS: 3688 if (uView == LVS_ICON)3689 {3690 if (infoPtr->himlNormal != NULL)3691 {3692 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE)3693 {3694 bResult = TRUE;3695 lprc->left = ptItem.x + ptOrigin.x;3696 lprc->top = ptItem.y + ptOrigin.y;3697 lprc->right = lprc->left + infoPtr->iconSpacing.cx;3698 lprc->bottom = lprc->top + infoPtr->iconSpacing.cy;3699 }3700 }3701 }3702 else if (uView == LVS_SMALLICON)3703 {3704 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE)3705 {3706 bResult = TRUE;3707 lprc->left = ptItem.x + ptOrigin.x;3708 lprc->right = lprc->left;3709 lprc->top = ptItem.y + ptOrigin.y;3710 lprc->bottom = lprc->top + infoPtr->nItemHeight;3711 if (infoPtr->himlState != NULL)3712 lprc->right += infoPtr->iconSize.cx;3713 if (infoPtr->himlSmall != NULL)3714 lprc->right += infoPtr->iconSize.cx;3715 lprc->right += LISTVIEW_GetLabelWidth(hwnd, nItem);3716 }3717 }3718 else3719 {3720 bResult = TRUE;3721 lprc->left = ptItem.x;3722 lprc->right = lprc->left;3723 lprc->top = ptItem.y;3724 lprc->bottom = lprc->top + infoPtr->nItemHeight;3725 3726 if (infoPtr->himlState != NULL)3727 {3728 lprc->right += infoPtr->iconSize.cx;3729 }3730 3731 if (infoPtr->himlSmall != NULL)3732 {3733 lprc->right += infoPtr->iconSize.cx;3734 }3735 3736 lprc->right += LISTVIEW_GetLabelWidth(hwnd, nItem);3737 }3738 break;3739 3740 case LVIR_SELECTBOUNDS:3741 3689 if (uView == LVS_ICON) 3742 3690 { … … 3751 3699 lprc->bottom = lprc->top + infoPtr->iconSpacing.cy; 3752 3700 } 3753 } 3701 } 3754 3702 } 3755 3703 else if (uView == LVS_SMALLICON) … … 3758 3706 { 3759 3707 bResult = TRUE; 3760 lprc->left = ptItem.x + ptOrigin.x; 3708 lprc->left = ptItem.x + ptOrigin.x; 3709 lprc->right = lprc->left; 3761 3710 lprc->top = ptItem.y + ptOrigin.y; 3762 3711 lprc->bottom = lprc->top + infoPtr->nItemHeight; 3763 3712 if (infoPtr->himlState != NULL) 3713 lprc->right += infoPtr->iconSize.cx; 3714 if (infoPtr->himlSmall != NULL) 3715 lprc->right += infoPtr->iconSize.cx; 3716 lprc->right += LISTVIEW_GetLabelWidth(hwnd, nItem); 3717 } 3718 } 3719 else 3720 { 3721 bResult = TRUE; 3722 lprc->left = ptItem.x; 3723 lprc->right = lprc->left; 3724 lprc->top = ptItem.y; 3725 lprc->bottom = lprc->top + infoPtr->nItemHeight; 3726 3727 if (infoPtr->himlState != NULL) 3728 { 3729 lprc->right += infoPtr->iconSize.cx; 3730 } 3731 3732 if (infoPtr->himlSmall != NULL) 3733 { 3734 lprc->right += infoPtr->iconSize.cx; 3735 } 3736 3737 lprc->right += LISTVIEW_GetLabelWidth(hwnd, nItem); 3738 } 3739 break; 3740 3741 case LVIR_SELECTBOUNDS: 3742 if (uView == LVS_ICON) 3743 { 3744 if (infoPtr->himlNormal != NULL) 3745 { 3746 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE) 3747 { 3748 bResult = TRUE; 3749 lprc->left = ptItem.x + ptOrigin.x; 3750 lprc->top = ptItem.y + ptOrigin.y; 3751 lprc->right = lprc->left + infoPtr->iconSpacing.cx; 3752 lprc->bottom = lprc->top + infoPtr->iconSpacing.cy; 3753 } 3754 } 3755 } 3756 else if (uView == LVS_SMALLICON) 3757 { 3758 if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE) 3759 { 3760 bResult = TRUE; 3761 lprc->left = ptItem.x + ptOrigin.x; 3762 lprc->top = ptItem.y + ptOrigin.y; 3763 lprc->bottom = lprc->top + infoPtr->nItemHeight; 3764 3764 3765 if (infoPtr->himlState != NULL) 3765 3766 { 3766 3767 lprc->left += infoPtr->iconSize.cx; 3767 3768 } 3768 3769 3769 3770 lprc->right = lprc->left; 3770 3771 3771 3772 if (infoPtr->himlSmall != NULL) 3772 3773 { 3773 3774 lprc->right += infoPtr->iconSize.cx; 3774 3775 } 3775 3776 3776 3777 lprc->right += LISTVIEW_GetLabelWidth(hwnd, nItem); 3777 3778 } … … 3780 3781 { 3781 3782 bResult = TRUE; 3782 lprc->left = ptItem.x; 3783 lprc->left = ptItem.x; 3783 3784 lprc->top = ptItem.y; 3784 3785 lprc->bottom = lprc->top + infoPtr->nItemHeight; … … 3788 3789 lprc->left += infoPtr->iconSize.cx; 3789 3790 } 3790 3791 3791 3792 lprc->right = lprc->left; 3792 3793 3793 3794 if (infoPtr->himlSmall != NULL) 3794 3795 { … … 3802 3803 } 3803 3804 } 3804 3805 3805 3806 return bResult; 3806 3807 } … … 3809 3810 * DESCRIPTION: 3810 3811 * Retrieves the width of a label. 3811 * 3812 * PARAMETER(S): 3813 * [I] HWND : window handle 3814 * 3812 * 3813 * PARAMETER(S): 3814 * [I] HWND : window handle 3815 * 3815 3816 * RETURN: 3816 3817 * SUCCESS : string width (in pixels) … … 3832 3833 if (ListView_GetItemA(hwnd, &lvItem) != FALSE) 3833 3834 { 3834 nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText); 3835 } 3836 3835 nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText); 3836 } 3837 3837 3838 return nLabelWidth; 3838 3839 } … … 3841 3842 * DESCRIPTION: 3842 3843 * Retrieves the spacing between listview control items. 3843 * 3844 * PARAMETER(S): 3845 * [I] HWND : window handle 3846 * [I] BOOL : flag for small or large icon 3844 * 3845 * PARAMETER(S): 3846 * [I] HWND : window handle 3847 * [I] BOOL : flag for small or large icon 3847 3848 * 3848 3849 * RETURN: … … 3862 3863 /* TODO: need to store width of smallicon item */ 3863 3864 lResult = MAKELONG(0, infoPtr->nItemHeight); 3864 } 3865 3865 } 3866 3866 3867 return lResult; 3867 3868 } … … 3870 3871 * DESCRIPTION: 3871 3872 * Retrieves the state of a listview control item. 3872 * 3873 * 3873 3874 * PARAMETER(S): 3874 3875 * [I] HWND : window handle 3875 3876 * [I] INT : item index 3876 3877 * [I] UINT : state mask 3877 * 3878 * 3878 3879 * RETURN: 3879 3880 * State specified by the mask. … … 3902 3903 /*** 3903 3904 * DESCRIPTION: 3904 * Retrieves the text of a listview control item or subitem. 3905 * 3905 * Retrieves the text of a listview control item or subitem. 3906 * 3906 3907 * PARAMETER(S): 3907 3908 * [I] HWND : window handle 3908 3909 * [I] INT : item index 3909 3910 * [IO] LPLVITEMA : item information 3910 * 3911 * 3911 3912 * RETURN: 3912 3913 * SUCCESS : string length … … 3917 3918 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 3918 3919 INT nLength = 0; 3919 3920 3920 3921 if (lpLVItem != NULL) 3921 3922 { … … 3937 3938 * DESCRIPTION: 3938 3939 * Searches for an item based on properties + relationships. 3939 * 3940 * 3940 3941 * PARAMETER(S): 3941 3942 * [I] HWND : window handle 3942 3943 * [I] INT : item index 3943 3944 * [I] INT : relationship flag 3944 * 3945 * 3945 3946 * RETURN: 3946 3947 * SUCCESS : item index … … 3955 3956 INT nCountPerColumn; 3956 3957 INT i; 3957 3958 3958 3959 if ((nItem >= -1) && (nItem < GETITEMCOUNT(infoPtr))) 3959 { 3960 { 3960 3961 ZeroMemory(&lvFindInfo, sizeof(LVFINDINFO)); 3961 3962 3962 3963 if (uFlags & LVNI_CUT) 3963 3964 uMask |= LVIS_CUT; 3964 3965 3965 3966 if (uFlags & LVNI_DROPHILITED) 3966 3967 uMask |= LVIS_DROPHILITED; 3967 3968 3968 3969 if (uFlags & LVNI_FOCUSED) 3969 3970 uMask |= LVIS_FOCUSED; … … 4087 4088 * DESCRIPTION: 4088 4089 * Retrieves the origin coordinates when in icon or small icon display mode. 4089 * 4090 * 4090 4091 * PARAMETER(S): 4091 4092 * [I] HWND : window handle 4092 4093 * [O] LPPOINT : coordinate information 4093 * 4094 * 4094 4095 * RETURN: 4095 4096 * SUCCESS : TRUE … … 4104 4105 INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top; 4105 4106 BOOL bResult = FALSE; 4106 4107 4107 4108 TRACE("(hwnd=%x, lpptOrigin=%p)\n", hwnd, lpptOrigin); 4108 4109 … … 4117 4118 { 4118 4119 scrollInfo.fMask = SIF_POS; 4119 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 4120 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 4120 4121 { 4121 4122 lpptOrigin->x = -scrollInfo.nPos * max(nListWidth / 10, 1); … … 4131 4132 } 4132 4133 } 4133 4134 4134 4135 bResult = TRUE; 4135 4136 } 4136 4137 4137 4138 return bResult; 4138 4139 } … … 4141 4142 * DESCRIPTION: 4142 4143 * Retrieves the number of items that are marked as selected. 4143 * 4144 * PARAMETER(S): 4145 * [I] HWND : window handle 4146 * 4144 * 4145 * PARAMETER(S): 4146 * [I] HWND : window handle 4147 * 4147 4148 * RETURN: 4148 4149 * Number of items selected. … … 4161 4162 } 4162 4163 } 4163 4164 4164 4165 return nSelectedCount; 4165 4166 } … … 4168 4169 * DESCRIPTION: 4169 4170 * Retrieves item index that marks the start of a multiple selection. 4170 * 4171 * PARAMETER(S): 4172 * [I] HWND : window handle 4173 * 4171 * 4172 * PARAMETER(S): 4173 * [I] HWND : window handle 4174 * 4174 4175 * RETURN: 4175 4176 * Index number or -1 if there is no selection mark. … … 4185 4186 * DESCRIPTION: 4186 4187 * Retrieves the width of a string. 4187 * 4188 * PARAMETER(S): 4189 * [I] HWND : window handle 4190 * 4188 * 4189 * PARAMETER(S): 4190 * [I] HWND : window handle 4191 * 4191 4192 * RETURN: 4192 4193 * SUCCESS : string width (in pixels) … … 4217 4218 * DESCRIPTION: 4218 4219 * Retrieves the text backgound color. 4219 * 4220 * PARAMETER(S): 4221 * [I] HWND : window handle 4222 * 4220 * 4221 * PARAMETER(S): 4222 * [I] HWND : window handle 4223 * 4223 4224 * RETURN: 4224 4225 * COLORREF associated with the the background. … … 4234 4235 * DESCRIPTION: 4235 4236 * Retrieves the text color. 4236 * 4237 * PARAMETER(S): 4238 * [I] HWND : window handle 4239 * 4237 * 4238 * PARAMETER(S): 4239 * [I] HWND : window handle 4240 * 4240 4241 * RETURN: 4241 4242 * COLORREF associated with the text. … … 4251 4252 * DESCRIPTION: 4252 4253 * Determines which section of the item was selected (if any). 4253 * 4254 * 4254 4255 * PARAMETER(S): 4255 4256 * [I] HWND : window handle … … 4265 4266 RECT rcItem; 4266 4267 INT i; 4267 4268 4268 4269 TRACE("(hwnd=%x, x=%ld, y=%ld)\n", hwnd, lpHitTestInfo->pt.x, 4269 4270 lpHitTestInfo->pt.y); … … 4287 4288 } 4288 4289 } 4289 4290 4290 4291 rcItem.left = LVIR_LABEL; 4291 4292 if (LISTVIEW_GetItemRect(hwnd, i, &rcItem) != FALSE) … … 4299 4300 } 4300 4301 } 4301 4302 4302 4303 lpHitTestInfo->flags = LVHT_ONITEMSTATEICON; 4303 4304 lpHitTestInfo->iItem = i; … … 4307 4308 } 4308 4309 } 4309 4310 4310 4311 lpHitTestInfo->flags = LVHT_NOWHERE; 4311 4312 … … 4316 4317 * DESCRIPTION: 4317 4318 * Determines which listview item is located at the specified position. 4318 * 4319 * 4319 4320 * PARAMETER(S): 4320 4321 * [I] HWND : window handle … … 4336 4337 lpHitTestInfo->flags = LVHT_TOLEFT; 4337 4338 } 4338 else if (infoPtr->rcList.right < lpHitTestInfo->pt.x) 4339 else if (infoPtr->rcList.right < lpHitTestInfo->pt.x) 4339 4340 { 4340 4341 lpHitTestInfo->flags = LVHT_TORIGHT; … … 4344 4345 lpHitTestInfo->flags |= LVHT_ABOVE; 4345 4346 } 4346 else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y) 4347 else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y) 4347 4348 { 4348 4349 lpHitTestInfo->flags |= LVHT_BELOW; … … 4353 4354 nItem = LISTVIEW_HitTestItem(hwnd, lpHitTestInfo); 4354 4355 } 4355 4356 4356 4357 return nItem; 4357 4358 } … … 4360 4361 * DESCRIPTION: 4361 4362 * Inserts a new column. 4362 * 4363 * 4363 4364 * PARAMETER(S): 4364 4365 * [I] HWND : window handle … … 4370 4371 * FAILURE : -1 4371 4372 */ 4372 static LRESULT LISTVIEW_InsertColumnA(HWND hwnd, INT nColumn, 4373 static LRESULT LISTVIEW_InsertColumnA(HWND hwnd, INT nColumn, 4373 4374 LPLVCOLUMNA lpColumn) 4374 4375 { … … 4377 4378 INT nNewColumn = -1; 4378 4379 4379 TRACE("(hwnd=%x, nColumn=%d, lpColumn=%p)\n",hwnd, nColumn, 4380 TRACE("(hwnd=%x, nColumn=%d, lpColumn=%p)\n",hwnd, nColumn, 4380 4381 lpColumn); 4381 4382 4382 if (lpColumn != NULL) 4383 if (lpColumn != NULL) 4383 4384 { 4384 4385 /* initialize memory */ 4385 4386 ZeroMemory(&hdi, sizeof(HDITEMA)); 4386 4387 4387 if (lpColumn->mask & LVCF_FMT) 4388 if (lpColumn->mask & LVCF_FMT) 4388 4389 { 4389 4390 /* format member is valid */ … … 4410 4411 } 4411 4412 } 4412 4413 4413 4414 if (lpColumn->fmt & LVCFMT_BITMAP_ON_RIGHT) 4414 4415 { … … 4421 4422 /* ??? */ 4422 4423 } 4423 4424 4424 4425 if (lpColumn->fmt & LVCFMT_IMAGE) 4425 4426 { … … 4429 4430 } 4430 4431 4431 if (lpColumn->mask & LVCF_WIDTH) 4432 if (lpColumn->mask & LVCF_WIDTH) 4432 4433 { 4433 4434 hdi.mask |= HDI_WIDTH; 4434 4435 hdi.cxy = lpColumn->cx; 4435 4436 } 4436 4437 if (lpColumn->mask & LVCF_TEXT) 4437 4438 if (lpColumn->mask & LVCF_TEXT) 4438 4439 { 4439 4440 hdi.mask |= HDI_TEXT | HDI_FORMAT; … … 4442 4443 hdi.fmt |= HDF_STRING; 4443 4444 } 4444 4445 if (lpColumn->mask & LVCF_IMAGE) 4445 4446 if (lpColumn->mask & LVCF_IMAGE) 4446 4447 { 4447 4448 hdi.mask |= HDI_IMAGE; … … 4449 4450 } 4450 4451 4451 if (lpColumn->mask & LVCF_ORDER) 4452 if (lpColumn->mask & LVCF_ORDER) 4452 4453 { 4453 4454 hdi.mask |= HDI_ORDER; … … 4471 4472 * DESCRIPTION: 4472 4473 * Inserts a new item in the listview control. 4473 * 4474 * 4474 4475 * PARAMETER(S): 4475 4476 * [I] HWND : window handle … … 4511 4512 if (nItem != -1) 4512 4513 { 4513 nItem = DPA_InsertPtr(infoPtr->hdpaItems, lpLVItem->iItem, 4514 nItem = DPA_InsertPtr(infoPtr->hdpaItems, lpLVItem->iItem, 4514 4515 hdpaSubItems); 4515 4516 if (nItem != -1) … … 4521 4522 { 4522 4523 LISTVIEW_SetItemFocus(hwnd, nItem); 4523 } 4524 } 4524 4525 } 4525 4526 4526 4527 /* send LVN_INSERTITEM notification */ 4527 4528 ZeroMemory(&nmlv, sizeof(NMLISTVIEW)); … … 4532 4533 nmlv.lParam = lpItem->lParam;; 4533 4534 ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv); 4534 4535 4535 4536 /* align items (set position of each item) */ 4536 4537 if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) … … 4545 4546 } 4546 4547 } 4547 4548 4548 4549 LISTVIEW_UpdateScroll(hwnd); 4549 4550 /* refresh client area */ … … 4562 4563 COMCTL32_Free(lpItem); 4563 4564 } 4564 4565 4565 4566 return nItem; 4566 4567 } … … 4571 4572 * DESCRIPTION: 4572 4573 * Redraws a range of items. 4573 * 4574 * 4574 4575 * PARAMETER(S): 4575 4576 * [I] HWND : window handle … … 4583 4584 static LRESULT LISTVIEW_RedrawItems(HWND hwnd, INT nFirst, INT nLast) 4584 4585 { 4585 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 4586 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 4586 4587 BOOL bResult = FALSE; 4587 4588 RECT rc; … … 4607 4608 * DESCRIPTION: 4608 4609 * Sets the background color. 4609 * 4610 * 4610 4611 * PARAMETER(S): 4611 4612 * [I] HWND : window handle … … 4622 4623 infoPtr->clrBk = clrBk; 4623 4624 InvalidateRect(hwnd, NULL, TRUE); 4624 4625 4625 4626 return TRUE; 4626 4627 } … … 4630 4631 * Sets the callback mask. This mask will be used when the parent 4631 4632 * window stores state information (some or all). 4632 * 4633 * 4633 4634 * PARAMETER(S): 4634 4635 * [I] HWND : window handle … … 4651 4652 * DESCRIPTION: 4652 4653 * Sets the attributes of a header item. 4653 * 4654 * 4654 4655 * PARAMETER(S): 4655 4656 * [I] HWND : window handle … … 4661 4662 * FAILURE : FALSE 4662 4663 */ 4663 static LRESULT LISTVIEW_SetColumnA(HWND hwnd, INT nColumn, 4664 static LRESULT LISTVIEW_SetColumnA(HWND hwnd, INT nColumn, 4664 4665 LPLVCOLUMNA lpColumn) 4665 4666 { … … 4668 4669 HDITEMA hdi; 4669 4670 4670 if ((lpColumn != NULL) && (nColumn >= 0) && 4671 if ((lpColumn != NULL) && (nColumn >= 0) && 4671 4672 (nColumn < Header_GetItemCount(infoPtr->hwndHeader))) 4672 4673 { … … 4674 4675 ZeroMemory(&hdi, sizeof(HDITEMA)); 4675 4676 4676 if (lpColumn->mask & LVCF_FMT) 4677 if (lpColumn->mask & LVCF_FMT) 4677 4678 { 4678 4679 /* format member is valid */ … … 4699 4700 } 4700 4701 } 4701 4702 4702 4703 if (lpColumn->fmt & LVCFMT_BITMAP_ON_RIGHT) 4703 4704 { … … 4709 4710 hdi.fmt |= HDF_IMAGE; 4710 4711 } 4711 4712 4712 4713 if (lpColumn->fmt & LVCFMT_IMAGE) 4713 4714 { … … 4717 4718 } 4718 4719 4719 if (lpColumn->mask & LVCF_WIDTH) 4720 if (lpColumn->mask & LVCF_WIDTH) 4720 4721 { 4721 4722 hdi.mask |= HDI_WIDTH; 4722 4723 hdi.cxy = lpColumn->cx; 4723 4724 } 4724 4725 if (lpColumn->mask & LVCF_TEXT) 4725 4726 if (lpColumn->mask & LVCF_TEXT) 4726 4727 { 4727 4728 hdi.mask |= HDI_TEXT | HDI_FORMAT; … … 4730 4731 hdi.fmt |= HDF_STRING; 4731 4732 } 4732 4733 if (lpColumn->mask & LVCF_IMAGE) 4733 4734 if (lpColumn->mask & LVCF_IMAGE) 4734 4735 { 4735 4736 hdi.mask |= HDI_IMAGE; … … 4737 4738 } 4738 4739 4739 if (lpColumn->mask & LVCF_ORDER) 4740 if (lpColumn->mask & LVCF_ORDER) 4740 4741 { 4741 4742 hdi.mask |= HDI_ORDER; … … 4746 4747 bResult = Header_SetItemA(infoPtr->hwndHeader, nColumn, &hdi); 4747 4748 } 4748 4749 4749 4750 return bResult; 4750 4751 } … … 4773 4774 lStyle = GetWindowLongA(hwnd, GWL_STYLE); 4774 4775 if ((lStyle & LVS_TYPEMASK) != LVS_REPORT) 4775 return (FALSE);4776 return (FALSE); 4776 4777 4777 4778 // make sure we can get the listview info 4778 4779 if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0))) 4779 return (FALSE); 4780 return (FALSE); 4780 4781 if (!infoPtr->hwndHeader) // make sure we have a header 4781 return (FALSE); 4782 4782 return (FALSE); 4783 4783 4784 // FIXME: currently ignoring LVSCW_AUTOSIZE (-1) and 4784 4785 // LVSCV_AUTOSIZE_USEHEADER (-2) 4785 if (cx < 0) 4786 return (FALSE);4787 4786 if (cx < 0) 4787 return (FALSE); 4788 4788 4789 hdi.mask = HDI_WIDTH; 4789 4790 hdi.cxy = cx; … … 4802 4803 * DESCRIPTION: 4803 4804 * Sets image lists. 4804 * 4805 * PARAMETER(S): 4806 * [I] HWND : window handle 4807 * [I] INT : image list type 4805 * 4806 * PARAMETER(S): 4807 * [I] HWND : window handle 4808 * [I] INT : image list type 4808 4809 * [I] HIMAGELIST : image list handle 4809 4810 * … … 4817 4818 HIMAGELIST himlTemp = 0; 4818 4819 4819 switch (nType) 4820 switch (nType) 4820 4821 { 4821 4822 case LVSIL_NORMAL: … … 4843 4844 * DESCRIPTION: 4844 4845 * Sets the attributes of an item. 4845 * 4846 * PARAMETER(S): 4847 * [I] HWND : window handle 4848 * [I] LPLVITEM : item information 4846 * 4847 * PARAMETER(S): 4848 * [I] HWND : window handle 4849 * [I] LPLVITEM : item information 4849 4850 * 4850 4851 * RETURN: … … 4881 4882 * DESCRIPTION: 4882 4883 * Preallocates memory. 4883 * 4884 * 4884 4885 * PARAMETER(S): 4885 4886 * [I] HWND : window handle … … 4897 4898 * DESCRIPTION: 4898 4899 * Sets the position of an item. 4899 * 4900 * 4900 4901 * PARAMETER(S): 4901 4902 * [I] HWND : window handle … … 4908 4909 * FAILURE : FALSE 4909 4910 */ 4910 static BOOL LISTVIEW_SetItemPosition(HWND hwnd, INT nItem, 4911 static BOOL LISTVIEW_SetItemPosition(HWND hwnd, INT nItem, 4911 4912 INT nPosX, INT nPosY) 4912 4913 { … … 4943 4944 * DESCRIPTION: 4944 4945 * Sets the state of one or many items. 4945 * 4946 * 4946 4947 * PARAMETER(S): 4947 4948 * [I] HWND : window handle … … 4967 4968 lvItem.state = lpLVItem->state; 4968 4969 lvItem.stateMask = lpLVItem->stateMask ; 4969 4970 4970 4971 /* apply to all items */ 4971 4972 for (i = 0; i< GETITEMCOUNT(infoPtr); i++) … … 4994 4995 * DESCRIPTION: 4995 4996 * Sets the text of an item or subitem. 4996 * 4997 * 4997 4998 * PARAMETER(S): 4998 4999 * [I] HWND : window handle … … 5019 5020 bResult = ListView_SetItemA(hwnd, &lvItem); 5020 5021 } 5021 5022 5022 5023 return bResult; 5023 5024 } … … 5026 5027 * DESCRIPTION: 5027 5028 * Sets the text background color. 5028 * 5029 * 5029 5030 * PARAMETER(S): 5030 5031 * [I] HWND : window handle … … 5048 5049 * DESCRIPTION: 5049 5050 * Sets the text foreground color. 5050 * 5051 * PARAMETER(S): 5052 * [I] HWND : window handle 5053 * [I] COLORREF : text color 5051 * 5052 * PARAMETER(S): 5053 * [I] HWND : window handle 5054 * [I] COLORREF : text color 5054 5055 * 5055 5056 * RETURN: … … 5071 5072 * DESCRIPTION: 5072 5073 * Callback internally used by LISTVIEW_SortItems() 5073 * 5074 * 5074 5075 * PARAMETER(S): 5075 5076 * [I] LPVOID : first LISTVIEW_ITEM to compare … … 5082 5083 * if first and second are equivalent : zero 5083 5084 */ 5084 static INT WINAPI LISTVIEW_CallBackCompare( 5085 LPVOID first, 5086 LPVOID second, 5085 static INT WINAPI LISTVIEW_CallBackCompare( 5086 LPVOID first, 5087 LPVOID second, 5087 5088 LPARAM lParam) 5088 5089 { … … 5100 5101 * DESCRIPTION: 5101 5102 * Sorts the listview items. 5102 * 5103 * 5103 5104 * PARAMETER(S): 5104 5105 * [I] HWND : window handle … … 5117 5118 int nCount, i; 5118 5119 HDPA sortList; 5119 5120 5120 5121 if (!infoPtr || !infoPtr->hdpaItems) 5121 return FALSE;5122 5122 return FALSE; 5123 5123 5124 nCount = GETITEMCOUNT(infoPtr); 5124 5125 // if there are 0 or 1 items, there is no need to sort 5125 5126 if (nCount > 1) 5126 5127 { 5127 sortList = DPA_Create(nCount);5128 5129 infoPtr->pfnCompare = (PFNLVCOMPARE)lParam;5130 infoPtr->lParamSort = (LPARAM)wParam;5131 5132 // append pointers one by one to sortList5133 for (i = 0; i < nCount; i++)5134 {5135 if ((hdpaSubItems = (HDPA) DPA_GetPtr(infoPtr->hdpaItems, i)))5136 if ((lpItem = (LISTVIEW_ITEM *) DPA_GetPtr(hdpaSubItems, 0)))5137 DPA_InsertPtr(sortList, nCount + 1, lpItem);5138 }5139 5140 // sort the sortList5141 DPA_Sort(sortList, LISTVIEW_CallBackCompare, hwnd);5142 5143 // copy the pointers back5144 for (i = 0; i < nCount; i++)5145 {5146 if ((hdpaSubItems = (HDPA) DPA_GetPtr(infoPtr->hdpaItems, i)) &&5147 (lpItem = (LISTVIEW_ITEM *) DPA_GetPtr(sortList, i)))5148 DPA_SetPtr(hdpaSubItems, 0, lpItem);5149 }5150 5151 DPA_Destroy(sortList);5128 sortList = DPA_Create(nCount); 5129 5130 infoPtr->pfnCompare = (PFNLVCOMPARE)lParam; 5131 infoPtr->lParamSort = (LPARAM)wParam; 5132 5133 // append pointers one by one to sortList 5134 for (i = 0; i < nCount; i++) 5135 { 5136 if ((hdpaSubItems = (HDPA) DPA_GetPtr(infoPtr->hdpaItems, i))) 5137 if ((lpItem = (LISTVIEW_ITEM *) DPA_GetPtr(hdpaSubItems, 0))) 5138 DPA_InsertPtr(sortList, nCount + 1, lpItem); 5139 } 5140 5141 // sort the sortList 5142 DPA_Sort(sortList, LISTVIEW_CallBackCompare, hwnd); 5143 5144 // copy the pointers back 5145 for (i = 0; i < nCount; i++) 5146 { 5147 if ((hdpaSubItems = (HDPA) DPA_GetPtr(infoPtr->hdpaItems, i)) && 5148 (lpItem = (LISTVIEW_ITEM *) DPA_GetPtr(sortList, i))) 5149 DPA_SetPtr(hdpaSubItems, 0, lpItem); 5150 } 5151 5152 DPA_Destroy(sortList); 5152 5153 } 5153 5154 … … 5158 5159 * DESCRIPTION: 5159 5160 * Updates an items or rearranges the listview control. 5160 * 5161 * 5161 5162 * PARAMETER(S): 5162 5163 * [I] HWND : window handle … … 5199 5200 * DESCRIPTION: 5200 5201 * Creates the listview control. 5201 * 5202 * 5202 5203 * PARAMETER(S): 5203 5204 * [I] HWND : window handle … … 5217 5218 5218 5219 /* determine the type of structures to use */ 5219 infoPtr->notifyFormat = SendMessageA(GetParent(hwnd), WM_NOTIFYFORMAT, 5220 infoPtr->notifyFormat = SendMessageA(GetParent(hwnd), WM_NOTIFYFORMAT, 5220 5221 (WPARAM)hwnd, (LPARAM)NF_QUERY); 5221 5222 if (infoPtr->notifyFormat != NFR_ANSI) 5222 5223 { 5223 FIXME("ANSI notify format is NOT used\n");5224 } 5225 5224 //FIXME("ANSI notify format is NOT used\n"); 5225 } 5226 5226 5227 /* initialize color information */ 5227 5228 infoPtr->clrBk = GetSysColor(COLOR_WINDOW); 5228 5229 infoPtr->clrText = GetSysColor(COLOR_WINDOWTEXT); 5229 infoPtr->clrTextBk = GetSysColor(COLOR_WINDOW); 5230 infoPtr->clrTextBk = GetSysColor(COLOR_WINDOW); 5230 5231 5231 5232 /* set default values */ … … 5241 5242 infoPtr->hDefaultFont = CreateFontIndirectA(&logFont); 5242 5243 infoPtr->hFont = infoPtr->hDefaultFont; 5243 5244 5244 5245 /* create header */ 5245 infoPtr->hwndHeader = CreateWindowA(WC_HEADERA, (LPCSTR)NULL, 5246 WS_CHILD | HDS_HORZ | HDS_BUTTONS, 5247 0, 0, 0, 0, hwnd, (HMENU)0, 5246 5247 infoPtr->hwndHeader = CreateWindowA(WC_HEADERA, (LPCSTR)NULL, 5248 WS_CHILD | HDS_HORZ | HDS_BUTTONS, 5249 0, 0, 0, 0, hwnd, (HMENU)0, 5248 5250 lpcs->hInstance, NULL); 5249 5251 5250 5252 /* set header font */ 5251 SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, 5253 SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, 5252 5254 (LPARAM)TRUE); 5253 5255 5254 5256 if (uView == LVS_ICON) 5255 5257 { … … 5289 5291 * DESCRIPTION: 5290 5292 * Erases the background of the listview control. 5291 * 5293 * 5292 5294 * PARAMETER(S): 5293 5295 * [I] HWND : window handle 5294 5296 * [I] WPARAM : device context handle 5295 5297 * [I] LPARAM : not used 5296 * 5298 * 5297 5299 * RETURN: 5298 5300 * SUCCESS : TRUE 5299 5301 * FAILURE : FALSE 5300 5302 */ 5301 static LRESULT LISTVIEW_EraseBackground(HWND hwnd, WPARAM wParam, 5303 static LRESULT LISTVIEW_EraseBackground(HWND hwnd, WPARAM wParam, 5302 5304 LPARAM lParam) 5303 5305 { … … 5305 5307 BOOL bResult; 5306 5308 5307 if (infoPtr->clrBk == CLR_NONE) 5309 if (infoPtr->clrBk == CLR_NONE) 5308 5310 { 5309 5311 bResult = SendMessageA(GetParent(hwnd), WM_ERASEBKGND, wParam, lParam); 5310 5312 } 5311 else 5313 else 5312 5314 { 5313 5315 RECT rc; … … 5325 5327 * DESCRIPTION: 5326 5328 * Retrieves the listview control font. 5327 * 5329 * 5328 5330 * PARAMETER(S): 5329 5331 * [I] HWND : window handle … … 5342 5344 * DESCRIPTION: 5343 5345 * Performs vertical scrolling. 5344 * 5346 * 5345 5347 * PARAMETER(S): 5346 5348 * [I] HWND : window handle 5347 5349 * [I] INT : scroll code 5348 * [I] SHORT : current scroll position if scroll code is SB_THIMBPOSITION 5350 * [I] SHORT : current scroll position if scroll code is SB_THIMBPOSITION 5349 5351 * or SB_THUMBTRACK. 5350 5352 * [I] HWND : scrollbar control window handle … … 5362 5364 scrollInfo.cbSize = sizeof(SCROLLINFO); 5363 5365 scrollInfo.fMask = /*SIF_PAGE |*/ SIF_POS | SIF_RANGE; 5364 5366 5365 5367 if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE) 5366 5368 { … … 5374 5376 } 5375 5377 break; 5376 5378 5377 5379 case SB_LINEDOWN: 5378 5380 if (scrollInfo.nPos < scrollInfo.nMax) … … 5381 5383 } 5382 5384 break; 5383 5385 5384 5386 case SB_PAGEUP: 5385 5387 if (scrollInfo.nPos > scrollInfo.nMin) … … 5406 5408 } 5407 5409 break; 5408 5410 5409 5411 case SB_PAGEDOWN: 5410 5412 if (scrollInfo.nPos < scrollInfo.nMax) … … 5420 5422 nPage = 10; 5421 5423 } 5422 5424 5423 5425 if (scrollInfo.nPos <= scrollInfo.nMax - nPage) 5424 5426 { … … 5443 5445 } 5444 5446 } 5445 5447 5446 5448 return 0; 5447 5449 } … … 5450 5452 * DESCRIPTION: 5451 5453 * Performs horizontal scrolling. 5452 * 5454 * 5453 5455 * PARAMETER(S): 5454 5456 * [I] HWND : window handle 5455 5457 * [I] INT : scroll code 5456 * [I] SHORT : current scroll position if scroll code is SB_THIMBPOSITION 5458 * [I] SHORT : current scroll position if scroll code is SB_THIMBPOSITION 5457 5459 * or SB_THUMBTRACK. 5458 5460 * [I] HWND : scrollbar control window handle … … 5470 5472 scrollInfo.cbSize = sizeof(SCROLLINFO); 5471 5473 scrollInfo.fMask = /*SIF_PAGE |*/ SIF_POS | SIF_RANGE; 5472 5474 5473 5475 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 5474 5476 { … … 5483 5485 } 5484 5486 break; 5485 5487 5486 5488 case SB_LINERIGHT: 5487 5489 if (scrollInfo.nPos < scrollInfo.nMax) … … 5490 5492 } 5491 5493 break; 5492 5494 5493 5495 case SB_PAGELEFT: 5494 5496 if (scrollInfo.nPos > scrollInfo.nMin) … … 5504 5506 nPage = 10; 5505 5507 } 5506 5508 5507 5509 if (scrollInfo.nPos >= nPage) 5508 5510 { … … 5515 5517 } 5516 5518 break; 5517 5519 5518 5520 case SB_PAGERIGHT: 5519 5521 if (scrollInfo.nPos < scrollInfo.nMax) … … 5529 5531 nPage = 10; 5530 5532 } 5531 5533 5532 5534 if (scrollInfo.nPos <= scrollInfo.nMax - nPage) 5533 5535 { … … 5552 5554 } 5553 5555 } 5554 5556 5555 5557 return 0; 5556 5558 } … … 5558 5560 /*** 5559 5561 * DESCRIPTION: 5560 * ??? 5561 * 5562 * PARAMETER(S): 5563 * [I] HWND : window handle 5564 * [I] INT : virtual key 5562 * ??? 5563 * 5564 * PARAMETER(S): 5565 * [I] HWND : window handle 5566 * [I] INT : virtual key 5565 5567 * [I] LONG : key data 5566 5568 * … … 5573 5575 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); 5574 5576 HWND hwndParent = GetParent(hwnd); 5575 NMLVKEYDOWN nmKeyDown; 5577 NMLVKEYDOWN nmKeyDown; 5576 5578 NMHDR nmh; 5577 5579 INT nItem = -1; … … 5580 5582 /* send LVN_KEYDOWN notification */ 5581 5583 ZeroMemory(&nmKeyDown, sizeof(NMLVKEYDOWN)); 5582 nmKeyDown.hdr.hwndFrom = hwnd; 5583 nmKeyDown.hdr.idFrom = nCtrlId; 5584 nmKeyDown.hdr.code = LVN_KEYDOWN; 5585 nmKeyDown.wVKey = nVirtualKey; 5586 nmKeyDown.flags = 0; 5587 SendMessageA(hwndParent, WM_NOTIFY, (WPARAM)nCtrlId, (LPARAM)&nmKeyDown); 5588 5584 nmKeyDown.hdr.hwndFrom = hwnd; 5585 nmKeyDown.hdr.idFrom = nCtrlId; 5586 nmKeyDown.hdr.code = LVN_KEYDOWN; 5587 nmKeyDown.wVKey = nVirtualKey; 5588 nmKeyDown.flags = 0; 5589 SendMessageA(hwndParent, WM_NOTIFY, (WPARAM)nCtrlId, (LPARAM)&nmKeyDown); 5590 5589 5591 /* initialize */ 5590 5592 nmh.hwndFrom = hwnd; … … 5599 5601 nmh.code = NM_RETURN; 5600 5602 ListView_Notify(hwndParent, nCtrlId, &nmh); 5601 5603 5602 5604 /* send LVN_ITEMACTIVATE notification */ 5603 5605 nmh.code = LVN_ITEMACTIVATE; … … 5627 5629 nItem = LISTVIEW_GetNextItem(hwnd, infoPtr->nFocusedItem, LVNI_ABOVE); 5628 5630 break; 5629 5631 5630 5632 case VK_RIGHT: 5631 5633 nItem = LISTVIEW_GetNextItem(hwnd, infoPtr->nFocusedItem, LVNI_TORIGHT); … … 5662 5664 * DESCRIPTION: 5663 5665 * Kills the focus. 5664 * 5666 * 5665 5667 * PARAMETER(S): 5666 5668 * [I] HWND : window handle … … 5693 5695 * DESCRIPTION: 5694 5696 * Processes double click messages (left mouse button). 5695 * 5697 * 5696 5698 * PARAMETER(S): 5697 5699 * [I] HWND : window handle … … 5703 5705 * Zero 5704 5706 */ 5705 static LRESULT LISTVIEW_LButtonDblClk(HWND hwnd, WORD wKey, WORD wPosX, 5707 static LRESULT LISTVIEW_LButtonDblClk(HWND hwnd, WORD wKey, WORD wPosX, 5706 5708 WORD wPosY) 5707 5709 { … … 5727 5729 * DESCRIPTION: 5728 5730 * Processes mouse down messages (left mouse button). 5729 * 5731 * 5730 5732 * PARAMETER(S): 5731 5733 * [I] HWND : window handle … … 5737 5739 * Zero 5738 5740 */ 5739 static LRESULT LISTVIEW_LButtonDown(HWND hwnd, WORD wKey, WORD wPosX, 5741 static LRESULT LISTVIEW_LButtonDown(HWND hwnd, WORD wKey, WORD wPosX, 5740 5742 WORD wPosY) 5741 5743 { … … 5748 5750 INT nItem; 5749 5751 5750 TRACE("(hwnd=%x, key=%hu, X=%hu, Y=%hu)\n", hwnd, wKey, wPosX, 5752 TRACE("(hwnd=%x, key=%hu, X=%hu, Y=%hu)\n", hwnd, wKey, wPosX, 5751 5753 wPosY); 5752 5754 5753 /* send NM_RELEASEDCAPTURE notification */ 5755 /* send NM_RELEASEDCAPTURE notification */ 5754 5756 nmh.hwndFrom = hwnd; 5755 5757 nmh.idFrom = nCtrlId; 5756 5758 nmh.code = NM_RELEASEDCAPTURE; 5757 5759 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 5758 5760 5759 5761 if (infoPtr->bFocus == FALSE) 5760 5762 { … … 5764 5766 /* set left button down flag */ 5765 5767 infoPtr->bLButtonDown = TRUE; 5766 5768 5767 5769 ptPosition.x = wPosX; 5768 5770 ptPosition.y = wPosY; … … 5815 5817 * DESCRIPTION: 5816 5818 * Processes mouse up messages (left mouse button). 5817 * 5819 * 5818 5820 * PARAMETER(S): 5819 5821 * [I] HWND : window handle … … 5825 5827 * Zero 5826 5828 */ 5827 static LRESULT LISTVIEW_LButtonUp(HWND hwnd, WORD wKey, WORD wPosX, 5829 static LRESULT LISTVIEW_LButtonUp(HWND hwnd, WORD wKey, WORD wPosX, 5828 5830 WORD wPosY) 5829 5831 { … … 5832 5834 TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY); 5833 5835 5834 if (infoPtr->bLButtonDown != FALSE) 5836 if (infoPtr->bLButtonDown != FALSE) 5835 5837 { 5836 5838 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); … … 5853 5855 * DESCRIPTION: 5854 5856 * Creates the listview control (called before WM_CREATE). 5855 * 5856 * PARAMETER(S): 5857 * [I] HWND : window handle 5858 * [I] WPARAM : unhandled 5857 * 5858 * PARAMETER(S): 5859 * [I] HWND : window handle 5860 * [I] WPARAM : unhandled 5859 5861 * [I] LPARAM : widow creation info 5860 * 5862 * 5861 5863 * RETURN: 5862 5864 * Zero … … 5866 5868 LISTVIEW_INFO *infoPtr; 5867 5869 5868 TRACE("(hwnd=%x,wParam=%x,lParam=%lx)\n", hwnd, wParam, lParam);5870 //TRACE("(hwnd=%x,wParam=%x,lParam=%lx)\n", hwnd, wParam, lParam); 5869 5871 5870 5872 /* allocate memory for info structure */ 5871 5873 infoPtr = (LISTVIEW_INFO *)COMCTL32_Alloc(sizeof(LISTVIEW_INFO)); 5872 SetWindowLongA(hwnd, 0, (LONG)infoPtr);5873 if (infoPtr == NULL) 5874 { 5875 ERR("could not allocate info memory!\n");5874 SetWindowLongA(hwnd,0,(DWORD)infoPtr); 5875 if (infoPtr == NULL) 5876 { 5877 //ERR("could not allocate info memory!\n"); 5876 5878 return 0; 5877 5879 } 5878 5880 5879 if ((LISTVIEW_INFO *)GetWindowLongA(hwnd, 0) != infoPtr) 5880 { 5881 ERR("pointer assignment error!\n");5881 if ((LISTVIEW_INFO *)GetWindowLongA(hwnd, 0) != infoPtr) 5882 { 5883 //ERR("pointer assignment error!\n"); 5882 5884 return 0; 5883 5885 } 5884 5886 5885 return DefWindowProcA(hwnd, WM_NCCREATE, wParam,lParam);5887 return DefWindowProcA(hwnd,WM_NCCREATE,wParam,lParam); 5886 5888 } 5887 5889 … … 5889 5891 * DESCRIPTION: 5890 5892 * Destroys the listview control (called after WM_DESTROY). 5891 * 5892 * PARAMETER(S): 5893 * [I] HWND : window handle 5894 * 5893 * 5894 * PARAMETER(S): 5895 * [I] HWND : window handle 5896 * 5895 5897 * RETURN: 5896 5898 * Zero … … 5900 5902 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 5901 5903 5902 TRACE("(hwnd=%x)\n", hwnd);5904 //TRACE("(hwnd=%x)\n", hwnd); 5903 5905 5904 5906 /* delete all items */ … … 5924 5926 * DESCRIPTION: 5925 5927 * Handles notifications from children. 5926 * 5928 * 5927 5929 * PARAMETER(S): 5928 5930 * [I] HWND : window handle 5929 5931 * [I] INT : control identifier 5930 5932 * [I] LPNMHDR : notification information 5931 * 5933 * 5932 5934 * RETURN: 5933 5935 * Zero … … 5936 5938 { 5937 5939 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 5938 5939 if (lpnmh->hwndFrom == infoPtr->hwndHeader) 5940 5941 if (lpnmh->hwndFrom == infoPtr->hwndHeader) 5940 5942 { 5941 5943 /* handle notification from header control */ … … 5953 5955 * DESCRIPTION: 5954 5956 * Determines the type of structure to use. 5955 * 5957 * 5956 5958 * PARAMETER(S): 5957 5959 * [I] HWND : window handle of the sender 5958 * [I] HWND : listview window handle 5960 * [I] HWND : listview window handle 5959 5961 * [I] INT : command specifying the nature of the WM_NOTIFYFORMAT 5960 5962 * … … 5969 5971 { 5970 5972 /* determine the type of structure to use */ 5971 infoPtr->notifyFormat = SendMessageA(hwndFrom, WM_NOTIFYFORMAT, 5973 infoPtr->notifyFormat = SendMessageA(hwndFrom, WM_NOTIFYFORMAT, 5972 5974 (WPARAM)hwnd, (LPARAM)NF_QUERY); 5973 5975 if (infoPtr->notifyFormat == NFR_UNICODE) … … 5983 5985 * DESCRIPTION: 5984 5986 * Paints/Repaints the listview control. 5985 * 5987 * 5986 5988 * PARAMETER(S): 5987 5989 * [I] HWND : window handle … … 6014 6016 * DESCRIPTION: 6015 6017 * Processes double click messages (right mouse button). 6016 * 6018 * 6017 6019 * PARAMETER(S): 6018 6020 * [I] HWND : window handle … … 6024 6026 * Zero 6025 6027 */ 6026 static LRESULT LISTVIEW_RButtonDblClk(HWND hwnd, WORD wKey, WORD wPosX, 6028 static LRESULT LISTVIEW_RButtonDblClk(HWND hwnd, WORD wKey, WORD wPosX, 6027 6029 WORD wPosY) 6028 6030 { 6029 6031 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); 6030 6032 NMHDR nmh; 6031 6032 TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY);6033 6034 /* send NM_RELEASEDCAPTURE notification */6035 nmh.hwndFrom = hwnd;6036 nmh.idFrom = nCtrlId;6037 nmh.code = NM_RELEASEDCAPTURE;6038 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh);6039 6040 /* send NM_RDBLCLK notification */6041 nmh.code = NM_RDBLCLK;6042 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh);6043 6044 return 0;6045 }6046 6047 /***6048 * DESCRIPTION:6049 * Processes mouse down messages (right mouse button).6050 *6051 * PARAMETER(S):6052 * [I] HWND : window handle6053 * [I] WORD : key flag6054 * [I] WORD : x coordinate6055 * [I] WORD : y coordinate6056 *6057 * RETURN:6058 * Zero6059 */6060 static LRESULT LISTVIEW_RButtonDown(HWND hwnd, WORD wKey, WORD wPosX,6061 WORD wPosY)6062 {6063 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);6064 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID);6065 POINT ptPosition;6066 NMHDR nmh;6067 INT nItem;6068 6033 6069 6034 TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY); … … 6074 6039 nmh.code = NM_RELEASEDCAPTURE; 6075 6040 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6076 6041 6042 /* send NM_RDBLCLK notification */ 6043 nmh.code = NM_RDBLCLK; 6044 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6045 6046 return 0; 6047 } 6048 6049 /*** 6050 * DESCRIPTION: 6051 * Processes mouse down messages (right mouse button). 6052 * 6053 * PARAMETER(S): 6054 * [I] HWND : window handle 6055 * [I] WORD : key flag 6056 * [I] WORD : x coordinate 6057 * [I] WORD : y coordinate 6058 * 6059 * RETURN: 6060 * Zero 6061 */ 6062 static LRESULT LISTVIEW_RButtonDown(HWND hwnd, WORD wKey, WORD wPosX, 6063 WORD wPosY) 6064 { 6065 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 6066 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); 6067 POINT ptPosition; 6068 NMHDR nmh; 6069 INT nItem; 6070 6071 TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY); 6072 6073 /* send NM_RELEASEDCAPTURE notification */ 6074 nmh.hwndFrom = hwnd; 6075 nmh.idFrom = nCtrlId; 6076 nmh.code = NM_RELEASEDCAPTURE; 6077 ListView_Notify(GetParent(hwnd), nCtrlId, &nmh); 6078 6077 6079 /* make sure the listview control window has the focus */ 6078 6080 if (infoPtr->bFocus == FALSE) … … 6099 6101 LISTVIEW_RemoveSelections(hwnd, 0, GETITEMCOUNT(infoPtr)); 6100 6102 } 6101 6103 6102 6104 return 0; 6103 6105 } … … 6106 6108 * DESCRIPTION: 6107 6109 * Processes mouse up messages (right mouse button). 6108 * 6110 * 6109 6111 * PARAMETER(S): 6110 6112 * [I] HWND : window handle … … 6116 6118 * Zero 6117 6119 */ 6118 static LRESULT LISTVIEW_RButtonUp(HWND hwnd, WORD wKey, WORD wPosX, 6120 static LRESULT LISTVIEW_RButtonUp(HWND hwnd, WORD wKey, WORD wPosX, 6119 6121 WORD wPosY) 6120 6122 { … … 6125 6127 TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY); 6126 6128 6127 if (infoPtr->bRButtonDown != FALSE) 6129 if (infoPtr->bRButtonDown != FALSE) 6128 6130 { 6129 6131 /* send NM_RClICK notification */ … … 6137 6139 infoPtr->bRButtonDown = FALSE; 6138 6140 } 6139 6141 6140 6142 return 0; 6141 6143 } … … 6143 6145 /*** 6144 6146 * DESCRIPTION: 6145 * Sets the focus. 6146 * 6147 * Sets the focus. 6148 * 6147 6149 * PARAMETER(S): 6148 6150 * [I] HWND : window handle … … 6172 6174 /*** 6173 6175 * DESCRIPTION: 6174 * Sets the font. 6175 * 6176 * Sets the font. 6177 * 6176 6178 * PARAMETER(S): 6177 6179 * [I] HWND : window handle … … 6201 6203 { 6202 6204 /* set header font */ 6203 SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont, 6205 SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont, 6204 6206 MAKELPARAM(fRedraw, 0)); 6205 6207 } … … 6207 6209 /* invalidate listview control client area */ 6208 6210 InvalidateRect(hwnd, NULL, TRUE); 6209 6211 6210 6212 if (fRedraw != FALSE) 6211 6213 { … … 6220 6222 * Resizes the listview control. This function processes WM_SIZE 6221 6223 * messages. At this time, the width and height are not used. 6222 * 6224 * 6223 6225 * PARAMETER(S): 6224 6226 * [I] HWND : window handle … … 6231 6233 static LRESULT LISTVIEW_Size(HWND hwnd, int Width, int Height) 6232 6234 { 6233 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 6235 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 6234 6236 UINT uView = lStyle & LVS_TYPEMASK; 6235 6237 … … 6251 6253 6252 6254 LISTVIEW_UpdateScroll(hwnd); 6253 6255 6254 6256 /* invalidate client area + erase background */ 6255 6257 InvalidateRect(hwnd, NULL, TRUE); … … 6261 6263 * DESCRIPTION: 6262 6264 * Sets the size information. 6263 * 6265 * 6264 6266 * PARAMETER(S): 6265 6267 * [I] HWND : window handle … … 6274 6276 UINT uView = lStyle & LVS_TYPEMASK; 6275 6277 RECT rcList; 6276 6278 6277 6279 GetClientRect(hwnd, &rcList); 6278 6280 infoPtr->rcList.left = 0; … … 6280 6282 infoPtr->rcList.top = 0; 6281 6283 infoPtr->rcList.bottom = max(rcList.bottom - rcList.top, 1); 6282 6284 6283 6285 if (uView == LVS_LIST) 6284 6286 { … … 6287 6289 INT nHScrollHeight = GetSystemMetrics(SM_CYHSCROLL); 6288 6290 if (infoPtr->rcList.bottom > nHScrollHeight) 6289 { 6291 { 6290 6292 infoPtr->rcList.bottom -= nHScrollHeight; 6291 6293 } … … 6309 6311 /*** 6310 6312 * DESCRIPTION: 6311 * Processes WM_STYLECHANGED messages. 6312 * 6313 * Processes WM_STYLECHANGED messages. 6314 * 6313 6315 * PARAMETER(S): 6314 6316 * [I] HWND : window handle … … 6319 6321 * Zero 6320 6322 */ 6321 static INT LISTVIEW_StyleChanged(HWND hwnd, WPARAM wStyleType, 6323 static INT LISTVIEW_StyleChanged(HWND hwnd, WPARAM wStyleType, 6322 6324 LPSTYLESTRUCT lpss) 6323 6325 { … … 6327 6329 RECT rcList = infoPtr->rcList; 6328 6330 6329 TRACE("(hwnd=%x, styletype=%x, stylestruct=%p)\n", 6331 TRACE("(hwnd=%x, styletype=%x, stylestruct=%p)\n", 6330 6332 hwnd, wStyleType, lpss); 6331 6333 … … 6336 6338 ShowWindow(infoPtr->hwndHeader, SW_HIDE); 6337 6339 } 6338 6340 6339 6341 if ((lpss->styleOld & WS_HSCROLL) != 0) 6340 6342 { 6341 6343 ShowScrollBar(hwnd, SB_HORZ, FALSE); 6342 6344 } 6343 6345 6344 6346 if ((lpss->styleOld & WS_VSCROLL) != 0) 6345 6347 { 6346 6348 ShowScrollBar(hwnd, SB_VERT, FALSE); 6347 6349 } 6348 6350 6349 6351 if (uNewView == LVS_ICON) 6350 6352 { … … 6370 6372 hl.pwpos = ℘ 6371 6373 Header_Layout(infoPtr->hwndHeader, &hl); 6372 SetWindowPos(infoPtr->hwndHeader, hwnd, wp.x, wp.y, wp.cx, wp.cy, 6374 SetWindowPos(infoPtr->hwndHeader, hwnd, wp.x, wp.y, wp.cx, wp.cy, 6373 6375 wp.flags); 6374 6376 if (!(LVS_NOCOLUMNHEADER & lpss->styleNew)) … … 6409 6411 /* add scrollbars if needed */ 6410 6412 LISTVIEW_UpdateScroll(hwnd); 6411 6413 6412 6414 /* invalidate client area + erase background */ 6413 6415 InvalidateRect(hwnd, NULL, TRUE); … … 6430 6432 switch (uMsg) 6431 6433 { 6432 case LVM_APPROXIMATEVIEWRECT: 6433 return LISTVIEW_ApproximateViewRect(hwnd, (INT)wParam, 6434 case LVM_APPROXIMATEVIEWRECT: 6435 return LISTVIEW_ApproximateViewRect(hwnd, (INT)wParam, 6434 6436 LOWORD(lParam), HIWORD(lParam)); 6435 case LVM_ARRANGE: 6437 case LVM_ARRANGE: 6436 6438 return LISTVIEW_Arrange(hwnd, (INT)wParam); 6437 6439 … … 6447 6449 return LISTVIEW_DeleteItem(hwnd, (INT)wParam); 6448 6450 6449 /* case LVM_EDITLABEL: */6451 /* case LVM_EDITLABEL: */ 6450 6452 6451 6453 case LVM_ENSUREVISIBLE: … … 6458 6460 return LISTVIEW_GetBkColor(hwnd); 6459 6461 6460 /* case LVM_GETBKIMAGE: */6462 /* case LVM_GETBKIMAGE: */ 6461 6463 6462 6464 case LVM_GETCALLBACKMASK: … … 6466 6468 return LISTVIEW_GetColumnA(hwnd, (INT)wParam, (LPLVCOLUMNA)lParam); 6467 6469 6468 /* case LVM_GETCOLUMNW: */6469 /* case LVM_GETCOLUMNORDERARRAY: */6470 /* case LVM_GETCOLUMNW: */ 6471 /* case LVM_GETCOLUMNORDERARRAY: */ 6470 6472 6471 6473 case LVM_GETCOLUMNWIDTH: … … 6475 6477 return LISTVIEW_GetCountPerPage(hwnd); 6476 6478 6477 /* case LVM_GETEDITCONTROL: */6478 /* case LVM_GETEXTENDEDLISTVIEWSTYLE: */6479 /* case LVM_GETEDITCONTROL: */ 6480 /* case LVM_GETEXTENDEDLISTVIEWSTYLE: */ 6479 6481 6480 6482 case LVM_GETHEADER: 6481 6483 return LISTVIEW_GetHeader(hwnd); 6482 6484 6483 /* case LVM_GETHOTCURSOR: */6484 /* case LVM_GETHOTITEM: */6485 /* case LVM_GETHOVERTIME: */6485 /* case LVM_GETHOTCURSOR: */ 6486 /* case LVM_GETHOTITEM: */ 6487 /* case LVM_GETHOVERTIME: */ 6486 6488 6487 6489 case LVM_GETIMAGELIST: 6488 6490 return LISTVIEW_GetImageList(hwnd, (INT)wParam); 6489 6491 6490 /* case LVM_GETISEARCHSTRING: */6492 /* case LVM_GETISEARCHSTRING: */ 6491 6493 6492 6494 case LVM_GETITEMA: 6493 6495 return LISTVIEW_GetItemA(hwnd, (LPLVITEMA)lParam); 6494 6496 6495 /* case LVM_GETITEMW: */6497 /* case LVM_GETITEMW: */ 6496 6498 6497 6499 case LVM_GETITEMCOUNT: … … 6501 6503 return LISTVIEW_GetItemPosition(hwnd, (INT)wParam, (LPPOINT)lParam); 6502 6504 6503 case LVM_GETITEMRECT: 6505 case LVM_GETITEMRECT: 6504 6506 return LISTVIEW_GetItemRect(hwnd, (INT)wParam, (LPRECT)lParam); 6505 6507 6506 case LVM_GETITEMSPACING: 6508 case LVM_GETITEMSPACING: 6507 6509 return LISTVIEW_GetItemSpacing(hwnd, (BOOL)wParam); 6508 6510 6509 case LVM_GETITEMSTATE: 6511 case LVM_GETITEMSTATE: 6510 6512 return LISTVIEW_GetItemState(hwnd, (INT)wParam, (UINT)lParam); 6511 6513 6512 6514 case LVM_GETITEMTEXTA: 6513 6515 LISTVIEW_GetItemTextA(hwnd, (INT)wParam, (LPLVITEMA)lParam); 6514 6516 break; 6515 6517 6516 /* case LVM_GETITEMTEXTW: */6518 /* case LVM_GETITEMTEXTW: */ 6517 6519 6518 6520 case LVM_GETNEXTITEM: 6519 6521 return LISTVIEW_GetNextItem(hwnd, (INT)wParam, LOWORD(lParam)); 6520 6522 6521 /* case LVM_GETNUMBEROFWORKAREAS: */6523 /* case LVM_GETNUMBEROFWORKAREAS: */ 6522 6524 6523 6525 case LVM_GETORIGIN: … … 6527 6529 return LISTVIEW_GetSelectedCount(hwnd); 6528 6530 6529 case LVM_GETSELECTIONMARK: 6531 case LVM_GETSELECTIONMARK: 6530 6532 return LISTVIEW_GetSelectionMark(hwnd); 6531 6533 … … 6533 6535 return LISTVIEW_GetStringWidthA (hwnd, (LPCSTR)lParam); 6534 6536 6535 /* case LVM_GETSTRINGWIDTHW: */6536 /* case LVM_GETSUBITEMRECT: */6537 /* case LVM_GETSTRINGWIDTHW: */ 6538 /* case LVM_GETSUBITEMRECT: */ 6537 6539 6538 6540 case LVM_GETTEXTBKCOLOR: … … 6542 6544 return LISTVIEW_GetTextColor(hwnd); 6543 6545 6544 /* case LVM_GETTOOLTIPS: */6546 /* case LVM_GETTOOLTIPS: */ 6545 6547 6546 6548 case LVM_GETTOPINDEX: 6547 6549 return LISTVIEW_GetTopIndex(hwnd); 6548 6550 6549 /* case LVM_GETUNICODEFORMAT: */6551 /* case LVM_GETUNICODEFORMAT: */ 6550 6552 6551 6553 case LVM_GETVIEWRECT: 6552 6554 return LISTVIEW_GetViewRect(hwnd, (LPRECT)lParam); 6553 6555 6554 /* case LVM_GETWORKAREAS: */6556 /* case LVM_GETWORKAREAS: */ 6555 6557 6556 6558 case LVM_HITTEST: … … 6558 6560 6559 6561 case LVM_INSERTCOLUMNA: 6560 return LISTVIEW_InsertColumnA(hwnd, (INT)wParam, 6562 return LISTVIEW_InsertColumnA(hwnd, (INT)wParam, 6561 6563 (LPLVCOLUMNA)lParam); 6562 6564 6563 /* case LVM_INSERTCOLUMNW: */6565 /* case LVM_INSERTCOLUMNW: */ 6564 6566 6565 6567 case LVM_INSERTITEMA: 6566 6568 return LISTVIEW_InsertItemA(hwnd, (LPLVITEMA)lParam); 6567 6569 6568 /* case LVM_INSERTITEMW: */6570 /* case LVM_INSERTITEMW: */ 6569 6571 6570 6572 case LVM_REDRAWITEMS: … … 6577 6579 return LISTVIEW_SetBkColor(hwnd, (COLORREF)lParam); 6578 6580 6579 /* case LVM_SETBKIMAGE: */6581 /* case LVM_SETBKIMAGE: */ 6580 6582 6581 6583 case LVM_SETCALLBACKMASK: … … 6585 6587 return LISTVIEW_SetColumnA(hwnd, (INT)wParam, (LPLVCOLUMNA)lParam); 6586 6588 6587 /* case LVM_SETCOLUMNW: */6588 /* case LVM_SETCOLUMNORDERARRAY: */6589 /* case LVM_SETCOLUMNW: */ 6590 /* case LVM_SETCOLUMNORDERARRAY: */ 6589 6591 6590 6592 case LVM_SETCOLUMNWIDTH: 6591 6593 return LISTVIEW_SetColumnWidth(hwnd, (INT)wParam, (INT)lParam); 6592 6594 6593 /* case LVM_SETEXTENDEDLISTVIEWSTYLE: */6594 /* case LVM_SETHOTCURSOR: */6595 /* case LVM_SETHOTITEM: */6596 /* case LVM_SETHOVERTIME: */6597 /* case LVM_SETICONSPACING: */6598 6595 /* case LVM_SETEXTENDEDLISTVIEWSTYLE: */ 6596 /* case LVM_SETHOTCURSOR: */ 6597 /* case LVM_SETHOTITEM: */ 6598 /* case LVM_SETHOVERTIME: */ 6599 /* case LVM_SETICONSPACING: */ 6600 6599 6601 case LVM_SETIMAGELIST: 6600 6602 return LISTVIEW_SetImageList(hwnd, (INT)wParam, (HIMAGELIST)lParam); … … 6603 6605 return LISTVIEW_SetItemA(hwnd, (LPLVITEMA)lParam); 6604 6606 6605 /* case LVM_SETITEMW: */6606 6607 case LVM_SETITEMCOUNT: 6607 /* case LVM_SETITEMW: */ 6608 6609 case LVM_SETITEMCOUNT: 6608 6610 LISTVIEW_SetItemCount(hwnd, (INT)wParam); 6609 6611 break; 6610 6612 6611 6613 case LVM_SETITEMPOSITION: 6612 6614 return LISTVIEW_SetItemPosition(hwnd, (INT)wParam, (INT)LOWORD(lParam), 6613 6615 (INT)HIWORD(lParam)); 6614 6616 6615 /* case LVM_SETITEMPOSITION: */6616 6617 case LVM_SETITEMSTATE: 6617 /* case LVM_SETITEMPOSITION: */ 6618 6619 case LVM_SETITEMSTATE: 6618 6620 return LISTVIEW_SetItemState(hwnd, (INT)wParam, (LPLVITEMA)lParam); 6619 6621 … … 6621 6623 return LISTVIEW_SetItemTextA(hwnd, (INT)wParam, (LPLVITEMA)lParam); 6622 6624 6623 /* case LVM_SETSELECTIONMARK: */6625 /* case LVM_SETSELECTIONMARK: */ 6624 6626 6625 6627 case LVM_SETTEXTBKCOLOR: … … 6629 6631 return LISTVIEW_SetTextColor(hwnd, (COLORREF)lParam); 6630 6632 6631 /* case LVM_SETTOOLTIPS: */6632 /* case LVM_SETUNICODEFORMAT: */6633 /* case LVM_SETWORKAREAS: */6633 /* case LVM_SETTOOLTIPS: */ 6634 /* case LVM_SETUNICODEFORMAT: */ 6635 /* case LVM_SETWORKAREAS: */ 6634 6636 6635 6637 case LVM_SORTITEMS: 6636 6638 return LISTVIEW_SortItems(hwnd, wParam, lParam); 6637 6639 6638 /* case LVM_SUBITEMHITTEST: */6639 6640 case LVM_UPDATE: 6640 /* case LVM_SUBITEMHITTEST: */ 6641 6642 case LVM_UPDATE: 6641 6643 return LISTVIEW_Update(hwnd, (INT)wParam); 6642 6644 6643 /* case WM_CHAR: */6644 /* case WM_COMMAND: */6645 /* case WM_CHAR: */ 6646 /* case WM_COMMAND: */ 6645 6647 6646 6648 case WM_CREATE: 6647 6649 return LISTVIEW_Create(hwnd, wParam, lParam); 6648 6650 6649 6651 case WM_ERASEBKGND: 6650 6652 return LISTVIEW_EraseBackground(hwnd, wParam, lParam); … … 6657 6659 6658 6660 case WM_HSCROLL: 6659 return LISTVIEW_HScroll(hwnd, (INT)LOWORD(wParam), 6661 return LISTVIEW_HScroll(hwnd, (INT)LOWORD(wParam), 6660 6662 (INT)HIWORD(wParam), (HWND)lParam); 6661 6663 … … 6667 6669 6668 6670 case WM_LBUTTONDBLCLK: 6669 return LISTVIEW_LButtonDblClk(hwnd, (WORD)wParam, LOWORD(lParam), 6671 return LISTVIEW_LButtonDblClk(hwnd, (WORD)wParam, LOWORD(lParam), 6670 6672 HIWORD(lParam)); 6671 6673 6672 6674 case WM_LBUTTONDOWN: 6673 return LISTVIEW_LButtonDown(hwnd, (WORD)wParam, LOWORD(lParam), 6675 return LISTVIEW_LButtonDown(hwnd, (WORD)wParam, LOWORD(lParam), 6674 6676 HIWORD(lParam)); 6675 6677 case WM_LBUTTONUP: 6676 return LISTVIEW_LButtonUp(hwnd, (WORD)wParam, LOWORD(lParam), 6678 return LISTVIEW_LButtonUp(hwnd, (WORD)wParam, LOWORD(lParam), 6677 6679 HIWORD(lParam)); 6678 6679 /* case WM_MOUSEMOVE: */6680 /* return LISTVIEW_MouseMove (hwnd, wParam, lParam); */6680 6681 /* case WM_MOUSEMOVE: */ 6682 /* return LISTVIEW_MouseMove (hwnd, wParam, lParam); */ 6681 6683 6682 6684 case WM_NCCREATE: … … 6692 6694 return LISTVIEW_NotifyFormat(hwnd, (HWND)wParam, (INT)lParam); 6693 6695 6694 case WM_PAINT: 6695 return LISTVIEW_Paint(hwnd, (HDC)wParam); 6696 case WM_PAINT: 6697 return LISTVIEW_Paint(hwnd, (HDC)wParam); 6696 6698 6697 6699 case WM_RBUTTONDBLCLK: 6698 return LISTVIEW_RButtonDblClk(hwnd, (WORD)wParam, LOWORD(lParam), 6700 return LISTVIEW_RButtonDblClk(hwnd, (WORD)wParam, LOWORD(lParam), 6699 6701 HIWORD(lParam)); 6700 6702 6701 6703 case WM_RBUTTONDOWN: 6702 return LISTVIEW_RButtonDown(hwnd, (WORD)wParam, LOWORD(lParam), 6704 return LISTVIEW_RButtonDown(hwnd, (WORD)wParam, LOWORD(lParam), 6703 6705 HIWORD(lParam)); 6704 6706 6705 6707 case WM_RBUTTONUP: 6706 return LISTVIEW_RButtonUp(hwnd, (WORD)wParam, LOWORD(lParam), 6708 return LISTVIEW_RButtonUp(hwnd, (WORD)wParam, LOWORD(lParam), 6707 6709 HIWORD(lParam)); 6708 6710 … … 6713 6715 return LISTVIEW_SetFont(hwnd, (HFONT)wParam, (WORD)lParam); 6714 6716 6715 /* case WM_SETREDRAW: */6717 /* case WM_SETREDRAW: */ 6716 6718 6717 6719 case WM_SIZE: … … 6721 6723 return LISTVIEW_StyleChanged(hwnd, wParam, (LPSTYLESTRUCT)lParam); 6722 6724 6723 /* case WM_TIMER: */6725 /* case WM_TIMER: */ 6724 6726 6725 6727 case WM_VSCROLL: 6726 return LISTVIEW_VScroll(hwnd, (INT)LOWORD(wParam), 6728 return LISTVIEW_VScroll(hwnd, (INT)LOWORD(wParam), 6727 6729 (INT)HIWORD(wParam), (HWND)lParam); 6728 6730 6729 /* case WM_WINDOWPOSCHANGED: */6730 /* case WM_WININICHANGE: */6731 /* case WM_WINDOWPOSCHANGED: */ 6732 /* case WM_WININICHANGE: */ 6731 6733 6732 6734 default: 6733 if (uMsg >= WM_USER)6734 {6735 ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam,6736 lParam);6737 }6735 //if (uMsg >= WM_USER) 6736 //{ 6737 // ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, 6738 // lParam); 6739 //} 6738 6740 6739 6741 /* call default window procedure */ … … 6747 6749 * DESCRIPTION: 6748 6750 * Registers the window class. 6749 * 6751 * 6750 6752 * PARAMETER(S): 6751 6753 * None … … 6758 6760 WNDCLASSA wndClass; 6759 6761 6760 if (!GlobalFindAtomA(WC_LISTVIEWA)) 6762 if (!GlobalFindAtomA(WC_LISTVIEWA)) 6761 6763 { 6762 6764 ZeroMemory(&wndClass, sizeof(WNDCLASSA)); … … 6775 6777 * DESCRIPTION: 6776 6778 * Unregisters the window class. 6777 * 6779 * 6778 6780 * PARAMETER(S): 6779 6781 * None -
trunk/src/comctl32/progress.c
r219 r236 1 /* $Id: progress.c,v 1. 6 1999-06-26 14:20:31cbratschi Exp $ */1 /* $Id: progress.c,v 1.7 1999-06-28 15:46:25 cbratschi Exp $ */ 2 2 /* 3 3 * Progress control … … 284 284 285 285 286 static LRESULT PROGRESS_NCCreate(HWND hwnd,WPARAM wParam,LPARAM lParam) 287 { 288 DWORD dwExStyle; 289 290 dwExStyle = GetWindowLongA(hwnd,GWL_EXSTYLE); 291 SetWindowLongA(hwnd,GWL_EXSTYLE,dwExStyle | WS_EX_STATICEDGE); 292 293 return TRUE; 294 } 295 296 static LRESULT PROGRESS_Create(HWND hwnd,WPARAM wParam,LPARAM lParam) 297 { 298 PROGRESS_INFO *infoPtr; 299 300 /* allocate memory for info struct */ 301 infoPtr = (PROGRESS_INFO *)COMCTL32_Alloc(sizeof(PROGRESS_INFO)); 302 SetWindowLongA(hwnd,0,(DWORD)infoPtr); 303 304 /* initialize the info struct */ 305 infoPtr->MinVal = 0; 306 infoPtr->MaxVal = 100; 307 infoPtr->CurVal = 0; 308 infoPtr->Step = 10; 309 infoPtr->ColorBar = CLR_DEFAULT; 310 infoPtr->ColorBk = CLR_DEFAULT; 311 infoPtr->hFont = (HANDLE)NULL; 312 // TRACE(progress, "Progress Ctrl creation, hwnd=%04x\n", hwnd); 313 314 return 0; 315 } 316 317 static LRESULT PROGRESS_Destroy(HWND hwnd,WPARAM wParam,LPARAM lParam) 318 { 319 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 320 321 // TRACE (progress, "Progress Ctrl destruction, hwnd=%04x\n", hwnd); 322 COMCTL32_Free (infoPtr); 323 324 return 0; 325 } 326 327 static LRESULT PROGRESS_GetFont(HWND hwnd,WPARAM wParam,LPARAM lParam) 328 { 329 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 330 331 return (LRESULT)infoPtr->hFont; 332 } 333 286 334 /*********************************************************************** 287 335 * PROGRESS_SetFont 288 336 * Set new Font for progress bar 289 337 */ 290 static HFONT 291 PROGRESS_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) 292 { 293 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 338 static HFONT PROGRESS_SetFont (HWND hwnd,WPARAM wParam,LPARAM lParam) 339 { 340 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 294 341 HFONT hOldFont = infoPtr->hFont; 295 342 296 343 infoPtr->hFont = (HFONT)wParam; 297 if (LOWORD(lParam)) 298 PROGRESS_Refresh (hwnd); 344 if (LOWORD(lParam)) PROGRESS_Refresh (hwnd); 345 299 346 return hOldFont; 300 347 } 301 348 349 static LRESULT PROGRESS_DeltaPos(HWND hwnd,WPARAM wParam,LPARAM lParam) 350 { 351 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 352 INT temp; 353 354 //if(lParam) UNKNOWN_PARAM(PBM_DELTAPOS, wParam, lParam); 355 temp = infoPtr->CurVal; 356 if (wParam != 0) 357 { 358 infoPtr->CurVal += (INT)wParam; 359 PROGRESS_CoercePos(hwnd); 360 PROGRESS_Update(hwnd,temp); 361 } 362 363 return temp; 364 } 365 366 static LRESULT PROGRESS_SetPos(HWND hwnd,WPARAM wParam,LPARAM lParam) 367 { 368 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 369 INT temp; 370 371 //if (lParam) UNKNOWN_PARAM(PBM_SETPOS, wParam, lParam); 372 temp = infoPtr->CurVal; 373 if (temp != wParam) 374 { 375 infoPtr->CurVal = (UINT16)wParam; //CB: 0..65535 allowed 376 PROGRESS_CoercePos(hwnd); 377 PROGRESS_Update(hwnd,temp); 378 } 379 380 return temp; 381 } 382 383 static LRESULT PROGRESS_SetRange(HWND hwnd,WPARAM wParam,LPARAM lParam) 384 { 385 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 386 INT temp; 387 388 //if (wParam) UNKNOWN_PARAM(PBM_SETRANGE, wParam, lParam); 389 temp = MAKELONG(infoPtr->MinVal,infoPtr->MaxVal); 390 if (temp != lParam) 391 { 392 infoPtr->MinVal = LOWORD(lParam); 393 infoPtr->MaxVal = HIWORD(lParam); 394 if (infoPtr->MaxVal <= infoPtr->MinVal) infoPtr->MaxVal = infoPtr->MinVal+1; 395 PROGRESS_CoercePos(hwnd); 396 PROGRESS_Refresh(hwnd); 397 } 398 399 return temp; 400 } 401 402 static LRESULT PROGRESS_SetStep(HWND hwnd,WPARAM wParam,LPARAM lParam) 403 { 404 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 405 INT temp; 406 407 //if (lParam) UNKNOWN_PARAM(PBM_SETSTEP, wParam, lParam); 408 temp = infoPtr->Step; 409 infoPtr->Step = (INT)wParam; //CB: negative steps allowed 410 411 return temp; 412 } 413 414 static LRESULT PROGRESS_StepIt(HWND hwnd,WPARAM wParam,LPARAM lParam) 415 { 416 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 417 INT temp; 418 419 //if (wParam || lParam) UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam); 420 temp = infoPtr->CurVal; 421 infoPtr->CurVal += infoPtr->Step; 422 if(infoPtr->CurVal > infoPtr->MaxVal) infoPtr->CurVal = infoPtr->MinVal; 423 if(temp != infoPtr->CurVal) PROGRESS_Update (hwnd,temp); 424 425 return temp; 426 } 427 428 static LRESULT PROGRESS_SetRange32(HWND hwnd,WPARAM wParam,LPARAM lParam) 429 { 430 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 431 INT temp; 432 433 temp = MAKELONG(infoPtr->MinVal,infoPtr->MaxVal); 434 if((infoPtr->MinVal != (INT)wParam) || (infoPtr->MaxVal != (INT)lParam)) 435 { 436 infoPtr->MinVal = (INT)wParam; 437 infoPtr->MaxVal = (INT)lParam; 438 if(infoPtr->MaxVal <= infoPtr->MinVal) infoPtr->MaxVal = infoPtr->MinVal+1; 439 PROGRESS_CoercePos(hwnd); 440 PROGRESS_Refresh(hwnd); 441 } 442 443 return temp; 444 } 445 446 static LRESULT PROGRESS_GetRange(HWND hwnd,WPARAM wParam,LPARAM lParam) 447 { 448 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 449 450 if (lParam) 451 { 452 ((PPBRANGE)lParam)->iLow = infoPtr->MinVal; 453 ((PPBRANGE)lParam)->iHigh = infoPtr->MaxVal; 454 } 455 456 return (wParam) ? infoPtr->MinVal : infoPtr->MaxVal; 457 } 458 459 static LRESULT PROGRESS_GetPos(HWND hwnd,WPARAM wParam,LPARAM lParam) 460 { 461 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 462 463 //if (wParam || lParam) UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam); 464 465 return (infoPtr->CurVal); 466 } 467 468 static LRESULT PROGRESS_SetBarColor(HWND hwnd,WPARAM wParam,LPARAM lParam) 469 { 470 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 471 COLORREF oldColorBar = infoPtr->ColorBar; 472 473 //if (wParam) UNKNOWN_PARAM(PBM_SETBARCOLOR, wParam, lParam); 474 infoPtr->ColorBar = (COLORREF)lParam; 475 if (infoPtr->ColorBar != oldColorBar) PROGRESS_Refresh(hwnd); 476 477 return 0; 478 } 479 480 static LRESULT PROGRESS_SetBkColor(HWND hwnd,WPARAM wParam,LPARAM lParam) 481 { 482 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd); 483 COLORREF oldColorBk = infoPtr->ColorBk; 484 485 //if (wParam) UNKNOWN_PARAM(PBM_SETBKCOLOR, wParam, lParam); 486 infoPtr->ColorBk = (COLORREF)lParam; 487 if (infoPtr->ColorBk != oldColorBk) PROGRESS_Refresh (hwnd); 488 489 return 0; 490 } 302 491 303 492 /*********************************************************************** … … 307 496 WPARAM wParam, LPARAM lParam) 308 497 { 309 PROGRESS_INFO *infoPtr = PROGRESS_GetInfoPtr(hwnd);310 INT temp;311 312 498 switch(message) 313 499 { 314 500 case WM_NCCREATE: 315 { 316 DWORD dwExStyle; 317 dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE); 318 SetWindowLongA(hwnd, GWL_EXSTYLE, dwExStyle | WS_EX_STATICEDGE); 319 } 320 return TRUE; 501 return PROGRESS_NCCreate(hwnd,wParam,lParam); 321 502 322 503 case WM_CREATE: 323 /* allocate memory for info struct */ 324 infoPtr = 325 (PROGRESS_INFO *)COMCTL32_Alloc (sizeof(PROGRESS_INFO)); 326 SetWindowLongA(hwnd, 0, (DWORD)infoPtr); 327 328 /* initialize the info struct */ 329 infoPtr->MinVal=0; 330 infoPtr->MaxVal=100; 331 infoPtr->CurVal=0; 332 infoPtr->Step=10; 333 infoPtr->ColorBar=CLR_DEFAULT; 334 infoPtr->ColorBk=CLR_DEFAULT; 335 infoPtr->hFont=(HANDLE)NULL; 336 // TRACE(progress, "Progress Ctrl creation, hwnd=%04x\n", hwnd); 337 break; 504 return PROGRESS_Create(hwnd,wParam,lParam); 338 505 339 506 case WM_DESTROY: 340 // TRACE (progress, "Progress Ctrl destruction, hwnd=%04x\n", hwnd); 341 COMCTL32_Free (infoPtr); 342 break; 507 return PROGRESS_Destroy(hwnd,wParam,lParam); 343 508 344 509 case WM_ERASEBKGND: … … 348 513 349 514 case WM_GETFONT: 350 return (LRESULT)infoPtr->hFont;515 return PROGRESS_GetFont(hwnd,wParam,lParam); 351 516 352 517 case WM_SETFONT: 353 return PROGRESS_SetFont (hwnd, wParam,lParam);518 return PROGRESS_SetFont (hwnd,wParam,lParam); 354 519 355 520 case WM_PAINT: 356 PROGRESS_Paint (hwnd);521 PROGRESS_Paint(hwnd); 357 522 break; 358 523 359 524 case PBM_DELTAPOS: 360 if(lParam) 361 UNKNOWN_PARAM(PBM_DELTAPOS, wParam, lParam); 362 temp = infoPtr->CurVal; 363 if(wParam != 0){ 364 infoPtr->CurVal += (INT)wParam; 365 PROGRESS_CoercePos (hwnd); 366 PROGRESS_Update (hwnd,temp); 367 } 368 return temp; 525 return PROGRESS_DeltaPos(hwnd,wParam,lParam); 369 526 370 527 case PBM_SETPOS: 371 if (lParam) 372 UNKNOWN_PARAM(PBM_SETPOS, wParam, lParam); 373 temp = infoPtr->CurVal; 374 if(temp != wParam){ 375 infoPtr->CurVal = (UINT16)wParam; //CB: 0..65535 allowed 376 PROGRESS_CoercePos(hwnd); 377 PROGRESS_Update (hwnd,temp); 378 } 379 return temp; 528 return PROGRESS_SetPos(hwnd,wParam,lParam); 380 529 381 530 case PBM_SETRANGE: 382 if (wParam) 383 UNKNOWN_PARAM(PBM_SETRANGE, wParam, lParam); 384 temp = MAKELONG(infoPtr->MinVal, infoPtr->MaxVal); 385 if(temp != lParam){ 386 infoPtr->MinVal = LOWORD(lParam); 387 infoPtr->MaxVal = HIWORD(lParam); 388 if(infoPtr->MaxVal <= infoPtr->MinVal) 389 infoPtr->MaxVal = infoPtr->MinVal+1; 390 PROGRESS_CoercePos(hwnd); 391 PROGRESS_Refresh (hwnd); 392 } 393 return temp; 531 return PROGRESS_SetRange(hwnd,wParam,lParam); 394 532 395 533 case PBM_SETSTEP: 396 if (lParam) 397 UNKNOWN_PARAM(PBM_SETSTEP, wParam, lParam); 398 temp = infoPtr->Step; 399 infoPtr->Step = (INT)wParam; //CB: negative steps allowed 400 return temp; 534 return PROGRESS_SetStep(hwnd,wParam,lParam); 401 535 402 536 case PBM_STEPIT: 403 if (wParam || lParam) 404 UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam); 405 temp = infoPtr->CurVal; 406 infoPtr->CurVal += infoPtr->Step; 407 if(infoPtr->CurVal > infoPtr->MaxVal) 408 infoPtr->CurVal = infoPtr->MinVal; 409 if(temp != infoPtr->CurVal) 410 PROGRESS_Update (hwnd,temp); 411 return temp; 537 return PROGRESS_StepIt(hwnd,wParam,lParam); 412 538 413 539 case PBM_SETRANGE32: 414 temp = MAKELONG(infoPtr->MinVal, infoPtr->MaxVal); 415 if((infoPtr->MinVal != (INT)wParam) || 416 (infoPtr->MaxVal != (INT)lParam)) { 417 infoPtr->MinVal = (INT)wParam; 418 infoPtr->MaxVal = (INT)lParam; 419 if(infoPtr->MaxVal <= infoPtr->MinVal) 420 infoPtr->MaxVal = infoPtr->MinVal+1; 421 PROGRESS_CoercePos(hwnd); 422 PROGRESS_Refresh (hwnd); 423 } 424 return temp; 540 return PROGRESS_SetRange32(hwnd,wParam,lParam); 425 541 426 542 case PBM_GETRANGE: 427 if (lParam){ 428 ((PPBRANGE)lParam)->iLow = infoPtr->MinVal; 429 ((PPBRANGE)lParam)->iHigh = infoPtr->MaxVal; 430 } 431 return (wParam) ? infoPtr->MinVal : infoPtr->MaxVal; 543 return PROGRESS_GetRange(hwnd,wParam,lParam); 432 544 433 545 case PBM_GETPOS: 434 if (wParam || lParam) 435 UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam); 436 return (infoPtr->CurVal); 546 return PROGRESS_GetPos(hwnd,wParam,lParam); 437 547 438 548 case PBM_SETBARCOLOR: 439 if (wParam) 440 UNKNOWN_PARAM(PBM_SETBARCOLOR, wParam, lParam); 441 infoPtr->ColorBar = (COLORREF)lParam; 442 PROGRESS_Refresh (hwnd); 443 break; 549 return PROGRESS_SetBarColor(hwnd,wParam,lParam); 444 550 445 551 case PBM_SETBKCOLOR: 446 if (wParam) 447 UNKNOWN_PARAM(PBM_SETBKCOLOR, wParam, lParam); 448 infoPtr->ColorBk = (COLORREF)lParam; 449 PROGRESS_Refresh (hwnd); 450 break; 552 return PROGRESS_SetBkColor(hwnd,wParam,lParam); 451 553 452 554 default: -
trunk/src/comctl32/rebar.c
r94 r236 1 /* $Id: rebar.c,v 1. 4 1999-06-10 16:22:01 achimhaExp $ */1 /* $Id: rebar.c,v 1.5 1999-06-28 15:46:26 cbratschi Exp $ */ 2 2 /* 3 3 * Rebar control … … 5 5 * Copyright 1998, 1999 Eric Kohl 6 6 * Copyright 1999 Achim Hasenmueller 7 * Copyright 1999 Christoph Bratschi 7 8 * 8 9 * NOTES … … 14 15 * - vertical placement 15 16 * - ComboBox and ComboBoxEx placement 16 * - center image 17 * - center image 17 18 * - Layout code. 18 19 * - Display code. … … 52 53 /* draw gripper */ 53 54 if (lpBand->fDraw & DRAW_GRIPPER) 54 DrawEdge (hdc, &lpBand->rcGripper, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE);55 DrawEdge (hdc, &lpBand->rcGripper, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE); 55 56 56 57 /* draw caption image */ 57 58 if (lpBand->fDraw & DRAW_IMAGE) { 58 /* FIXME: center image */59 POINT pt;60 61 pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2;62 pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2;63 64 ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc,65 /* lpBand->rcCapImage.left, lpBand->rcCapImage.top, */66 pt.x, pt.y,67 ILD_TRANSPARENT);59 /* FIXME: center image */ 60 POINT pt; 61 62 pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2; 63 pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2; 64 65 ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc, 66 /* lpBand->rcCapImage.left, lpBand->rcCapImage.top, */ 67 pt.x, pt.y, 68 ILD_TRANSPARENT); 68 69 } 69 70 70 71 /* draw caption text */ 71 72 if (lpBand->fDraw & DRAW_TEXT) { 72 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);73 INT oldBkMode = SetBkMode (hdc, TRANSPARENT);74 DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText,75 DT_CENTER | DT_VCENTER | DT_SINGLELINE);76 if (oldBkMode != TRANSPARENT)77 SetBkMode (hdc, oldBkMode);78 SelectObject (hdc, hOldFont);73 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); 74 INT oldBkMode = SetBkMode (hdc, TRANSPARENT); 75 DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, 76 DT_CENTER | DT_VCENTER | DT_SINGLELINE); 77 if (oldBkMode != TRANSPARENT) 78 SetBkMode (hdc, oldBkMode); 79 SelectObject (hdc, hOldFont); 79 80 } 80 81 } … … 89 90 90 91 for (i = 0; i < infoPtr->uNumBands; i++) { 91 lpBand = &infoPtr->bands[i];92 93 if ((lpBand->fStyle & RBBS_HIDDEN) || 94 ((GetWindowLongA (hwnd, GWL_STYLE) & CCS_VERT) &&95 (lpBand->fStyle & RBBS_NOVERT)))96 continue;97 98 REBAR_DrawBand (hdc, infoPtr, lpBand);92 lpBand = &infoPtr->bands[i]; 93 94 if ((lpBand->fStyle & RBBS_HIDDEN) || 95 ((GetWindowLongA (hwnd, GWL_STYLE) & CCS_VERT) && 96 (lpBand->fStyle & RBBS_NOVERT))) 97 continue; 98 99 REBAR_DrawBand (hdc, infoPtr, lpBand); 99 100 100 101 } … … 112 113 /* image is visible */ 113 114 if ((lpBand->iImage > -1) && (infoPtr->himl)) { 114 lpBand->fDraw |= DRAW_IMAGE;115 116 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;117 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;118 119 /* update band height */120 if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) {121 lpBand->uMinHeight = infoPtr->imageSize.cy + 2;122 lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight;123 }115 lpBand->fDraw |= DRAW_IMAGE; 116 117 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx; 118 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy; 119 120 /* update band height */ 121 if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) { 122 lpBand->uMinHeight = infoPtr->imageSize.cy + 2; 123 lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight; 124 } 124 125 } 125 126 … … 132 133 /* text is visible */ 133 134 if (lpBand->lpText) { 134 HDC hdc = GetDC (0);135 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);136 SIZE size;137 138 lpBand->fDraw |= DRAW_TEXT;139 GetTextExtentPoint32W (hdc, lpBand->lpText,140 lstrlenW (lpBand->lpText), &size);141 lpBand->rcCapText.right += size.cx;142 143 SelectObject (hdc, hOldFont);144 ReleaseDC (0, hdc);135 HDC hdc = GetDC (0); 136 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); 137 SIZE size; 138 139 lpBand->fDraw |= DRAW_TEXT; 140 GetTextExtentPoint32W (hdc, lpBand->lpText, 141 lstrlenW (lpBand->lpText), &size); 142 lpBand->rcCapText.right += size.cx; 143 144 SelectObject (hdc, hOldFont); 145 ReleaseDC (0, hdc); 145 146 } 146 147 147 148 /* set initial child window rectangle */ 148 149 if (lpBand->fStyle & RBBS_FIXEDSIZE) { 149 lpBand->rcChild.left = lpBand->rcCapText.right;150 lpBand->rcChild.top = lpBand->rcBand.top;151 lpBand->rcChild.right = lpBand->rcBand.right;152 lpBand->rcChild.bottom = lpBand->rcBand.bottom;150 lpBand->rcChild.left = lpBand->rcCapText.right; 151 lpBand->rcChild.top = lpBand->rcBand.top; 152 lpBand->rcChild.right = lpBand->rcBand.right; 153 lpBand->rcChild.bottom = lpBand->rcBand.bottom; 153 154 } 154 155 else { 155 lpBand->rcChild.left = lpBand->rcCapText.right + 4;156 lpBand->rcChild.top = lpBand->rcBand.top + 2;157 lpBand->rcChild.right = lpBand->rcBand.right - 4;158 lpBand->rcChild.bottom = lpBand->rcBand.bottom - 2;156 lpBand->rcChild.left = lpBand->rcCapText.right + 4; 157 lpBand->rcChild.top = lpBand->rcBand.top + 2; 158 lpBand->rcChild.right = lpBand->rcBand.right - 4; 159 lpBand->rcChild.bottom = lpBand->rcBand.bottom - 2; 159 160 } 160 161 161 162 /* calculate gripper rectangle */ 162 163 if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) && 163 (!(lpBand->fStyle & RBBS_FIXEDSIZE)) &&164 ((lpBand->fStyle & RBBS_GRIPPERALWAYS) || 165 (infoPtr->uNumBands > 1))) {166 lpBand->fDraw |= DRAW_GRIPPER;167 lpBand->rcGripper.left = lpBand->rcBand.left + 3;168 lpBand->rcGripper.right = lpBand->rcGripper.left + 3;169 lpBand->rcGripper.top = lpBand->rcBand.top + 3;170 lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3;171 172 /* move caption rectangles */173 OffsetRect (&lpBand->rcCapImage, GRIPPER_WIDTH, 0);174 OffsetRect (&lpBand->rcCapText, GRIPPER_WIDTH, 0);175 176 /* adjust child rectangle */177 lpBand->rcChild.left += GRIPPER_WIDTH;164 (!(lpBand->fStyle & RBBS_FIXEDSIZE)) && 165 ((lpBand->fStyle & RBBS_GRIPPERALWAYS) || 166 (infoPtr->uNumBands > 1))) { 167 lpBand->fDraw |= DRAW_GRIPPER; 168 lpBand->rcGripper.left = lpBand->rcBand.left + 3; 169 lpBand->rcGripper.right = lpBand->rcGripper.left + 3; 170 lpBand->rcGripper.top = lpBand->rcBand.top + 3; 171 lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3; 172 173 /* move caption rectangles */ 174 OffsetRect (&lpBand->rcCapImage, GRIPPER_WIDTH, 0); 175 OffsetRect (&lpBand->rcCapText, GRIPPER_WIDTH, 0); 176 177 /* adjust child rectangle */ 178 lpBand->rcChild.left += GRIPPER_WIDTH; 178 179 } 179 180 … … 192 193 /* image is visible */ 193 194 if ((lpBand->iImage > -1) && (infoPtr->himl)) { 194 lpBand->fDraw |= DRAW_IMAGE;195 196 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;197 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;198 199 /* update band width */200 if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) {201 lpBand->uMinHeight = infoPtr->imageSize.cx + 2;202 lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight;203 }195 lpBand->fDraw |= DRAW_IMAGE; 196 197 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx; 198 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy; 199 200 /* update band width */ 201 if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) { 202 lpBand->uMinHeight = infoPtr->imageSize.cx + 2; 203 lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight; 204 } 204 205 } 205 206 … … 212 213 /* text is visible */ 213 214 if (lpBand->lpText) { 214 HDC hdc = GetDC (0);215 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);216 SIZE size;217 218 lpBand->fDraw |= DRAW_TEXT;219 GetTextExtentPoint32W (hdc, lpBand->lpText,220 lstrlenW (lpBand->lpText), &size);221 /* lpBand->rcCapText.right += size.cx; */222 lpBand->rcCapText.bottom += size.cy;223 224 SelectObject (hdc, hOldFont);225 ReleaseDC (0, hdc);215 HDC hdc = GetDC (0); 216 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); 217 SIZE size; 218 219 lpBand->fDraw |= DRAW_TEXT; 220 GetTextExtentPoint32W (hdc, lpBand->lpText, 221 lstrlenW (lpBand->lpText), &size); 222 /* lpBand->rcCapText.right += size.cx; */ 223 lpBand->rcCapText.bottom += size.cy; 224 225 SelectObject (hdc, hOldFont); 226 ReleaseDC (0, hdc); 226 227 } 227 228 228 229 /* set initial child window rectangle */ 229 230 if (lpBand->fStyle & RBBS_FIXEDSIZE) { 230 lpBand->rcChild.left = lpBand->rcBand.left;231 lpBand->rcChild.top = lpBand->rcCapText.bottom;232 lpBand->rcChild.right = lpBand->rcBand.right;233 lpBand->rcChild.bottom = lpBand->rcBand.bottom;231 lpBand->rcChild.left = lpBand->rcBand.left; 232 lpBand->rcChild.top = lpBand->rcCapText.bottom; 233 lpBand->rcChild.right = lpBand->rcBand.right; 234 lpBand->rcChild.bottom = lpBand->rcBand.bottom; 234 235 } 235 236 else { 236 lpBand->rcChild.left = lpBand->rcBand.left + 2;237 lpBand->rcChild.top = lpBand->rcCapText.bottom + 4;238 lpBand->rcChild.right = lpBand->rcBand.right - 2;239 lpBand->rcChild.bottom = lpBand->rcBand.bottom - 4;237 lpBand->rcChild.left = lpBand->rcBand.left + 2; 238 lpBand->rcChild.top = lpBand->rcCapText.bottom + 4; 239 lpBand->rcChild.right = lpBand->rcBand.right - 2; 240 lpBand->rcChild.bottom = lpBand->rcBand.bottom - 4; 240 241 } 241 242 242 243 /* calculate gripper rectangle */ 243 244 if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) && 244 (!(lpBand->fStyle & RBBS_FIXEDSIZE)) &&245 ((lpBand->fStyle & RBBS_GRIPPERALWAYS) || 246 (infoPtr->uNumBands > 1))) {247 lpBand->fDraw |= DRAW_GRIPPER;248 249 if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_VERTICALGRIPPER) {250 /* adjust band width */251 lpBand->rcBand.right += GRIPPER_WIDTH;252 lpBand->uMinHeight += GRIPPER_WIDTH;253 254 lpBand->rcGripper.left = lpBand->rcBand.left + 3;255 lpBand->rcGripper.right = lpBand->rcGripper.left + 3;256 lpBand->rcGripper.top = lpBand->rcBand.top + 3;257 lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3;258 259 /* move caption rectangles */260 OffsetRect (&lpBand->rcCapImage, GRIPPER_WIDTH, 0);261 OffsetRect (&lpBand->rcCapText, GRIPPER_WIDTH, 0);262 263 /* adjust child rectangle */264 lpBand->rcChild.left += GRIPPER_WIDTH;265 }266 else {267 lpBand->rcGripper.left = lpBand->rcBand.left + 3;268 lpBand->rcGripper.right = lpBand->rcBand.right - 3;269 lpBand->rcGripper.top = lpBand->rcBand.top + 3;270 lpBand->rcGripper.bottom = lpBand->rcGripper.top + 3;271 272 /* move caption rectangles */273 OffsetRect (&lpBand->rcCapImage, 0, GRIPPER_WIDTH);274 OffsetRect (&lpBand->rcCapText, 0, GRIPPER_WIDTH);275 276 /* adjust child rectangle */277 lpBand->rcChild.top += GRIPPER_WIDTH;278 }245 (!(lpBand->fStyle & RBBS_FIXEDSIZE)) && 246 ((lpBand->fStyle & RBBS_GRIPPERALWAYS) || 247 (infoPtr->uNumBands > 1))) { 248 lpBand->fDraw |= DRAW_GRIPPER; 249 250 if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_VERTICALGRIPPER) { 251 /* adjust band width */ 252 lpBand->rcBand.right += GRIPPER_WIDTH; 253 lpBand->uMinHeight += GRIPPER_WIDTH; 254 255 lpBand->rcGripper.left = lpBand->rcBand.left + 3; 256 lpBand->rcGripper.right = lpBand->rcGripper.left + 3; 257 lpBand->rcGripper.top = lpBand->rcBand.top + 3; 258 lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3; 259 260 /* move caption rectangles */ 261 OffsetRect (&lpBand->rcCapImage, GRIPPER_WIDTH, 0); 262 OffsetRect (&lpBand->rcCapText, GRIPPER_WIDTH, 0); 263 264 /* adjust child rectangle */ 265 lpBand->rcChild.left += GRIPPER_WIDTH; 266 } 267 else { 268 lpBand->rcGripper.left = lpBand->rcBand.left + 3; 269 lpBand->rcGripper.right = lpBand->rcBand.right - 3; 270 lpBand->rcGripper.top = lpBand->rcBand.top + 3; 271 lpBand->rcGripper.bottom = lpBand->rcGripper.top + 3; 272 273 /* move caption rectangles */ 274 OffsetRect (&lpBand->rcCapImage, 0, GRIPPER_WIDTH); 275 OffsetRect (&lpBand->rcCapText, 0, GRIPPER_WIDTH); 276 277 /* adjust child rectangle */ 278 lpBand->rcChild.top += GRIPPER_WIDTH; 279 } 279 280 } 280 281 } … … 292 293 293 294 if (lpRect) 294 rcClient = *lpRect;295 rcClient = *lpRect; 295 296 else 296 GetClientRect (hwnd, &rcClient);297 GetClientRect (hwnd, &rcClient); 297 298 298 299 x = 0; … … 300 301 301 302 if (dwStyle & CCS_VERT) { 302 cx = 20; /* FIXME: fixed height */303 cy = rcClient.bottom - rcClient.top;303 cx = 20; /* FIXME: fixed height */ 304 cy = rcClient.bottom - rcClient.top; 304 305 } 305 306 else { 306 cx = rcClient.right - rcClient.left;307 cy = 20; /* FIXME: fixed height */307 cx = rcClient.right - rcClient.left; 308 cy = 20; /* FIXME: fixed height */ 308 309 } 309 310 310 311 for (i = 0; i < infoPtr->uNumBands; i++) { 311 lpBand = &infoPtr->bands[i];312 313 if ((lpBand->fStyle & RBBS_HIDDEN) || 314 ((dwStyle & CCS_VERT) && (lpBand->fStyle & RBBS_NOVERT)))315 continue;316 317 318 if (dwStyle & CCS_VERT) {319 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT)320 cx = lpBand->cyMaxChild;321 else if (lpBand->fStyle & RBBIM_CHILDSIZE)322 cx = lpBand->cyMinChild;323 else324 cx = 20; /* FIXME */325 326 lpBand->rcBand.left = x;327 lpBand->rcBand.right = x + cx;328 lpBand->rcBand.top = y;329 lpBand->rcBand.bottom = y + cy;330 lpBand->uMinHeight = cx;331 }332 else {333 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT)334 cy = lpBand->cyMaxChild;335 else if (lpBand->fStyle & RBBIM_CHILDSIZE)336 cy = lpBand->cyMinChild;337 else338 cy = 20; /* FIXME */339 340 lpBand->rcBand.left = x;341 lpBand->rcBand.right = x + cx;342 lpBand->rcBand.top = y;343 lpBand->rcBand.bottom = y + cy;344 lpBand->uMinHeight = cy;345 }346 347 if (dwStyle & CCS_VERT) {348 REBAR_CalcVertBand (hwnd, infoPtr, lpBand);349 x += lpBand->uMinHeight;350 }351 else {352 REBAR_CalcHorzBand (infoPtr, lpBand);353 y += lpBand->uMinHeight;354 }312 lpBand = &infoPtr->bands[i]; 313 314 if ((lpBand->fStyle & RBBS_HIDDEN) || 315 ((dwStyle & CCS_VERT) && (lpBand->fStyle & RBBS_NOVERT))) 316 continue; 317 318 319 if (dwStyle & CCS_VERT) { 320 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT) 321 cx = lpBand->cyMaxChild; 322 else if (lpBand->fStyle & RBBIM_CHILDSIZE) 323 cx = lpBand->cyMinChild; 324 else 325 cx = 20; /* FIXME */ 326 327 lpBand->rcBand.left = x; 328 lpBand->rcBand.right = x + cx; 329 lpBand->rcBand.top = y; 330 lpBand->rcBand.bottom = y + cy; 331 lpBand->uMinHeight = cx; 332 } 333 else { 334 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT) 335 cy = lpBand->cyMaxChild; 336 else if (lpBand->fStyle & RBBIM_CHILDSIZE) 337 cy = lpBand->cyMinChild; 338 else 339 cy = 20; /* FIXME */ 340 341 lpBand->rcBand.left = x; 342 lpBand->rcBand.right = x + cx; 343 lpBand->rcBand.top = y; 344 lpBand->rcBand.bottom = y + cy; 345 lpBand->uMinHeight = cy; 346 } 347 348 if (dwStyle & CCS_VERT) { 349 REBAR_CalcVertBand (hwnd, infoPtr, lpBand); 350 x += lpBand->uMinHeight; 351 } 352 else { 353 REBAR_CalcHorzBand (infoPtr, lpBand); 354 y += lpBand->uMinHeight; 355 } 355 356 } 356 357 357 358 if (dwStyle & CCS_VERT) { 358 infoPtr->calcSize.cx = x;359 infoPtr->calcSize.cy = rcClient.bottom - rcClient.top;359 infoPtr->calcSize.cx = x; 360 infoPtr->calcSize.cy = rcClient.bottom - rcClient.top; 360 361 } 361 362 else { 362 infoPtr->calcSize.cx = rcClient.right - rcClient.left;363 infoPtr->calcSize.cy = y;363 infoPtr->calcSize.cx = rcClient.right - rcClient.left; 364 infoPtr->calcSize.cy = y; 364 365 } 365 366 } … … 373 374 374 375 // TRACE (rebar, " to [%d x %d]!\n", 375 // infoPtr->calcSize.cx, infoPtr->calcSize.cy);376 // infoPtr->calcSize.cx, infoPtr->calcSize.cy); 376 377 377 378 infoPtr->bAutoResize = TRUE; … … 383 384 384 385 if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) { 385 InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));386 InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); 386 387 } 387 388 388 389 SetWindowPos (hwnd, 0, 0, 0, 389 rc.right - rc.left, rc.bottom - rc.top,390 SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW);390 rc.right - rc.left, rc.bottom - rc.top, 391 SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW); 391 392 } 392 393 … … 401 402 402 403 for (i = 0; i < infoPtr->uNumBands; i++) { 403 lpBand = &infoPtr->bands[i];404 405 if (lpBand->fStyle & RBBS_HIDDEN)406 continue;407 if (lpBand->hwndChild) {408 // TRACE (rebar, "hwndChild = %x\n", lpBand->hwndChild);409 410 GetClassNameA (lpBand->hwndChild, szClassName, 40);411 if (!lstrcmpA (szClassName, "ComboBox")) {412 INT nEditHeight, yPos;413 RECT rc;414 415 /* special placement code for combo box */416 417 418 /* get size of edit line */419 GetWindowRect (lpBand->hwndChild, &rc);420 nEditHeight = rc.bottom - rc.top;421 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2;422 423 /* center combo box inside child area */424 SetWindowPos (lpBand->hwndChild, HWND_TOP,425 lpBand->rcChild.left, /*lpBand->rcChild.top*/ yPos,426 lpBand->rcChild.right - lpBand->rcChild.left,427 nEditHeight,428 SWP_SHOWWINDOW);429 }404 lpBand = &infoPtr->bands[i]; 405 406 if (lpBand->fStyle & RBBS_HIDDEN) 407 continue; 408 if (lpBand->hwndChild) { 409 // TRACE (rebar, "hwndChild = %x\n", lpBand->hwndChild); 410 411 GetClassNameA (lpBand->hwndChild, szClassName, 40); 412 if (!lstrcmpA (szClassName, "ComboBox")) { 413 INT nEditHeight, yPos; 414 RECT rc; 415 416 /* special placement code for combo box */ 417 418 419 /* get size of edit line */ 420 GetWindowRect (lpBand->hwndChild, &rc); 421 nEditHeight = rc.bottom - rc.top; 422 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2; 423 424 /* center combo box inside child area */ 425 SetWindowPos (lpBand->hwndChild, HWND_TOP, 426 lpBand->rcChild.left, /*lpBand->rcChild.top*/ yPos, 427 lpBand->rcChild.right - lpBand->rcChild.left, 428 nEditHeight, 429 SWP_SHOWWINDOW); 430 } 430 431 #if 0 431 else if (!lstrcmpA (szClassName, WC_COMBOBOXEXA)) {432 /* special placement code for extended combo box */433 434 435 }432 else if (!lstrcmpA (szClassName, WC_COMBOBOXEXA)) { 433 /* special placement code for extended combo box */ 434 435 436 } 436 437 #endif 437 else {438 SetWindowPos (lpBand->hwndChild, HWND_TOP,439 lpBand->rcChild.left, lpBand->rcChild.top,440 lpBand->rcChild.right - lpBand->rcChild.left,441 lpBand->rcChild.bottom - lpBand->rcChild.top,442 SWP_SHOWWINDOW);443 }444 }438 else { 439 SetWindowPos (lpBand->hwndChild, HWND_TOP, 440 lpBand->rcChild.left, lpBand->rcChild.top, 441 lpBand->rcChild.right - lpBand->rcChild.left, 442 lpBand->rcChild.bottom - lpBand->rcChild.top, 443 SWP_SHOWWINDOW); 444 } 445 } 445 446 } 446 447 } … … 460 461 if (PtInRect (&rect, *lpPt)) 461 462 { 462 if (infoPtr->uNumBands == 0) {463 *pFlags = RBHT_NOWHERE;464 if (pBand)465 *pBand = -1;466 // TRACE (rebar, "NOWHERE\n");467 return;468 }469 else {470 /* somewhere inside */471 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) {472 lpBand = &infoPtr->bands[iCount];473 if (PtInRect (&lpBand->rcBand, *lpPt)) {474 if (pBand)475 *pBand = iCount;476 if (PtInRect (&lpBand->rcGripper, *lpPt)) {477 *pFlags = RBHT_GRABBER;478 // TRACE (rebar, "ON GRABBER %d\n", iCount);479 return;480 }481 else if (PtInRect (&lpBand->rcCapImage, *lpPt)) {482 *pFlags = RBHT_CAPTION;483 // TRACE (rebar, "ON CAPTION %d\n", iCount);484 return;485 }486 else if (PtInRect (&lpBand->rcCapText, *lpPt)) {487 *pFlags = RBHT_CAPTION;488 // TRACE (rebar, "ON CAPTION %d\n", iCount);489 return;490 }491 else if (PtInRect (&lpBand->rcChild, *lpPt)) {492 *pFlags = RBHT_CLIENT;493 // TRACE (rebar, "ON CLIENT %d\n", iCount);494 return;495 }496 else {497 *pFlags = RBHT_NOWHERE;498 // TRACE (rebar, "NOWHERE %d\n", iCount);499 return;500 }501 }502 }503 504 *pFlags = RBHT_NOWHERE;505 if (pBand)506 *pBand = -1;507 508 // TRACE (rebar, "NOWHERE\n");509 return;510 }463 if (infoPtr->uNumBands == 0) { 464 *pFlags = RBHT_NOWHERE; 465 if (pBand) 466 *pBand = -1; 467 // TRACE (rebar, "NOWHERE\n"); 468 return; 469 } 470 else { 471 /* somewhere inside */ 472 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) { 473 lpBand = &infoPtr->bands[iCount]; 474 if (PtInRect (&lpBand->rcBand, *lpPt)) { 475 if (pBand) 476 *pBand = iCount; 477 if (PtInRect (&lpBand->rcGripper, *lpPt)) { 478 *pFlags = RBHT_GRABBER; 479 // TRACE (rebar, "ON GRABBER %d\n", iCount); 480 return; 481 } 482 else if (PtInRect (&lpBand->rcCapImage, *lpPt)) { 483 *pFlags = RBHT_CAPTION; 484 // TRACE (rebar, "ON CAPTION %d\n", iCount); 485 return; 486 } 487 else if (PtInRect (&lpBand->rcCapText, *lpPt)) { 488 *pFlags = RBHT_CAPTION; 489 // TRACE (rebar, "ON CAPTION %d\n", iCount); 490 return; 491 } 492 else if (PtInRect (&lpBand->rcChild, *lpPt)) { 493 *pFlags = RBHT_CLIENT; 494 // TRACE (rebar, "ON CLIENT %d\n", iCount); 495 return; 496 } 497 else { 498 *pFlags = RBHT_NOWHERE; 499 // TRACE (rebar, "NOWHERE %d\n", iCount); 500 return; 501 } 502 } 503 } 504 505 *pFlags = RBHT_NOWHERE; 506 if (pBand) 507 *pBand = -1; 508 509 // TRACE (rebar, "NOWHERE\n"); 510 return; 511 } 511 512 } 512 513 else { 513 *pFlags = RBHT_NOWHERE;514 if (pBand)515 *pBand = -1;516 // TRACE (rebar, "NOWHERE\n");517 return;514 *pFlags = RBHT_NOWHERE; 515 if (pBand) 516 *pBand = -1; 517 // TRACE (rebar, "NOWHERE\n"); 518 return; 518 519 } 519 520 … … 534 535 535 536 if (uBand >= infoPtr->uNumBands) 536 return FALSE;537 return FALSE; 537 538 538 539 // TRACE (rebar, "deleting band %u!\n", uBand); 539 540 540 541 if (infoPtr->uNumBands == 1) { 541 // TRACE (rebar, " simple delete!\n");542 COMCTL32_Free (infoPtr->bands);543 infoPtr->bands = NULL;544 infoPtr->uNumBands = 0;542 // TRACE (rebar, " simple delete!\n"); 543 COMCTL32_Free (infoPtr->bands); 544 infoPtr->bands = NULL; 545 infoPtr->uNumBands = 0; 545 546 } 546 547 else { 547 REBAR_BAND *oldBands = infoPtr->bands;548 REBAR_BAND *oldBands = infoPtr->bands; 548 549 // TRACE(rebar, "complex delete! [uBand=%u]\n", uBand); 549 550 550 infoPtr->uNumBands--;551 infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands);551 infoPtr->uNumBands--; 552 infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands); 552 553 if (uBand > 0) { 553 554 memcpy (&infoPtr->bands[0], &oldBands[0], … … 560 561 } 561 562 562 COMCTL32_Free (oldBands);563 COMCTL32_Free (oldBands); 563 564 } 564 565 … … 583 584 584 585 if (!lParam) 585 return 0;586 return 0; 586 587 if ((UINT)wParam >= infoPtr->uNumBands) 587 return 0;588 return 0; 588 589 589 590 lpBand = &infoPtr->bands[(UINT)wParam]; … … 618 619 619 620 if (lprbbi == NULL) 620 return FALSE;621 return FALSE; 621 622 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) 622 return FALSE;623 return FALSE; 623 624 if ((UINT)wParam >= infoPtr->uNumBands) 624 return FALSE;625 return FALSE; 625 626 626 627 // TRACE (rebar, "index %u\n", (UINT)wParam); … … 630 631 631 632 if (lprbbi->fMask & RBBIM_STYLE) 632 lprbbi->fStyle = lpBand->fStyle;633 lprbbi->fStyle = lpBand->fStyle; 633 634 634 635 if (lprbbi->fMask & RBBIM_COLORS) { 635 lprbbi->clrFore = lpBand->clrFore;636 lprbbi->clrBack = lpBand->clrBack;637 } 638 639 if ((lprbbi->fMask & RBBIM_TEXT) && 640 (lprbbi->lpText) && (lpBand->lpText)) {641 lstrcpynWtoA (lprbbi->lpText, lpBand->lpText, lprbbi->cch);636 lprbbi->clrFore = lpBand->clrFore; 637 lprbbi->clrBack = lpBand->clrBack; 638 } 639 640 if ((lprbbi->fMask & RBBIM_TEXT) && 641 (lprbbi->lpText) && (lpBand->lpText)) { 642 lstrcpynWtoA (lprbbi->lpText, lpBand->lpText, MIN(lprbbi->cch,lstrlenW(lpBand->lpText))); 642 643 } 643 644 644 645 if (lprbbi->fMask & RBBIM_IMAGE) 645 lprbbi->iImage = lpBand->iImage;646 lprbbi->iImage = lpBand->iImage; 646 647 647 648 if (lprbbi->fMask & RBBIM_CHILD) 648 lprbbi->hwndChild = lpBand->hwndChild;649 lprbbi->hwndChild = lpBand->hwndChild; 649 650 650 651 if (lprbbi->fMask & RBBIM_CHILDSIZE) { 651 lprbbi->cxMinChild = lpBand->cxMinChild;652 lprbbi->cyMinChild = lpBand->cyMinChild;653 lprbbi->cyMaxChild = lpBand->cyMaxChild;654 lprbbi->cyChild = lpBand->cyChild;655 lprbbi->cyIntegral = lpBand->cyIntegral;652 lprbbi->cxMinChild = lpBand->cxMinChild; 653 lprbbi->cyMinChild = lpBand->cyMinChild; 654 lprbbi->cyMaxChild = lpBand->cyMaxChild; 655 lprbbi->cyChild = lpBand->cyChild; 656 lprbbi->cyIntegral = lpBand->cyIntegral; 656 657 } 657 658 658 659 if (lprbbi->fMask & RBBIM_SIZE) 659 lprbbi->cx = lpBand->cx;660 lprbbi->cx = lpBand->cx; 660 661 661 662 if (lprbbi->fMask & RBBIM_BACKGROUND) 662 lprbbi->hbmBack = lpBand->hbmBack;663 lprbbi->hbmBack = lpBand->hbmBack; 663 664 664 665 if (lprbbi->fMask & RBBIM_ID) 665 lprbbi->wID = lpBand->wID;666 lprbbi->wID = lpBand->wID; 666 667 667 668 /* check for additional data */ 668 669 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { 669 if (lprbbi->fMask & RBBIM_IDEALSIZE)670 lprbbi->cxIdeal = lpBand->cxIdeal;671 672 if (lprbbi->fMask & RBBIM_LPARAM)673 lprbbi->lParam = lpBand->lParam;674 675 if (lprbbi->fMask & RBBIM_HEADERSIZE)676 lprbbi->cxHeader = lpBand->cxHeader;670 if (lprbbi->fMask & RBBIM_IDEALSIZE) 671 lprbbi->cxIdeal = lpBand->cxIdeal; 672 673 if (lprbbi->fMask & RBBIM_LPARAM) 674 lprbbi->lParam = lpBand->lParam; 675 676 if (lprbbi->fMask & RBBIM_HEADERSIZE) 677 lprbbi->cxHeader = lpBand->cxHeader; 677 678 } 678 679 … … 689 690 690 691 if (lprbbi == NULL) 691 return FALSE;692 return FALSE; 692 693 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) 693 return FALSE;694 return FALSE; 694 695 if ((UINT)wParam >= infoPtr->uNumBands) 695 return FALSE;696 return FALSE; 696 697 697 698 // TRACE (rebar, "index %u\n", (UINT)wParam); … … 701 702 702 703 if (lprbbi->fMask & RBBIM_STYLE) 703 lprbbi->fStyle = lpBand->fStyle;704 lprbbi->fStyle = lpBand->fStyle; 704 705 705 706 if (lprbbi->fMask & RBBIM_COLORS) { 706 lprbbi->clrFore = lpBand->clrFore;707 lprbbi->clrBack = lpBand->clrBack;708 } 709 710 if ((lprbbi->fMask & RBBIM_TEXT) && 711 (lprbbi->lpText) && (lpBand->lpText)) {712 lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch);707 lprbbi->clrFore = lpBand->clrFore; 708 lprbbi->clrBack = lpBand->clrBack; 709 } 710 711 if ((lprbbi->fMask & RBBIM_TEXT) && 712 (lprbbi->lpText) && (lpBand->lpText)) { 713 lstrcpynW (lprbbi->lpText, lpBand->lpText, MIN(lprbbi->cch,lstrlenW(lpBand->lpText))); 713 714 } 714 715 715 716 if (lprbbi->fMask & RBBIM_IMAGE) 716 lprbbi->iImage = lpBand->iImage;717 lprbbi->iImage = lpBand->iImage; 717 718 718 719 if (lprbbi->fMask & RBBIM_CHILD) 719 lprbbi->hwndChild = lpBand->hwndChild;720 lprbbi->hwndChild = lpBand->hwndChild; 720 721 721 722 if (lprbbi->fMask & RBBIM_CHILDSIZE) { 722 lprbbi->cxMinChild = lpBand->cxMinChild;723 lprbbi->cyMinChild = lpBand->cyMinChild;724 lprbbi->cyMaxChild = lpBand->cyMaxChild;725 lprbbi->cyChild = lpBand->cyChild;726 lprbbi->cyIntegral = lpBand->cyIntegral;723 lprbbi->cxMinChild = lpBand->cxMinChild; 724 lprbbi->cyMinChild = lpBand->cyMinChild; 725 lprbbi->cyMaxChild = lpBand->cyMaxChild; 726 lprbbi->cyChild = lpBand->cyChild; 727 lprbbi->cyIntegral = lpBand->cyIntegral; 727 728 } 728 729 729 730 if (lprbbi->fMask & RBBIM_SIZE) 730 lprbbi->cx = lpBand->cx;731 lprbbi->cx = lpBand->cx; 731 732 732 733 if (lprbbi->fMask & RBBIM_BACKGROUND) 733 lprbbi->hbmBack = lpBand->hbmBack;734 lprbbi->hbmBack = lpBand->hbmBack; 734 735 735 736 if (lprbbi->fMask & RBBIM_ID) 736 lprbbi->wID = lpBand->wID;737 lprbbi->wID = lpBand->wID; 737 738 738 739 /* check for additional data */ 739 740 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { 740 if (lprbbi->fMask & RBBIM_IDEALSIZE)741 lprbbi->cxIdeal = lpBand->cxIdeal;742 743 if (lprbbi->fMask & RBBIM_LPARAM)744 lprbbi->lParam = lpBand->lParam;745 746 if (lprbbi->fMask & RBBIM_HEADERSIZE)747 lprbbi->cxHeader = lpBand->cxHeader;741 if (lprbbi->fMask & RBBIM_IDEALSIZE) 742 lprbbi->cxIdeal = lpBand->cxIdeal; 743 744 if (lprbbi->fMask & RBBIM_LPARAM) 745 lprbbi->lParam = lpBand->lParam; 746 747 if (lprbbi->fMask & RBBIM_HEADERSIZE) 748 lprbbi->cxHeader = lpBand->cxHeader; 748 749 } 749 750 … … 762 763 763 764 if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) 764 nHeight += (2 * GetSystemMetrics(SM_CYEDGE));765 nHeight += (2 * GetSystemMetrics(SM_CYEDGE)); 765 766 766 767 … … 778 779 779 780 if (lpInfo == NULL) 780 return FALSE;781 return FALSE; 781 782 782 783 if (lpInfo->cbSize < sizeof (REBARINFO)) 783 return FALSE;784 return FALSE; 784 785 785 786 // TRACE (rebar, "getting bar info!\n"); 786 787 787 788 if (infoPtr->himl) { 788 lpInfo->himl = infoPtr->himl;789 lpInfo->fMask |= RBIM_IMAGELIST;789 lpInfo->himl = infoPtr->himl; 790 lpInfo->fMask |= RBIM_IMAGELIST; 790 791 } 791 792 … … 827 828 828 829 if ((iBand < 0) && ((UINT)iBand >= infoPtr->uNumBands)) 829 return FALSE;830 return FALSE; 830 831 if (!lprc) 831 return FALSE;832 return FALSE; 832 833 833 834 // TRACE (rebar, "band %d\n", iBand); … … 899 900 { 900 901 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ 901 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; 902 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; 902 903 903 904 if (!lprbht) 904 return -1;905 return -1; 905 906 906 907 REBAR_InternalHitTest (hwnd, &lprbht->pt, &lprbht->flags, &lprbht->iBand); … … 917 918 918 919 if (infoPtr == NULL) 919 return -1;920 return -1; 920 921 921 922 if (infoPtr->uNumBands < 1) 922 return -1;923 return -1; 923 924 924 925 // TRACE (rebar, "id %u\n", (UINT)wParam); 925 926 926 927 for (i = 0; i < infoPtr->uNumBands; i++) { 927 if (infoPtr->bands[i].wID == (UINT)wParam) {928 // TRACE (rebar, "band %u found!\n", i);929 return i;930 }928 if (infoPtr->bands[i].wID == (UINT)wParam) { 929 // TRACE (rebar, "band %u found!\n", i); 930 return i; 931 } 931 932 } 932 933 … … 945 946 946 947 if (infoPtr == NULL) 947 return FALSE;948 return FALSE; 948 949 if (lprbbi == NULL) 949 return FALSE;950 return FALSE; 950 951 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) 951 return FALSE;952 return FALSE; 952 953 953 954 // TRACE (rebar, "insert band at %u!\n", uIndex); 954 955 955 956 if (infoPtr->uNumBands == 0) { 956 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));957 uIndex = 0;957 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND)); 958 uIndex = 0; 958 959 } 959 960 else { 960 REBAR_BAND *oldBands = infoPtr->bands;961 infoPtr->bands =962 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));963 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))964 uIndex = infoPtr->uNumBands;965 966 /* pre insert copy */967 if (uIndex > 0) {968 memcpy (&infoPtr->bands[0], &oldBands[0],969 uIndex * sizeof(REBAR_BAND));970 }971 972 /* post copy */973 if (uIndex < infoPtr->uNumBands - 1) {974 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],975 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));976 }977 978 COMCTL32_Free (oldBands);961 REBAR_BAND *oldBands = infoPtr->bands; 962 infoPtr->bands = 963 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND)); 964 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands)) 965 uIndex = infoPtr->uNumBands; 966 967 /* pre insert copy */ 968 if (uIndex > 0) { 969 memcpy (&infoPtr->bands[0], &oldBands[0], 970 uIndex * sizeof(REBAR_BAND)); 971 } 972 973 /* post copy */ 974 if (uIndex < infoPtr->uNumBands - 1) { 975 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex], 976 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND)); 977 } 978 979 COMCTL32_Free (oldBands); 979 980 } 980 981 … … 987 988 988 989 if (lprbbi->fMask & RBBIM_STYLE) 989 lpBand->fStyle = lprbbi->fStyle;990 lpBand->fStyle = lprbbi->fStyle; 990 991 991 992 if (lprbbi->fMask & RBBIM_COLORS) { 992 lpBand->clrFore = lprbbi->clrFore;993 lpBand->clrBack = lprbbi->clrBack;993 lpBand->clrFore = lprbbi->clrFore; 994 lpBand->clrBack = lprbbi->clrBack; 994 995 } 995 996 else { 996 lpBand->clrFore = CLR_NONE;997 lpBand->clrBack = CLR_NONE;997 lpBand->clrFore = CLR_NONE; 998 lpBand->clrBack = CLR_NONE; 998 999 } 999 1000 1000 1001 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { 1001 INT len = lstrlenA (lprbbi->lpText);1002 if (len > 0) {1003 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));1004 lstrcpyAtoW (lpBand->lpText, lprbbi->lpText);1005 }1002 INT len = lstrlenA (lprbbi->lpText); 1003 if (len > 0) { 1004 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 1005 lstrcpyAtoW (lpBand->lpText, lprbbi->lpText); 1006 } 1006 1007 } 1007 1008 1008 1009 if (lprbbi->fMask & RBBIM_IMAGE) 1009 lpBand->iImage = lprbbi->iImage;1010 lpBand->iImage = lprbbi->iImage; 1010 1011 else 1011 lpBand->iImage = -1;1012 lpBand->iImage = -1; 1012 1013 1013 1014 if (lprbbi->fMask & RBBIM_CHILD) { 1014 // TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild);1015 lpBand->hwndChild = lprbbi->hwndChild;1016 lpBand->hwndPrevParent =1017 SetParent (lpBand->hwndChild, hwnd);1015 // TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild); 1016 lpBand->hwndChild = lprbbi->hwndChild; 1017 lpBand->hwndPrevParent = 1018 SetParent (lpBand->hwndChild, hwnd); 1018 1019 } 1019 1020 1020 1021 if (lprbbi->fMask & RBBIM_CHILDSIZE) { 1021 lpBand->cxMinChild = lprbbi->cxMinChild;1022 lpBand->cyMinChild = lprbbi->cyMinChild;1023 lpBand->cyMaxChild = lprbbi->cyMaxChild;1024 lpBand->cyChild = lprbbi->cyChild;1025 lpBand->cyIntegral = lprbbi->cyIntegral;1022 lpBand->cxMinChild = lprbbi->cxMinChild; 1023 lpBand->cyMinChild = lprbbi->cyMinChild; 1024 lpBand->cyMaxChild = lprbbi->cyMaxChild; 1025 lpBand->cyChild = lprbbi->cyChild; 1026 lpBand->cyIntegral = lprbbi->cyIntegral; 1026 1027 } 1027 1028 else { 1028 lpBand->cxMinChild = -1;1029 lpBand->cyMinChild = -1;1030 lpBand->cyMaxChild = -1;1031 lpBand->cyChild = -1;1032 lpBand->cyIntegral = -1;1029 lpBand->cxMinChild = -1; 1030 lpBand->cyMinChild = -1; 1031 lpBand->cyMaxChild = -1; 1032 lpBand->cyChild = -1; 1033 lpBand->cyIntegral = -1; 1033 1034 } 1034 1035 1035 1036 if (lprbbi->fMask & RBBIM_SIZE) 1036 lpBand->cx = lprbbi->cx;1037 lpBand->cx = lprbbi->cx; 1037 1038 else 1038 lpBand->cx = -1;1039 lpBand->cx = -1; 1039 1040 1040 1041 if (lprbbi->fMask & RBBIM_BACKGROUND) 1041 lpBand->hbmBack = lprbbi->hbmBack;1042 lpBand->hbmBack = lprbbi->hbmBack; 1042 1043 1043 1044 if (lprbbi->fMask & RBBIM_ID) 1044 lpBand->wID = lprbbi->wID;1045 lpBand->wID = lprbbi->wID; 1045 1046 1046 1047 /* check for additional data */ 1047 1048 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { 1048 if (lprbbi->fMask & RBBIM_IDEALSIZE)1049 lpBand->cxIdeal = lprbbi->cxIdeal;1050 1051 if (lprbbi->fMask & RBBIM_LPARAM)1052 lpBand->lParam = lprbbi->lParam;1053 1054 if (lprbbi->fMask & RBBIM_HEADERSIZE)1055 lpBand->cxHeader = lprbbi->cxHeader;1049 if (lprbbi->fMask & RBBIM_IDEALSIZE) 1050 lpBand->cxIdeal = lprbbi->cxIdeal; 1051 1052 if (lprbbi->fMask & RBBIM_LPARAM) 1053 lpBand->lParam = lprbbi->lParam; 1054 1055 if (lprbbi->fMask & RBBIM_HEADERSIZE) 1056 lpBand->cxHeader = lprbbi->cxHeader; 1056 1057 } 1057 1058 … … 1074 1075 1075 1076 if (infoPtr == NULL) 1076 return FALSE;1077 return FALSE; 1077 1078 if (lprbbi == NULL) 1078 return FALSE;1079 return FALSE; 1079 1080 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) 1080 return FALSE;1081 return FALSE; 1081 1082 1082 1083 // TRACE (rebar, "insert band at %u!\n", uIndex); 1083 1084 1084 1085 if (infoPtr->uNumBands == 0) { 1085 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));1086 uIndex = 0;1086 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND)); 1087 uIndex = 0; 1087 1088 } 1088 1089 else { 1089 REBAR_BAND *oldBands = infoPtr->bands;1090 infoPtr->bands =1091 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));1092 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))1093 uIndex = infoPtr->uNumBands;1094 1095 /* pre insert copy */1096 if (uIndex > 0) {1097 memcpy (&infoPtr->bands[0], &oldBands[0],1098 uIndex * sizeof(REBAR_BAND));1099 }1100 1101 /* post copy */1102 if (uIndex < infoPtr->uNumBands - 1) {1103 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],1104 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));1105 }1106 1107 COMCTL32_Free (oldBands);1090 REBAR_BAND *oldBands = infoPtr->bands; 1091 infoPtr->bands = 1092 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND)); 1093 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands)) 1094 uIndex = infoPtr->uNumBands; 1095 1096 /* pre insert copy */ 1097 if (uIndex > 0) { 1098 memcpy (&infoPtr->bands[0], &oldBands[0], 1099 uIndex * sizeof(REBAR_BAND)); 1100 } 1101 1102 /* post copy */ 1103 if (uIndex < infoPtr->uNumBands - 1) { 1104 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex], 1105 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND)); 1106 } 1107 1108 COMCTL32_Free (oldBands); 1108 1109 } 1109 1110 … … 1116 1117 1117 1118 if (lprbbi->fMask & RBBIM_STYLE) 1118 lpBand->fStyle = lprbbi->fStyle;1119 lpBand->fStyle = lprbbi->fStyle; 1119 1120 1120 1121 if (lprbbi->fMask & RBBIM_COLORS) { 1121 lpBand->clrFore = lprbbi->clrFore;1122 lpBand->clrBack = lprbbi->clrBack;1122 lpBand->clrFore = lprbbi->clrFore; 1123 lpBand->clrBack = lprbbi->clrBack; 1123 1124 } 1124 1125 else { 1125 lpBand->clrFore = CLR_NONE;1126 lpBand->clrBack = CLR_NONE;1126 lpBand->clrFore = CLR_NONE; 1127 lpBand->clrBack = CLR_NONE; 1127 1128 } 1128 1129 1129 1130 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { 1130 INT len = lstrlenW (lprbbi->lpText);1131 if (len > 0) {1132 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));1133 lstrcpyW (lpBand->lpText, lprbbi->lpText);1134 }1131 INT len = lstrlenW (lprbbi->lpText); 1132 if (len > 0) { 1133 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 1134 lstrcpyW (lpBand->lpText, lprbbi->lpText); 1135 } 1135 1136 } 1136 1137 1137 1138 if (lprbbi->fMask & RBBIM_IMAGE) 1138 lpBand->iImage = lprbbi->iImage;1139 lpBand->iImage = lprbbi->iImage; 1139 1140 else 1140 lpBand->iImage = -1;1141 lpBand->iImage = -1; 1141 1142 1142 1143 if (lprbbi->fMask & RBBIM_CHILD) { 1143 // TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild);1144 lpBand->hwndChild = lprbbi->hwndChild;1145 lpBand->hwndPrevParent =1146 SetParent (lpBand->hwndChild, hwnd);1144 // TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild); 1145 lpBand->hwndChild = lprbbi->hwndChild; 1146 lpBand->hwndPrevParent = 1147 SetParent (lpBand->hwndChild, hwnd); 1147 1148 } 1148 1149 1149 1150 if (lprbbi->fMask & RBBIM_CHILDSIZE) { 1150 lpBand->cxMinChild = lprbbi->cxMinChild;1151 lpBand->cyMinChild = lprbbi->cyMinChild;1152 lpBand->cyMaxChild = lprbbi->cyMaxChild;1153 lpBand->cyChild = lprbbi->cyChild;1154 lpBand->cyIntegral = lprbbi->cyIntegral;1151 lpBand->cxMinChild = lprbbi->cxMinChild; 1152 lpBand->cyMinChild = lprbbi->cyMinChild; 1153 lpBand->cyMaxChild = lprbbi->cyMaxChild; 1154 lpBand->cyChild = lprbbi->cyChild; 1155 lpBand->cyIntegral = lprbbi->cyIntegral; 1155 1156 } 1156 1157 else { 1157 lpBand->cxMinChild = -1;1158 lpBand->cyMinChild = -1;1159 lpBand->cyMaxChild = -1;1160 lpBand->cyChild = -1;1161 lpBand->cyIntegral = -1;1158 lpBand->cxMinChild = -1; 1159 lpBand->cyMinChild = -1; 1160 lpBand->cyMaxChild = -1; 1161 lpBand->cyChild = -1; 1162 lpBand->cyIntegral = -1; 1162 1163 } 1163 1164 1164 1165 if (lprbbi->fMask & RBBIM_SIZE) 1165 lpBand->cx = lprbbi->cx;1166 lpBand->cx = lprbbi->cx; 1166 1167 else 1167 lpBand->cx = -1;1168 lpBand->cx = -1; 1168 1169 1169 1170 if (lprbbi->fMask & RBBIM_BACKGROUND) 1170 lpBand->hbmBack = lprbbi->hbmBack;1171 lpBand->hbmBack = lprbbi->hbmBack; 1171 1172 1172 1173 if (lprbbi->fMask & RBBIM_ID) 1173 lpBand->wID = lprbbi->wID;1174 lpBand->wID = lprbbi->wID; 1174 1175 1175 1176 /* check for additional data */ 1176 1177 if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) { 1177 if (lprbbi->fMask & RBBIM_IDEALSIZE)1178 lpBand->cxIdeal = lprbbi->cxIdeal;1179 1180 if (lprbbi->fMask & RBBIM_LPARAM)1181 lpBand->lParam = lprbbi->lParam;1182 1183 if (lprbbi->fMask & RBBIM_HEADERSIZE)1184 lpBand->cxHeader = lprbbi->cxHeader;1178 if (lprbbi->fMask & RBBIM_IDEALSIZE) 1179 lpBand->cxIdeal = lprbbi->cxIdeal; 1180 1181 if (lprbbi->fMask & RBBIM_LPARAM) 1182 lpBand->lParam = lprbbi->lParam; 1183 1184 if (lprbbi->fMask & RBBIM_HEADERSIZE) 1185 lpBand->cxHeader = lprbbi->cxHeader; 1185 1186 } 1186 1187 … … 1200 1201 1201 1202 // FIXME (rebar, "(uBand = %u fIdeal = %s)\n", 1202 // (UINT)wParam, lParam ? "TRUE" : "FALSE");1203 1204 1203 // (UINT)wParam, lParam ? "TRUE" : "FALSE"); 1204 1205 1205 1206 return 0; 1206 1207 } … … 1214 1215 // FIXME (rebar, "(uBand = %u)\n", (UINT)wParam); 1215 1216 1216 1217 1217 1218 return 0; 1218 1219 } … … 1225 1226 1226 1227 // FIXME (rebar, "(iFrom = %u iTof = %u)\n", 1227 // (UINT)wParam, (UINT)lParam);1228 1229 1228 // (UINT)wParam, (UINT)lParam); 1229 1230 1230 1231 return FALSE; 1231 1232 } … … 1240 1241 1241 1242 if (lprbbi == NULL) 1242 return FALSE;1243 return FALSE; 1243 1244 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) 1244 return FALSE;1245 return FALSE; 1245 1246 if ((UINT)wParam >= infoPtr->uNumBands) 1246 return FALSE;1247 return FALSE; 1247 1248 1248 1249 // TRACE (rebar, "index %u\n", (UINT)wParam); … … 1252 1253 1253 1254 if (lprbbi->fMask & RBBIM_STYLE) 1254 lpBand->fStyle = lprbbi->fStyle;1255 lpBand->fStyle = lprbbi->fStyle; 1255 1256 1256 1257 if (lprbbi->fMask & RBBIM_COLORS) { 1257 lpBand->clrFore = lprbbi->clrFore;1258 lpBand->clrBack = lprbbi->clrBack;1258 lpBand->clrFore = lprbbi->clrFore; 1259 lpBand->clrBack = lprbbi->clrBack; 1259 1260 } 1260 1261 1261 1262 if (lprbbi->fMask & RBBIM_TEXT) { 1262 if (lpBand->lpText) {1263 COMCTL32_Free (lpBand->lpText);1264 lpBand->lpText = NULL;1265 }1266 if (lprbbi->lpText) {1267 INT len = lstrlenA (lprbbi->lpText);1268 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));1269 lstrcpyAtoW (lpBand->lpText, lprbbi->lpText);1270 }1263 if (lpBand->lpText) { 1264 COMCTL32_Free (lpBand->lpText); 1265 lpBand->lpText = NULL; 1266 } 1267 if (lprbbi->lpText) { 1268 INT len = lstrlenA (lprbbi->lpText); 1269 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 1270 lstrcpyAtoW (lpBand->lpText, lprbbi->lpText); 1271 } 1271 1272 } 1272 1273 1273 1274 if (lprbbi->fMask & RBBIM_IMAGE) 1274 lpBand->iImage = lprbbi->iImage;1275 lpBand->iImage = lprbbi->iImage; 1275 1276 1276 1277 if (lprbbi->fMask & RBBIM_CHILD) { 1277 if (lprbbi->hwndChild) {1278 lpBand->hwndChild = lprbbi->hwndChild;1279 lpBand->hwndPrevParent =1280 SetParent (lpBand->hwndChild, hwnd);1281 }1282 else {1283 // TRACE (rebar, "child: 0x%x prev parent: 0x%x\n",1284 // lpBand->hwndChild, lpBand->hwndPrevParent);1285 lpBand->hwndChild = 0;1286 lpBand->hwndPrevParent = 0;1287 }1278 if (lprbbi->hwndChild) { 1279 lpBand->hwndChild = lprbbi->hwndChild; 1280 lpBand->hwndPrevParent = 1281 SetParent (lpBand->hwndChild, hwnd); 1282 } 1283 else { 1284 // TRACE (rebar, "child: 0x%x prev parent: 0x%x\n", 1285 // lpBand->hwndChild, lpBand->hwndPrevParent); 1286 lpBand->hwndChild = 0; 1287 lpBand->hwndPrevParent = 0; 1288 } 1288 1289 } 1289 1290 1290 1291 if (lprbbi->fMask & RBBIM_CHILDSIZE) { 1291 lpBand->cxMinChild = lprbbi->cxMinChild;1292 lpBand->cyMinChild = lprbbi->cyMinChild;1293 lpBand->cyMaxChild = lprbbi->cyMaxChild;1294 lpBand->cyChild = lprbbi->cyChild;1295 lpBand->cyIntegral = lprbbi->cyIntegral;1292 lpBand->cxMinChild = lprbbi->cxMinChild; 1293 lpBand->cyMinChild = lprbbi->cyMinChild; 1294 lpBand->cyMaxChild = lprbbi->cyMaxChild; 1295 lpBand->cyChild = lprbbi->cyChild; 1296 lpBand->cyIntegral = lprbbi->cyIntegral; 1296 1297 } 1297 1298 1298 1299 if (lprbbi->fMask & RBBIM_SIZE) 1299 lpBand->cx = lprbbi->cx;1300 lpBand->cx = lprbbi->cx; 1300 1301 1301 1302 if (lprbbi->fMask & RBBIM_BACKGROUND) 1302 lpBand->hbmBack = lprbbi->hbmBack;1303 lpBand->hbmBack = lprbbi->hbmBack; 1303 1304 1304 1305 if (lprbbi->fMask & RBBIM_ID) 1305 lpBand->wID = lprbbi->wID;1306 lpBand->wID = lprbbi->wID; 1306 1307 1307 1308 /* check for additional data */ 1308 1309 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { 1309 if (lprbbi->fMask & RBBIM_IDEALSIZE)1310 lpBand->cxIdeal = lprbbi->cxIdeal;1311 1312 if (lprbbi->fMask & RBBIM_LPARAM)1313 lpBand->lParam = lprbbi->lParam;1314 1315 if (lprbbi->fMask & RBBIM_HEADERSIZE)1316 lpBand->cxHeader = lprbbi->cxHeader;1310 if (lprbbi->fMask & RBBIM_IDEALSIZE) 1311 lpBand->cxIdeal = lprbbi->cxIdeal; 1312 1313 if (lprbbi->fMask & RBBIM_LPARAM) 1314 lpBand->lParam = lprbbi->lParam; 1315 1316 if (lprbbi->fMask & RBBIM_HEADERSIZE) 1317 lpBand->cxHeader = lprbbi->cxHeader; 1317 1318 } 1318 1319 … … 1333 1334 1334 1335 if (lprbbi == NULL) 1335 return FALSE;1336 return FALSE; 1336 1337 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) 1337 return FALSE;1338 return FALSE; 1338 1339 if ((UINT)wParam >= infoPtr->uNumBands) 1339 return FALSE;1340 return FALSE; 1340 1341 1341 1342 // TRACE (rebar, "index %u\n", (UINT)wParam); … … 1345 1346 1346 1347 if (lprbbi->fMask & RBBIM_STYLE) 1347 lpBand->fStyle = lprbbi->fStyle;1348 lpBand->fStyle = lprbbi->fStyle; 1348 1349 1349 1350 if (lprbbi->fMask & RBBIM_COLORS) { 1350 lpBand->clrFore = lprbbi->clrFore;1351 lpBand->clrBack = lprbbi->clrBack;1351 lpBand->clrFore = lprbbi->clrFore; 1352 lpBand->clrBack = lprbbi->clrBack; 1352 1353 } 1353 1354 1354 1355 if (lprbbi->fMask & RBBIM_TEXT) { 1355 if (lpBand->lpText) {1356 COMCTL32_Free (lpBand->lpText);1357 lpBand->lpText = NULL;1358 }1359 if (lprbbi->lpText) {1360 INT len = lstrlenW (lprbbi->lpText);1361 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));1362 lstrcpyW (lpBand->lpText, lprbbi->lpText);1363 }1356 if (lpBand->lpText) { 1357 COMCTL32_Free (lpBand->lpText); 1358 lpBand->lpText = NULL; 1359 } 1360 if (lprbbi->lpText) { 1361 INT len = lstrlenW (lprbbi->lpText); 1362 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 1363 lstrcpyW (lpBand->lpText, lprbbi->lpText); 1364 } 1364 1365 } 1365 1366 1366 1367 if (lprbbi->fMask & RBBIM_IMAGE) 1367 lpBand->iImage = lprbbi->iImage;1368 lpBand->iImage = lprbbi->iImage; 1368 1369 1369 1370 if (lprbbi->fMask & RBBIM_CHILD) { 1370 if (lprbbi->hwndChild) {1371 lpBand->hwndChild = lprbbi->hwndChild;1372 lpBand->hwndPrevParent =1373 SetParent (lpBand->hwndChild, hwnd);1374 }1375 else {1376 // TRACE (rebar, "child: 0x%x prev parent: 0x%x\n",1377 // lpBand->hwndChild, lpBand->hwndPrevParent);1378 lpBand->hwndChild = 0;1379 lpBand->hwndPrevParent = 0;1380 }1371 if (lprbbi->hwndChild) { 1372 lpBand->hwndChild = lprbbi->hwndChild; 1373 lpBand->hwndPrevParent = 1374 SetParent (lpBand->hwndChild, hwnd); 1375 } 1376 else { 1377 // TRACE (rebar, "child: 0x%x prev parent: 0x%x\n", 1378 // lpBand->hwndChild, lpBand->hwndPrevParent); 1379 lpBand->hwndChild = 0; 1380 lpBand->hwndPrevParent = 0; 1381 } 1381 1382 } 1382 1383 1383 1384 if (lprbbi->fMask & RBBIM_CHILDSIZE) { 1384 lpBand->cxMinChild = lprbbi->cxMinChild;1385 lpBand->cyMinChild = lprbbi->cyMinChild;1386 lpBand->cyMaxChild = lprbbi->cyMaxChild;1387 lpBand->cyChild = lprbbi->cyChild;1388 lpBand->cyIntegral = lprbbi->cyIntegral;1385 lpBand->cxMinChild = lprbbi->cxMinChild; 1386 lpBand->cyMinChild = lprbbi->cyMinChild; 1387 lpBand->cyMaxChild = lprbbi->cyMaxChild; 1388 lpBand->cyChild = lprbbi->cyChild; 1389 lpBand->cyIntegral = lprbbi->cyIntegral; 1389 1390 } 1390 1391 1391 1392 if (lprbbi->fMask & RBBIM_SIZE) 1392 lpBand->cx = lprbbi->cx;1393 lpBand->cx = lprbbi->cx; 1393 1394 1394 1395 if (lprbbi->fMask & RBBIM_BACKGROUND) 1395 lpBand->hbmBack = lprbbi->hbmBack;1396 lpBand->hbmBack = lprbbi->hbmBack; 1396 1397 1397 1398 if (lprbbi->fMask & RBBIM_ID) 1398 lpBand->wID = lprbbi->wID;1399 lpBand->wID = lprbbi->wID; 1399 1400 1400 1401 /* check for additional data */ 1401 1402 if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) { 1402 if (lprbbi->fMask & RBBIM_IDEALSIZE)1403 lpBand->cxIdeal = lprbbi->cxIdeal;1404 1405 if (lprbbi->fMask & RBBIM_LPARAM)1406 lpBand->lParam = lprbbi->lParam;1407 1408 if (lprbbi->fMask & RBBIM_HEADERSIZE)1409 lpBand->cxHeader = lprbbi->cxHeader;1403 if (lprbbi->fMask & RBBIM_IDEALSIZE) 1404 lpBand->cxIdeal = lprbbi->cxIdeal; 1405 1406 if (lprbbi->fMask & RBBIM_LPARAM) 1407 lpBand->lParam = lprbbi->lParam; 1408 1409 if (lprbbi->fMask & RBBIM_HEADERSIZE) 1410 lpBand->cxHeader = lprbbi->cxHeader; 1410 1411 } 1411 1412 … … 1425 1426 1426 1427 if (lpInfo == NULL) 1427 return FALSE;1428 return FALSE; 1428 1429 1429 1430 if (lpInfo->cbSize < sizeof (REBARINFO)) 1430 return FALSE;1431 return FALSE; 1431 1432 1432 1433 // TRACE (rebar, "setting bar info!\n"); 1433 1434 1434 1435 if (lpInfo->fMask & RBIM_IMAGELIST) { 1435 infoPtr->himl = lpInfo->himl;1436 if (infoPtr->himl) {1437 ImageList_GetIconSize (infoPtr->himl, &infoPtr->imageSize.cx,1438 &infoPtr->imageSize.cy);1439 }1440 else {1441 infoPtr->imageSize.cx = 0;1442 infoPtr->imageSize.cy = 0;1443 }1436 infoPtr->himl = lpInfo->himl; 1437 if (infoPtr->himl) { 1438 ImageList_GetIconSize (infoPtr->himl, &infoPtr->imageSize.cx, 1439 &infoPtr->imageSize.cy); 1440 } 1441 else { 1442 infoPtr->imageSize.cx = 0; 1443 infoPtr->imageSize.cy = 0; 1444 } 1444 1445 } 1445 1446 … … 1514 1515 1515 1516 if (((INT)wParam < 0) || ((INT)wParam > infoPtr->uNumBands)) 1516 return FALSE;1517 return FALSE; 1517 1518 1518 1519 lpBand = &infoPtr->bands[(INT)wParam]; 1519 1520 1520 1521 if ((BOOL)lParam) { 1521 // TRACE (rebar, "show band %d\n", (INT)wParam);1522 lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN;1523 if (IsWindow (lpBand->hwndChild))1524 ShowWindow (lpBand->hwndChild, SW_SHOW);1522 // TRACE (rebar, "show band %d\n", (INT)wParam); 1523 lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN; 1524 if (IsWindow (lpBand->hwndChild)) 1525 ShowWindow (lpBand->hwndChild, SW_SHOW); 1525 1526 } 1526 1527 else { 1527 // TRACE (rebar, "hide band %d\n", (INT)wParam);1528 lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN;1529 if (IsWindow (lpBand->hwndChild))1530 ShowWindow (lpBand->hwndChild, SW_SHOW);1528 // TRACE (rebar, "hide band %d\n", (INT)wParam); 1529 lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN; 1530 if (IsWindow (lpBand->hwndChild)) 1531 ShowWindow (lpBand->hwndChild, SW_SHOW); 1531 1532 } 1532 1533 … … 1546 1547 1547 1548 if (lpRect == NULL) 1548 return FALSE;1549 return FALSE; 1549 1550 1550 1551 // FIXME (rebar, "layout change not implemented!\n"); 1551 1552 // FIXME (rebar, "[%d %d %d %d]\n", 1552 // lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);1553 // lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); 1553 1554 1554 1555 #if 0 1555 1556 SetWindowPos (hwnd, 0, lpRect->left, lpRect->top, 1556 lpRect->right - lpRect->left, lpRect->bottom - lpRect->top,1557 SWP_NOZORDER);1557 lpRect->right - lpRect->left, lpRect->bottom - lpRect->top, 1558 SWP_NOZORDER); 1558 1559 #endif 1559 1560 … … 1589 1590 1590 1591 // if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_AUTOSIZE) 1591 // FIXME (rebar, "style RBS_AUTOSIZE set!\n");1592 // FIXME (rebar, "style RBS_AUTOSIZE set!\n"); 1592 1593 1593 1594 #if 0 … … 1610 1611 /* free rebar bands */ 1611 1612 if ((infoPtr->uNumBands > 0) && infoPtr->bands) { 1612 /* clean up each band */1613 for (i = 0; i < infoPtr->uNumBands; i++) {1614 lpBand = &infoPtr->bands[i];1615 1616 /* delete text strings */1617 if (lpBand->lpText) {1618 COMCTL32_Free (lpBand->lpText);1619 lpBand->lpText = NULL;1620 }1621 /* destroy child window */1622 DestroyWindow (lpBand->hwndChild);1623 }1624 1625 /* free band array */1626 COMCTL32_Free (infoPtr->bands);1627 infoPtr->bands = NULL;1613 /* clean up each band */ 1614 for (i = 0; i < infoPtr->uNumBands; i++) { 1615 lpBand = &infoPtr->bands[i]; 1616 1617 /* delete text strings */ 1618 if (lpBand->lpText) { 1619 COMCTL32_Free (lpBand->lpText); 1620 lpBand->lpText = NULL; 1621 } 1622 /* destroy child window */ 1623 DestroyWindow (lpBand->hwndChild); 1624 } 1625 1626 /* free band array */ 1627 COMCTL32_Free (infoPtr->bands); 1628 infoPtr->bands = NULL; 1628 1629 } 1629 1630 … … 1671 1672 { 1672 1673 if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) { 1673 ((LPRECT)lParam)->left += GetSystemMetrics(SM_CXEDGE);1674 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE);1675 ((LPRECT)lParam)->right -= GetSystemMetrics(SM_CXEDGE);1676 ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE);1674 ((LPRECT)lParam)->left += GetSystemMetrics(SM_CXEDGE); 1675 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE); 1676 ((LPRECT)lParam)->right -= GetSystemMetrics(SM_CXEDGE); 1677 ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE); 1677 1678 } 1678 1679 … … 1689 1690 1690 1691 if (dwStyle & WS_MINIMIZE) 1691 return 0; /* Nothing to do */1692 return 0; /* Nothing to do */ 1692 1693 1693 1694 DefWindowProcA (hwnd, WM_NCPAINT, wParam, lParam); 1694 1695 1695 1696 if (!(hdc = GetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ))) 1696 return 0;1697 return 0; 1697 1698 1698 1699 if (dwStyle & WS_BORDER) { 1699 GetWindowRect (hwnd, &rcWindow);1700 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);1701 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT);1700 GetWindowRect (hwnd, &rcWindow); 1701 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top); 1702 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT); 1702 1703 } 1703 1704 … … 1717 1718 REBAR_Refresh (hwnd, hdc); 1718 1719 if (!wParam) 1719 EndPaint (hwnd, &ps);1720 EndPaint (hwnd, &ps); 1720 1721 return 0; 1721 1722 } … … 1738 1739 1739 1740 if (flags == RBHT_GRABBER) { 1740 if ((dwStyle & CCS_VERT) &&1741 !(dwStyle & RBS_VERTICALGRIPPER))1742 SetCursor (infoPtr->hcurVert);1743 else1744 SetCursor (infoPtr->hcurHorz);1741 if ((dwStyle & CCS_VERT) && 1742 !(dwStyle & RBS_VERTICALGRIPPER)) 1743 SetCursor (infoPtr->hcurVert); 1744 else 1745 SetCursor (infoPtr->hcurHorz); 1745 1746 } 1746 1747 else if (flags != RBHT_CLIENT) 1747 SetCursor (infoPtr->hcurArrow);1748 SetCursor (infoPtr->hcurArrow); 1748 1749 1749 1750 return 0; … … 1755 1756 { 1756 1757 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 1757 1758 1758 1759 /* TEXTMETRIC32A tm; */ 1759 1760 HFONT hFont /*, hOldFont */; … … 1793 1794 /* auto resize deadlock check */ 1794 1795 if (infoPtr->bAutoResize) { 1795 infoPtr->bAutoResize = FALSE;1796 return 0;1796 infoPtr->bAutoResize = FALSE; 1797 return 0; 1797 1798 } 1798 1799 … … 1805 1806 1806 1807 if (dwStyle & CCS_VERT) { 1807 if (dwStyle & CCS_LEFT == CCS_LEFT) {1808 x = rcParent.left;1809 y = rcParent.top;1810 cx = infoPtr->calcSize.cx;1811 cy = infoPtr->calcSize.cy;1812 }1813 else {1814 x = rcParent.right - infoPtr->calcSize.cx;1815 y = rcParent.top;1816 cx = infoPtr->calcSize.cx;1817 cy = infoPtr->calcSize.cy;1818 }1808 if (dwStyle & CCS_LEFT == CCS_LEFT) { 1809 x = rcParent.left; 1810 y = rcParent.top; 1811 cx = infoPtr->calcSize.cx; 1812 cy = infoPtr->calcSize.cy; 1813 } 1814 else { 1815 x = rcParent.right - infoPtr->calcSize.cx; 1816 y = rcParent.top; 1817 cx = infoPtr->calcSize.cx; 1818 cy = infoPtr->calcSize.cy; 1819 } 1819 1820 } 1820 1821 else { 1821 if (dwStyle & CCS_TOP) {1822 x = rcParent.left;1823 y = rcParent.top;1824 cx = infoPtr->calcSize.cx;1825 cy = infoPtr->calcSize.cy;1826 }1827 else {1828 x = rcParent.left;1829 y = rcParent.bottom - infoPtr->calcSize.cy;1830 cx = infoPtr->calcSize.cx;1831 cy = infoPtr->calcSize.cy;1832 }1822 if (dwStyle & CCS_TOP) { 1823 x = rcParent.left; 1824 y = rcParent.top; 1825 cx = infoPtr->calcSize.cx; 1826 cy = infoPtr->calcSize.cy; 1827 } 1828 else { 1829 x = rcParent.left; 1830 y = rcParent.bottom - infoPtr->calcSize.cy; 1831 cx = infoPtr->calcSize.cx; 1832 cy = infoPtr->calcSize.cy; 1833 } 1833 1834 } 1834 1835 1835 1836 SetWindowPos32 (hwnd, 0, x, y, cx, cy, 1836 SWP_NOZORDER | SWP_SHOWWINDOW);1837 SWP_NOZORDER | SWP_SHOWWINDOW); 1837 1838 */ 1838 1839 REBAR_Layout (hwnd, NULL); … … 1849 1850 switch (uMsg) 1850 1851 { 1851 /* case RB_BEGINDRAG: */1852 1853 case RB_DELETEBAND:1854 return REBAR_DeleteBand (hwnd, wParam, lParam);1855 1856 /* case RB_DRAGMOVE: */1857 /* case RB_ENDDRAG: */1858 1859 case RB_GETBANDBORDERS:1860 return REBAR_GetBandBorders (hwnd, wParam, lParam);1861 1862 case RB_GETBANDCOUNT:1863 return REBAR_GetBandCount (hwnd);1864 1865 /* case RB_GETBANDINFO32: */ /* outdated, just for compatibility */1866 1867 case RB_GETBANDINFOA:1868 return REBAR_GetBandInfoA (hwnd, wParam, lParam);1869 1870 case RB_GETBANDINFOW:1871 return REBAR_GetBandInfoW (hwnd, wParam, lParam);1872 1873 case RB_GETBARHEIGHT:1874 return REBAR_GetBarHeight (hwnd, wParam, lParam);1875 1876 case RB_GETBARINFO:1877 return REBAR_GetBarInfo (hwnd, wParam, lParam);1878 1879 case RB_GETBKCOLOR:1880 return REBAR_GetBkColor (hwnd);1881 1882 /* case RB_GETCOLORSCHEME: */1883 /* case RB_GETDROPTARGET: */1884 1885 case RB_GETPALETTE:1886 return REBAR_GetPalette (hwnd, wParam, lParam);1887 1888 case RB_GETRECT:1889 return REBAR_GetRect (hwnd, wParam, lParam);1890 1891 case RB_GETROWCOUNT:1892 return REBAR_GetRowCount (hwnd);1893 1894 case RB_GETROWHEIGHT:1895 return REBAR_GetRowHeight (hwnd, wParam, lParam);1896 1897 case RB_GETTEXTCOLOR:1898 return REBAR_GetTextColor (hwnd);1899 1900 case RB_GETTOOLTIPS:1901 return REBAR_GetToolTips (hwnd);1902 1903 case RB_GETUNICODEFORMAT:1904 return REBAR_GetUnicodeFormat (hwnd);1905 1906 case RB_HITTEST:1907 return REBAR_HitTest (hwnd, wParam, lParam);1908 1909 case RB_IDTOINDEX:1910 return REBAR_IdToIndex (hwnd, wParam, lParam);1911 1912 case RB_INSERTBANDA:1913 return REBAR_InsertBandA (hwnd, wParam, lParam);1914 1915 case RB_INSERTBANDW:1916 return REBAR_InsertBandW (hwnd, wParam, lParam);1917 1918 case RB_MAXIMIZEBAND:1919 return REBAR_MaximizeBand (hwnd, wParam, lParam);1920 1921 case RB_MINIMIZEBAND:1922 return REBAR_MinimizeBand (hwnd, wParam, lParam);1923 1924 case RB_MOVEBAND:1925 return REBAR_MoveBand (hwnd, wParam, lParam);1926 1927 case RB_SETBANDINFOA:1928 return REBAR_SetBandInfoA (hwnd, wParam, lParam);1929 1930 case RB_SETBANDINFOW:1931 return REBAR_SetBandInfoW (hwnd, wParam, lParam);1932 1933 case RB_SETBARINFO:1934 return REBAR_SetBarInfo (hwnd, wParam, lParam);1935 1936 case RB_SETBKCOLOR:1937 return REBAR_SetBkColor (hwnd, wParam, lParam);1938 1939 /* case RB_SETCOLORSCHEME: */1940 /* case RB_SETPALETTE: */1941 /* return REBAR_GetPalette (hwnd, wParam, lParam); */1942 1943 case RB_SETPARENT:1944 return REBAR_SetParent (hwnd, wParam, lParam);1945 1946 case RB_SETTEXTCOLOR:1947 return REBAR_SetTextColor (hwnd, wParam, lParam);1948 1949 /* case RB_SETTOOLTIPS: */1950 1951 case RB_SETUNICODEFORMAT:1952 return REBAR_SetUnicodeFormat (hwnd, wParam);1953 1954 case RB_SHOWBAND:1955 return REBAR_ShowBand (hwnd, wParam, lParam);1956 1957 case RB_SIZETORECT:1958 return REBAR_SizeToRect (hwnd, wParam, lParam);1959 1960 1961 case WM_COMMAND:1962 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);1963 1964 case WM_CREATE:1965 return REBAR_Create (hwnd, wParam, lParam);1966 1967 case WM_DESTROY:1968 return REBAR_Destroy (hwnd, wParam, lParam);1969 1970 case WM_GETFONT:1971 return REBAR_GetFont (hwnd, wParam, lParam);1972 1973 /* case WM_MOUSEMOVE: */1974 /* return REBAR_MouseMove (hwnd, wParam, lParam); */1975 1976 case WM_NCCALCSIZE:1977 return REBAR_NCCalcSize (hwnd, wParam, lParam);1978 1979 case WM_NCPAINT:1980 return REBAR_NCPaint (hwnd, wParam, lParam);1981 1982 case WM_NOTIFY:1983 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);1984 1985 case WM_PAINT:1986 return REBAR_Paint (hwnd, wParam);1987 1988 case WM_SETCURSOR:1989 return REBAR_SetCursor (hwnd, wParam, lParam);1990 1991 case WM_SETFONT:1992 return REBAR_SetFont (hwnd, wParam, lParam);1993 1994 case WM_SIZE:1995 return REBAR_Size (hwnd, wParam, lParam);1996 1997 /* case WM_TIMER: */1998 1999 /* case WM_WININICHANGE: */2000 2001 default:2002 // if (uMsg >= WM_USER)2003 // ERR (rebar, "unknown msg %04x wp=%08x lp=%08lx\n",2004 // uMsg, wParam, lParam);2005 return DefWindowProcA (hwnd, uMsg, wParam, lParam);1852 /* case RB_BEGINDRAG: */ 1853 1854 case RB_DELETEBAND: 1855 return REBAR_DeleteBand (hwnd, wParam, lParam); 1856 1857 /* case RB_DRAGMOVE: */ 1858 /* case RB_ENDDRAG: */ 1859 1860 case RB_GETBANDBORDERS: 1861 return REBAR_GetBandBorders (hwnd, wParam, lParam); 1862 1863 case RB_GETBANDCOUNT: 1864 return REBAR_GetBandCount (hwnd); 1865 1866 /* case RB_GETBANDINFO32: */ /* outdated, just for compatibility */ 1867 1868 case RB_GETBANDINFOA: 1869 return REBAR_GetBandInfoA (hwnd, wParam, lParam); 1870 1871 case RB_GETBANDINFOW: 1872 return REBAR_GetBandInfoW (hwnd, wParam, lParam); 1873 1874 case RB_GETBARHEIGHT: 1875 return REBAR_GetBarHeight (hwnd, wParam, lParam); 1876 1877 case RB_GETBARINFO: 1878 return REBAR_GetBarInfo (hwnd, wParam, lParam); 1879 1880 case RB_GETBKCOLOR: 1881 return REBAR_GetBkColor (hwnd); 1882 1883 /* case RB_GETCOLORSCHEME: */ 1884 /* case RB_GETDROPTARGET: */ 1885 1886 case RB_GETPALETTE: 1887 return REBAR_GetPalette (hwnd, wParam, lParam); 1888 1889 case RB_GETRECT: 1890 return REBAR_GetRect (hwnd, wParam, lParam); 1891 1892 case RB_GETROWCOUNT: 1893 return REBAR_GetRowCount (hwnd); 1894 1895 case RB_GETROWHEIGHT: 1896 return REBAR_GetRowHeight (hwnd, wParam, lParam); 1897 1898 case RB_GETTEXTCOLOR: 1899 return REBAR_GetTextColor (hwnd); 1900 1901 case RB_GETTOOLTIPS: 1902 return REBAR_GetToolTips (hwnd); 1903 1904 case RB_GETUNICODEFORMAT: 1905 return REBAR_GetUnicodeFormat (hwnd); 1906 1907 case RB_HITTEST: 1908 return REBAR_HitTest (hwnd, wParam, lParam); 1909 1910 case RB_IDTOINDEX: 1911 return REBAR_IdToIndex (hwnd, wParam, lParam); 1912 1913 case RB_INSERTBANDA: 1914 return REBAR_InsertBandA (hwnd, wParam, lParam); 1915 1916 case RB_INSERTBANDW: 1917 return REBAR_InsertBandW (hwnd, wParam, lParam); 1918 1919 case RB_MAXIMIZEBAND: 1920 return REBAR_MaximizeBand (hwnd, wParam, lParam); 1921 1922 case RB_MINIMIZEBAND: 1923 return REBAR_MinimizeBand (hwnd, wParam, lParam); 1924 1925 case RB_MOVEBAND: 1926 return REBAR_MoveBand (hwnd, wParam, lParam); 1927 1928 case RB_SETBANDINFOA: 1929 return REBAR_SetBandInfoA (hwnd, wParam, lParam); 1930 1931 case RB_SETBANDINFOW: 1932 return REBAR_SetBandInfoW (hwnd, wParam, lParam); 1933 1934 case RB_SETBARINFO: 1935 return REBAR_SetBarInfo (hwnd, wParam, lParam); 1936 1937 case RB_SETBKCOLOR: 1938 return REBAR_SetBkColor (hwnd, wParam, lParam); 1939 1940 /* case RB_SETCOLORSCHEME: */ 1941 /* case RB_SETPALETTE: */ 1942 /* return REBAR_GetPalette (hwnd, wParam, lParam); */ 1943 1944 case RB_SETPARENT: 1945 return REBAR_SetParent (hwnd, wParam, lParam); 1946 1947 case RB_SETTEXTCOLOR: 1948 return REBAR_SetTextColor (hwnd, wParam, lParam); 1949 1950 /* case RB_SETTOOLTIPS: */ 1951 1952 case RB_SETUNICODEFORMAT: 1953 return REBAR_SetUnicodeFormat (hwnd, wParam); 1954 1955 case RB_SHOWBAND: 1956 return REBAR_ShowBand (hwnd, wParam, lParam); 1957 1958 case RB_SIZETORECT: 1959 return REBAR_SizeToRect (hwnd, wParam, lParam); 1960 1961 1962 case WM_COMMAND: 1963 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); 1964 1965 case WM_CREATE: 1966 return REBAR_Create (hwnd, wParam, lParam); 1967 1968 case WM_DESTROY: 1969 return REBAR_Destroy (hwnd, wParam, lParam); 1970 1971 case WM_GETFONT: 1972 return REBAR_GetFont (hwnd, wParam, lParam); 1973 1974 /* case WM_MOUSEMOVE: */ 1975 /* return REBAR_MouseMove (hwnd, wParam, lParam); */ 1976 1977 case WM_NCCALCSIZE: 1978 return REBAR_NCCalcSize (hwnd, wParam, lParam); 1979 1980 case WM_NCPAINT: 1981 return REBAR_NCPaint (hwnd, wParam, lParam); 1982 1983 case WM_NOTIFY: 1984 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); 1985 1986 case WM_PAINT: 1987 return REBAR_Paint (hwnd, wParam); 1988 1989 case WM_SETCURSOR: 1990 return REBAR_SetCursor (hwnd, wParam, lParam); 1991 1992 case WM_SETFONT: 1993 return REBAR_SetFont (hwnd, wParam, lParam); 1994 1995 case WM_SIZE: 1996 return REBAR_Size (hwnd, wParam, lParam); 1997 1998 /* case WM_TIMER: */ 1999 2000 /* case WM_WININICHANGE: */ 2001 2002 default: 2003 // if (uMsg >= WM_USER) 2004 // ERR (rebar, "unknown msg %04x wp=%08x lp=%08lx\n", 2005 // uMsg, wParam, lParam); 2006 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 2006 2007 } 2007 2008 return 0; … … 2024 2025 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); 2025 2026 wndClass.lpszClassName = REBARCLASSNAMEA; 2026 2027 2027 2028 RegisterClassA (&wndClass); 2028 2029 } … … 2033 2034 { 2034 2035 if (GlobalFindAtomA (REBARCLASSNAMEA)) 2035 UnregisterClassA (REBARCLASSNAMEA, (HINSTANCE)NULL);2036 } 2037 2036 UnregisterClassA (REBARCLASSNAMEA, (HINSTANCE)NULL); 2037 } 2038 -
trunk/src/comctl32/status.c
r164 r236 1 /* $Id: status.c,v 1. 5 1999-06-23 19:45:01 achimhaExp $ */1 /* $Id: status.c,v 1.6 1999-06-28 15:46:26 cbratschi Exp $ */ 2 2 /* 3 3 * Interface code to StatusWindow widget/control … … 192 192 else { 193 193 for (i = 0; i < infoPtr->numParts; i++) { 194 if (infoPtr->parts[i].style & SBT_OWNERDRAW) {194 if (infoPtr->parts[i].style & SBT_OWNERDRAW) { 195 195 DRAWITEMSTRUCT dis; 196 196 … … 441 441 442 442 if (ti.lpszText) 443 lstrcpynA ((LPSTR)lParam, ti.lpszText, HIWORD(wParam));443 lstrcpynA ((LPSTR)lParam, ti.lpszText, MIN(HIWORD(wParam),lstrlenA(ti.lpszText))); 444 444 } 445 445 … … 461 461 462 462 if (ti.lpszText) 463 lstrcpynW ((LPWSTR)lParam, ti.lpszText, HIWORD(wParam));463 lstrcpynW ((LPWSTR)lParam, ti.lpszText, MIN(HIWORD(wParam),lstrlenW(ti.lpszText))); 464 464 } 465 465 … … 571 571 if (oldNumParts > self->numParts) { 572 572 for (i = self->numParts ; i < oldNumParts; i++) { 573 if (self->parts[i].text && !(self->parts[i].style & SBT_OWNERDRAW))573 if (self->parts[i].text && !(self->parts[i].style & SBT_OWNERDRAW)) 574 574 COMCTL32_Free (self->parts[i].text); 575 575 } … … 635 635 STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (hwnd); 636 636 STATUSWINDOWPART *part; 637 int part_num;638 int style;637 int part_num; 638 int style; 639 639 LPSTR text; 640 int len;640 int len; 641 641 HDC hdc; 642 642 … … 646 646 647 647 if ((self->simple) || (self->parts==NULL) || (part_num==255)) 648 part = &self->part0;648 part = &self->part0; 649 649 else 650 part = &self->parts[part_num];650 part = &self->parts[part_num]; 651 651 if (!part) return FALSE; 652 652 653 653 if (!(part->style & SBT_OWNERDRAW) && part->text) 654 COMCTL32_Free (part->text);654 COMCTL32_Free (part->text); 655 655 part->text = 0; 656 656 657 657 if (style & SBT_OWNERDRAW) { 658 part->text = (LPWSTR)text;658 part->text = (LPWSTR)text; 659 659 } 660 660 else { 661 /* duplicate string */662 if (text && (len = lstrlenA(text))) {663 part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));664 lstrcpyAtoW (part->text, text);665 }661 /* duplicate string */ 662 if (text && (len = lstrlenA(text))) { 663 part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 664 lstrcpyAtoW (part->text, text); 665 } 666 666 } 667 667 part->style = style; … … 689 689 690 690 if ((self->simple) || (self->parts==NULL) || (part_num==255)) 691 part = &self->part0;691 part = &self->part0; 692 692 else 693 part = &self->parts[part_num];693 part = &self->parts[part_num]; 694 694 if (!part) return FALSE; 695 695 696 696 if (!(part->style & SBT_OWNERDRAW) && part->text) 697 COMCTL32_Free (part->text);697 COMCTL32_Free (part->text); 698 698 part->text = 0; 699 699 700 700 if (style & SBT_OWNERDRAW) { 701 part->text = text;701 part->text = text; 702 702 } 703 703 else { 704 /* duplicate string */705 if (text && (len = lstrlenW(text))) {706 part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));707 lstrcpyW(part->text, text);708 }704 /* duplicate string */ 705 if (text && (len = lstrlenW(text))) { 706 part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 707 lstrcpyW(part->text, text); 708 } 709 709 } 710 710 part->style = style; … … 896 896 { 897 897 STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (hwnd); 898 int i;898 int i; 899 899 900 900 for (i = 0; i < self->numParts; i++) { 901 if (self->parts[i].text && !(self->parts[i].style & SBT_OWNERDRAW))902 COMCTL32_Free (self->parts[i].text);901 if (self->parts[i].text && !(self->parts[i].style & SBT_OWNERDRAW)) 902 COMCTL32_Free (self->parts[i].text); 903 903 } 904 904 if (self->part0.text && !(self->part0.style & SBT_OWNERDRAW)) 905 COMCTL32_Free (self->part0.text);905 COMCTL32_Free (self->part0.text); 906 906 COMCTL32_Free (self->parts); 907 907 908 908 /* delete default font */ 909 909 if (self->hDefaultFont) 910 DeleteObject (self->hDefaultFont);910 DeleteObject (self->hDefaultFont); 911 911 912 912 /* delete tool tip control */ 913 913 if (self->hwndToolTip) 914 DestroyWindow (self->hwndToolTip);914 DestroyWindow (self->hwndToolTip); 915 915 916 916 COMCTL32_Free (self); -
trunk/src/comctl32/tab.c
r164 r236 1 /* $Id: tab.c,v 1. 5 1999-06-23 19:45:01 achimhaExp $ */1 /* $Id: tab.c,v 1.6 1999-06-28 15:46:26 cbratschi Exp $ */ 2 2 /* 3 3 * Tab control … … 7 7 * Copyright 1999 Francis Beaudet 8 8 * Copyright 1999 Achim Hasenmueller 9 * Copyright 1999 Christoph Bratschi 9 10 * 10 11 * TODO: … … 83 84 { 84 85 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 85 86 86 87 return infoPtr->iSelected; 87 88 } … … 91 92 { 92 93 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 93 94 94 95 return infoPtr->uFocus; 95 96 } … … 111 112 INT iItem=(INT) wParam; 112 113 INT prevItem; 113 114 114 115 prevItem=-1; 115 116 if ((iItem >= 0) && (iItem < infoPtr->uNumItem)) { … … 125 126 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 126 127 INT iItem=(INT) wParam; 127 128 128 129 if ((iItem < 0) || (iItem > infoPtr->uNumItem)) return 0; 129 130 … … 131 132 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BUTTONS) { 132 133 // FIXME (tab,"Should set input focus\n"); 133 } else { 134 } else { 134 135 if (infoPtr->iSelected != iItem) { 135 136 if (TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)!=TRUE) { … … 137 138 TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE); 138 139 139 TAB_EnsureSelectionVisible(hwnd, infoPtr);140 TAB_InvalidateTabArea(hwnd, infoPtr);140 TAB_EnsureSelectionVisible(hwnd, infoPtr); 141 TAB_InvalidateTabArea(hwnd, infoPtr); 141 142 } 142 143 } … … 176 177 * Perform a sanity check and a trivial visibility check. 177 178 */ 178 if ( (infoPtr->uNumItem <=0) ||179 if ( (infoPtr->uNumItem == 0) || 179 180 (itemIndex >= infoPtr->uNumItem) || 180 181 (itemIndex < infoPtr->leftmostVisible) ) … … 187 188 if (itemRect==NULL) 188 189 itemRect = &tmpItemRect; 189 190 190 191 /* 191 192 * Retrieve the unmodified item rect. … … 194 195 195 196 /* 196 * "scroll" it to make sure the item at the very left of the 197 * "scroll" it to make sure the item at the very left of the 197 198 * tab control is the leftmost visible tab. 198 199 */ 199 200 OffsetRect(itemRect, 200 -infoPtr->items[infoPtr->leftmostVisible].rect.left, 201 0);202 203 /* 204 * Move the rectangle so the first item is slightly offset from 201 -infoPtr->items[infoPtr->leftmostVisible].rect.left, 202 0); 203 204 /* 205 * Move the rectangle so the first item is slightly offset from 205 206 * the left of the tab control. 206 207 */ 207 208 OffsetRect(itemRect, 208 SELECTED_TAB_OFFSET,209 0);209 SELECTED_TAB_OFFSET, 210 0); 210 211 211 212 … … 225 226 * If it also a bit higher. 226 227 */ 227 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BOTTOM) 228 { 228 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BOTTOM) 229 { 229 230 selectedRect->top -=2; /* the border is thicker on the bottom */ 230 231 selectedRect->bottom +=SELECTED_TAB_OFFSET; … … 242 243 static BOOL TAB_GetItemRect(HWND hwnd, WPARAM wParam, LPARAM lParam) 243 244 { 244 return TAB_InternalGetItemRect(hwnd, TAB_GetInfoPtr(hwnd), (INT)wParam, 245 return TAB_InternalGetItemRect(hwnd, TAB_GetInfoPtr(hwnd), (INT)wParam, 245 246 (LPRECT)lParam, (LPRECT)NULL); 246 247 } … … 252 253 */ 253 254 static LRESULT TAB_KeyUp( 254 HWND hwnd, 255 HWND hwnd, 255 256 WPARAM keyCode) 256 257 { … … 267 268 break; 268 269 } 269 270 270 271 /* 271 272 * If we changed to a valid item, change the selection … … 296 297 */ 297 298 static LRESULT TAB_FocusChanging( 298 HWND hwnd, 299 UINT uMsg, 300 WPARAM wParam, 299 HWND hwnd, 300 UINT uMsg, 301 WPARAM wParam, 301 302 LPARAM lParam) 302 303 { … … 309 310 */ 310 311 isVisible = TAB_InternalGetItemRect(hwnd, 311 infoPtr,312 infoPtr->uFocus,313 NULL,314 &selectedRect);315 312 infoPtr, 313 infoPtr->uFocus, 314 NULL, 315 &selectedRect); 316 316 317 /* 317 318 * If the rectangle is not completely invisible, invalidate that … … 331 332 static HWND TAB_InternalHitTest ( 332 333 HWND hwnd, 333 TAB_INFO* infoPtr, 334 POINT pt, 334 TAB_INFO* infoPtr, 335 POINT pt, 335 336 UINT* flags) 336 337 337 338 { 338 339 RECT rect; 339 int iCount; 340 341 for (iCount = 0; iCount < infoPtr->uNumItem; iCount++) 340 int iCount; 341 342 for (iCount = 0; iCount < infoPtr->uNumItem; iCount++) 342 343 { 343 344 TAB_InternalGetItemRect(hwnd, 344 infoPtr, 345 iCount,346 &rect,347 NULL);345 infoPtr, 346 iCount, 347 &rect, 348 NULL); 348 349 349 350 if (PtInRect (&rect, pt)) … … 363 364 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 364 365 LPTCHITTESTINFO lptest=(LPTCHITTESTINFO) lParam; 365 366 366 367 return TAB_InternalHitTest (hwnd, infoPtr,lptest->pt,&lptest->flags); 367 368 } … … 375 376 if (infoPtr->hwndToolTip) 376 377 TAB_RelayEvent (infoPtr->hwndToolTip, hwnd, 377 WM_LBUTTONDOWN, wParam, lParam);378 WM_LBUTTONDOWN, wParam, lParam); 378 379 379 380 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_FOCUSONBUTTONDOWN ) { … … 389 390 POINT pt; 390 391 INT newItem,dummy; 391 392 392 393 if (infoPtr->hwndToolTip) 393 394 TAB_RelayEvent (infoPtr->hwndToolTip, hwnd, 394 WM_LBUTTONDOWN, wParam, lParam);395 395 WM_LBUTTONDOWN, wParam, lParam); 396 396 397 pt.x = (INT)LOWORD(lParam); 397 398 pt.y = (INT)HIWORD(lParam); 398 399 399 400 newItem=TAB_InternalHitTest (hwnd, infoPtr,pt,(unsigned int*)&dummy); 400 401 401 402 // TRACE(tab, "On Tab, item %d\n", newItem); 402 403 403 404 if ( (newItem!=-1) && 404 405 (infoPtr->iSelected != newItem) ) … … 434 435 if (infoPtr->hwndToolTip) 435 436 TAB_RelayEvent (infoPtr->hwndToolTip, hwnd, 436 WM_LBUTTONDOWN, wParam, lParam);437 WM_LBUTTONDOWN, wParam, lParam); 437 438 return 0; 438 439 } … … 445 446 */ 446 447 static LRESULT TAB_AdjustRect( 447 HWND hwnd, 448 WPARAM fLarger, 448 HWND hwnd, 449 WPARAM fLarger, 449 450 LPRECT prc) 450 451 { 451 452 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 452 453 453 if (fLarger) 454 if (fLarger) 454 455 { 455 456 /* … … 460 461 * Add the height of the tabs. 461 462 */ 462 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BOTTOM) 463 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BOTTOM) 463 464 prc->bottom += infoPtr->tabHeight; 464 465 else … … 475 476 InflateRect(prc, CONTROL_BORDER_SIZEX, CONTROL_BORDER_SIZEX); 476 477 } 477 else 478 else 478 479 { 479 480 /* 480 481 * Go from window rectangle. 481 482 */ 482 483 483 484 /* 484 485 * Deflate the rectangle for the border … … 494 495 * Remove the height of the tabs. 495 496 */ 496 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BOTTOM) 497 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BOTTOM) 497 498 prc->bottom -= infoPtr->tabHeight; 498 499 else … … 500 501 501 502 } 502 503 503 504 return 0; 504 505 } … … 511 512 */ 512 513 static LRESULT TAB_OnHScroll( 513 HWND hwnd, 514 HWND hwnd, 514 515 int nScrollCode, 515 516 int nPos, … … 543 544 * TAB_SetupScroling 544 545 * 545 * This method will check the current scrolling state and make sure the 546 * This method will check the current scrolling state and make sure the 546 547 * scrolling control is displayed (or not). 547 548 */ … … 561 562 controlPos.left = controlPos.right - 2*GetSystemMetrics(SM_CXHSCROLL); 562 563 563 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BOTTOM) 564 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BOTTOM) 564 565 { 565 566 controlPos.top = clientRect->bottom - infoPtr->tabHeight; … … 583 584 */ 584 585 infoPtr->hwndUpDown = CreateWindowA("ScrollBar", 585 "",586 WS_VISIBLE | WS_CHILD | WS_OVERLAPPED | SBS_HORZ,587 controlPos.left, controlPos.top,588 controlPos.right - controlPos.left,589 controlPos.bottom - controlPos.top,590 hwnd,591 (HMENU)NULL, 592 (HINSTANCE)NULL, 593 NULL); 586 "", 587 WS_VISIBLE | WS_CHILD | WS_OVERLAPPED | SBS_HORZ, 588 controlPos.left, controlPos.top, 589 controlPos.right - controlPos.left, 590 controlPos.bottom - controlPos.top, 591 hwnd, 592 (HMENU)NULL, 593 (HINSTANCE)NULL, 594 NULL); 594 595 } 595 596 else 596 597 { 597 SetWindowPos(infoPtr->hwndUpDown, 598 (HWND)NULL,599 controlPos.left, controlPos.top,600 controlPos.right - controlPos.left,601 controlPos.bottom - controlPos.top,602 SWP_SHOWWINDOW | SWP_NOZORDER); 598 SetWindowPos(infoPtr->hwndUpDown, 599 (HWND)NULL, 600 controlPos.left, controlPos.top, 601 controlPos.right - controlPos.left, 602 controlPos.bottom - controlPos.top, 603 SWP_SHOWWINDOW | SWP_NOZORDER); 603 604 } 604 605 } … … 641 642 * a font. 642 643 */ 643 hdc = GetDC(hwnd); 644 644 hdc = GetDC(hwnd); 645 645 646 hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject (SYSTEM_FONT); 646 647 hOldFont = SelectObject (hdc, hFont); … … 651 652 */ 652 653 GetClientRect(hwnd, &clientRect); 653 654 654 655 /* 655 656 * The leftmost item will be "0" aligned … … 665 666 666 667 /* 667 * Make sure there is enough space for the letters + growing the 668 * selected item + extra space for the selected item. 669 */ 670 infoPtr->tabHeight = fontMetrics.tmHeight + 2*VERTICAL_ITEM_PADDING + 668 * Make sure there is enough space for the letters + growing the 669 * selected item + extra space for the selected item. 670 */ 671 infoPtr->tabHeight = fontMetrics.tmHeight + 2*VERTICAL_ITEM_PADDING + 671 672 SELECTED_TAB_OFFSET; 672 673 } … … 677 678 * Calculate the vertical position of the tab 678 679 */ 679 if (lStyle & TCS_BOTTOM) 680 { 681 infoPtr->items[curItem].rect.bottom = clientRect.bottom - 680 if (lStyle & TCS_BOTTOM) 681 { 682 infoPtr->items[curItem].rect.bottom = clientRect.bottom - 682 683 SELECTED_TAB_OFFSET; 683 infoPtr->items[curItem].rect.top = clientRect.bottom - 684 infoPtr->items[curItem].rect.top = clientRect.bottom - 684 685 infoPtr->tabHeight; 685 686 } 686 else 687 { 688 infoPtr->items[curItem].rect.top = clientRect.top + 687 else 688 { 689 infoPtr->items[curItem].rect.top = clientRect.top + 689 690 SELECTED_TAB_OFFSET; 690 infoPtr->items[curItem].rect.bottom = clientRect.top + 691 infoPtr->items[curItem].rect.bottom = clientRect.top + 691 692 infoPtr->tabHeight; 692 693 } … … 708 709 * Calculate how wide the tab is depending on the text it contains 709 710 */ 710 GetTextExtentPoint32A(hdc, infoPtr->items[curItem].pszText, 711 GetTextExtentPoint32A(hdc, infoPtr->items[curItem].pszText, 711 712 lstrlenA(infoPtr->items[curItem].pszText), &size); 712 713 713 714 infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left + 714 715 size.cx + 2*HORIZONTAL_ITEM_PADDING; … … 716 717 717 718 // TRACE(tab, "TextSize: %i\n ", size.cx); 718 // TRACE(tab, "Rect: T %i, L %i, B %i, R %i\n", 719 // infoPtr->items[curItem].rect.top,720 // infoPtr->items[curItem].rect.left,721 // infoPtr->items[curItem].rect.bottom,722 // infoPtr->items[curItem].rect.right);719 // TRACE(tab, "Rect: T %i, L %i, B %i, R %i\n", 720 // infoPtr->items[curItem].rect.top, 721 // infoPtr->items[curItem].rect.left, 722 // infoPtr->items[curItem].rect.bottom, 723 // infoPtr->items[curItem].rect.right); 723 724 724 725 /* … … 735 736 * Check if we need a scrolling control. 736 737 */ 737 infoPtr->needsScrolling = (curItemLeftPos + (2*SELECTED_TAB_OFFSET) > 738 infoPtr->needsScrolling = (curItemLeftPos + (2*SELECTED_TAB_OFFSET) > 738 739 clientRect.right); 739 740 740 TAB_SetupScrolling(hwnd, infoPtr, &clientRect); 741 741 TAB_SetupScrolling(hwnd, infoPtr, &clientRect); 742 742 743 /* 743 744 * Cleanup … … 751 752 * 752 753 * This method is used to draw a single tab into the tab control. 753 */ 754 */ 754 755 static void TAB_DrawItem( 755 HWND hwnd, 756 HDC hdc, 756 HWND hwnd, 757 HDC hdc, 757 758 INT iItem) 758 759 { … … 768 769 */ 769 770 isVisible = TAB_InternalGetItemRect(hwnd, 770 infoPtr,771 iItem,772 &itemRect,773 &selectedRect);771 infoPtr, 772 iItem, 773 &itemRect, 774 &selectedRect); 774 775 775 776 if (isVisible) 776 777 { 777 HBRUSH hbr = CreateSolidBrush (GetSysColor(COLOR_BTNFACE)); 778 HBRUSH hbr = CreateSolidBrush (GetSysColor(COLOR_BTNFACE)); 778 779 HPEN hwPen = GetSysColorPen (COLOR_3DHILIGHT); 779 780 HPEN hbPen = GetSysColorPen (COLOR_BTNSHADOW); … … 782 783 HPEN holdPen; 783 784 INT oldBkMode; 784 INT cx,cy; 785 INT cx,cy; 785 786 786 787 if (lStyle & TCS_BUTTONS) 787 788 { 788 /* 789 /* 789 790 * Get item rectangle. 790 791 */ … … 795 796 if (iItem == infoPtr->iSelected) 796 797 { 797 /* 798 * Background color. 798 /* 799 * Background color. 799 800 */ 800 801 if (!(lStyle & TCS_OWNERDRAWFIXED)) 801 hbr = CreateSolidBrush(GetSysColor(COLOR_3DHILIGHT)); 802 hbr = CreateSolidBrush(GetSysColor(COLOR_3DHILIGHT)); 802 803 803 804 /* 804 805 * Erase the background. 805 */ 806 */ 806 807 FillRect(hdc, &r, hbr); 807 808 … … 819 820 LineTo (hdc, r.right, r.bottom); 820 821 LineTo (hdc, r.right, r.top); 821 822 822 823 /* shadow */ 823 824 SelectObject(hdc, hbPen); … … 829 830 /* 830 831 * Erase the background. 831 */ 832 */ 832 833 FillRect(hdc, &r, hbr); 833 834 … … 836 837 LineTo (hdc, r.left, r.top); 837 838 LineTo (hdc, r.right, r.top); 838 839 839 840 /* shadow */ 840 841 SelectObject(hdc, hbPen); … … 845 846 else 846 847 { 847 /* 848 * Background color. 848 /* 849 * Background color. 849 850 */ 850 hbr = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); 851 hbr = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); 851 852 852 853 /* … … 861 862 /* 862 863 * Erase the background. 863 * This is necessary when drawing the selected item since it is larger 864 * than the others, it might overlap with stuff already drawn by the 864 * This is necessary when drawing the selected item since it is larger 865 * than the others, it might overlap with stuff already drawn by the 865 866 * other tabs 866 */ 867 */ 867 868 FillRect(hdc, &r, hbr); 868 869 … … 875 876 r.right--; 876 877 r.bottom--; 877 878 878 879 holdPen = SelectObject (hdc, hwPen); 879 880 880 if (lStyle & TCS_BOTTOM) 881 if (lStyle & TCS_BOTTOM) 881 882 { 882 883 /* highlight */ … … 884 885 LineTo (hdc, r.left, r.bottom - ROUND_CORNER_SIZE); 885 886 LineTo (hdc, r.left + ROUND_CORNER_SIZE, r.bottom); 886 887 887 888 /* shadow */ 888 889 SelectObject(hdc, hbPen); … … 891 892 LineTo (hdc, r.right, r.top); 892 893 } 893 else 894 else 894 895 { 895 896 /* highlight */ … … 898 899 LineTo (hdc, r.left + ROUND_CORNER_SIZE, r.top); 899 900 LineTo (hdc, r.right - ROUND_CORNER_SIZE, r.top); 900 901 901 902 /* shadow */ 902 903 SelectObject(hdc, hbPen); … … 905 906 } 906 907 } 907 908 908 909 /* 909 910 * Text pen 910 911 */ 911 SelectObject(hdc, hsdPen); 912 913 oldBkMode = SetBkMode(hdc, TRANSPARENT); 912 SelectObject(hdc, hsdPen); 913 914 oldBkMode = SetBkMode(hdc, TRANSPARENT); 914 915 SetTextColor (hdc, COLOR_BTNTEXT); 915 916 … … 922 923 * Draw the icon. 923 924 */ 924 if (infoPtr->himl) 925 { 926 ImageList_Draw (infoPtr->himl, iItem, hdc, 927 r.left, r.top+1, ILD_NORMAL);925 if (infoPtr->himl) 926 { 927 ImageList_Draw (infoPtr->himl, iItem, hdc, 928 r.left, r.top+1, ILD_NORMAL); 928 929 ImageList_GetIconSize (infoPtr->himl, &cx, &cy); 929 930 r.left+=cx; … … 934 935 */ 935 936 DrawTextA(hdc, 936 infoPtr->items[iItem].pszText, 937 lstrlenA(infoPtr->items[iItem].pszText),938 &r, 939 DT_LEFT|DT_SINGLELINE|DT_VCENTER);937 infoPtr->items[iItem].pszText, 938 lstrlenA(infoPtr->items[iItem].pszText), 939 &r, 940 DT_LEFT|DT_SINGLELINE|DT_VCENTER); 940 941 941 942 /* … … 943 944 */ 944 945 if (((lStyle & TCS_FOCUSNEVER) == 0) && 945 (GetFocus() == hwnd) &&946 (iItem == infoPtr->uFocus) )946 (GetFocus() == hwnd) && 947 (iItem == infoPtr->uFocus) ) 947 948 { 948 949 InflateRect(&r, FOCUS_RECT_HOFFSET, FOCUS_RECT_VOFFSET); … … 951 952 952 953 MoveToEx (hdc, r.left, r.top, NULL); 953 LineTo (hdc, r.right-1, r.top); 954 LineTo (hdc, r.right-1, r.top); 954 955 LineTo (hdc, r.right-1, r.bottom -1); 955 956 LineTo (hdc, r.left, r.bottom -1); … … 970 971 * This method is used to draw the raised border around the tab control 971 972 * "content" area. 972 */ 973 */ 973 974 static void TAB_DrawBorder (HWND hwnd, HDC hdc) 974 975 { … … 985 986 * Adjust for the style 986 987 */ 987 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BOTTOM) 988 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BOTTOM) 988 989 { 989 990 rect.bottom -= infoPtr->tabHeight; … … 1003 1004 /* highlight */ 1004 1005 htmPen = SelectObject (hdc, hwPen); 1005 1006 1006 1007 MoveToEx (hdc, rect.left, rect.bottom, NULL); 1007 LineTo (hdc, rect.left, rect.top); 1008 LineTo (hdc, rect.left, rect.top); 1008 1009 LineTo (hdc, rect.right, rect.top); 1009 1010 … … 1026 1027 * 1027 1028 * This method repaints the tab control.. 1028 */ 1029 */ 1029 1030 static void TAB_Refresh (HWND hwnd, HDC hdc) 1030 1031 { … … 1040 1041 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BUTTONS) 1041 1042 { 1042 for (i = 0; i < infoPtr->uNumItem; i++) 1043 { 1044 TAB_DrawItem (hwnd, hdc, i);1043 for (i = 0; i < infoPtr->uNumItem; i++) 1044 { 1045 TAB_DrawItem (hwnd, hdc, i); 1045 1046 } 1046 1047 } … … 1050 1051 * Draw all the non selected item first. 1051 1052 */ 1052 for (i = 0; i < infoPtr->uNumItem; i++) 1053 for (i = 0; i < infoPtr->uNumItem; i++) 1053 1054 { 1054 1055 if (i != infoPtr->iSelected) 1055 TAB_DrawItem (hwnd, hdc, i);1056 TAB_DrawItem (hwnd, hdc, i); 1056 1057 } 1057 1058 … … 1075 1076 { 1076 1077 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 1077 1078 1078 1079 infoPtr->DoRedraw=(BOOL) wParam; 1079 1080 return 0; … … 1081 1082 1082 1083 static LRESULT TAB_EraseBackground( 1083 HWND hwnd, 1084 HWND hwnd, 1084 1085 HDC givenDC) 1085 1086 { … … 1135 1136 GetClientRect(infoPtr->hwndUpDown, &scrollerRect); 1136 1137 visibleRect.right -= scrollerRect.right; 1137 1138 1138 1139 /* 1139 1140 * Get the rectangle for the item 1140 1141 */ 1141 1142 isVisible = TAB_InternalGetItemRect(hwnd, 1142 infoPtr,1143 infoPtr->iSelected,1144 NULL,1145 &selectedRect);1143 infoPtr, 1144 infoPtr->iSelected, 1145 NULL, 1146 &selectedRect); 1146 1147 1147 1148 /* … … 1163 1164 1164 1165 while ( (infoPtr->leftmostVisible < infoPtr->iSelected) && 1165 !isVisible)1166 !isVisible) 1166 1167 { 1167 1168 infoPtr->leftmostVisible++; … … 1171 1172 */ 1172 1173 isVisible = TAB_InternalGetItemRect(hwnd, 1173 infoPtr,1174 infoPtr->iSelected,1175 NULL,1176 &selectedRect);1174 infoPtr, 1175 infoPtr->iSelected, 1176 NULL, 1177 &selectedRect); 1177 1178 1178 1179 /* … … 1189 1190 pt2.x = selectedRect.right - 1; 1190 1191 pt2.y = selectedRect.bottom - 1; 1191 1192 1192 1193 isVisible = PtInRect(&visibleRect, pt1) && PtInRect(&visibleRect, pt2); 1193 1194 } … … 1210 1211 GetClientRect(hwnd, &clientRect); 1211 1212 1212 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BOTTOM) 1213 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BOTTOM) 1213 1214 { 1214 1215 clientRect.top = clientRect.bottom - (infoPtr->tabHeight + 1); … … 1227 1228 HDC hdc; 1228 1229 PAINTSTRUCT ps; 1229 1230 1230 1231 hdc = wParam== 0 ? BeginPaint (hwnd, &ps) : (HDC)wParam; 1231 1232 TAB_Refresh (hwnd, hdc); 1232 1233 1233 1234 if(!wParam) 1234 1235 EndPaint (hwnd, &ps); … … 1239 1240 static LRESULT 1240 1241 TAB_InsertItem (HWND hwnd, WPARAM wParam, LPARAM lParam) 1241 { 1242 { 1242 1243 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 1243 1244 TCITEMA *pti; 1244 1245 INT iItem, len; 1245 1246 RECT rect; 1246 1247 1247 1248 GetClientRect (hwnd, &rect); 1248 1249 // TRACE(tab, "Rect: %x T %i, L %i, B %i, R %i\n", hwnd, 1249 // rect.top, rect.left, rect.bottom, rect.right); 1250 1250 // rect.top, rect.left, rect.bottom, rect.right); 1251 1251 1252 pti = (TCITEMA *)lParam; 1252 1253 iItem = (INT)wParam; 1253 1254 1254 1255 if (iItem < 0) return -1; 1255 1256 if (iItem > infoPtr->uNumItem) 1256 1257 iItem = infoPtr->uNumItem; 1257 1258 1258 1259 if (infoPtr->uNumItem == 0) { 1259 1260 infoPtr->items = COMCTL32_Alloc (sizeof (TAB_ITEM)); … … 1262 1263 else { 1263 1264 TAB_ITEM *oldItems = infoPtr->items; 1264 1265 1265 1266 infoPtr->uNumItem++; 1266 1267 infoPtr->items = COMCTL32_Alloc (sizeof (TAB_ITEM) * infoPtr->uNumItem); 1267 1268 1268 1269 /* pre insert copy */ 1269 1270 if (iItem > 0) { 1270 1271 memcpy (&infoPtr->items[0], &oldItems[0], 1271 iItem * sizeof(TAB_ITEM));1272 } 1273 1272 iItem * sizeof(TAB_ITEM)); 1273 } 1274 1274 1275 /* post insert copy */ 1275 1276 if (iItem < infoPtr->uNumItem - 1) { 1276 1277 memcpy (&infoPtr->items[iItem+1], &oldItems[iItem], 1277 (infoPtr->uNumItem - iItem - 1) * sizeof(TAB_ITEM));1278 1279 } 1280 1278 (infoPtr->uNumItem - iItem - 1) * sizeof(TAB_ITEM)); 1279 1280 } 1281 1281 1282 COMCTL32_Free (oldItems); 1282 1283 } 1283 1284 1284 1285 infoPtr->items[iItem].mask = pti->mask; 1285 1286 if (pti->mask & TCIF_TEXT) { … … 1289 1290 infoPtr->items[iItem].cchTextMax = pti->cchTextMax; 1290 1291 } 1291 1292 1292 1293 if (pti->mask & TCIF_IMAGE) 1293 1294 infoPtr->items[iItem].iImage = pti->iImage; 1294 1295 1295 1296 if (pti->mask & TCIF_PARAM) 1296 1297 infoPtr->items[iItem].lParam = pti->lParam; 1297 1298 1298 1299 TAB_InvalidateTabArea(hwnd, infoPtr); 1299 1300 1300 1301 // TRACE(tab, "[%04x]: added item %d '%s'\n", 1301 // hwnd, iItem, infoPtr->items[iItem].pszText);1302 // hwnd, iItem, infoPtr->items[iItem].pszText); 1302 1303 1303 1304 TAB_SetItemBounds(hwnd); … … 1305 1306 } 1306 1307 1307 static LRESULT 1308 static LRESULT 1308 1309 TAB_SetItemSize (HWND hwnd, WPARAM wParam, LPARAM lParam) 1309 1310 { … … 1322 1323 } 1323 1324 1324 static LRESULT 1325 static LRESULT 1325 1326 TAB_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 1326 1327 { 1327 1328 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 1328 TCITEMA *tabItem; 1329 TAB_ITEM *wineItem; 1329 TCITEMA *tabItem; 1330 TAB_ITEM *wineItem; 1330 1331 INT iItem,len; 1331 1332 … … 1337 1338 wineItem=& infoPtr->items[iItem]; 1338 1339 1339 if (tabItem->mask & TCIF_IMAGE) 1340 if (tabItem->mask & TCIF_IMAGE) 1340 1341 wineItem->iImage=tabItem->iImage; 1341 1342 1342 if (tabItem->mask & TCIF_PARAM) 1343 if (tabItem->mask & TCIF_PARAM) 1343 1344 wineItem->lParam=tabItem->lParam; 1344 1345 1345 // if (tabItem->mask & TCIF_RTLREADING) 1346 // if (tabItem->mask & TCIF_RTLREADING) 1346 1347 // FIXME (tab,"TCIF_RTLREADING\n"); 1347 1348 1348 if (tabItem->mask & TCIF_STATE) 1349 if (tabItem->mask & TCIF_STATE) 1349 1350 wineItem->dwState=tabItem->dwState; 1350 1351 1351 1352 if (tabItem->mask & TCIF_TEXT) { 1352 len =lstrlenA (tabItem->pszText);1353 if (len>wineItem->cchTextMax) 1354 wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, len+1);1353 len = lstrlenA (tabItem->pszText); 1354 if (len>wineItem->cchTextMax) 1355 wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, len+1); 1355 1356 lstrcpynA (wineItem->pszText, tabItem->pszText, len); 1356 1357 } … … 1359 1360 } 1360 1361 1361 static LRESULT 1362 static LRESULT 1362 1363 TAB_GetItemCount (HWND hwnd, WPARAM wParam, LPARAM lParam) 1363 1364 { … … 1368 1369 1369 1370 1370 static LRESULT 1371 static LRESULT 1371 1372 TAB_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 1372 1373 { … … 1383 1384 wineItem=& infoPtr->items[iItem]; 1384 1385 1385 if (tabItem->mask & TCIF_IMAGE) 1386 if (tabItem->mask & TCIF_IMAGE) 1386 1387 tabItem->iImage=wineItem->iImage; 1387 1388 1388 if (tabItem->mask & TCIF_PARAM) 1389 if (tabItem->mask & TCIF_PARAM) 1389 1390 tabItem->lParam=wineItem->lParam; 1390 1391 1391 // if (tabItem->mask & TCIF_RTLREADING) 1392 // if (tabItem->mask & TCIF_RTLREADING) 1392 1393 // FIXME (tab, "TCIF_RTLREADING\n"); 1393 1394 1394 if (tabItem->mask & TCIF_STATE) 1395 if (tabItem->mask & TCIF_STATE) 1395 1396 tabItem->dwState=wineItem->dwState; 1396 1397 1397 if (tabItem->mask & TCIF_TEXT) 1398 if (tabItem->mask & TCIF_TEXT) 1398 1399 lstrcpynA (tabItem->pszText, wineItem->pszText, tabItem->cchTextMax); 1399 1400 … … 1401 1402 } 1402 1403 1403 static LRESULT 1404 static LRESULT 1404 1405 TAB_DeleteItem (HWND hwnd, WPARAM wParam, LPARAM lParam) 1405 1406 { … … 1411 1412 { 1412 1413 TAB_ITEM *oldItems = infoPtr->items; 1413 1414 1414 1415 infoPtr->uNumItem--; 1415 1416 infoPtr->items = COMCTL32_Alloc(sizeof (TAB_ITEM) * infoPtr->uNumItem); 1416 1417 if (iItem > 0) 1417 1418 if (iItem > 0) 1418 1419 memcpy(&infoPtr->items[0], &oldItems[0], iItem * sizeof(TAB_ITEM)); 1419 1420 if (iItem < infoPtr->uNumItem) 1420 1421 if (iItem < infoPtr->uNumItem) 1421 1422 memcpy(&infoPtr->items[iItem], &oldItems[iItem + 1], 1422 1423 (infoPtr->uNumItem - iItem) * sizeof(TAB_ITEM)); 1423 1424 1424 1425 COMCTL32_Free (oldItems); 1425 1426 … … 1429 1430 if ((iItem == infoPtr->iSelected) && (iItem > 0)) 1430 1431 infoPtr->iSelected--; 1431 1432 1432 1433 if (iItem < infoPtr->iSelected) 1433 1434 infoPtr->iSelected--; … … 1445 1446 } 1446 1447 1447 static LRESULT 1448 static LRESULT 1448 1449 TAB_DeleteAllItems (HWND hwnd, WPARAM wParam, LPARAM lParam) 1449 1450 { … … 1452 1453 COMCTL32_Free (infoPtr->items); 1453 1454 infoPtr->uNumItem=0; 1454 1455 1455 1456 return TRUE; 1456 1457 } … … 1471 1472 { 1472 1473 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 1473 1474 1474 1475 // TRACE (tab,"%x %lx\n",wParam, lParam); 1475 1476 1476 1477 infoPtr->hFont = (HFONT)wParam; 1477 1478 1478 1479 TAB_SetItemBounds(hwnd); 1479 1480 … … 1525 1526 cx=LOWORD (lParam); 1526 1527 cy=HIWORD (lParam); 1527 if (GetWindowLongA(hwnd, GWL_STYLE) & CCS_NORESIZE) 1528 if (GetWindowLongA(hwnd, GWL_STYLE) & CCS_NORESIZE) 1528 1529 uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE); 1529 1530 … … 1548 1549 1549 1550 1550 static LRESULT 1551 static LRESULT 1551 1552 TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) 1552 1553 { … … 1559 1560 1560 1561 SetWindowLongA(hwnd, 0, (DWORD)infoPtr); 1561 1562 1562 1563 infoPtr->uNumItem = 0; 1563 1564 infoPtr->hFont = 0; 1564 1565 infoPtr->items = 0; 1565 1566 infoPtr->hcurArrow = LoadCursorA (0, IDC_ARROWA); 1566 infoPtr->iSelected = 0; 1567 infoPtr->uFocus = 0; 1567 infoPtr->iSelected = 0; 1568 infoPtr->uFocus = 0; 1568 1569 infoPtr->hwndToolTip = 0; 1569 1570 infoPtr->DoRedraw = TRUE; … … 1571 1572 infoPtr->hwndUpDown = 0; 1572 1573 infoPtr->leftmostVisible = 0; 1573 1574 // TRACE(tab, "Created tab control, hwnd [%04x]\n", hwnd); 1574 1575 // TRACE(tab, "Created tab control, hwnd [%04x]\n", hwnd); 1575 1576 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_TOOLTIPS) { 1576 1577 /* Create tooltip control */ 1577 1578 infoPtr->hwndToolTip = 1578 1579 CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0, 1579 CW_USEDEFAULT, CW_USEDEFAULT,1580 CW_USEDEFAULT, CW_USEDEFAULT,1581 hwnd, 0, 0, 0);1582 1580 CW_USEDEFAULT, CW_USEDEFAULT, 1581 CW_USEDEFAULT, CW_USEDEFAULT, 1582 hwnd, 0, 0, 0); 1583 1583 1584 /* Send NM_TOOLTIPSCREATED notification */ 1584 1585 if (infoPtr->hwndToolTip) { 1585 1586 NMTOOLTIPSCREATED nmttc; 1586 1587 1587 1588 nmttc.hdr.hwndFrom = hwnd; 1588 1589 nmttc.hdr.idFrom = GetWindowLongA(hwnd, GWL_ID); 1589 1590 nmttc.hdr.code = NM_TOOLTIPSCREATED; 1590 1591 nmttc.hwndToolTips = infoPtr->hwndToolTip; 1591 1592 1592 1593 SendMessageA (GetParent (hwnd), WM_NOTIFY, 1593 (WPARAM)GetWindowLongA(hwnd, GWL_ID), (LPARAM)&nmttc);1594 } 1595 } 1596 1594 (WPARAM)GetWindowLongA(hwnd, GWL_ID), (LPARAM)&nmttc); 1595 } 1596 } 1597 1597 1598 /* 1598 1599 * We need to get text information so we need a DC and we need to select 1599 1600 * a font. 1600 1601 */ 1601 hdc = GetDC(hwnd); 1602 hdc = GetDC(hwnd); 1602 1603 hOldFont = SelectObject (hdc, GetStockObject (SYSTEM_FONT)); 1603 1604 … … 1608 1609 1609 1610 /* 1610 * Make sure there is enough space for the letters + growing the 1611 * selected item + extra space for the selected item. 1612 */ 1613 infoPtr->tabHeight = fontMetrics.tmHeight + 2*VERTICAL_ITEM_PADDING + 1611 * Make sure there is enough space for the letters + growing the 1612 * selected item + extra space for the selected item. 1613 */ 1614 infoPtr->tabHeight = fontMetrics.tmHeight + 2*VERTICAL_ITEM_PADDING + 1614 1615 SELECTED_TAB_OFFSET; 1615 1616 … … 1634 1635 for (iItem = 0; iItem < infoPtr->uNumItem; iItem++) { 1635 1636 if (infoPtr->items[iItem].pszText) 1636 COMCTL32_Free (infoPtr->items[iItem].pszText);1637 COMCTL32_Free (infoPtr->items[iItem].pszText); 1637 1638 } 1638 1639 COMCTL32_Free (infoPtr->items); 1639 1640 } 1640 1641 if (infoPtr->hwndToolTip) 1641 1642 if (infoPtr->hwndToolTip) 1642 1643 DestroyWindow (infoPtr->hwndToolTip); 1643 1644 1644 1645 if (infoPtr->hwndUpDown) 1645 1646 DestroyWindow(infoPtr->hwndUpDown); … … 1656 1657 case TCM_GETIMAGELIST: 1657 1658 return TAB_GetImageList (hwnd, wParam, lParam); 1658 1659 1659 1660 case TCM_SETIMAGELIST: 1660 1661 return TAB_SetImageList (hwnd, wParam, lParam); 1661 1662 1662 1663 case TCM_GETITEMCOUNT: 1663 1664 return TAB_GetItemCount (hwnd, wParam, lParam); 1664 1665 1665 1666 case TCM_GETITEMA: 1666 1667 return TAB_GetItemA (hwnd, wParam, lParam); 1667 1668 1668 1669 case TCM_GETITEMW: 1669 1670 // FIXME (tab, "Unimplemented msg TCM_GETITEMW\n"); 1670 1671 return 0; 1671 1672 1672 1673 case TCM_SETITEMA: 1673 1674 return TAB_SetItemA (hwnd, wParam, lParam); 1674 1675 1675 1676 case TCM_SETITEMW: 1676 1677 // FIXME (tab, "Unimplemented msg TCM_SETITEMW\n"); 1677 1678 return 0; 1678 1679 1679 1680 case TCM_DELETEITEM: 1680 1681 return TAB_DeleteItem (hwnd, wParam, lParam); 1681 1682 1682 1683 case TCM_DELETEALLITEMS: 1683 1684 return TAB_DeleteAllItems (hwnd, wParam, lParam); 1684 1685 1685 1686 case TCM_GETITEMRECT: 1686 1687 return TAB_GetItemRect (hwnd, wParam, lParam); 1687 1688 1688 1689 case TCM_GETCURSEL: 1689 1690 return TAB_GetCurSel (hwnd); 1690 1691 1691 1692 case TCM_HITTEST: 1692 1693 return TAB_HitTest (hwnd, wParam, lParam); 1693 1694 1694 1695 case TCM_SETCURSEL: 1695 1696 return TAB_SetCurSel (hwnd, wParam); 1696 1697 1697 1698 case TCM_INSERTITEMA: 1698 1699 return TAB_InsertItem (hwnd, wParam, lParam); 1699 1700 1700 1701 case TCM_INSERTITEMW: 1701 1702 // FIXME (tab, "Unimplemented msg TCM_INSERTITEM32W\n"); 1702 1703 return 0; 1703 1704 1704 1705 case TCM_SETITEMEXTRA: 1705 1706 // FIXME (tab, "Unimplemented msg TCM_SETITEMEXTRA\n"); 1706 1707 return 0; 1707 1708 1708 1709 case TCM_ADJUSTRECT: 1709 1710 return TAB_AdjustRect (hwnd, (BOOL)wParam, (LPRECT)lParam); 1710 1711 1711 1712 case TCM_SETITEMSIZE: 1712 1713 return TAB_SetItemSize (hwnd, wParam, lParam); 1713 1714 1714 1715 case TCM_REMOVEIMAGE: 1715 1716 // FIXME (tab, "Unimplemented msg TCM_REMOVEIMAGE\n"); 1716 1717 return 0; 1717 1718 1718 1719 case TCM_SETPADDING: 1719 1720 // FIXME (tab, "Unimplemented msg TCM_SETPADDING\n"); 1720 1721 return 0; 1721 1722 1722 1723 case TCM_GETROWCOUNT: 1723 1724 // FIXME (tab, "Unimplemented msg TCM_GETROWCOUNT\n"); … … 1735 1736 // FIXME (tab, "Unimplemented msg TCM_HIGHLIGHTITEM\n"); 1736 1737 return 0; 1737 1738 1738 1739 case TCM_GETTOOLTIPS: 1739 1740 return TAB_GetToolTips (hwnd, wParam, lParam); 1740 1741 1741 1742 case TCM_SETTOOLTIPS: 1742 1743 return TAB_SetToolTips (hwnd, wParam, lParam); 1743 1744 1744 1745 case TCM_GETCURFOCUS: 1745 1746 return TAB_GetCurFocus (hwnd); 1746 1747 1747 1748 case TCM_SETCURFOCUS: 1748 1749 return TAB_SetCurFocus (hwnd, wParam); 1749 1750 1750 1751 case TCM_SETMINTTABWIDTH: 1751 1752 // FIXME (tab, "Unimplemented msg TCM_SETMINTTABWIDTH\n"); 1752 1753 return 0; 1753 1754 1754 1755 case TCM_DESELECTALL: 1755 1756 // FIXME (tab, "Unimplemented msg TCM_DESELECTALL\n"); 1756 1757 return 0; 1757 1758 1758 1759 case TCM_GETEXTENDEDSTYLE: 1759 1760 // FIXME (tab, "Unimplemented msg TCM_GETEXTENDEDSTYLE\n"); … … 1766 1767 case WM_GETFONT: 1767 1768 return TAB_GetFont (hwnd, wParam, lParam); 1768 1769 1769 1770 case WM_SETFONT: 1770 1771 return TAB_SetFont (hwnd, wParam, lParam); 1771 1772 1772 1773 case WM_CREATE: 1773 1774 return TAB_Create (hwnd, wParam, lParam); 1774 1775 1775 1776 case WM_NCDESTROY: 1776 1777 return TAB_Destroy (hwnd, wParam, lParam); 1777 1778 1778 1779 case WM_GETDLGCODE: 1779 1780 return DLGC_WANTARROWS | DLGC_WANTCHARS; 1780 1781 1781 1782 case WM_LBUTTONDOWN: 1782 1783 return TAB_LButtonDown (hwnd, wParam, lParam); 1783 1784 1784 1785 case WM_LBUTTONUP: 1785 1786 return TAB_LButtonUp (hwnd, wParam, lParam); 1786 1787 1787 1788 case WM_RBUTTONDOWN: 1788 1789 return TAB_RButtonDown (hwnd, wParam, lParam); 1789 1790 1790 1791 case WM_MOUSEMOVE: 1791 1792 return TAB_MouseMove (hwnd, wParam, lParam); 1792 1793 1793 1794 case WM_ERASEBKGND: 1794 1795 return TAB_EraseBackground (hwnd, (HDC)wParam); … … 1799 1800 case WM_SIZE: 1800 1801 return TAB_Size (hwnd, wParam, lParam); 1801 1802 1802 1803 case WM_SETREDRAW: 1803 1804 return TAB_SetRedraw (hwnd, wParam); … … 1805 1806 case WM_HSCROLL: 1806 1807 return TAB_OnHScroll(hwnd, (int)LOWORD(wParam), (int)HIWORD(wParam), (HWND)lParam); 1807 1808 1808 1809 case WM_KILLFOCUS: 1809 1810 case WM_SETFOCUS: … … 1815 1816 default: 1816 1817 // if (uMsg >= WM_USER) 1817 // ERR (tab, "unknown msg %04x wp=%08x lp=%08lx\n",1818 // uMsg, wParam, lParam);1818 // ERR (tab, "unknown msg %04x wp=%08x lp=%08lx\n", 1819 // uMsg, wParam, lParam); 1819 1820 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 1820 1821 } … … 1839 1840 wndClass.hbrBackground = (HBRUSH)NULL; 1840 1841 wndClass.lpszClassName = WC_TABCONTROLA; 1841 1842 1842 1843 RegisterClassA (&wndClass); 1843 1844 } -
trunk/src/comctl32/toolbar.c
r180 r236 1 /* $Id: toolbar.c,v 1. 6 1999-06-24 16:37:45cbratschi Exp $ */1 /* $Id: toolbar.c,v 1.7 1999-06-28 15:46:27 cbratschi Exp $ */ 2 2 /* 3 3 * Toolbar control … … 29 29 */ 30 30 31 /* CB: Odin32/WINE bugs 32 - IMAGELIST_Draw draws a line too much at the bottom of the bitmap 33 */ 34 31 35 #include <string.h> 32 36 … … 1514 1518 lstrcpynA (lpTbInfo->pszText, 1515 1519 (LPSTR)infoPtr->strings[btnPtr->iString], 1516 lpTbInfo->cchText);1520 MIN(lpTbInfo->cchText,lstrlenA((LPSTR)infoPtr->strings[btnPtr->iString]))); 1517 1521 } 1518 1522 … … 2057 2061 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 2058 2062 2059 if ((LOWORD(lParam) <= 0) || (HIWORD(lParam) <=0)) return FALSE;2063 if ((LOWORD(lParam) <= 0) || (HIWORD(lParam) <= 0)) return FALSE; 2060 2064 2061 2065 infoPtr->nBitmapWidth = (INT)LOWORD(lParam); … … 2474 2478 2475 2479 nmttc.hdr.hwndFrom = hwnd; 2476 nmttc.hdr.idFrom = GetWindowLongA (hwnd,GWL_ID);2480 nmttc.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID); 2477 2481 nmttc.hdr.code = NM_TOOLTIPSCREATED; 2478 2482 nmttc.hwndToolTips = infoPtr->hwndToolTip; 2479 2483 2480 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 2481 (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc); 2484 SendMessageA(infoPtr->hwndNotify,WM_NOTIFY,(WPARAM)nmttc.hdr.idFrom,(LPARAM)&nmttc); 2482 2485 } 2483 2486 } … … 2691 2694 INT nHit; 2692 2695 HDC hdc; 2696 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 2693 2697 2694 2698 if (infoPtr->hwndToolTip) … … 2711 2715 oldBtnPtr->bHot = FALSE; 2712 2716 2713 InvalidateRect (hwnd, &oldBtnPtr->rect,TRUE);2717 if (dwStyle & TBSTYLE_FLAT) InvalidateRect(hwnd,&oldBtnPtr->rect,TRUE); 2714 2718 } 2715 2719 } … … 2723 2727 btnPtr->bHot = TRUE; 2724 2728 2725 hdc = GetDC (hwnd); 2726 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 2727 ReleaseDC (hwnd, hdc); 2729 if (dwStyle & TBSTYLE_FLAT) 2730 { 2731 hdc = GetDC (hwnd); 2732 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 2733 ReleaseDC (hwnd, hdc); 2734 } 2728 2735 2729 2736 infoPtr->nHotItem = nHit; … … 2864 2871 2865 2872 TOOLBAR_CalcToolbar(hwnd); 2866 hdc = wParam ==0 ? BeginPaint(hwnd,&ps) : (HDC)wParam;2873 hdc = wParam == 0 ? BeginPaint(hwnd,&ps) : (HDC)wParam; 2867 2874 TOOLBAR_Refresh(hwnd,hdc); 2868 2875 if (!wParam) EndPaint (hwnd, &ps); -
trunk/src/comctl32/tooltips.c
r219 r236 1 /* $Id: tooltips.c,v 1. 7 1999-06-26 14:20:31cbratschi Exp $ */1 /* $Id: tooltips.c,v 1.8 1999-06-28 15:46:27 cbratschi Exp $ */ 2 2 /* 3 3 * Tool tip control … … 29 29 #include "comctl32.h" 30 30 31 32 31 #define ID_TIMERSHOW 1 /* show delay timer */ 33 32 #define ID_TIMERPOP 2 /* auto pop timer */ … … 41 40 42 41 #define TOOLTIPS_GetInfoPtr(hWindow) ((TOOLTIPS_INFO *)GetWindowLongA (hWindow, 0)) 43 44 42 45 43 LRESULT CALLBACK … … 119 117 } else if (ttnmdi.szText[0]) 120 118 { 121 lstrcpynAtoW (infoPtr->szTipText,ttnmdi.szText,80);119 lstrcpynAtoW(infoPtr->szTipText,ttnmdi.szText,MIN(INFOTIPSIZE-1,lstrlenA(ttnmdi.szText))); 122 120 if (ttnmdi.uFlags & TTF_DI_SETITEM) 123 121 { … … 130 128 { 131 129 /* no text available */ 132 infoPtr->szTipText[0] = L'\0';130 infoPtr->szTipText[0] = '\0'; 133 131 } else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) 134 132 { 135 lstrcpynAtoW(infoPtr->szTipText,ttnmdi.lpszText, INFOTIPSIZE);133 lstrcpynAtoW(infoPtr->szTipText,ttnmdi.lpszText,MIN(INFOTIPSIZE-1,lstrlenA(ttnmdi.lpszText))); 136 134 if (ttnmdi.uFlags & TTF_DI_SETITEM) 137 135 { … … 149 147 { 150 148 /* the item is a usual (unicode) text */ 151 lstrcpynW (infoPtr->szTipText,toolPtr->lpszText,INFOTIPSIZE);149 lstrcpynW(infoPtr->szTipText,toolPtr->lpszText,MIN(INFOTIPSIZE-1,lstrlenW(toolPtr->lpszText))); 152 150 } 153 151 } … … 155 153 { 156 154 /* no text available */ 157 infoPtr->szTipText[0] = L'\0';155 infoPtr->szTipText[0] = '\0'; 158 156 } 159 157 … … 206 204 207 205 // TRACE (tooltips, "Show tooltip pre %d!\n", infoPtr->nTool); 208 209 206 TOOLTIPS_GetTipText(hwnd,infoPtr,infoPtr->nCurrentTool); 210 207 211 if (infoPtr->szTipText[0] == L'\0')208 if (infoPtr->szTipText[0] == '\0') 212 209 { 213 210 infoPtr->nCurrentTool = -1; … … 316 313 TOOLTIPS_GetTipText(hwnd,infoPtr,infoPtr->nTrackTool); 317 314 318 if (infoPtr->szTipText[0] == L'\0')315 if (infoPtr->szTipText[0] == '\0') 319 316 { 320 317 infoPtr->nTrackTool = -1; … … 558 555 TOOLTIPS_Activate (HWND hwnd, WPARAM wParam, LPARAM lParam) 559 556 { 560 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);557 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(hwnd); 561 558 562 559 infoPtr->bActive = (BOOL)wParam; … … 572 569 573 570 574 static LRESULT 575 TOOLTIPS_AddToolA(HWND hwnd,WPARAM wParam,LPARAM lParam) 576 { 577 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(hwnd); 578 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam; 579 TTTOOL_INFO *toolPtr; 580 581 if (lpToolInfo == NULL) return FALSE; 582 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) return FALSE; 583 584 // TRACE (tooltips, "add tool (%x) %x %d%s!\n", 585 // hwnd, lpToolInfo->hwnd, lpToolInfo->uId, 586 // (lpToolInfo->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : ""); 587 588 if (infoPtr->uNumTools == 0) 589 { 590 infoPtr->tools = COMCTL32_Alloc(sizeof(TTTOOL_INFO)); 591 toolPtr = infoPtr->tools; 592 } else 593 { 594 TTTOOL_INFO *oldTools = infoPtr->tools; 595 596 //CB: check if already exists! 597 598 infoPtr->tools = COMCTL32_Alloc (sizeof(TTTOOL_INFO)*(infoPtr->uNumTools+1)); 599 memcpy (infoPtr->tools,oldTools,infoPtr->uNumTools*sizeof(TTTOOL_INFO)); 600 COMCTL32_Free(oldTools); 601 toolPtr = &infoPtr->tools[infoPtr->uNumTools]; 602 } 603 604 infoPtr->uNumTools++; 605 606 /* copy tool data */ 607 toolPtr->uFlags = lpToolInfo->uFlags; 608 toolPtr->hwnd = lpToolInfo->hwnd; 609 toolPtr->uId = lpToolInfo->uId; 610 toolPtr->rect = lpToolInfo->rect; 611 toolPtr->hinst = lpToolInfo->hinst; 612 613 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)) 614 { 615 // TRACE (tooltips, "add string id %x!\n", (int)lpToolInfo->lpszText); 616 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText; 617 } else if (lpToolInfo->lpszText) 618 { 619 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) 620 { 621 // TRACE (tooltips, "add CALLBACK!\n"); 622 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 623 } else 624 { 625 INT len = lstrlenA (lpToolInfo->lpszText); 626 // TRACE (tooltips, "add text \"%s\"!\n", lpToolInfo->lpszText); 627 toolPtr->lpszText = COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 628 lstrcpyAtoW (toolPtr->lpszText, lpToolInfo->lpszText); 629 } 630 } else toolPtr->lpszText = NULL; 631 632 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOA)) 633 toolPtr->lParam = lpToolInfo->lParam; 634 635 /* install subclassing hook */ 571 static VOID TOOLTIPS_Subclass(HWND hwnd,TTTOOL_INFO *toolPtr) 572 { 636 573 if (toolPtr->uFlags & TTF_SUBCLASS) 637 574 { … … 669 606 // TRACE (tooltips, "subclassing installed!\n"); 670 607 } 671 672 return TRUE; 673 } 674 675 676 static LRESULT 677 TOOLTIPS_AddToolW (HWND hwnd, WPARAM wParam, LPARAM lParam) 678 { 679 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd); 680 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam; 608 } 609 610 static VOID TOOLTIPS_Desubclass(TTTOOL_INFO *toolPtr) 611 { 612 if (toolPtr->uFlags & TTF_SUBCLASS) 613 { 614 if (toolPtr->uFlags & TTF_IDISHWND) 615 { 616 LPTT_SUBCLASS_INFO lpttsi = 617 (LPTT_SUBCLASS_INFO)GetPropA((HWND)toolPtr->uId,COMCTL32_aSubclass); 618 if (lpttsi) 619 { 620 SetWindowLongA ((HWND)toolPtr->uId,GWL_WNDPROC,(LONG)lpttsi->wpOrigProc); 621 RemovePropA ((HWND)toolPtr->uId,COMCTL32_aSubclass); 622 COMCTL32_Free(&lpttsi); 623 } 624 // else 625 // ERR (tooltips, "Invalid data handle!\n"); 626 } else 627 { 628 LPTT_SUBCLASS_INFO lpttsi = 629 (LPTT_SUBCLASS_INFO)GetPropA(toolPtr->hwnd,COMCTL32_aSubclass); 630 if (lpttsi) 631 { 632 if (lpttsi->uRefCount == 1) 633 { 634 SetWindowLongA((HWND)toolPtr->uId,GWL_WNDPROC,(LONG)lpttsi->wpOrigProc); 635 RemovePropA((HWND)toolPtr->uId,COMCTL32_aSubclass); 636 COMCTL32_Free(&lpttsi); 637 } else lpttsi->uRefCount--; 638 } 639 // else 640 // ERR (tooltips, "Invalid data handle!\n"); 641 } 642 } 643 } 644 645 static LRESULT 646 TOOLTIPS_AddToolA(HWND hwnd,WPARAM wParam,LPARAM lParam) 647 { 648 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(hwnd); 649 LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam; 681 650 TTTOOL_INFO *toolPtr; 682 651 683 if (lpToolInfo == NULL) 684 return FALSE; 685 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEW) 686 return FALSE; 652 if (lpToolInfo == NULL) return FALSE; 653 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) return FALSE; 687 654 688 655 // TRACE (tooltips, "add tool (%x) %x %d%s!\n", … … 690 657 // (lpToolInfo->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : ""); 691 658 692 if (infoPtr->uNumTools == 0) { 693 infoPtr->tools = COMCTL32_Alloc (sizeof(TTTOOL_INFO)); 694 toolPtr = infoPtr->tools; 695 } 696 else { 697 TTTOOL_INFO *oldTools = infoPtr->tools; 698 infoPtr->tools = 699 COMCTL32_Alloc (sizeof(TTTOOL_INFO) * (infoPtr->uNumTools + 1)); 700 memcpy (infoPtr->tools, oldTools, 701 infoPtr->uNumTools * sizeof(TTTOOL_INFO)); 702 COMCTL32_Free (oldTools); 659 if (infoPtr->uNumTools == 0) 660 { 661 infoPtr->tools = COMCTL32_Alloc(sizeof(TTTOOL_INFO)); 662 toolPtr = infoPtr->tools; 663 } else 664 { 665 TTTOOL_INFO *oldTools = infoPtr->tools; 666 INT x; 667 668 toolPtr = NULL; 669 670 //check if toolinfo already exists 671 for (x = 0;x < infoPtr->uNumTools;x++) 672 { 673 if (lpToolInfo->hwnd == infoPtr->tools[x].hwnd && lpToolInfo->uId == infoPtr->tools[x].uId) 674 { 675 //return toolPtr 676 toolPtr = &infoPtr->tools[x]; 677 //free allocated memory 678 TOOLTIPS_Desubclass(toolPtr); 679 if ((toolPtr->hinst) && (toolPtr->lpszText)) 680 { 681 if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(toolPtr->lpszText); 682 } 683 684 break; 685 } 686 } 687 688 if (toolPtr == NULL) 689 { 690 infoPtr->tools = COMCTL32_Alloc (sizeof(TTTOOL_INFO)*(infoPtr->uNumTools+1)); 691 memcpy(infoPtr->tools,oldTools,infoPtr->uNumTools*sizeof(TTTOOL_INFO)); 692 COMCTL32_Free(oldTools); 703 693 toolPtr = &infoPtr->tools[infoPtr->uNumTools]; 694 } 695 } 696 697 infoPtr->uNumTools++; 698 699 /* copy tool data */ 700 toolPtr->uFlags = lpToolInfo->uFlags; 701 toolPtr->hwnd = lpToolInfo->hwnd; 702 toolPtr->uId = lpToolInfo->uId; 703 toolPtr->rect = lpToolInfo->rect; 704 toolPtr->hinst = lpToolInfo->hinst; 705 706 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)) 707 { 708 // TRACE (tooltips, "add string id %x!\n", (int)lpToolInfo->lpszText); 709 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText; 710 } else if (lpToolInfo->lpszText) 711 { 712 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) 713 { 714 // TRACE (tooltips, "add CALLBACK!\n"); 715 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 716 } else 717 { 718 INT len = lstrlenA (lpToolInfo->lpszText); 719 // TRACE (tooltips, "add text \"%s\"!\n", lpToolInfo->lpszText); 720 toolPtr->lpszText = COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 721 lstrcpyAtoW (toolPtr->lpszText, lpToolInfo->lpszText); 722 } 723 } else toolPtr->lpszText = NULL; 724 725 if (lpToolInfo->cbSize >= sizeof(TTTOOLINFOA)) 726 toolPtr->lParam = lpToolInfo->lParam; 727 728 /* install subclassing hook */ 729 TOOLTIPS_Subclass(hwnd,toolPtr); 730 731 return TRUE; 732 } 733 734 735 static LRESULT 736 TOOLTIPS_AddToolW (HWND hwnd, WPARAM wParam, LPARAM lParam) 737 { 738 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd); 739 LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam; 740 TTTOOL_INFO *toolPtr; 741 742 if (lpToolInfo == NULL) 743 return FALSE; 744 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEW) 745 return FALSE; 746 747 // TRACE (tooltips, "add tool (%x) %x %d%s!\n", 748 // hwnd, lpToolInfo->hwnd, lpToolInfo->uId, 749 // (lpToolInfo->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : ""); 750 751 if (infoPtr->uNumTools == 0) 752 { 753 infoPtr->tools = COMCTL32_Alloc (sizeof(TTTOOL_INFO)); 754 toolPtr = infoPtr->tools; 755 } else 756 { 757 TTTOOL_INFO *oldTools = infoPtr->tools; 758 INT x; 759 760 toolPtr = NULL; 761 762 //check if toolinfo already exists 763 for (x = 0;x < infoPtr->uNumTools;x++) 764 { 765 if (lpToolInfo->hwnd == infoPtr->tools[x].hwnd && lpToolInfo->uId == infoPtr->tools[x].uId) 766 { 767 //return toolPtr 768 toolPtr = &infoPtr->tools[x]; 769 //free allocated memory 770 TOOLTIPS_Desubclass(toolPtr); 771 if ((toolPtr->hinst) && (toolPtr->lpszText)) 772 { 773 if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(toolPtr->lpszText); 774 } 775 776 break; 777 } 778 } 779 780 if (toolPtr == NULL) 781 { 782 infoPtr->tools = COMCTL32_Alloc(sizeof(TTTOOL_INFO)*(infoPtr->uNumTools+1)); 783 memcpy (infoPtr->tools,oldTools,infoPtr->uNumTools*sizeof(TTTOOL_INFO)); 784 COMCTL32_Free(oldTools); 785 toolPtr = &infoPtr->tools[infoPtr->uNumTools]; 786 } 704 787 } 705 788 … … 735 818 736 819 /* install subclassing hook */ 737 if (toolPtr->uFlags & TTF_SUBCLASS) { 738 if (toolPtr->uFlags & TTF_IDISHWND) { 739 LPTT_SUBCLASS_INFO lpttsi = 740 (LPTT_SUBCLASS_INFO)GetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 741 if (lpttsi == NULL) { 742 lpttsi = 743 (LPTT_SUBCLASS_INFO)COMCTL32_Alloc (sizeof(TT_SUBCLASS_INFO)); 744 lpttsi->wpOrigProc = 745 (WNDPROC)SetWindowLongA ((HWND)toolPtr->uId, 746 GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc); 747 lpttsi->hwndToolTip = hwnd; 748 lpttsi->uRefCount++; 749 SetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass, 750 (HANDLE)lpttsi); 751 } 752 // else 753 // WARN (tooltips, "A window tool must only be listed once!\n"); 754 } 755 else { 756 LPTT_SUBCLASS_INFO lpttsi = 757 (LPTT_SUBCLASS_INFO)GetPropA (toolPtr->hwnd, COMCTL32_aSubclass); 758 if (lpttsi == NULL) { 759 lpttsi = 760 (LPTT_SUBCLASS_INFO)COMCTL32_Alloc (sizeof(TT_SUBCLASS_INFO)); 761 lpttsi->wpOrigProc = 762 (WNDPROC)SetWindowLongA (toolPtr->hwnd, 763 GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc); 764 lpttsi->hwndToolTip = hwnd; 765 lpttsi->uRefCount++; 766 SetPropA (toolPtr->hwnd, COMCTL32_aSubclass, (HANDLE)lpttsi); 767 } 768 else 769 lpttsi->uRefCount++; 770 } 771 // TRACE (tooltips, "subclassing installed!\n"); 772 } 820 TOOLTIPS_Subclass(hwnd,toolPtr); 773 821 774 822 return TRUE; … … 804 852 805 853 /* remove subclassing */ 806 if (toolPtr->uFlags & TTF_SUBCLASS) { 807 if (toolPtr->uFlags & TTF_IDISHWND) { 808 LPTT_SUBCLASS_INFO lpttsi = 809 (LPTT_SUBCLASS_INFO)GetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 810 if (lpttsi) { 811 SetWindowLongA ((HWND)toolPtr->uId, GWL_WNDPROC, 812 (LONG)lpttsi->wpOrigProc); 813 RemovePropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 814 COMCTL32_Free (&lpttsi); 815 } 816 // else 817 // ERR (tooltips, "Invalid data handle!\n"); 818 } 819 else { 820 LPTT_SUBCLASS_INFO lpttsi = 821 (LPTT_SUBCLASS_INFO)GetPropA (toolPtr->hwnd, COMCTL32_aSubclass); 822 if (lpttsi) { 823 if (lpttsi->uRefCount == 1) { 824 SetWindowLongA ((HWND)toolPtr->uId, GWL_WNDPROC, 825 (LONG)lpttsi->wpOrigProc); 826 RemovePropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 827 COMCTL32_Free (&lpttsi); 828 } 829 else 830 lpttsi->uRefCount--; 831 } 832 // else 833 // ERR (tooltips, "Invalid data handle!\n"); 834 } 835 } 854 TOOLTIPS_Desubclass(toolPtr); 836 855 837 856 /* delete tool from tool list */ … … 890 909 891 910 /* remove subclassing */ 892 if (toolPtr->uFlags & TTF_SUBCLASS) { 893 if (toolPtr->uFlags & TTF_IDISHWND) { 894 LPTT_SUBCLASS_INFO lpttsi = 895 (LPTT_SUBCLASS_INFO)GetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 896 if (lpttsi) { 897 SetWindowLongA ((HWND)toolPtr->uId, GWL_WNDPROC, 898 (LONG)lpttsi->wpOrigProc); 899 RemovePropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 900 COMCTL32_Free (&lpttsi); 901 } 902 // else 903 // ERR (tooltips, "Invalid data handle!\n"); 904 } 905 else { 906 LPTT_SUBCLASS_INFO lpttsi = 907 (LPTT_SUBCLASS_INFO)GetPropA (toolPtr->hwnd, COMCTL32_aSubclass); 908 if (lpttsi) { 909 if (lpttsi->uRefCount == 1) { 910 SetWindowLongA ((HWND)toolPtr->uId, GWL_WNDPROC, 911 (LONG)lpttsi->wpOrigProc); 912 RemovePropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 913 COMCTL32_Free (&lpttsi); 914 } 915 else 916 lpttsi->uRefCount--; 917 } 918 // else 919 // ERR (tooltips, "Invalid data handle!\n"); 920 } 921 } 911 TOOLTIPS_Desubclass(toolPtr); 922 912 923 913 /* delete tool from tool list */ … … 1443 1433 // TRACE (tooltips, "WM_MOUSEMOVE (%04x %ld %ld)\n", 1444 1434 // hwnd, pt.x, pt.y); 1445 infoPtr->bActive = TRUE;//CB: somewhere reset, find it!!! 1435 1446 1436 if (infoPtr->bActive && (infoPtr->nTool != infoPtr->nOldTool)) 1447 1437 { … … 1855 1845 1856 1846 /* initialize info structure */ 1847 infoPtr->szTipText[0] = '\0'; 1857 1848 infoPtr->bActive = TRUE; 1858 1849 infoPtr->bTrackActive = FALSE; 1859 1850 infoPtr->clrBk = GetSysColor(COLOR_INFOBK); 1860 1851 infoPtr->clrText = GetSysColor(COLOR_INFOTEXT); 1852 infoPtr->xTrackPos = 0; 1853 infoPtr->yTrackPos = 0; 1861 1854 1862 1855 nclm.cbSize = sizeof(NONCLIENTMETRICSA); … … 1910 1903 1911 1904 /* remove subclassing */ 1912 if (toolPtr->uFlags & TTF_SUBCLASS) 1913 { 1914 LPTT_SUBCLASS_INFO lpttsi; 1915 1916 if (toolPtr->uFlags & TTF_IDISHWND) 1917 lpttsi = (LPTT_SUBCLASS_INFO)GetPropA((HWND)toolPtr->uId,COMCTL32_aSubclass); 1918 else 1919 lpttsi = (LPTT_SUBCLASS_INFO)GetPropA(toolPtr->hwnd,COMCTL32_aSubclass); 1920 1921 if (lpttsi) 1922 { 1923 SetWindowLongA ((HWND)toolPtr->uId,GWL_WNDPROC,(LONG)lpttsi->wpOrigProc); 1924 RemovePropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 1925 COMCTL32_Free (&lpttsi); 1926 } 1927 } 1905 TOOLTIPS_Desubclass(toolPtr); 1906 1928 1907 } 1929 1908 COMCTL32_Free (infoPtr->tools); … … 2079 2058 if(wParam < length) 2080 2059 { 2081 lstrcpynWtoA((LPSTR)lParam, infoPtr->szTipText,(UINT)wParam);2060 lstrcpynWtoA((LPSTR)lParam,infoPtr->szTipText,MIN((UINT)wParam,lstrlenW(infoPtr->szTipText))); 2082 2061 return wParam; 2083 2062 } 2084 lstrcpyWtoA((LPSTR)lParam, infoPtr->szTipText);2063 lstrcpyWtoA((LPSTR)lParam,infoPtr->szTipText); 2085 2064 return length; 2086 2065 … … 2093 2072 2094 2073 // TRACE (tooltips, "timer %d (%x) expired!\n", wParam, hwnd); 2095 2096 2074 switch (wParam) 2097 2075 { 2098 2076 case ID_TIMERSHOW: 2099 KillTimer (hwnd,ID_TIMERSHOW);2077 KillTimer(hwnd,ID_TIMERSHOW); 2100 2078 if (TOOLTIPS_CheckTool(hwnd,TRUE) == infoPtr->nTool) 2101 2079 TOOLTIPS_Show(hwnd,infoPtr); … … 2116 2094 break; 2117 2095 } 2096 2118 2097 return 0; 2119 2098 } -
trunk/src/comctl32/trackbar.c
r219 r236 1 /* $Id: trackbar.c,v 1. 8 1999-06-26 14:20:32cbratschi Exp $ */1 /* $Id: trackbar.c,v 1.9 1999-06-28 15:46:28 cbratschi Exp $ */ 2 2 /* 3 3 * Trackbar control … … 1384 1384 j = hi; 1385 1385 x = list[(lo+hi)/2]; 1386 while (i <= j)1386 do 1387 1387 { 1388 1388 while (list[i] < x) i++; … … 1396 1396 j--; 1397 1397 } 1398 } 1398 } while (i <= j); 1399 1399 if (lo < j) TRACKBAR_QuickSort(list,lo,j); 1400 1400 if (i < hi) TRACKBAR_QuickSort(list,i,hi); -
trunk/src/comctl32/treeview.c
r164 r236 1 /* $Id: treeview.c,v 1. 5 1999-06-23 19:45:02 achimhaExp $ */1 /* $Id: treeview.c,v 1.6 1999-06-28 15:46:28 cbratschi Exp $ */ 2 2 /* Treeview control 3 3 * … … 894 894 if (tvItem->mask & TVIF_TEXT) { 895 895 if (tvItem->pszText!=LPSTR_TEXTCALLBACKA) { 896 len =lstrlenA (tvItem->pszText);897 if (len >wineItem->cchTextMax)898 wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, len+1);896 len = lstrlenA (tvItem->pszText); 897 if (len > wineItem->cchTextMax) 898 wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, len+1); 899 899 lstrcpynA (wineItem->pszText, tvItem->pszText,len); 900 900 } else { … … 903 903 wineItem->cchTextMax=0; 904 904 } 905 wineItem->pszText =LPSTR_TEXTCALLBACKA;905 wineItem->pszText = LPSTR_TEXTCALLBACKA; 906 906 } 907 907 } … … 1166 1166 } 1167 1167 else if (wineItem->pszText) { 1168 lstrcpynA (tvItem->pszText, wineItem->pszText, tvItem->cchTextMax);1168 lstrcpynA (tvItem->pszText, wineItem->pszText, MIN(tvItem->cchTextMax,lstrlenA(wineItem->pszText))); 1169 1169 } 1170 1170 }
Note:
See TracChangeset
for help on using the changeset viewer.
