1 /*******************************************************************************
2 * Copyright (c) 2000, 2012 IBM Corporation and others.
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/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.dnd;
16 import org.eclipse.swt.internal.ole.win32.*;
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.
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>
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>
32 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
34 public class TransferData {
36 * The type is a unique identifier of a system format or user defined format.
37 * (Warning: This field is platform dependent)
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.
45 * @noreference This field is not intended to be referenced by clients.
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
53 * (Warning: This field is platform dependent)
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.
61 * @noreference This field is not intended to be referenced by clients.
63 public FORMATETC formatetc;
66 * The stgmedium structure is a generalized global memory handle used for
67 * data transfer operations.
68 * (Warning: This field is platform dependent)
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.
76 * @noreference This field is not intended to be referenced by clients.
78 public STGMEDIUM stgmedium;
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)
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.
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>
93 * @noreference This field is not intended to be referenced by clients.
95 public int result = COM.E_FAIL;
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)
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.
108 * @noreference This field is not intended to be referenced by clients.
110 public long pIDataObject;
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);