Show
Ignore:
Timestamp:
07/01/08 04:15:59 (5 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Updater SWT 3.4M7 to 3.4

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/dnd/TableDragSourceEffect.d

    r213 r246  
    11/******************************************************************************* 
    2  * Copyright (c) 2007 IBM Corporation and others. 
     2 * Copyright (c) 2007, 2008 IBM Corporation and others. 
    33 * All rights reserved. This program and the accompanying materials 
    44 * are made available under the terms of the Eclipse Public License v1.0 
     
    4242 * @see DragSourceEffect 
    4343 * @see DragSourceEvent 
     44 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> 
    4445 * 
    4546 * @since 3.3 
     
    9495            int DI_GETDRAGIMAGE = OS.RegisterWindowMessage ( "ShellGetDragImage"w.ptr ); //$NON-NLS-1$ 
    9596            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                } 
    97102                event.y += shdi.ptOffset.y; 
    98103                auto hImage = shdi.hbmpDragImage; 
     
    130135                    byte[] srcData = (cast(byte*) dibBM.bmBits)[ 0 .. BITMAPINFOHEADER.sizeof ]; 
    131136 
    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                     } 
    142137                    PaletteData palette = new PaletteData(0xFF00, 0xFF0000, 0xFF000000); 
    143138                    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                    } 
    146154                    dragSourceImage = new Image(control.getDisplay(), data); 
    147155                    OS.SelectObject (memHdc, oldMemBitmap); 
     
    151159                    OS.DeleteDC (srcHdc); 
    152160                    OS.ReleaseDC (null, hdc); 
     161                    OS.DeleteObject (hImage); 
    153162                    return dragSourceImage; 
    154163                }