Changeset 246:fd9c62a2998e for dwt/dnd/TreeDragSourceEffect.d
- Timestamp:
- 07/01/08 04:15:59 (6 months ago)
- Files:
-
- dwt/dnd/TreeDragSourceEffect.d (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/dnd/TreeDragSourceEffect.d
r213 r246 1 1 /******************************************************************************* 2 * Copyright (c) 2007 IBM Corporation and others.2 * Copyright (c) 2007, 2008 IBM Corporation and others. 3 3 * All rights reserved. This program and the accompanying materials 4 4 * are made available under the terms of the Eclipse Public License v1.0 … … 41 41 * @see DragSourceEffect 42 42 * @see DragSourceEvent 43 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> 43 44 * 44 45 * @since 3.3 … … 93 94 int DI_GETDRAGIMAGE = OS.RegisterWindowMessage ("ShellGetDragImage"w.ptr); //$NON-NLS-1$ 94 95 if (OS.SendMessage (control.handle, DI_GETDRAGIMAGE, 0, &shdi) !is 0) { 95 event.x += shdi.ptOffset.x; 96 if ((control.getStyle() & DWT.MIRRORED) !is 0) { 97 event.x += shdi.sizeDragImage.cx - shdi.ptOffset.x; 98 } else { 99 event.x += shdi.ptOffset.x; 100 } 96 101 event.y += shdi.ptOffset.y; 97 102 auto hImage = shdi.hbmpDragImage; … … 129 134 PaletteData palette = new PaletteData(0xFF00, 0xFF0000, 0xFF000000); 130 135 ImageData data = new ImageData(srcWidth, srcHeight, bm.bmBitsPixel, palette, bm.bmWidthBytes, srcData); 131 data.transparentPixel = shdi.crColorKey << 8; 136 if (shdi.crColorKey is -1) { 137 byte[] alphaData = new byte[srcWidth * srcHeight]; 138 int spinc = dibBM.bmWidthBytes - srcWidth * 4; 139 int ap = 0, sp = 3; 140 for (int y = 0; y < srcHeight; ++y) { 141 for (int x = 0; x < srcWidth; ++x) { 142 alphaData [ap++] = srcData [sp]; 143 sp += 4; 144 } 145 sp += spinc; 146 } 147 data.alphaData = alphaData; 148 } else { 149 data.transparentPixel = shdi.crColorKey << 8; 150 } 132 151 dragSourceImage = new Image (control.getDisplay (), data); 133 152 OS.SelectObject (memHdc, oldMemBitmap); … … 137 156 OS.DeleteDC (srcHdc); 138 157 OS.ReleaseDC (null, hdc); 158 OS.DeleteObject (hImage); 139 159 return dragSourceImage; 140 160 }
