Show
Ignore:
Timestamp:
07/01/08 04:15:59 (6 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/TreeDragSourceEffect.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 
     
    4141 * @see DragSourceEffect 
    4242 * @see DragSourceEvent 
     43 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> 
    4344 * 
    4445 * @since 3.3 
     
    9394            int DI_GETDRAGIMAGE = OS.RegisterWindowMessage ("ShellGetDragImage"w.ptr); //$NON-NLS-1$ 
    9495            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                } 
    96101                event.y += shdi.ptOffset.y; 
    97102                auto hImage = shdi.hbmpDragImage; 
     
    129134                    PaletteData palette = new PaletteData(0xFF00, 0xFF0000, 0xFF000000); 
    130135                    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                    } 
    132151                    dragSourceImage = new Image (control.getDisplay (), data); 
    133152                    OS.SelectObject (memHdc, oldMemBitmap); 
     
    137156                    OS.DeleteDC (srcHdc); 
    138157                    OS.ReleaseDC (null, hdc); 
     158                    OS.DeleteObject (hImage); 
    139159                    return dragSourceImage; 
    140160                }