comparison dwt/dnd/TransferData.d @ 135:242e33c0e383

Added dnd source, ByteArrayTransfer,Clipboard completed
author Frank Benoit <benoit@tionex.de>
date Wed, 13 Feb 2008 04:51:22 +0100
parents
children fd9c62a2998e
comparison
equal deleted inserted replaced
134:fa7d7d66b9ed 135:242e33c0e383
1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module dwt.dnd.TransferData;
14
15 import dwt.internal.ole.win32.COM;
16 import dwt.internal.ole.win32.OBJIDL;
17
18 /**
19 * The <code>TransferData</code> class is a platform specific data structure for
20 * describing the type and the contents of data being converted by a transfer agent.
21 *
22 * <p>As an application writer, you do not need to know the specifics of
23 * TransferData. TransferData instances are passed to a subclass of Transfer
24 * and the Transfer object manages the platform specific issues.
25 * You can ask a Transfer subclass if it can handle this data by calling
26 * Transfer.isSupportedType(transferData).</p>
27 *
28 * <p>You should only need to become familiar with the fields in this class if you
29 * are implementing a Transfer subclass and you are unable to subclass the
30 * ByteArrayTransfer class.</p>
31 */
32 public class TransferData {
33 /**
34 * The type is a unique identifier of a system format or user defined format.
35 * (Warning: This field is platform dependent)
36 * <p>
37 * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT
38 * public API. It is marked public only so that it can be shared
39 * within the packages provided by DWT. It is not available on all
40 * platforms and should never be accessed from application code.
41 * </p>
42 */
43 public int type;
44
45 /**
46 * The formatetc structure is a generalized data transfer format, enhanced to
47 * encompass a target device, the aspect, or view of the data, and
48 * a storage medium.
49 * (Warning: This field is platform dependent)
50 * <p>
51 * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT
52 * public API. It is marked public only so that it can be shared
53 * within the packages provided by DWT. It is not available on all
54 * platforms and should never be accessed from application code.
55 * </p>
56 */
57 public FORMATETC* formatetc;
58
59 /**
60 * The stgmedium structure is a generalized global memory handle used for
61 * data transfer operations.
62 * (Warning: This field is platform dependent)
63 * <p>
64 * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT
65 * public API. It is marked public only so that it can be shared
66 * within the packages provided by DWT. It is not available on all
67 * platforms and should never be accessed from application code.
68 * </p>
69 */
70 public STGMEDIUM* stgmedium;
71
72 /**
73 * The result field contains the result of converting a
74 * java data type into a platform specific value.
75 * (Warning: This field is platform dependent)
76 * <p>
77 * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT
78 * public API. It is marked public only so that it can be shared
79 * within the packages provided by DWT. It is not available on all
80 * platforms and should never be accessed from application code.
81 * </p>
82 * <p>The value of result is 1 if the conversion was successful.
83 * The value of result is 0 if the conversion failed.</p>
84 */
85 public int result = COM.E_FAIL;
86
87 /**
88 * The pIDataObject is the address of an IDataObject OLE Interface which
89 * provides access to the data associated with the transfer.
90 * (Warning: This field is platform dependent)
91 * <p>
92 * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT
93 * public API. It is marked public only so that it can be shared
94 * within the packages provided by DWT. It is not available on all
95 * platforms and should never be accessed from application code.
96 * </p>
97 */
98 public IDataObject pIDataObject;
99
100 static bool sameType(TransferData data1, TransferData data2) {
101 if (data1 is data2) return true;
102 if (data1 is null || data2 is null) return false;
103 return (data1.type is data2.type &&
104 data1.formatetc.cfFormat is data2.formatetc.cfFormat &&
105 data1.formatetc.dwAspect is data2.formatetc.dwAspect &&
106 data1.formatetc.tymed is data2.formatetc.tymed);
107 }
108
109 }