changeset 143:45172b7a0ee6

TreeDragSourceEffect
author Frank Benoit <benoit@tionex.de>
date Wed, 13 Feb 2008 16:30:21 +0100
parents c48567faeab1
children 35669d0d0dc5
files dwt/dnd/TreeDragSourceEffect.d dwt/internal/win32/OS.d dwt/internal/win32/WINAPI.d
diffstat 3 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/dnd/TreeDragSourceEffect.d	Wed Feb 13 16:26:35 2008 +0100
+++ b/dwt/dnd/TreeDragSourceEffect.d	Wed Feb 13 16:30:21 2008 +0100
@@ -23,6 +23,8 @@
 import dwt.dnd.DragSourceEffect;
 import dwt.dnd.DragSourceEvent;
 
+import dwt.dwthelper.utils;
+
 /**
  * This class provides default implementations to display a source image
  * when a drag is initiated from a <code>Tree</code>.
@@ -92,27 +94,27 @@
             int count = Math.min(selection.length, 10);
             Rectangle bounds = selection[0].getBounds(0);
             for (int i = 1; i < count; i++) {
-                bounds = bounds.union_(selection[i].getBounds(0));
+                bounds = bounds.makeUnion(selection[i].getBounds(0));
             }
-            int hDC = OS.GetDC(0);
-            int hDC1 = OS.CreateCompatibleDC(hDC);
-            int bitmap = OS.CreateCompatibleBitmap(hDC, bounds.width, bounds.height);
-            int hOldBitmap = OS.SelectObject(hDC1, bitmap);
+            auto hDC = OS.GetDC(null);
+            auto hDC1 = OS.CreateCompatibleDC(hDC);
+            auto bitmap = OS.CreateCompatibleBitmap(hDC, bounds.width, bounds.height);
+            auto hOldBitmap = OS.SelectObject(hDC1, bitmap);
             RECT rect;
             rect.right = bounds.width;
             rect.bottom = bounds.height;
-            int hBrush = OS.GetStockObject(OS.WHITE_BRUSH);
+            auto hBrush = OS.GetStockObject(OS.WHITE_BRUSH);
             OS.FillRect(hDC1, &rect, hBrush);
             for (int i = 0; i < count; i++) {
                 TreeItem selected = selection[i];
                 Rectangle cell = selected.getBounds(0);
-                int imageList = OS.SendMessage(tree.handle, OS.TVM_CREATEDRAGIMAGE, 0, selected.handle);
+                HANDLE imageList = cast(HANDLE) OS.SendMessage(tree.handle, OS.TVM_CREATEDRAGIMAGE, 0, selected.handle);
                 OS.ImageList_Draw(imageList, 0, hDC1, cell.x - bounds.x, cell.y - bounds.y, OS.ILD_SELECTED);
                 OS.ImageList_Destroy(imageList);
             }
             OS.SelectObject(hDC1, hOldBitmap);
             OS.DeleteDC (hDC1);
-            OS.ReleaseDC (0, hDC);
+            OS.ReleaseDC (null, hDC);
             Display display = tree.getDisplay();
             dragSourceImage = Image.win32_new(display, DWT.BITMAP, bitmap);
             return dragSourceImage;
--- a/dwt/internal/win32/OS.d	Wed Feb 13 16:26:35 2008 +0100
+++ b/dwt/internal/win32/OS.d	Wed Feb 13 16:30:21 2008 +0100
@@ -4660,6 +4660,7 @@
 alias WINAPI.ImageList_DragLeave ImageList_DragLeave;
 alias WINAPI.ImageList_DragMove ImageList_DragMove;
 alias WINAPI.ImageList_DragShowNolock ImageList_DragShowNolock;
+alias WINAPI.ImageList_Draw ImageList_Draw;
 alias WINAPI.ImageList_EndDrag ImageList_EndDrag;
 alias WINAPI.ImageList_GetIcon ImageList_GetIcon;
 alias WINAPI.ImageList_GetIconSize ImageList_GetIconSize;
--- a/dwt/internal/win32/WINAPI.d	Wed Feb 13 16:26:35 2008 +0100
+++ b/dwt/internal/win32/WINAPI.d	Wed Feb 13 16:30:21 2008 +0100
@@ -1593,7 +1593,7 @@
 //     COLORREF ImageList_SetBkColor(HIMAGELIST, COLORREF);
 //     COLORREF ImageList_GetBkColor(HIMAGELIST);
 //     WINBOOL ImageList_SetOverlayImage(HIMAGELIST, int, int);
-//     WINBOOL ImageList_Draw(HIMAGELIST, int, HDC, int, int, UINT);
+    WINBOOL ImageList_Draw(HIMAGELIST, int, HDC, int, int, UINT);
 //     WINBOOL ImageList_Replace(HIMAGELIST, int, HBITMAP, HBITMAP);
 //     int ImageList_AddMasked(HIMAGELIST, HBITMAP, COLORREF);
 //     WINBOOL ImageList_DrawEx(HIMAGELIST, int, HDC, int, int, int, int, COLORREF, COLORREF, UINT);