]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/dnd/TransferData.java
80240e23d9a8e8c3b8f85cb56dadbe7bca2df4dc
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / dnd / TransferData.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2012 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.dnd;
15
16 import org.eclipse.swt.internal.ole.win32.*;
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  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
33  */
34 public class TransferData {
35         /**
36          * The type is a unique identifier of a system format or user defined format.
37          * (Warning: This field is platform dependent)
38          * <p>
39          * <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT
40          * public API. It is marked public only so that it can be shared
41          * within the packages provided by SWT. It is not available on all
42          * platforms and should never be accessed from application code.
43          * </p>
44          *
45          * @noreference This field is not intended to be referenced by clients.
46          */
47         public int type;
48
49         /**
50          * The formatetc structure is a generalized data transfer format, enhanced to
51          * encompass a target device, the aspect, or view of the data, and
52          * a storage medium.
53          * (Warning: This field is platform dependent)
54          * <p>
55          * <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT
56          * public API. It is marked public only so that it can be shared
57          * within the packages provided by SWT. It is not available on all
58          * platforms and should never be accessed from application code.
59          * </p>
60          *
61          * @noreference This field is not intended to be referenced by clients.
62          */
63         public FORMATETC formatetc;
64
65         /**
66          * The stgmedium structure is a generalized global memory handle used for
67          * data transfer operations.
68          * (Warning: This field is platform dependent)
69          * <p>
70          * <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT
71          * public API. It is marked public only so that it can be shared
72          * within the packages provided by SWT. It is not available on all
73          * platforms and should never be accessed from application code.
74          * </p>
75          *
76          * @noreference This field is not intended to be referenced by clients.
77          */
78         public STGMEDIUM stgmedium;
79
80         /**
81          * The result field contains the result of converting a
82          * java data type into a platform specific value.
83          * (Warning: This field is platform dependent)
84          * <p>
85          * <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT
86          * public API. It is marked public only so that it can be shared
87          * within the packages provided by SWT. It is not available on all
88          * platforms and should never be accessed from application code.
89          * </p>
90          * <p>The value of result is 1 if the conversion was successful.
91          * The value of result is 0 if the conversion failed.</p>
92          *
93          * @noreference This field is not intended to be referenced by clients.
94          */
95         public int result = COM.E_FAIL;
96
97         /**
98          * The pIDataObject is the address of an IDataObject OLE Interface which
99          * provides access to the data associated with the transfer.
100          * (Warning: This field is platform dependent)
101          * <p>
102          * <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT
103          * public API. It is marked public only so that it can be shared
104          * within the packages provided by SWT. It is not available on all
105          * platforms and should never be accessed from application code.
106          * </p>
107          *
108          * @noreference This field is not intended to be referenced by clients.
109          */
110         public long pIDataObject;
111
112         static boolean sameType(TransferData data1, TransferData data2) {
113                 if (data1 == data2) return true;
114                 if (data1 == null || data2 == null) return false;
115                 return (data1.type == data2.type &&
116                                 data1.formatetc.cfFormat == data2.formatetc.cfFormat &&
117                                 data1.formatetc.dwAspect == data2.formatetc.dwAspect &&
118                                 data1.formatetc.tymed == data2.formatetc.tymed);
119         }
120
121 }