Changeset 194:3afcd4ddcf90
- Timestamp:
- 03/19/08 16:48:31
(5 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Update to SWT 3.3.2
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r155 |
r194 |
|
| 1088 | 1088 | break; |
|---|
| 1089 | 1089 | case DWT.Deactivate: |
|---|
| 1090 | | dropDown (false); |
|---|
| | 1090 | /* |
|---|
| | 1091 | * Bug in GTK. When the arrow button is pressed the popup control receives a |
|---|
| | 1092 | * deactivate event and then the arrow button receives a selection event. If |
|---|
| | 1093 | * we hide the popup in the deactivate event, the selection event will show |
|---|
| | 1094 | * it again. To prevent the popup from showing again, we will let the selection |
|---|
| | 1095 | * event of the arrow button hide the popup. |
|---|
| | 1096 | */ |
|---|
| | 1097 | if ("gtk".equals(DWT.getPlatform())) { |
|---|
| | 1098 | Point point = arrow.toControl(getDisplay().getCursorLocation()); |
|---|
| | 1099 | Point size = arrow.getSize(); |
|---|
| | 1100 | Rectangle rect = new Rectangle(0, 0, size.x, size.y); |
|---|
| | 1101 | if (!rect.contains(point)) dropDown (false); |
|---|
| | 1102 | } else { |
|---|
| | 1103 | dropDown(false); |
|---|
| | 1104 | } |
|---|
| 1091 | 1105 | break; |
|---|
| 1092 | 1106 | default: |
|---|
| r136 |
r194 |
|
| 132 | 132 | DragSourceEffect dragEffect; |
|---|
| 133 | 133 | Composite topControl; |
|---|
| | 134 | HWND hwndDrag; |
|---|
| 134 | 135 | |
|---|
| 135 | 136 | // ole interfaces |
|---|
| … | … | |
| 144 | 145 | static const char[] DRAGSOURCEID = "DragSource"; //$NON-NLS-1$ |
|---|
| 145 | 146 | static const int CFSTR_PERFORMEDDROPEFFECT; |
|---|
| | 147 | static final TCHAR[] WindowClass = "#32770\0"; |
|---|
| 146 | 148 | static this(){ |
|---|
| 147 | 149 | CFSTR_PERFORMEDDROPEFFECT = Transfer.registerType("Performed DropEffect"); //$NON-NLS-1$ |
|---|
| … | … | |
| 299 | 301 | int operations = opToOs(getStyle()); |
|---|
| 300 | 302 | Display display = control.getDisplay(); |
|---|
| 301 | | char[] key = "org.eclipse.swt.internal.win32.runMessagesInIdle"; //$NON-NLS-1$ |
|---|
| | 303 | char[] key = "dwt.internal.win32.runMessagesInIdle"; //$NON-NLS-1$ |
|---|
| 302 | 304 | Object oldValue = display.getData(key); |
|---|
| 303 | 305 | display.setData(key, new ValueWrapperBool(true)); |
|---|
| 304 | 306 | ImageList imagelist = null; |
|---|
| 305 | 307 | Image image = event.image; |
|---|
| | 308 | hwndDrag = null; |
|---|
| | 309 | topControl = null; |
|---|
| 306 | 310 | if (image !is null) { |
|---|
| 307 | 311 | imagelist = new ImageList(DWT.NONE); |
|---|
| 308 | 312 | imagelist.add(image); |
|---|
| 309 | 313 | topControl = control.getShell(); |
|---|
| 310 | | OS.ImageList_BeginDrag(imagelist.getHandle(), 0, 0, 0); |
|---|
| 311 | | Point location = topControl.getLocation(); |
|---|
| | 314 | /* |
|---|
| | 315 | * Bug in Windows. The image is inverted if the shell is RIGHT_TO_LEFT. |
|---|
| | 316 | * The fix is to create a transparent window that covers the shell client |
|---|
| | 317 | * area and use it during the drag to prevent the image from being inverted. |
|---|
| | 318 | * On XP if the shell is RTL, the image is not displayed. |
|---|
| | 319 | */ |
|---|
| | 320 | int offset = 0; |
|---|
| | 321 | hwndDrag = topControl.handle; |
|---|
| | 322 | if ((topControl.getStyle() & DWT.RIGHT_TO_LEFT) !is 0) { |
|---|
| | 323 | offset = image.getBounds().width; |
|---|
| | 324 | RECT rect; |
|---|
| | 325 | OS.GetClientRect (topControl.handle, &rect); |
|---|
| | 326 | hwndDrag = OS.CreateWindowEx ( |
|---|
| | 327 | OS.WS_EX_TRANSPARENT | OS.WS_EX_NOINHERITLAYOUT, |
|---|
| | 328 | WindowClass.ptr, |
|---|
| | 329 | null, |
|---|
| | 330 | OS.WS_CHILD | OS.WS_CLIPSIBLINGS, |
|---|
| | 331 | 0, 0, |
|---|
| | 332 | rect.right - rect.left, rect.bottom - rect.top, |
|---|
| | 333 | topControl.handle, |
|---|
| | 334 | null, |
|---|
| | 335 | OS.GetModuleHandle (null), |
|---|
| | 336 | null); |
|---|
| | 337 | OS.ShowWindow (hwndDrag, OS.SW_SHOW); |
|---|
| | 338 | } |
|---|
| | 339 | OS.ImageList_BeginDrag(imagelist.getHandle(), 0, offset, 0); |
|---|
| 312 | 340 | /* |
|---|
| 313 | 341 | * Feature in Windows. When ImageList_DragEnter() is called, |
|---|
| … | … | |
| 324 | 352 | OS.RedrawWindow (topControl.handle, null, null, flags); |
|---|
| 325 | 353 | } |
|---|
| 326 | | OS.ImageList_DragEnter(topControl.handle, dragEvent.x - location.x, dragEvent.y - location.y); |
|---|
| 327 | | } |
|---|
| 328 | | int result = COM.DoDragDrop(iDataObject, iDropSource, operations, pdwEffect.ptr); |
|---|
| 329 | | if (imagelist !is null) { |
|---|
| 330 | | OS.ImageList_DragLeave(topControl.handle); |
|---|
| 331 | | OS.ImageList_EndDrag(); |
|---|
| 332 | | imagelist.dispose(); |
|---|
| 333 | | topControl = null; |
|---|
| 334 | | } |
|---|
| 335 | | display.setData(key, oldValue); |
|---|
| | 354 | POINT pt; |
|---|
| | 355 | pt.x = dragEvent.x; |
|---|
| | 356 | pt.y = dragEvent.y; |
|---|
| | 357 | OS.MapWindowPoints (control.handle, null, &pt, 1); |
|---|
| | 358 | RECT rect; |
|---|
| | 359 | OS.GetWindowRect (hwndDrag, &rect); |
|---|
| | 360 | OS.ImageList_DragEnter(hwndDrag, pt.x - rect.left, pt.y - rect.top); |
|---|
| | 361 | } |
|---|
| | 362 | int result = COM.DRAGDROP_S_CANCEL; |
|---|
| | 363 | try { |
|---|
| | 364 | result = COM.DoDragDrop(iDataObject, iDropSource, operations, pdwEffect.ptr); |
|---|
| | 365 | } finally { |
|---|
| | 366 | // ensure that we don't leave transparent window around |
|---|
| | 367 | if (hwndDrag !is null) { |
|---|
| | 368 | OS.ImageList_DragLeave(hwndDrag); |
|---|
| | 369 | OS.ImageList_EndDrag(); |
|---|
| | 370 | imagelist.dispose(); |
|---|
| | 371 | if (hwndDrag !is topControl.handle) OS.DestroyWindow(hwndDrag); |
|---|
| | 372 | hwndDrag = null; |
|---|
| | 373 | topControl = null; |
|---|
| | 374 | } |
|---|
| | 375 | display.setData(key, oldValue); |
|---|
| | 376 | } |
|---|
| 336 | 377 | int operation = osToOp(pdwEffect[0]); |
|---|
| 337 | 378 | if (dataEffect is DND.DROP_MOVE) { |
|---|
| … | … | |
| 460 | 501 | |
|---|
| 461 | 502 | package .LRESULT QueryContinueDrag(int fEscapePressed, DWORD grfKeyState) { |
|---|
| | 503 | if (topControl !is null && topControl.isDisposed()) return COM.DRAGDROP_S_CANCEL; |
|---|
| 462 | 504 | if (fEscapePressed !is 0){ |
|---|
| 463 | | if (topControl !is null) OS.ImageList_DragLeave(topControl.handle); |
|---|
| | 505 | if (hwndDrag !is null) OS.ImageList_DragLeave(hwndDrag); |
|---|
| 464 | 506 | return COM.DRAGDROP_S_CANCEL; |
|---|
| 465 | 507 | } |
|---|
| … | … | |
| 473 | 515 | // if (display.xMouse) mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2; |
|---|
| 474 | 516 | if ((grfKeyState & mask) is 0) { |
|---|
| 475 | | if (topControl !is null) OS.ImageList_DragLeave(topControl.handle); |
|---|
| | 517 | if (hwndDrag !is null) OS.ImageList_DragLeave(hwndDrag); |
|---|
| 476 | 518 | return COM.DRAGDROP_S_DROP; |
|---|
| 477 | 519 | } |
|---|
| 478 | 520 | |
|---|
| 479 | | if (topControl !is null) { |
|---|
| 480 | | Display display = getDisplay(); |
|---|
| 481 | | Point pt = display.getCursorLocation(); |
|---|
| 482 | | Point location = topControl.getLocation(); |
|---|
| 483 | | OS.ImageList_DragMove(pt.x - location.x, pt.y - location.y); |
|---|
| | 521 | if (hwndDrag !is null) { |
|---|
| | 522 | POINT pt; |
|---|
| | 523 | OS.GetCursorPos (&pt); |
|---|
| | 524 | RECT rect; |
|---|
| | 525 | OS.GetWindowRect (hwndDrag, &rect); |
|---|
| | 526 | OS.ImageList_DragMove (pt.x - rect.left, pt.y - rect.top); |
|---|
| 484 | 527 | } |
|---|
| 485 | 528 | return COM.S_OK; |
|---|
| r146 |
r194 |
|
| 100 | 100 | auto hDC = OS.GetDC(null); |
|---|
| 101 | 101 | auto hDC1 = OS.CreateCompatibleDC(hDC); |
|---|
| | 102 | if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) { |
|---|
| | 103 | if ((table.getStyle() & DWT.RIGHT_TO_LEFT) !is 0) { |
|---|
| | 104 | OS.SetLayout(hDC1, OS.LAYOUT_RTL | OS.LAYOUT_BITMAPORIENTATIONPRESERVED); |
|---|
| | 105 | } |
|---|
| | 106 | } |
|---|
| 102 | 107 | auto bitmap = OS.CreateCompatibleBitmap(hDC, bounds.width, bounds.height); |
|---|
| 103 | 108 | auto hOldBitmap = OS.SelectObject(hDC1, bitmap); |
|---|
| r143 |
r194 |
|
| 97 | 97 | bounds = bounds.makeUnion(selection[i].getBounds(0)); |
|---|
| 98 | 98 | } |
|---|
| 99 | | auto hDC = OS.GetDC(null); |
|---|
| | 99 | auto hDC = OS.GetDC(tree.handle); |
|---|
| 100 | 100 | auto hDC1 = OS.CreateCompatibleDC(hDC); |
|---|
| 101 | 101 | auto bitmap = OS.CreateCompatibleBitmap(hDC, bounds.width, bounds.height); |
|---|
| … | … | |
| 115 | 115 | OS.SelectObject(hDC1, hOldBitmap); |
|---|
| 116 | 116 | OS.DeleteDC (hDC1); |
|---|
| 117 | | OS.ReleaseDC (null, hDC); |
|---|
| | 117 | OS.ReleaseDC (tree.handle, hDC); |
|---|
| 118 | 118 | Display display = tree.getDisplay(); |
|---|
| 119 | 119 | dragSourceImage = Image.win32_new(display, DWT.BITMAP, bitmap); |
|---|
| r190 |
r194 |
|
| 11 | 11 | import tango.io.Stdout; |
|---|
| 12 | 12 | import tango.stdc.stringz; |
|---|
| 13 | | import tango.text.Util; |
|---|
| | 13 | static import tango.text.Util; |
|---|
| 14 | 14 | import tango.text.Unicode; |
|---|
| 15 | 15 | import tango.text.convert.Utf; |
|---|
| r117 |
r194 |
|
| 3715 | 3715 | data.state &= ~(NULL_BRUSH | NULL_PEN); |
|---|
| 3716 | 3716 | auto hFont = data.hFont; |
|---|
| 3717 | | if (hFont !is null) { |
|---|
| | 3717 | if (hFont !is null && hFont !is cast(HFONT)-1 ) { |
|---|
| 3718 | 3718 | data.state &= ~FONT; |
|---|
| 3719 | 3719 | } else { |
|---|
| 3720 | | hFont = OS.GetCurrentObject(hDC, OS.OBJ_FONT); |
|---|
| | 3720 | data.hFont = OS.GetCurrentObject(hDC, OS.OBJ_FONT); |
|---|
| 3721 | 3721 | } |
|---|
| 3722 | 3722 | auto hPalette = data.device.hPalette; |
|---|
| r4 |
r194 |
|
| 1 | | /******************************************************************************* |
|---|
| | 1 | /******************************************************************************* |
|---|
| 2 | 2 | * Copyright (c) 2000, 2007 IBM Corporation and others. |
|---|
| 3 | 3 | * All rights reserved. This program and the accompanying materials |
|---|
| … | … | |
| 34 | 34 | * DWT Minor version number (must be in the range 0..999) |
|---|
| 35 | 35 | */ |
|---|
| 36 | | static const int MINOR_VERSION = 346; |
|---|
| | 36 | static const int MINOR_VERSION = 349; |
|---|
| 37 | 37 | |
|---|
| 38 | 38 | /** |
|---|
| r190 |
r194 |
|
| 1041 | 1041 | public static const int LANG_USER_DEFAULT = 1 << 10; |
|---|
| 1042 | 1042 | public static const int LAYOUT_RTL = 0x1; |
|---|
| | 1043 | public static const int LAYOUT_BITMAPORIENTATIONPRESERVED = 0x8; |
|---|
| 1043 | 1044 | public static const int LBN_DBLCLK = 0x2; |
|---|
| 1044 | 1045 | public static const int LBN_SELCHANGE = 0x1; |
|---|
| r117 |
r194 |
|
| 446 | 446 | setSystemMenu (); |
|---|
| 447 | 447 | } |
|---|
| 448 | | /* |
|---|
| 449 | | * Set the default icon for the shell to IDI_APPLICATION. |
|---|
| 450 | | * This is not necessary for native applications but later |
|---|
| 451 | | * versions of Java set the icon in javaw.exe instead of |
|---|
| 452 | | * leaving the default. |
|---|
| 453 | | * |
|---|
| 454 | | * NOTE: The icon is not leaked. It is shared within |
|---|
| 455 | | * the process by all threads and is released when the |
|---|
| 456 | | * process exits. |
|---|
| 457 | | */ |
|---|
| 458 | | if ((state & FOREIGN_HANDLE) is 0) { |
|---|
| 459 | | static if (!OS.IsWinCE) { |
|---|
| 460 | | auto hIcon = OS.LoadIcon (null, cast(wchar*)OS.IDI_APPLICATION); |
|---|
| 461 | | OS.SendMessage (handle, OS.WM_SETICON, OS.ICON_SMALL, hIcon); |
|---|
| 462 | | } |
|---|
| 463 | | } |
|---|
| 464 | 448 | } |
|---|
| 465 | 449 | |
|---|
| … | … | |
| 1029 | 1013 | default: |
|---|
| 1030 | 1014 | } |
|---|
| 1031 | | } else { |
|---|
| 1032 | | /* |
|---|
| 1033 | | * Set the default icon for the shell to IDI_APPLICATION. |
|---|
| 1034 | | * This is not necessary for native applications but later |
|---|
| 1035 | | * versions of Java set the icon in javaw.exe instead of |
|---|
| 1036 | | * leaving the default. |
|---|
| 1037 | | * |
|---|
| 1038 | | * NOTE: The icon is not leaked. It is shared within |
|---|
| 1039 | | * the process by all threads and is released when the |
|---|
| 1040 | | * process exits. |
|---|
| 1041 | | */ |
|---|
| 1042 | | if ((state & FOREIGN_HANDLE) is 0) { |
|---|
| 1043 | | hSmallIcon = OS.LoadIcon (null, cast(wchar*)OS.IDI_APPLICATION); |
|---|
| 1044 | | } |
|---|
| 1045 | 1015 | } |
|---|
| 1046 | 1016 | OS.SendMessage (handle, OS.WM_SETICON, OS.ICON_SMALL, hSmallIcon); |
|---|
| r57 |
r194 |
|
| 47 | 47 | Thread syncThread; |
|---|
| 48 | 48 | |
|---|
| | 49 | //TEMPORARY CODE |
|---|
| | 50 | static final bool IS_CARBON = false;//"carbon".equals (DWT.getPlatform ()); |
|---|
| | 51 | |
|---|
| 49 | 52 | /** |
|---|
| 50 | 53 | * Constructs a new instance of this class. |
|---|
| … | … | |
| 85 | 88 | public void asyncExec (Runnable runnable) { |
|---|
| 86 | 89 | if (runnable is null) { |
|---|
| 87 | | display.wake (); |
|---|
| 88 | | return; |
|---|
| | 90 | //TEMPORARY CODE |
|---|
| | 91 | if (!IS_CARBON) { |
|---|
| | 92 | display.wake (); |
|---|
| | 93 | return; |
|---|
| | 94 | } |
|---|
| 89 | 95 | } |
|---|
| 90 | 96 | addLast (new RunnableLock (runnable)); |
|---|
| r162 |
r194 |
|
| 562 | 562 | auto hwnd = parent.handle; |
|---|
| 563 | 563 | LVCOLUMN lvColumn; |
|---|
| 564 | | lvColumn.mask = OS.LVCF_FMT | OS.LVCF_IMAGE; |
|---|
| | 564 | lvColumn.mask = OS.LVCF_FMT; |
|---|
| 565 | 565 | OS.SendMessage (hwnd, OS.LVM_GETCOLUMN, index, &lvColumn); |
|---|
| 566 | 566 | lvColumn.fmt &= ~OS.LVCFMT_JUSTIFYMASK; |
|---|