Mercurial > projects > dwt-mac
comparison dwt/graphics/Cursor.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | db5a898b2119 |
children | cfa563df4fdd |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | 10 * |
11 * Port to the D programming language: | 11 * Port to the D programming language: |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <doob@me.com> |
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.graphics.Cursor; | 14 module dwt.graphics.Cursor; |
15 | 15 |
16 | 16 |
17 import dwt.DWT; | 17 import dwt.DWT; |
18 import dwt.DWTError; | 18 import dwt.DWTError; |
19 import dwt.internal.cocoa.NSAutoreleasePool; | |
19 import dwt.internal.cocoa.NSBitmapImageRep; | 20 import dwt.internal.cocoa.NSBitmapImageRep; |
20 import dwt.internal.cocoa.NSCursor; | 21 import dwt.internal.cocoa.NSCursor; |
21 import dwt.internal.cocoa.NSImage; | 22 import dwt.internal.cocoa.NSImage; |
22 import dwt.internal.cocoa.NSPoint; | 23 import dwt.internal.cocoa.NSPoint; |
23 import dwt.internal.cocoa.NSSize; | 24 import dwt.internal.cocoa.NSSize; |
24 import dwt.internal.cocoa.NSString; | 25 import dwt.internal.cocoa.NSString; |
26 import dwt.internal.cocoa.NSThread; | |
25 import dwt.internal.cocoa.OS; | 27 import dwt.internal.cocoa.OS; |
26 | 28 |
27 import tango.text.convert.Format; | 29 import tango.text.convert.Format; |
28 | 30 |
29 import dwt.dwthelper.utils; | 31 import dwt.dwthelper.utils; |
55 * </dd> | 57 * </dd> |
56 * </dl> | 58 * </dl> |
57 * <p> | 59 * <p> |
58 * Note: Only one of the above styles may be specified. | 60 * Note: Only one of the above styles may be specified. |
59 * </p> | 61 * </p> |
62 * | |
63 * @see <a href="http://www.eclipse.org/swt/snippets/#cursor">Cursor snippets</a> | |
64 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
60 */ | 65 */ |
61 | 66 |
62 public final class Cursor : Resource { | 67 public final class Cursor : Resource { |
63 | 68 |
64 alias Resource.init_ init_; | 69 alias Resource.init_ init_; |
70 static final byte[] WAIT_SOURCE = new byte[] { | |
71 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
72 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
73 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
74 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
75 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
76 (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
77 (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
78 (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
79 (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
80 (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
81 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
82 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
83 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
84 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
85 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
86 (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, | |
87 }; | |
65 | 88 |
66 /** | 89 /** |
67 * the handle to the OS cursor resource | 90 * the handle to the OS cursor resource |
68 * (Warning: This field is platform dependent) | 91 * (Warning: This field is platform dependent) |
69 * <p> | 92 * <p> |
123 * @see DWT#CURSOR_NO | 146 * @see DWT#CURSOR_NO |
124 * @see DWT#CURSOR_HAND | 147 * @see DWT#CURSOR_HAND |
125 */ | 148 */ |
126 public this(Device device, int style) { | 149 public this(Device device, int style) { |
127 super(device); | 150 super(device); |
128 switch (style) { | 151 NSAutoreleasePool pool = null; |
129 case DWT.CURSOR_HAND: handle = NSCursor.pointingHandCursor(); break; | 152 if (!NSThread.isMainThread()) pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); |
130 case DWT.CURSOR_ARROW: handle = NSCursor.arrowCursor(); break; | 153 try { |
131 case DWT.CURSOR_WAIT: handle = NSCursor.crosshairCursor(); break; | 154 switch (style) { |
132 case DWT.CURSOR_CROSS: handle = NSCursor.crosshairCursor(); break; | 155 case DWT.CURSOR_HAND: handle = NSCursor.pointingHandCursor(); break; |
133 case DWT.CURSOR_APPSTARTING: handle = NSCursor.arrowCursor(); break; | 156 case DWT.CURSOR_ARROW: handle = NSCursor.arrowCursor(); break; |
134 case DWT.CURSOR_HELP: handle = NSCursor.crosshairCursor(); break; | 157 case DWT.CURSOR_WAIT: break; |
135 case DWT.CURSOR_SIZEALL: handle = NSCursor.crosshairCursor(); break; | 158 case DWT.CURSOR_CROSS: handle = NSCursor.crosshairCursor(); break; |
136 case DWT.CURSOR_SIZENESW: handle = NSCursor.crosshairCursor(); break; | 159 case DWT.CURSOR_APPSTARTING: handle = NSCursor.arrowCursor(); break; |
137 case DWT.CURSOR_SIZENS: handle = NSCursor.resizeUpDownCursor(); break; | 160 case DWT.CURSOR_HELP: handle = NSCursor.crosshairCursor(); break; |
138 case DWT.CURSOR_SIZENWSE: handle = NSCursor.crosshairCursor(); break; | 161 case DWT.CURSOR_SIZEALL: handle = NSCursor.crosshairCursor(); break; |
139 case DWT.CURSOR_SIZEWE: handle = NSCursor.resizeLeftRightCursor(); break; | 162 case DWT.CURSOR_SIZENESW: handle = NSCursor.crosshairCursor(); break; |
140 case DWT.CURSOR_SIZEN: handle = NSCursor.resizeUpCursor(); break; | 163 case DWT.CURSOR_SIZENS: handle = NSCursor.resizeUpDownCursor(); break; |
141 case DWT.CURSOR_SIZES: handle = NSCursor.resizeDownCursor(); break; | 164 case DWT.CURSOR_SIZENWSE: handle = NSCursor.crosshairCursor(); break; |
142 case DWT.CURSOR_SIZEE: handle = NSCursor.resizeRightCursor(); break; | 165 case DWT.CURSOR_SIZEWE: handle = NSCursor.resizeLeftRightCursor(); break; |
143 case DWT.CURSOR_SIZEW: handle = NSCursor.resizeLeftCursor(); break; | 166 case DWT.CURSOR_SIZEN: handle = NSCursor.resizeUpCursor(); break; |
144 case DWT.CURSOR_SIZENE: handle = NSCursor.crosshairCursor(); break; | 167 case DWT.CURSOR_SIZES: handle = NSCursor.resizeDownCursor(); break; |
145 case DWT.CURSOR_SIZESE: handle = NSCursor.crosshairCursor(); break; | 168 case DWT.CURSOR_SIZEE: handle = NSCursor.resizeRightCursor(); break; |
146 case DWT.CURSOR_SIZESW: handle = NSCursor.crosshairCursor(); break; | 169 case DWT.CURSOR_SIZEW: handle = NSCursor.resizeLeftCursor(); break; |
147 case DWT.CURSOR_SIZENW: handle = NSCursor.crosshairCursor(); break; | 170 case DWT.CURSOR_SIZENE: handle = NSCursor.crosshairCursor(); break; |
148 case DWT.CURSOR_UPARROW: handle = NSCursor.crosshairCursor(); break; | 171 case DWT.CURSOR_SIZESE: handle = NSCursor.crosshairCursor(); break; |
149 case DWT.CURSOR_IBEAM: handle = NSCursor.IBeamCursor(); break; | 172 case DWT.CURSOR_SIZESW: handle = NSCursor.crosshairCursor(); break; |
150 case DWT.CURSOR_NO: handle = NSCursor.crosshairCursor(); break; | 173 case DWT.CURSOR_SIZENW: handle = NSCursor.crosshairCursor(); break; |
151 default: | 174 case DWT.CURSOR_UPARROW: handle = NSCursor.crosshairCursor(); break; |
152 DWT.error(DWT.ERROR_INVALID_ARGUMENT); | 175 case DWT.CURSOR_IBEAM: handle = NSCursor.IBeamCursor(); break; |
153 } | 176 case DWT.CURSOR_NO: handle = NSCursor.crosshairCursor(); break; |
154 handle.retain(); | 177 default: |
155 handle.setOnMouseEntered(true); | 178 DWT.error(DWT.ERROR_INVALID_ARGUMENT); |
179 } | |
180 if (handle is null && style is DWT.CURSOR_WAIT) { | |
181 NSImage nsImage = (NSImage)new NSImage().alloc(); | |
182 NSBitmapImageRep nsImageRep = (NSBitmapImageRep)new NSBitmapImageRep().alloc(); | |
183 handle = (NSCursor)new NSCursor().alloc(); | |
184 int width = 16, height = 16; | |
185 NSSize size = new NSSize(); | |
186 size.width = width; | |
187 size.height = height; | |
188 nsImage = nsImage.initWithSize(size); | |
189 nsImageRep = nsImageRep.initWithBitmapDataPlanes(0, width, height, 8, 4, true, false, OS.NSDeviceRGBColorSpace, | |
190 OS.NSAlphaFirstBitmapFormat | OS.NSAlphaNonpremultipliedBitmapFormat, width*4, 32); | |
191 OS.memmove(nsImageRep.bitmapData(), WAIT_SOURCE, WAIT_SOURCE.length); | |
192 nsImage.addRepresentation(nsImageRep); | |
193 NSPoint point = new NSPoint(); | |
194 point.x = 0; | |
195 point.y = 0; | |
196 handle = handle.initWithImage(nsImage, point); | |
197 nsImageRep.release(); | |
198 nsImage.release(); | |
199 } else { | |
200 handle.retain(); | |
201 } | |
202 handle.setOnMouseEntered(true); | |
156 init_(); | 203 init_(); |
204 } finally { | |
205 if (pool !is null) pool.release(); | |
206 } | |
157 } | 207 } |
158 | 208 |
159 /** | 209 /** |
160 * Constructs a new cursor given a device, image and mask | 210 * Constructs a new cursor given a device, image and mask |
161 * data describing the desired cursor appearance, and the x | 211 * data describing the desired cursor appearance, and the x |
228 // REVERSE SCREEN -> SCREEN | 278 // REVERSE SCREEN -> SCREEN |
229 } | 279 } |
230 offset += 4; | 280 offset += 4; |
231 } | 281 } |
232 } | 282 } |
233 createNSCursor(hotspotX, hotspotY, data, source.width, source.height); | 283 NSAutoreleasePool pool = null; |
284 if (!NSThread.isMainThread()) pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); | |
285 try { | |
286 createNSCursor(hotspotX, hotspotY, data, source.width, source.height); | |
234 init_(); | 287 init_(); |
288 } finally { | |
289 if (pool !is null) pool.release(); | |
290 } | |
235 } | 291 } |
236 | 292 |
237 void createNSCursor(int hotspotX, int hotspotY, byte[] buffer, int width, int height) { | 293 void createNSCursor(int hotspotX, int hotspotY, byte[] buffer, int width, int height) { |
238 ubyte** dummy; | 294 ubyte** dummy; |
239 NSImage nsImage = cast(NSImage)(new NSImage()).alloc(); | 295 NSImage nsImage = cast(NSImage)(new NSImage()).alloc(); |
241 handle = cast(NSCursor)(new NSCursor()).alloc(); | 297 handle = cast(NSCursor)(new NSCursor()).alloc(); |
242 NSSize size = NSSize(); | 298 NSSize size = NSSize(); |
243 size.width = width; | 299 size.width = width; |
244 size.height = height; | 300 size.height = height; |
245 nsImage = nsImage.initWithSize(size); | 301 nsImage = nsImage.initWithSize(size); |
246 nsImageRep = nsImageRep.initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_(dummy, cast(NSInteger) width, cast(NSInteger) height, | 302 nsImageRep = nsImageRep.initWithBitmapDataPlanes(0, width, height, |
247 8, 4, true, false, OS.NSDeviceRGBColorSpace, | 303 8, 4, true, false, OS.NSDeviceRGBColorSpace, |
248 NSAlphaFirstBitmapFormat | NSAlphaNonpremultipliedBitmapFormat, cast(NSInteger) (width * 4), 32); | 304 NSAlphaFirstBitmapFormat | NSAlphaNonpremultipliedBitmapFormat, cast(NSInteger) (width * 4), 32); |
249 OS.memmove(cast(void*) nsImageRep.bitmapData(), buffer.ptr, buffer.length); | 305 OS.memmove(cast(void*) nsImageRep.bitmapData(), buffer.ptr, buffer.length); |
250 nsImage.addRepresentation(nsImageRep); | 306 nsImage.addRepresentation(nsImageRep); |
251 NSPoint point = NSPoint(); | 307 NSPoint point = NSPoint(); |
252 point.x = hotspotX; | 308 point.x = hotspotX; |
253 point.y = hotspotY; | 309 point.y = hotspotY; |
254 handle = handle.initWithImage_hotSpot_(nsImage, point); | 310 handle = handle.initWithImage(nsImage, point); |
255 nsImageRep.release(); | 311 nsImageRep.release(); |
256 nsImage.release(); | 312 nsImage.release(); |
257 } | 313 } |
258 | 314 |
259 /** | 315 /** |
338 byte[] alphaData = source.alphaData; | 394 byte[] alphaData = source.alphaData; |
339 for (int i=0; i<data.length; i+=4) { | 395 for (int i=0; i<data.length; i+=4) { |
340 data[i] = alphaData[i/4]; | 396 data[i] = alphaData[i/4]; |
341 } | 397 } |
342 } | 398 } |
343 createNSCursor(hotspotX, hotspotY, data, source.width, source.height); | 399 NSAutoreleasePool pool = null; |
400 if (!NSThread.isMainThread()) pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); | |
401 try { | |
402 createNSCursor(hotspotX, hotspotY, data, source.width, source.height); | |
344 init_(); | 403 init_(); |
404 } finally { | |
405 if (pool !is null) pool.release(); | |
406 } | |
345 } | 407 } |
346 | 408 |
347 void destroy() { | 409 void destroy() { |
348 handle.release(); | 410 handle.release(); |
349 handle = null; | 411 handle = null; |