Changeset 218:c749c13479ef
- Timestamp:
- 05/18/08 13:57:18
(3 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
rebuild some function to work again with heap RECT. Also some overrides
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r214 |
r218 |
|
| 480 | 480 | if (explorerTheme) { |
|---|
| 481 | 481 | if (hooks (DWT.EraseItem)) { |
|---|
| 482 | | RECT itemRect = item.getBounds (index, true, true, false, false, true, hDC); |
|---|
| | 482 | RECT* itemRect = item.getBounds (index, true, true, false, false, true, hDC); |
|---|
| 483 | 483 | itemRect.left -= EXPLORER_EXTRA; |
|---|
| 484 | 484 | itemRect.right += EXPLORER_EXTRA + 1; |
|---|
| … | … | |
| 522 | 522 | } |
|---|
| 523 | 523 | if (x + width > clientRect.left) { |
|---|
| 524 | | RECT rect; |
|---|
| 525 | | RECT* backgroundRect = null; |
|---|
| 526 | | RECT rectTmp; |
|---|
| 527 | | bool drawItem = true, drawText = true, drawImage = true, drawBackground = false; |
|---|
| | 524 | RECT* rect = new RECT(), backgroundRect = null; |
|---|
| | 525 | bool drawItem = true, drawText = true, drawImage = true, drawBackground_ = false; |
|---|
| 528 | 526 | if (i is 0) { |
|---|
| 529 | 527 | drawItem = drawImage = drawText = false; |
|---|
| … | … | |
| 545 | 543 | data.device = display; |
|---|
| 546 | 544 | GC gc = GC.win32_new (hDC, data); |
|---|
| 547 | | RECT iconRect = item.getBounds (index, false, true, false, false, true, hDC); |
|---|
| | 545 | RECT* iconRect = item.getBounds (index, false, true, false, false, true, hDC); |
|---|
| 548 | 546 | gc.setClipping (iconRect.left, iconRect.top, iconRect.right - iconRect.left, iconRect.bottom - iconRect.top); |
|---|
| 549 | 547 | gc.drawImage (image, 0, 0, bounds.width, bounds.height, iconRect.left, iconRect.top, size.x, size.y); |
|---|
| … | … | |
| 554 | 552 | } |
|---|
| 555 | 553 | } else { |
|---|
| 556 | | drawItem = drawText = drawBackground = true; |
|---|
| | 554 | drawItem = drawText = drawBackground_ = true; |
|---|
| 557 | 555 | rect = item.getBounds (index, true, false, false, false, true, hDC); |
|---|
| 558 | 556 | if (linesVisible) { |
|---|
| … | … | |
| 563 | 561 | } |
|---|
| 564 | 562 | if (selected && !ignoreDrawSelection && !ignoreDrawBackground) { |
|---|
| 565 | | if (!explorerTheme) fillBackground (hDC, OS.GetBkColor (hDC), &rect); |
|---|
| 566 | | drawBackground = false; |
|---|
| 567 | | } |
|---|
| 568 | | backgroundRect = ▭ |
|---|
| | 563 | if (!explorerTheme) fillBackground (hDC, OS.GetBkColor (hDC), rect); |
|---|
| | 564 | drawBackground_ = false; |
|---|
| | 565 | } |
|---|
| | 566 | backgroundRect = rect; |
|---|
| 569 | 567 | if (hooks (DWT.EraseItem)) { |
|---|
| 570 | 568 | drawItem = drawText = drawImage = true; |
|---|
| 571 | 569 | rect = item.getBounds (index, true, true, false, false, true, hDC); |
|---|
| 572 | 570 | if ((style & DWT.FULL_SELECTION) !is 0) { |
|---|
| 573 | | backgroundRect = ▭ |
|---|
| | 571 | backgroundRect = rect; |
|---|
| 574 | 572 | } else { |
|---|
| 575 | | rectTmp = item.getBounds (index, true, false, false, false, true, hDC); |
|---|
| 576 | | backgroundRect = &rectTmp; |
|---|
| | 573 | backgroundRect = item.getBounds (index, true, false, false, false, true, hDC); |
|---|
| 577 | 574 | } |
|---|
| 578 | 575 | } |
|---|
| … | … | |
| 580 | 577 | selectionForeground = -1; |
|---|
| 581 | 578 | ignoreDrawForeground = ignoreDrawBackground = ignoreDrawSelection = ignoreDrawFocus = ignoreDrawHot = false; |
|---|
| 582 | | OS.SetRect (&rect, x, nmcd.nmcd.rc.top, x + width, nmcd.nmcd.rc.bottom); |
|---|
| 583 | | backgroundRect = ▭ |
|---|
| | 579 | OS.SetRect (rect, x, nmcd.nmcd.rc.top, x + width, nmcd.nmcd.rc.bottom); |
|---|
| | 580 | backgroundRect = rect; |
|---|
| 584 | 581 | } |
|---|
| 585 | 582 | int clrText = -1, clrTextBk = -1; |
|---|
| … | … | |
| 592 | 589 | OS.SetTextColor (hDC, getForegroundPixel ()); |
|---|
| 593 | 590 | OS.SetBkColor (hDC, getBackgroundPixel ()); |
|---|
| 594 | | drawForeground = drawBackground = true; |
|---|
| | 591 | drawForeground = drawBackground_ = true; |
|---|
| 595 | 592 | } |
|---|
| 596 | 593 | } else { |
|---|
| 597 | | drawForeground = drawBackground = true; |
|---|
| | 594 | drawForeground = drawBackground_ = true; |
|---|
| 598 | 595 | } |
|---|
| 599 | 596 | if (drawForeground) { |
|---|
| … | … | |
| 601 | 598 | if (clrText is -1) clrText = item.foreground; |
|---|
| 602 | 599 | } |
|---|
| 603 | | if (drawBackground) { |
|---|
| | 600 | if (drawBackground_) { |
|---|
| 604 | 601 | clrTextBk = item.cellBackground !is null ? item.cellBackground [index] : -1; |
|---|
| 605 | 602 | if (clrTextBk is -1) clrTextBk = item.background; |
|---|
| … | … | |
| 608 | 605 | } else { |
|---|
| 609 | 606 | if (clrTextBk is -1 && index is sortIndex) { |
|---|
| 610 | | drawBackground = true; |
|---|
| | 607 | drawBackground_ = true; |
|---|
| 611 | 608 | clrTextBk = clrSortBk; |
|---|
| 612 | 609 | } |
|---|
| … | … | |
| 615 | 612 | if (selected || (nmcd.nmcd.uItemState & OS.CDIS_HOT) !is 0) { |
|---|
| 616 | 613 | if ((style & DWT.FULL_SELECTION) !is 0) { |
|---|
| 617 | | drawBackground = false; |
|---|
| | 614 | drawBackground_ = false; |
|---|
| 618 | 615 | } else { |
|---|
| 619 | 616 | if (i is 0) { |
|---|
| 620 | | drawBackground = false; |
|---|
| | 617 | drawBackground_ = false; |
|---|
| 621 | 618 | if (!hooks (DWT.EraseItem)) drawText = false; |
|---|
| 622 | 619 | } |
|---|
| … | … | |
| 631 | 628 | } |
|---|
| 632 | 629 | if (hooks (DWT.EraseItem)) { |
|---|
| 633 | | RECT cellRect = item.getBounds (index, true, true, true, true, true, hDC); |
|---|
| | 630 | RECT* cellRect = item.getBounds (index, true, true, true, true, true, hDC); |
|---|
| 634 | 631 | int nSavedDC = OS.SaveDC (hDC); |
|---|
| 635 | 632 | GCData data = new GCData (); |
|---|
| … | … | |
| 693 | 690 | } else { |
|---|
| 694 | 691 | if (!explorerTheme) { |
|---|
| 695 | | drawBackground = true; |
|---|
| | 692 | drawBackground_ = true; |
|---|
| 696 | 693 | ignoreDrawBackground = false; |
|---|
| 697 | 694 | if ((handle is OS.GetFocus () || display.getHighContrast ()) && OS.IsWindowEnabled (handle)) { |
|---|
| … | … | |
| 754 | 751 | if (!ignoreDrawBackground) { |
|---|
| 755 | 752 | if (clrTextBk !is -1) { |
|---|
| 756 | | if (drawBackground) fillBackground (hDC, clrTextBk, backgroundRect); |
|---|
| | 753 | if (drawBackground_) fillBackground (hDC, clrTextBk, backgroundRect); |
|---|
| 757 | 754 | } else { |
|---|
| 758 | 755 | Control control = findImageControl (); |
|---|
| … | … | |
| 760 | 757 | if (i is 0) { |
|---|
| 761 | 758 | int right = Math.min (rect.right, width); |
|---|
| 762 | | OS.SetRect (&rect, rect.left, rect.top, right, rect.bottom); |
|---|
| 763 | | if (drawBackground) fillImageBackground (hDC, control, &rect); |
|---|
| | 759 | OS.SetRect (rect, rect.left, rect.top, right, rect.bottom); |
|---|
| | 760 | if (drawBackground_) fillImageBackground (hDC, control, rect); |
|---|
| 764 | 761 | } else { |
|---|
| 765 | | if (drawBackground) fillImageBackground (hDC, control, &rect); |
|---|
| | 762 | if (drawBackground_) fillImageBackground (hDC, control, rect); |
|---|
| 766 | 763 | } |
|---|
| 767 | 764 | } |
|---|
| … | … | |
| 794 | 791 | gc.dispose (); |
|---|
| 795 | 792 | } |
|---|
| 796 | | OS.SetRect (&rect, rect.left + size.x + offset, rect.top, rect.right - inset, rect.bottom); |
|---|
| | 793 | OS.SetRect (rect, rect.left + size.x + offset, rect.top, rect.right - inset, rect.bottom); |
|---|
| 797 | 794 | } else { |
|---|
| 798 | 795 | if (i is 0) { |
|---|
| … | … | |
| 802 | 799 | } |
|---|
| 803 | 800 | } else { |
|---|
| 804 | | OS.SetRect (&rect, rect.left + offset, rect.top, rect.right - inset, rect.bottom); |
|---|
| | 801 | OS.SetRect (rect, rect.left + offset, rect.top, rect.right - inset, rect.bottom); |
|---|
| 805 | 802 | } |
|---|
| 806 | 803 | } |
|---|
| … | … | |
| 833 | 830 | } |
|---|
| 834 | 831 | TCHAR[] buffer = StrToTCHARs (getCodePage (), string, false); |
|---|
| 835 | | if (!ignoreDrawForeground) OS.DrawText (hDC, buffer.ptr, buffer.length, &rect, flags); |
|---|
| 836 | | OS.DrawText (hDC, buffer.ptr, buffer.length, &rect, flags | OS.DT_CALCRECT); |
|---|
| | 832 | if (!ignoreDrawForeground) OS.DrawText (hDC, buffer.ptr, buffer.length, rect, flags); |
|---|
| | 833 | OS.DrawText (hDC, buffer.ptr, buffer.length, rect, flags | OS.DT_CALCRECT); |
|---|
| 837 | 834 | if (hFont !is cast(HFONT)-1) hFont = cast(HFONT)OS.SelectObject (hDC, hFont); |
|---|
| 838 | 835 | if (clrText !is -1) clrText = OS.SetTextColor (hDC, clrText); |
|---|
| … | … | |
| 844 | 841 | if (selectionForeground !is -1) clrText = selectionForeground; |
|---|
| 845 | 842 | if (hooks (DWT.PaintItem)) { |
|---|
| 846 | | RECT itemRect = item.getBounds (index, true, true, false, false, false, hDC); |
|---|
| | 843 | RECT* itemRect = item.getBounds (index, true, true, false, false, false, hDC); |
|---|
| 847 | 844 | int nSavedDC = OS.SaveDC (hDC); |
|---|
| 848 | 845 | GCData data = new GCData (); |
|---|
| … | … | |
| 884 | 881 | event.width = itemRect.right - itemRect.left; |
|---|
| 885 | 882 | event.height = itemRect.bottom - itemRect.top; |
|---|
| 886 | | RECT cellRect = item.getBounds (index, true, true, true, true, true, hDC); |
|---|
| | 883 | RECT* cellRect = item.getBounds (index, true, true, true, true, true, hDC); |
|---|
| 887 | 884 | int cellWidth = cellRect.right - cellRect.left; |
|---|
| 888 | 885 | int cellHeight = cellRect.bottom - cellRect.top; |
|---|
| … | … | |
| 931 | 928 | } else { |
|---|
| 932 | 929 | int index = OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0); |
|---|
| 933 | | RECT focusRect = item.getBounds (index, true, false, false, false, false, hDC); |
|---|
| 934 | | RECT clipRect = item.getBounds (index, true, false, false, false, true, hDC); |
|---|
| | 930 | RECT* focusRect = item.getBounds (index, true, false, false, false, false, hDC); |
|---|
| | 931 | RECT* clipRect = item.getBounds (index, true, false, false, false, true, hDC); |
|---|
| 935 | 932 | OS.IntersectClipRect (hDC, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom); |
|---|
| 936 | | OS.DrawFocusRect (hDC, &focusRect); |
|---|
| | 933 | OS.DrawFocusRect (hDC, focusRect); |
|---|
| 937 | 934 | OS.SelectClipRgn (hDC, null); |
|---|
| 938 | 935 | } |
|---|
| … | … | |
| 1024 | 1021 | RECT rect; |
|---|
| 1025 | 1022 | OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); |
|---|
| 1026 | | RECT cellRect = item.getBounds (index, true, true, true, true, true, hDC); |
|---|
| | 1023 | RECT* cellRect = item.getBounds (index, true, true, true, true, true, hDC); |
|---|
| 1027 | 1024 | if (clrSortBk !is -1) { |
|---|
| 1028 | | drawBackground (hDC, &cellRect, clrSortBk); |
|---|
| | 1025 | drawBackground (hDC, cellRect, clrSortBk); |
|---|
| 1029 | 1026 | } else { |
|---|
| 1030 | 1027 | if (OS.IsWindowEnabled (handle) || findImageControl () !is null) { |
|---|
| … | … | |
| 1099 | 1096 | fillBackground (hDC, clrTextBk, &rect); |
|---|
| 1100 | 1097 | } else { |
|---|
| 1101 | | RECT textRect = item.getBounds (index, true, false, false, false, true, hDC); |
|---|
| | 1098 | RECT* textRect = item.getBounds (index, true, false, false, false, true, hDC); |
|---|
| 1102 | 1099 | if (measureEvent !is null) { |
|---|
| 1103 | 1100 | textRect.right = Math.min (cellRect.right, measureEvent.x + measureEvent.width); |
|---|
| 1104 | 1101 | } |
|---|
| 1105 | | fillBackground (hDC, clrTextBk, &textRect); |
|---|
| | 1102 | fillBackground (hDC, clrTextBk, textRect); |
|---|
| 1106 | 1103 | } |
|---|
| 1107 | 1104 | } else { |
|---|
| 1108 | | fillBackground (hDC, clrTextBk, &cellRect); |
|---|
| | 1105 | fillBackground (hDC, clrTextBk, cellRect); |
|---|
| 1109 | 1106 | } |
|---|
| 1110 | 1107 | } |
|---|
| … | … | |
| 1117 | 1114 | if (explorerTheme) { |
|---|
| 1118 | 1115 | if ((style & DWT.FULL_SELECTION) is 0) { |
|---|
| 1119 | | RECT pRect = item.getBounds (index, true, true, false, false, false, hDC); |
|---|
| 1120 | | RECT pClipRect = item.getBounds (index, true, true, true, false, true, hDC); |
|---|
| | 1116 | RECT* pRect = item.getBounds (index, true, true, false, false, false, hDC); |
|---|
| | 1117 | RECT* pClipRect = item.getBounds (index, true, true, true, false, true, hDC); |
|---|
| 1121 | 1118 | if (measureEvent !is null) { |
|---|
| 1122 | 1119 | pRect.right = Math.min (pClipRect.right, measureEvent.x + measureEvent.width); |
|---|
| … | … | |
| 1130 | 1127 | int iStateId = selected ? OS.TREIS_SELECTED : OS.TREIS_HOT; |
|---|
| 1131 | 1128 | if (OS.GetFocus () !is handle && selected && !hot) iStateId = OS.TREIS_SELECTEDNOTFOCUS; |
|---|
| 1132 | | OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, &pRect, &pClipRect); |
|---|
| | 1129 | OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, pRect, pClipRect); |
|---|
| 1133 | 1130 | OS.CloseThemeData (hTheme); |
|---|
| 1134 | 1131 | } |
|---|
| … | … | |
| 1145 | 1142 | fillBackground (hDC, OS.GetBkColor (hDC), &rect); |
|---|
| 1146 | 1143 | } else { |
|---|
| 1147 | | fillBackground (hDC, OS.GetBkColor (hDC), &cellRect); |
|---|
| | 1144 | fillBackground (hDC, OS.GetBkColor (hDC), cellRect); |
|---|
| 1148 | 1145 | } |
|---|
| 1149 | 1146 | } else { |
|---|
| 1150 | | RECT textRect = item.getBounds (index, true, false, false, false, true, hDC); |
|---|
| | 1147 | RECT* textRect = item.getBounds (index, true, false, false, false, true, hDC); |
|---|
| 1151 | 1148 | if (measureEvent !is null) { |
|---|
| 1152 | 1149 | textRect.right = Math.min (cellRect.right, measureEvent.x + measureEvent.width); |
|---|
| 1153 | 1150 | } |
|---|
| 1154 | | fillBackground (hDC, OS.GetBkColor (hDC), &textRect); |
|---|
| | 1151 | fillBackground (hDC, OS.GetBkColor (hDC), textRect); |
|---|
| 1155 | 1152 | } |
|---|
| 1156 | 1153 | } |
|---|
| … | … | |
| 1179 | 1176 | } |
|---|
| 1180 | 1177 | if (focused && !ignoreDrawFocus && (style & DWT.FULL_SELECTION) is 0) { |
|---|
| 1181 | | RECT textRect = item.getBounds (index, true, explorerTheme, false, false, true, hDC); |
|---|
| | 1178 | RECT* textRect = item.getBounds (index, true, explorerTheme, false, false, true, hDC); |
|---|
| 1182 | 1179 | if (measureEvent !is null) { |
|---|
| 1183 | 1180 | textRect.right = Math.min (cellRect.right, measureEvent.x + measureEvent.width); |
|---|
| … | … | |
| 1185 | 1182 | nmcd.nmcd.uItemState &= ~OS.CDIS_FOCUS; |
|---|
| 1186 | 1183 | OS.MoveMemory (lParam, nmcd, NMTVCUSTOMDRAW.sizeof); |
|---|
| 1187 | | if( focusRect is null ) focusRect = new RECT; |
|---|
| 1188 | | *focusRect = textRect; |
|---|
| | 1184 | focusRect = textRect; |
|---|
| 1189 | 1185 | } |
|---|
| 1190 | 1186 | if (explorerTheme) { |
|---|
| … | … | |
| 1192 | 1188 | OS.MoveMemory (cast(void*)lParam, nmcd, NMTVCUSTOMDRAW.sizeof); |
|---|
| 1193 | 1189 | } |
|---|
| 1194 | | RECT itemRect = item.getBounds (index, true, true, false, false, false, hDC); |
|---|
| | 1190 | RECT* itemRect = item.getBounds (index, true, true, false, false, false, hDC); |
|---|
| 1195 | 1191 | OS.SaveDC (hDC); |
|---|
| 1196 | 1192 | OS.SelectClipRgn (hDC, null); |
|---|
| … | … | |
| 1323 | 1319 | fillBackground (hDC, clrTextBk, &rect); |
|---|
| 1324 | 1320 | } else { |
|---|
| 1325 | | RECT textRect = item.getBounds (index, true, false, true, false, true, hDC); |
|---|
| 1326 | | fillBackground (hDC, clrTextBk, &textRect); |
|---|
| | 1321 | RECT* textRect = item.getBounds (index, true, false, true, false, true, hDC); |
|---|
| | 1322 | fillBackground (hDC, clrTextBk, textRect); |
|---|
| 1327 | 1323 | } |
|---|
| 1328 | 1324 | } |
|---|
| … | … | |
| 2659 | 2655 | } |
|---|
| 2660 | 2656 | |
|---|
| 2661 | | void destroyScrollBar (int type) { |
|---|
| | 2657 | override void destroyScrollBar (int type) { |
|---|
| 2662 | 2658 | super.destroyScrollBar (type); |
|---|
| 2663 | 2659 | int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); |
|---|
| … | … | |
| 2722 | 2718 | } |
|---|
| 2723 | 2719 | |
|---|
| 2724 | | bool findCell (int x, int y, inout TreeItem item, inout int index, inout RECT cellRect, inout RECT itemRect) { |
|---|
| | 2720 | bool findCell (int x, int y, inout TreeItem item, inout int index, inout RECT* cellRect, inout RECT* itemRect) { |
|---|
| 2725 | 2721 | bool found = false; |
|---|
| 2726 | 2722 | TVHITTESTINFO lpht; |
|---|
| … | … | |
| 2757 | 2753 | } else { |
|---|
| 2758 | 2754 | cellRect.right = Math.min (cellRect.right, rect.right); |
|---|
| 2759 | | if (OS.PtInRect ( &cellRect, pt)) { |
|---|
| | 2755 | if (OS.PtInRect ( cellRect, pt)) { |
|---|
| 2760 | 2756 | if (isCustomToolTip ()) { |
|---|
| 2761 | 2757 | Event event = sendMeasureItemEvent (item, order [index], hDC); |
|---|
| 2762 | 2758 | if (isDisposed () || item.isDisposed ()) break; |
|---|
| 2763 | | //itemRect [0] = new RECT (); |
|---|
| | 2759 | itemRect = new RECT (); |
|---|
| 2764 | 2760 | itemRect.left = event.x; |
|---|
| 2765 | 2761 | itemRect.right = event.x + event.width; |
|---|
| … | … | |
| 4377 | 4373 | |
|---|
| 4378 | 4374 | Event sendMeasureItemEvent (TreeItem item, int index, HDC hDC) { |
|---|
| 4379 | | RECT itemRect = item.getBounds (index, true, true, false, false, false, hDC); |
|---|
| | 4375 | RECT* itemRect = item.getBounds (index, true, true, false, false, false, hDC); |
|---|
| 4380 | 4376 | int nSavedDC = OS.SaveDC (hDC); |
|---|
| 4381 | 4377 | GCData data = new GCData (); |
|---|
| … | … | |
| 5412 | 5408 | int index; |
|---|
| 5413 | 5409 | TreeItem item; |
|---|
| 5414 | | RECT cellRect, itemRect; |
|---|
| | 5410 | RECT* cellRect, itemRect; |
|---|
| 5415 | 5411 | if (findCell (pt.x, pt.y, item, index, cellRect, itemRect)) { |
|---|
| 5416 | 5412 | String text = null; |
|---|
| … | … | |
| 6582 | 6578 | int index; |
|---|
| 6583 | 6579 | TreeItem item; |
|---|
| 6584 | | RECT cellRect, itemRect; |
|---|
| | 6580 | RECT* cellRect, itemRect; |
|---|
| 6585 | 6581 | if (findCell (x, y, item, index, cellRect, itemRect)) { |
|---|
| 6586 | 6582 | /* |
|---|
| … | … | |
| 7600 | 7596 | int index; |
|---|
| 7601 | 7597 | TreeItem item; |
|---|
| 7602 | | RECT cellRect, itemRect; |
|---|
| | 7598 | RECT* cellRect, itemRect; |
|---|
| 7603 | 7599 | if (findCell (pt.x, pt.y, item, index, cellRect, itemRect)) { |
|---|
| 7604 | | RECT* toolRect = toolTipRect (&itemRect); |
|---|
| | 7600 | RECT* toolRect = toolTipRect (itemRect); |
|---|
| 7605 | 7601 | OS.MapWindowPoints (handle, null, cast(POINT*)toolRect, 2); |
|---|
| 7606 | 7602 | int width = toolRect.right - toolRect.left; |
|---|
| … | … | |
| 7643 | 7639 | int index; |
|---|
| 7644 | 7640 | TreeItem item; |
|---|
| 7645 | | RECT cellRect, itemRect; |
|---|
| | 7641 | RECT* cellRect, itemRect; |
|---|
| 7646 | 7642 | int pos = OS.GetMessagePos (); |
|---|
| 7647 | 7643 | POINT pt; |
|---|
| … | … | |
| 7657 | 7653 | cellRect = item.getBounds (index, true, true, false, false, false, hDC); |
|---|
| 7658 | 7654 | if (hooks (DWT.EraseItem)) { |
|---|
| 7659 | | Event event = sendEraseItemEvent (item, nmcd, index, &cellRect); |
|---|
| | 7655 | Event event = sendEraseItemEvent (item, nmcd, index, cellRect); |
|---|
| 7660 | 7656 | if (isDisposed () || item.isDisposed ()) break; |
|---|
| 7661 | 7657 | if (event.doit) { |
|---|
| … | … | |
| 7668 | 7664 | int nSavedDC = OS.SaveDC (nmcd.nmcd.hdc); |
|---|
| 7669 | 7665 | int gridWidth = getLinesVisible () ? Table.GRID_WIDTH : 0; |
|---|
| 7670 | | RECT* insetRect = toolTipInset (&cellRect); |
|---|
| | 7666 | RECT* insetRect = toolTipInset (cellRect); |
|---|
| 7671 | 7667 | OS.SetWindowOrgEx (nmcd.nmcd.hdc, insetRect.left, insetRect.top, null); |
|---|
| 7672 | 7668 | GCData data = new GCData (); |
|---|
| … | … | |
| 7681 | 7677 | if (image !is null || index is 0) { |
|---|
| 7682 | 7678 | Point size = getImageSize (); |
|---|
| 7683 | | RECT imageRect = item.getBounds (index, false, true, false, false, false, hDC); |
|---|
| | 7679 | RECT* imageRect = item.getBounds (index, false, true, false, false, false, hDC); |
|---|
| 7684 | 7680 | if (imageList is null) size.x = imageRect.right - imageRect.left; |
|---|
| 7685 | 7681 | if (image !is null) { |
|---|
| … | … | |
| 7710 | 7706 | if (hooks (DWT.PaintItem)) { |
|---|
| 7711 | 7707 | itemRect = item.getBounds (index, true, true, false, false, false, hDC); |
|---|
| 7712 | | sendPaintItemEvent (item, nmcd, index, &itemRect); |
|---|
| | 7708 | sendPaintItemEvent (item, nmcd, index, itemRect); |
|---|
| 7713 | 7709 | } |
|---|
| 7714 | 7710 | OS.SelectObject (hDC, oldFont); |
|---|
| r213 |
r218 |
|
| 367 | 367 | auto hFont = item.fontHandle (index); |
|---|
| 368 | 368 | if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont); |
|---|
| 369 | | RECT itemRect = item.getBounds (index, true, true, false, false, false, hDC); |
|---|
| | 369 | RECT* itemRect = item.getBounds (index, true, true, false, false, false, hDC); |
|---|
| 370 | 370 | if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont); |
|---|
| 371 | 371 | itemRight = itemRect.right; |
|---|
| … | … | |
| 660 | 660 | checkWidget (); |
|---|
| 661 | 661 | if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 662 | | if (string==/*eq*/text) return; |
|---|
| | 662 | if (string.equals (text)) return; |
|---|
| 663 | 663 | int index = parent.indexOf (this); |
|---|
| 664 | 664 | if (index is -1) return; |
|---|
| r213 |
r218 |
|
| 403 | 403 | checkWidget (); |
|---|
| 404 | 404 | if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); |
|---|
| 405 | | RECT rect = getBounds (0, true, false, false); |
|---|
| | 405 | RECT* rect = getBounds (0, true, false, false); |
|---|
| 406 | 406 | int width = rect.right - rect.left, height = rect.bottom - rect.top; |
|---|
| 407 | 407 | return new Rectangle (rect.left, rect.top, width, height); |
|---|
| … | … | |
| 425 | 425 | checkWidget(); |
|---|
| 426 | 426 | if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); |
|---|
| 427 | | RECT rect = getBounds (index, true, true, true); |
|---|
| | 427 | RECT* rect = getBounds (index, true, true, true); |
|---|
| 428 | 428 | int width = rect.right - rect.left, height = rect.bottom - rect.top; |
|---|
| 429 | 429 | return new Rectangle (rect.left, rect.top, width, height); |
|---|
| 430 | 430 | } |
|---|
| 431 | 431 | |
|---|
| 432 | | RECT getBounds (int index, bool getText, bool getImage, bool fullText) { |
|---|
| | 432 | RECT* getBounds (int index, bool getText, bool getImage, bool fullText) { |
|---|
| 433 | 433 | return getBounds (index, getText, getImage, fullText, false, true, null); |
|---|
| 434 | 434 | } |
|---|
| 435 | 435 | |
|---|
| 436 | 436 | //TODO - take into account grid (add bool arg) to damage less during redraw |
|---|
| 437 | | RECT getBounds (int index, bool getText, bool getImage, bool fullText, bool fullImage, bool clip, HDC hDC) { |
|---|
| 438 | | if (!getText && !getImage) return RECT.init; |
|---|
| | 437 | RECT* getBounds (int index, bool getText, bool getImage, bool fullText, bool fullImage, bool clip, HDC hDC) { |
|---|
| | 438 | if (!getText && !getImage) return new RECT(); |
|---|
| 439 | 439 | auto hwnd = parent.handle; |
|---|
| 440 | 440 | if ((parent.style & DWT.VIRTUAL) is 0 && !cached && !parent.painted) { |
|---|
| … | … | |
| 454 | 454 | firstColumn = index is OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0); |
|---|
| 455 | 455 | } |
|---|
| 456 | | RECT rect; |
|---|
| | 456 | RECT* rect = new RECT(); |
|---|
| 457 | 457 | if (firstColumn) { |
|---|
| 458 | 458 | bool full = columnCount is 0 && getText && getImage && fullText && fullImage; |
|---|
| 459 | | if (!OS.TreeView_GetItemRect (hwnd, handle, &rect, !full)) { |
|---|
| 460 | | return RECT.init; |
|---|
| | 459 | if (!OS.TreeView_GetItemRect (hwnd, handle, rect, !full)) { |
|---|
| | 460 | return new RECT(); |
|---|
| 461 | 461 | } |
|---|
| 462 | 462 | if (getImage && !fullImage) { |
|---|
| … | … | |
| 471 | 471 | if (fullText || fullImage || clip) { |
|---|
| 472 | 472 | if (hwndHeader !is null) { |
|---|
| 473 | | RECT headerRect; |
|---|
| | 473 | RECT* headerRect = new RECT(); |
|---|
| 474 | 474 | if (columnCount !is 0) { |
|---|
| 475 | | if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, cast(int) &headerRect) is 0) { |
|---|
| 476 | | return RECT.init; |
|---|
| | 475 | if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, cast(int) headerRect) is 0) { |
|---|
| | 476 | return new RECT(); |
|---|
| 477 | 477 | } |
|---|
| 478 | 478 | } else { |
|---|
| … | … | |
| 488 | 488 | } |
|---|
| 489 | 489 | } else { |
|---|
| 490 | | if (!(0 <= index && index < columnCount)) return RECT.init; |
|---|
| 491 | | RECT headerRect; |
|---|
| 492 | | if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, cast(int) &headerRect) is 0) { |
|---|
| 493 | | return RECT.init; |
|---|
| 494 | | } |
|---|
| 495 | | if (!OS.TreeView_GetItemRect (hwnd, handle, &rect, false)) { |
|---|
| 496 | | return RECT.init; |
|---|
| | 490 | if (!(0 <= index && index < columnCount)) return new RECT(); |
|---|
| | 491 | RECT* headerRect = new RECT(); |
|---|
| | 492 | if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, cast(int) headerRect) is 0) { |
|---|
| | 493 | return new RECT(); |
|---|
| | 494 | } |
|---|
| | 495 | if (!OS.TreeView_GetItemRect (hwnd, handle, rect, false)) { |
|---|
| | 496 | return new RECT(); |
|---|
| 497 | 497 | } |
|---|
| 498 | 498 | rect.left = headerRect.left; |
|---|
| … | … | |
| 518 | 518 | String string = index is 0 ? text : strings !is null ? strings [index] : null; |
|---|
| 519 | 519 | if (string !is null) { |
|---|
| 520 | | RECT textRect; |
|---|
| | 520 | RECT* textRect = new RECT(); |
|---|
| 521 | 521 | TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), string, false); |
|---|
| 522 | 522 | int flags = OS.DT_NOPREFIX | OS.DT_SINGLELINE | OS.DT_CALCRECT; |
|---|
| … | … | |
| 529 | 529 | hFont = OS.SelectObject (hNewDC, hFont); |
|---|
| 530 | 530 | } |
|---|
| 531 | | OS.DrawText (hNewDC, buffer.ptr, buffer.length, &textRect, flags); |
|---|
| | 531 | OS.DrawText (hNewDC, buffer.ptr, buffer.length, textRect, flags); |
|---|
| 532 | 532 | if (hDC is null) { |
|---|
| 533 | 533 | OS.SelectObject (hNewDC, hFont); |
|---|
| … | … | |
| 848 | 848 | checkWidget(); |
|---|
| 849 | 849 | if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); |
|---|
| 850 | | RECT rect = getBounds (index, false, true, false); |
|---|
| | 850 | RECT* rect = getBounds (index, false, true, false); |
|---|
| 851 | 851 | int width = rect.right - rect.left, height = rect.bottom - rect.top; |
|---|
| 852 | 852 | return new Rectangle (rect.left, rect.top, width, height); |
|---|
| … | … | |
| 938 | 938 | checkWidget(); |
|---|
| 939 | 939 | if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); |
|---|
| 940 | | RECT rect = getBounds (index, true, false, true); |
|---|
| | 940 | RECT* rect = getBounds (index, true, false, true); |
|---|
| 941 | 941 | if (index is 0) rect.left += Tree.INSET - 1; |
|---|
| 942 | 942 | rect.left = Math.min (rect.left, rect.right); |
|---|
| … | … | |
| 1005 | 1005 | if (!OS.IsWindowVisible (hwnd)) return; |
|---|
| 1006 | 1006 | bool fullImage = column is 0 && drawText && drawImage; |
|---|
| 1007 | | RECT rect = getBounds (column, drawText, drawImage, true, fullImage, true, null); |
|---|
| 1008 | | OS.InvalidateRect (hwnd, &rect, true); |
|---|
| | 1007 | RECT* rect = getBounds (column, drawText, drawImage, true, fullImage, true, null); |
|---|
| | 1008 | OS.InvalidateRect (hwnd, rect, true); |
|---|
| 1009 | 1009 | } |
|---|
| 1010 | 1010 | |
|---|