Changeset 246:fd9c62a2998e for dwt/dnd/TableDragSourceEffect.d
- Timestamp:
- 07/01/08 04:15:59 (5 months ago)
- Files:
-
- dwt/dnd/TableDragSourceEffect.d (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/dnd/TableDragSourceEffect.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 … … 42 42 * @see DragSourceEffect 43 43 * @see DragSourceEvent 44 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> 44 45 * 45 46 * @since 3.3 … … 94 95 int DI_GETDRAGIMAGE = OS.RegisterWindowMessage ( "ShellGetDragImage"w.ptr ); //$NON-NLS-1$ 95 96 if (OS.SendMessage (control.handle, DI_GETDRAGIMAGE, 0, &shdi) !is 0) { 96 event.x += shdi.ptOffset.x; 97 if ((control.getStyle() & DWT.MIRRORED) !is 0) { 98 event.x += shdi.sizeDragImage.cx - shdi.ptOffset.x; 99 } else { 100 event.x += shdi.ptOffset.x; 101 } 97 102 event.y += shdi.ptOffset.y; 98 103 auto hImage = shdi.hbmpDragImage; … … 130 135 byte[] srcData = (cast(byte*) dibBM.bmBits)[ 0 .. BITMAPINFOHEADER.sizeof ]; 131 136 132 byte[] alphaData = new byte[srcWidth * srcHeight];133 int spinc = dibBM.bmWidthBytes - srcWidth * 4;134 int ap = 0, sp = 3;135 for (int y = 0; y < srcHeight; ++y) {136 for (int x = 0; x < srcWidth; ++x) {137 alphaData [ap++] = srcData [sp];138 sp += 4;139 }140 sp += spinc;141 }142 137 PaletteData palette = new PaletteData(0xFF00, 0xFF0000, 0xFF000000); 143 138 ImageData data = new ImageData(srcWidth, srcHeight, bm.bmBitsPixel, palette, bm.bmWidthBytes, srcData); 144 data.alphaData = alphaData; 145 data.transparentPixel = shdi.crColorKey; 139 if (shdi.crColorKey is -1) { 140 byte[] alphaData = new byte[srcWidth * srcHeight]; 141 int spinc = dibBM.bmWidthBytes - srcWidth * 4; 142 int ap = 0, sp = 3; 143 for (int y = 0; y < srcHeight; ++y) { 144 for (int x = 0; x < srcWidth; ++x) { 145 alphaData [ap++] = srcData [sp]; 146 sp += 4; 147 } 148 sp += spinc; 149 } 150 data.alphaData = alphaData; 151 } else { 152 data.transparentPixel = shdi.crColorKey << 8; 153 } 146 154 dragSourceImage = new Image(control.getDisplay(), data); 147 155 OS.SelectObject (memHdc, oldMemBitmap); … … 151 159 OS.DeleteDC (srcHdc); 152 160 OS.ReleaseDC (null, hdc); 161 OS.DeleteObject (hImage); 153 162 return dragSourceImage; 154 163 }
