# HG changeset patch # User Frank Benoit # Date 1211133438 -7200 # Node ID c749c13479efe7536d43fe912166798ad65578c4 # Parent 8efa9bb96c53550d63382ff2e6531b048bcc6bc3 rebuild some function to work again with heap RECT. Also some overrides diff -r 8efa9bb96c53 -r c749c13479ef dwt/widgets/Tree.d --- a/dwt/widgets/Tree.d Sun May 18 19:54:28 2008 +0200 +++ b/dwt/widgets/Tree.d Sun May 18 19:57:18 2008 +0200 @@ -479,7 +479,7 @@ OS.SetRect (&pClipRect, width, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); if (explorerTheme) { if (hooks (DWT.EraseItem)) { - RECT itemRect = item.getBounds (index, true, true, false, false, true, hDC); + RECT* itemRect = item.getBounds (index, true, true, false, false, true, hDC); itemRect.left -= EXPLORER_EXTRA; itemRect.right += EXPLORER_EXTRA + 1; pClipRect.left = itemRect.left; @@ -521,10 +521,8 @@ } } if (x + width > clientRect.left) { - RECT rect; - RECT* backgroundRect = null; - RECT rectTmp; - bool drawItem = true, drawText = true, drawImage = true, drawBackground = false; + RECT* rect = new RECT(), backgroundRect = null; + bool drawItem = true, drawText = true, drawImage = true, drawBackground_ = false; if (i is 0) { drawItem = drawImage = drawText = false; if (findImageControl () !is null) { @@ -544,7 +542,7 @@ GCData data = new GCData(); data.device = display; GC gc = GC.win32_new (hDC, data); - RECT iconRect = item.getBounds (index, false, true, false, false, true, hDC); + RECT* iconRect = item.getBounds (index, false, true, false, false, true, hDC); gc.setClipping (iconRect.left, iconRect.top, iconRect.right - iconRect.left, iconRect.bottom - iconRect.top); gc.drawImage (image, 0, 0, bounds.width, bounds.height, iconRect.left, iconRect.top, size.x, size.y); OS.SelectClipRgn (hDC, null); @@ -553,7 +551,7 @@ } } } else { - drawItem = drawText = drawBackground = true; + drawItem = drawText = drawBackground_ = true; rect = item.getBounds (index, true, false, false, false, true, hDC); if (linesVisible) { rect.right++; @@ -562,25 +560,24 @@ } } if (selected && !ignoreDrawSelection && !ignoreDrawBackground) { - if (!explorerTheme) fillBackground (hDC, OS.GetBkColor (hDC), &rect); - drawBackground = false; + if (!explorerTheme) fillBackground (hDC, OS.GetBkColor (hDC), rect); + drawBackground_ = false; } - backgroundRect = ▭ + backgroundRect = rect; if (hooks (DWT.EraseItem)) { drawItem = drawText = drawImage = true; rect = item.getBounds (index, true, true, false, false, true, hDC); if ((style & DWT.FULL_SELECTION) !is 0) { - backgroundRect = ▭ + backgroundRect = rect; } else { - rectTmp = item.getBounds (index, true, false, false, false, true, hDC); - backgroundRect = &rectTmp; + backgroundRect = item.getBounds (index, true, false, false, false, true, hDC); } } } else { selectionForeground = -1; ignoreDrawForeground = ignoreDrawBackground = ignoreDrawSelection = ignoreDrawFocus = ignoreDrawHot = false; - OS.SetRect (&rect, x, nmcd.nmcd.rc.top, x + width, nmcd.nmcd.rc.bottom); - backgroundRect = ▭ + OS.SetRect (rect, x, nmcd.nmcd.rc.top, x + width, nmcd.nmcd.rc.bottom); + backgroundRect = rect; } int clrText = -1, clrTextBk = -1; auto hFont = item.fontHandle (index); @@ -591,33 +588,33 @@ if (i !is 0 && (style & DWT.FULL_SELECTION) is 0) { OS.SetTextColor (hDC, getForegroundPixel ()); OS.SetBkColor (hDC, getBackgroundPixel ()); - drawForeground = drawBackground = true; + drawForeground = drawBackground_ = true; } } else { - drawForeground = drawBackground = true; + drawForeground = drawBackground_ = true; } if (drawForeground) { clrText = item.cellForeground !is null ? item.cellForeground [index] : -1; if (clrText is -1) clrText = item.foreground; } - if (drawBackground) { + if (drawBackground_) { clrTextBk = item.cellBackground !is null ? item.cellBackground [index] : -1; if (clrTextBk is -1) clrTextBk = item.background; if (clrTextBk is -1 && index is sortIndex) clrTextBk = clrSortBk; } } else { if (clrTextBk is -1 && index is sortIndex) { - drawBackground = true; + drawBackground_ = true; clrTextBk = clrSortBk; } } if (explorerTheme) { if (selected || (nmcd.nmcd.uItemState & OS.CDIS_HOT) !is 0) { if ((style & DWT.FULL_SELECTION) !is 0) { - drawBackground = false; + drawBackground_ = false; } else { if (i is 0) { - drawBackground = false; + drawBackground_ = false; if (!hooks (DWT.EraseItem)) drawText = false; } } @@ -630,7 +627,7 @@ if (isDisposed () || item.isDisposed ()) break; } if (hooks (DWT.EraseItem)) { - RECT cellRect = item.getBounds (index, true, true, true, true, true, hDC); + RECT* cellRect = item.getBounds (index, true, true, true, true, true, hDC); int nSavedDC = OS.SaveDC (hDC); GCData data = new GCData (); data.device = display; @@ -692,7 +689,7 @@ selectionForeground = OS.GetSysColor (OS.COLOR_HIGHLIGHTTEXT); } else { if (!explorerTheme) { - drawBackground = true; + drawBackground_ = true; ignoreDrawBackground = false; if ((handle is OS.GetFocus () || display.getHighContrast ()) && OS.IsWindowEnabled (handle)) { clrTextBk = OS.GetSysColor (OS.COLOR_HIGHLIGHT); @@ -753,16 +750,16 @@ } if (!ignoreDrawBackground) { if (clrTextBk !is -1) { - if (drawBackground) fillBackground (hDC, clrTextBk, backgroundRect); + if (drawBackground_) fillBackground (hDC, clrTextBk, backgroundRect); } else { Control control = findImageControl (); if (control !is null) { if (i is 0) { int right = Math.min (rect.right, width); - OS.SetRect (&rect, rect.left, rect.top, right, rect.bottom); - if (drawBackground) fillImageBackground (hDC, control, &rect); + OS.SetRect (rect, rect.left, rect.top, right, rect.bottom); + if (drawBackground_) fillImageBackground (hDC, control, rect); } else { - if (drawBackground) fillImageBackground (hDC, control, &rect); + if (drawBackground_) fillImageBackground (hDC, control, rect); } } } @@ -793,7 +790,7 @@ OS.SelectClipRgn (hDC, null); gc.dispose (); } - OS.SetRect (&rect, rect.left + size.x + offset, rect.top, rect.right - inset, rect.bottom); + OS.SetRect (rect, rect.left + size.x + offset, rect.top, rect.right - inset, rect.bottom); } else { if (i is 0) { if (OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0) !is 0) { @@ -801,7 +798,7 @@ rect.left = Math.min (rect.left + size.x + offset, rect.right); } } else { - OS.SetRect (&rect, rect.left + offset, rect.top, rect.right - inset, rect.bottom); + OS.SetRect (rect, rect.left + offset, rect.top, rect.right - inset, rect.bottom); } } } @@ -832,8 +829,8 @@ if ((column.style & DWT.RIGHT) !is 0) flags |= OS.DT_RIGHT; } TCHAR[] buffer = StrToTCHARs (getCodePage (), string, false); - if (!ignoreDrawForeground) OS.DrawText (hDC, buffer.ptr, buffer.length, &rect, flags); - OS.DrawText (hDC, buffer.ptr, buffer.length, &rect, flags | OS.DT_CALCRECT); + if (!ignoreDrawForeground) OS.DrawText (hDC, buffer.ptr, buffer.length, rect, flags); + OS.DrawText (hDC, buffer.ptr, buffer.length, rect, flags | OS.DT_CALCRECT); if (hFont !is cast(HFONT)-1) hFont = cast(HFONT)OS.SelectObject (hDC, hFont); if (clrText !is -1) clrText = OS.SetTextColor (hDC, clrText); if (clrTextBk !is -1) clrTextBk = OS.SetBkColor (hDC, clrTextBk); @@ -843,7 +840,7 @@ } if (selectionForeground !is -1) clrText = selectionForeground; if (hooks (DWT.PaintItem)) { - RECT itemRect = item.getBounds (index, true, true, false, false, false, hDC); + RECT* itemRect = item.getBounds (index, true, true, false, false, false, hDC); int nSavedDC = OS.SaveDC (hDC); GCData data = new GCData (); data.device = display; @@ -883,7 +880,7 @@ event.y = itemRect.top; event.width = itemRect.right - itemRect.left; event.height = itemRect.bottom - itemRect.top; - RECT cellRect = item.getBounds (index, true, true, true, true, true, hDC); + RECT* cellRect = item.getBounds (index, true, true, true, true, true, hDC); int cellWidth = cellRect.right - cellRect.left; int cellHeight = cellRect.bottom - cellRect.top; gc.setClipping (cellRect.left, cellRect.top, cellWidth, cellHeight); @@ -930,10 +927,10 @@ OS.DrawFocusRect (hDC, &focusRect); } else { int index = OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0); - RECT focusRect = item.getBounds (index, true, false, false, false, false, hDC); - RECT clipRect = item.getBounds (index, true, false, false, false, true, hDC); + RECT* focusRect = item.getBounds (index, true, false, false, false, false, hDC); + RECT* clipRect = item.getBounds (index, true, false, false, false, true, hDC); OS.IntersectClipRect (hDC, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom); - OS.DrawFocusRect (hDC, &focusRect); + OS.DrawFocusRect (hDC, focusRect); OS.SelectClipRgn (hDC, null); } } @@ -1023,9 +1020,9 @@ if (hooks (DWT.EraseItem)) { RECT rect; OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); - RECT cellRect = item.getBounds (index, true, true, true, true, true, hDC); + RECT* cellRect = item.getBounds (index, true, true, true, true, true, hDC); if (clrSortBk !is -1) { - drawBackground (hDC, &cellRect, clrSortBk); + drawBackground (hDC, cellRect, clrSortBk); } else { if (OS.IsWindowEnabled (handle) || findImageControl () !is null) { drawBackground (hDC, &rect); @@ -1098,14 +1095,14 @@ if ((style & DWT.FULL_SELECTION) !is 0) { fillBackground (hDC, clrTextBk, &rect); } else { - RECT textRect = item.getBounds (index, true, false, false, false, true, hDC); + RECT* textRect = item.getBounds (index, true, false, false, false, true, hDC); if (measureEvent !is null) { textRect.right = Math.min (cellRect.right, measureEvent.x + measureEvent.width); } - fillBackground (hDC, clrTextBk, &textRect); + fillBackground (hDC, clrTextBk, textRect); } } else { - fillBackground (hDC, clrTextBk, &cellRect); + fillBackground (hDC, clrTextBk, cellRect); } } } @@ -1116,8 +1113,8 @@ } if (explorerTheme) { if ((style & DWT.FULL_SELECTION) is 0) { - RECT pRect = item.getBounds (index, true, true, false, false, false, hDC); - RECT pClipRect = item.getBounds (index, true, true, true, false, true, hDC); + RECT* pRect = item.getBounds (index, true, true, false, false, false, hDC); + RECT* pClipRect = item.getBounds (index, true, true, true, false, true, hDC); if (measureEvent !is null) { pRect.right = Math.min (pClipRect.right, measureEvent.x + measureEvent.width); } else { @@ -1129,7 +1126,7 @@ auto hTheme = OS.OpenThemeData (handle, Display.TREEVIEW.ptr); int iStateId = selected ? OS.TREIS_SELECTED : OS.TREIS_HOT; if (OS.GetFocus () !is handle && selected && !hot) iStateId = OS.TREIS_SELECTEDNOTFOCUS; - OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, &pRect, &pClipRect); + OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, pRect, pClipRect); OS.CloseThemeData (hTheme); } } else { @@ -1144,14 +1141,14 @@ if ((style & DWT.FULL_SELECTION) !is 0 && columnCount is 0) { fillBackground (hDC, OS.GetBkColor (hDC), &rect); } else { - fillBackground (hDC, OS.GetBkColor (hDC), &cellRect); + fillBackground (hDC, OS.GetBkColor (hDC), cellRect); } } else { - RECT textRect = item.getBounds (index, true, false, false, false, true, hDC); + RECT* textRect = item.getBounds (index, true, false, false, false, true, hDC); if (measureEvent !is null) { textRect.right = Math.min (cellRect.right, measureEvent.x + measureEvent.width); } - fillBackground (hDC, OS.GetBkColor (hDC), &textRect); + fillBackground (hDC, OS.GetBkColor (hDC), textRect); } } } else { @@ -1178,20 +1175,19 @@ } } if (focused && !ignoreDrawFocus && (style & DWT.FULL_SELECTION) is 0) { - RECT textRect = item.getBounds (index, true, explorerTheme, false, false, true, hDC); + RECT* textRect = item.getBounds (index, true, explorerTheme, false, false, true, hDC); if (measureEvent !is null) { textRect.right = Math.min (cellRect.right, measureEvent.x + measureEvent.width); } nmcd.nmcd.uItemState &= ~OS.CDIS_FOCUS; OS.MoveMemory (lParam, nmcd, NMTVCUSTOMDRAW.sizeof); - if( focusRect is null ) focusRect = new RECT; - *focusRect = textRect; + focusRect = textRect; } if (explorerTheme) { if (selected || (hot && ignoreDrawHot)) nmcd.nmcd.uItemState &= ~OS.CDIS_HOT; OS.MoveMemory (cast(void*)lParam, nmcd, NMTVCUSTOMDRAW.sizeof); } - RECT itemRect = item.getBounds (index, true, true, false, false, false, hDC); + RECT* itemRect = item.getBounds (index, true, true, false, false, false, hDC); OS.SaveDC (hDC); OS.SelectClipRgn (hDC, null); if (explorerTheme) { @@ -1322,8 +1318,8 @@ } fillBackground (hDC, clrTextBk, &rect); } else { - RECT textRect = item.getBounds (index, true, false, true, false, true, hDC); - fillBackground (hDC, clrTextBk, &textRect); + RECT* textRect = item.getBounds (index, true, false, true, false, true, hDC); + fillBackground (hDC, clrTextBk, textRect); } } } @@ -2658,7 +2654,7 @@ updateScrollBar (); } -void destroyScrollBar (int type) { +override void destroyScrollBar (int type) { super.destroyScrollBar (type); int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); if ((style & (DWT.H_SCROLL | DWT.V_SCROLL)) is 0) { @@ -2721,7 +2717,7 @@ updateFullSelection (); } -bool findCell (int x, int y, inout TreeItem item, inout int index, inout RECT cellRect, inout RECT itemRect) { +bool findCell (int x, int y, inout TreeItem item, inout int index, inout RECT* cellRect, inout RECT* itemRect) { bool found = false; TVHITTESTINFO lpht; lpht.pt.x = x; @@ -2756,11 +2752,11 @@ quit = true; } else { cellRect.right = Math.min (cellRect.right, rect.right); - if (OS.PtInRect ( &cellRect, pt)) { + if (OS.PtInRect ( cellRect, pt)) { if (isCustomToolTip ()) { Event event = sendMeasureItemEvent (item, order [index], hDC); if (isDisposed () || item.isDisposed ()) break; - //itemRect [0] = new RECT (); + itemRect = new RECT (); itemRect.left = event.x; itemRect.right = event.x + event.width; itemRect.top = event.y; @@ -4376,7 +4372,7 @@ } Event sendMeasureItemEvent (TreeItem item, int index, HDC hDC) { - RECT itemRect = item.getBounds (index, true, true, false, false, false, hDC); + RECT* itemRect = item.getBounds (index, true, true, false, false, false, hDC); int nSavedDC = OS.SaveDC (hDC); GCData data = new GCData (); data.device = display; @@ -5411,7 +5407,7 @@ OS.ScreenToClient (handle, &pt); int index; TreeItem item; - RECT cellRect, itemRect; + RECT* cellRect, itemRect; if (findCell (pt.x, pt.y, item, index, cellRect, itemRect)) { String text = null; if (index is 0) { @@ -6581,7 +6577,7 @@ int y = OS.GET_Y_LPARAM (lParam); int index; TreeItem item; - RECT cellRect, itemRect; + RECT* cellRect, itemRect; if (findCell (x, y, item, index, cellRect, itemRect)) { /* * Feature in Windows. When the new tool rectangle is @@ -7599,9 +7595,9 @@ OS.ScreenToClient (handle, &pt); int index; TreeItem item; - RECT cellRect, itemRect; + RECT* cellRect, itemRect; if (findCell (pt.x, pt.y, item, index, cellRect, itemRect)) { - RECT* toolRect = toolTipRect (&itemRect); + RECT* toolRect = toolTipRect (itemRect); OS.MapWindowPoints (handle, null, cast(POINT*)toolRect, 2); int width = toolRect.right - toolRect.left; int height = toolRect.bottom - toolRect.top; @@ -7642,7 +7638,7 @@ if (OS.SendMessage (itemToolTipHandle, OS.TTM_GETCURRENTTOOL, 0, cast(int)&lpti) !is 0) { int index; TreeItem item; - RECT cellRect, itemRect; + RECT* cellRect, itemRect; int pos = OS.GetMessagePos (); POINT pt; OS.POINTSTOPOINT (pt, pos); @@ -7656,7 +7652,7 @@ bool drawForeground = true; cellRect = item.getBounds (index, true, true, false, false, false, hDC); if (hooks (DWT.EraseItem)) { - Event event = sendEraseItemEvent (item, nmcd, index, &cellRect); + Event event = sendEraseItemEvent (item, nmcd, index, cellRect); if (isDisposed () || item.isDisposed ()) break; if (event.doit) { drawForeground = (event.detail & DWT.FOREGROUND) !is 0; @@ -7667,7 +7663,7 @@ if (drawForeground) { int nSavedDC = OS.SaveDC (nmcd.nmcd.hdc); int gridWidth = getLinesVisible () ? Table.GRID_WIDTH : 0; - RECT* insetRect = toolTipInset (&cellRect); + RECT* insetRect = toolTipInset (cellRect); OS.SetWindowOrgEx (nmcd.nmcd.hdc, insetRect.left, insetRect.top, null); GCData data = new GCData (); data.device = display; @@ -7680,7 +7676,7 @@ Image image = item.getImage (index); if (image !is null || index is 0) { Point size = getImageSize (); - RECT imageRect = item.getBounds (index, false, true, false, false, false, hDC); + RECT* imageRect = item.getBounds (index, false, true, false, false, false, hDC); if (imageList is null) size.x = imageRect.right - imageRect.left; if (image !is null) { Rectangle rect = image.getBounds (); @@ -7709,7 +7705,7 @@ } if (hooks (DWT.PaintItem)) { itemRect = item.getBounds (index, true, true, false, false, false, hDC); - sendPaintItemEvent (item, nmcd, index, &itemRect); + sendPaintItemEvent (item, nmcd, index, itemRect); } OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); diff -r 8efa9bb96c53 -r c749c13479ef dwt/widgets/TreeColumn.d --- a/dwt/widgets/TreeColumn.d Sun May 18 19:54:28 2008 +0200 +++ b/dwt/widgets/TreeColumn.d Sun May 18 19:57:18 2008 +0200 @@ -366,7 +366,7 @@ } else { auto hFont = item.fontHandle (index); if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont); - RECT itemRect = item.getBounds (index, true, true, false, false, false, hDC); + RECT* itemRect = item.getBounds (index, true, true, false, false, false, hDC); if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont); itemRight = itemRect.right; } @@ -659,7 +659,7 @@ override public void setText (String string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); - if (string==/*eq*/text) return; + if (string.equals (text)) return; int index = parent.indexOf (this); if (index is -1) return; super.setText (string); diff -r 8efa9bb96c53 -r c749c13479ef dwt/widgets/TreeItem.d --- a/dwt/widgets/TreeItem.d Sun May 18 19:54:28 2008 +0200 +++ b/dwt/widgets/TreeItem.d Sun May 18 19:57:18 2008 +0200 @@ -402,7 +402,7 @@ public Rectangle getBounds () { checkWidget (); if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); - RECT rect = getBounds (0, true, false, false); + RECT* rect = getBounds (0, true, false, false); int width = rect.right - rect.left, height = rect.bottom - rect.top; return new Rectangle (rect.left, rect.top, width, height); } @@ -424,18 +424,18 @@ public Rectangle getBounds (int index) { checkWidget(); if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); - RECT rect = getBounds (index, true, true, true); + RECT* rect = getBounds (index, true, true, true); int width = rect.right - rect.left, height = rect.bottom - rect.top; return new Rectangle (rect.left, rect.top, width, height); } -RECT getBounds (int index, bool getText, bool getImage, bool fullText) { +RECT* getBounds (int index, bool getText, bool getImage, bool fullText) { return getBounds (index, getText, getImage, fullText, false, true, null); } //TODO - take into account grid (add bool arg) to damage less during redraw -RECT getBounds (int index, bool getText, bool getImage, bool fullText, bool fullImage, bool clip, HDC hDC) { - if (!getText && !getImage) return RECT.init; +RECT* getBounds (int index, bool getText, bool getImage, bool fullText, bool fullImage, bool clip, HDC hDC) { + if (!getText && !getImage) return new RECT(); auto hwnd = parent.handle; if ((parent.style & DWT.VIRTUAL) is 0 && !cached && !parent.painted) { TVITEM tvItem; @@ -453,11 +453,11 @@ columnCount = parent.columnCount; firstColumn = index is OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0); } - RECT rect; + RECT* rect = new RECT(); if (firstColumn) { bool full = columnCount is 0 && getText && getImage && fullText && fullImage; - if (!OS.TreeView_GetItemRect (hwnd, handle, &rect, !full)) { - return RECT.init; + if (!OS.TreeView_GetItemRect (hwnd, handle, rect, !full)) { + return new RECT(); } if (getImage && !fullImage) { if (OS.SendMessage (hwnd, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0) !is 0) { @@ -470,10 +470,10 @@ } if (fullText || fullImage || clip) { if (hwndHeader !is null) { - RECT headerRect; + RECT* headerRect = new RECT(); if (columnCount !is 0) { - if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, cast(int) &headerRect) is 0) { - return RECT.init; + if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, cast(int) headerRect) is 0) { + return new RECT(); } } else { headerRect.right = parent.scrollWidth; @@ -487,13 +487,13 @@ } } } else { - if (!(0 <= index && index < columnCount)) return RECT.init; - RECT headerRect; - if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, cast(int) &headerRect) is 0) { - return RECT.init; + if (!(0 <= index && index < columnCount)) return new RECT(); + RECT* headerRect = new RECT(); + if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, cast(int) headerRect) is 0) { + return new RECT(); } - if (!OS.TreeView_GetItemRect (hwnd, handle, &rect, false)) { - return RECT.init; + if (!OS.TreeView_GetItemRect (hwnd, handle, rect, false)) { + return new RECT(); } rect.left = headerRect.left; if (fullText && getImage && clip) { @@ -517,7 +517,7 @@ } else { String string = index is 0 ? text : strings !is null ? strings [index] : null; if (string !is null) { - RECT textRect; + RECT* textRect = new RECT(); TCHAR[] buffer = StrToTCHARs (parent.getCodePage (), string, false); int flags = OS.DT_NOPREFIX | OS.DT_SINGLELINE | OS.DT_CALCRECT; auto hNewDC = hDC; @@ -528,7 +528,7 @@ if (hFont is cast(HFONT)-1) hFont = cast(HFONT) OS.SendMessage (hwnd, OS.WM_GETFONT, 0, 0); hFont = OS.SelectObject (hNewDC, hFont); } - OS.DrawText (hNewDC, buffer.ptr, buffer.length, &textRect, flags); + OS.DrawText (hNewDC, buffer.ptr, buffer.length, textRect, flags); if (hDC is null) { OS.SelectObject (hNewDC, hFont); OS.ReleaseDC (hwnd, hNewDC); @@ -847,7 +847,7 @@ public Rectangle getImageBounds (int index) { checkWidget(); if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); - RECT rect = getBounds (index, false, true, false); + RECT* rect = getBounds (index, false, true, false); int width = rect.right - rect.left, height = rect.bottom - rect.top; return new Rectangle (rect.left, rect.top, width, height); } @@ -937,7 +937,7 @@ public Rectangle getTextBounds (int index) { checkWidget(); if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED); - RECT rect = getBounds (index, true, false, true); + RECT* rect = getBounds (index, true, false, true); if (index is 0) rect.left += Tree.INSET - 1; rect.left = Math.min (rect.left, rect.right); rect.right = rect.right - Tree.INSET; @@ -1004,8 +1004,8 @@ auto hwnd = parent.handle; if (!OS.IsWindowVisible (hwnd)) return; bool fullImage = column is 0 && drawText && drawImage; - RECT rect = getBounds (column, drawText, drawImage, true, fullImage, true, null); - OS.InvalidateRect (hwnd, &rect, true); + RECT* rect = getBounds (column, drawText, drawImage, true, fullImage, true, null); + OS.InvalidateRect (hwnd, rect, true); } override void releaseChildren (bool destroy) {