root/dwt/dnd/TransferData.d

Revision 246:fd9c62a2998e, 4.6 kB (checked in by Frank Benoit <benoit@tionex.de>, 5 months ago)

Updater SWT 3.4M7 to 3.4

Line 
1 /*******************************************************************************
2  * Copyright (c) 2000, 2008 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  * @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 DWT
40      * public API. It is marked public only so that it can be shared
41      * within the packages provided by DWT. It is not available on all
42      * platforms and should never be accessed from application code.
43      * </p>
44      */
45     public int type;
46
47     /**
48      * The formatetc structure is a generalized data transfer format, enhanced to
49      * encompass a target device, the aspect, or view of the data, and
50      * a storage medium.
51      * (Warning: This field is platform dependent)
52      * <p>
53      * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT
54      * public API. It is marked public only so that it can be shared
55      * within the packages provided by DWT. It is not available on all
56      * platforms and should never be accessed from application code.
57      * </p>
58      */
59     public FORMATETC* formatetc;
60
61     /**
62      * The stgmedium structure is a generalized global memory handle used for
63      * data transfer operations.
64      * (Warning: This field is platform dependent)
65      * <p>
66      * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT
67      * public API. It is marked public only so that it can be shared
68      * within the packages provided by DWT. It is not available on all
69      * platforms and should never be accessed from application code.
70      * </p>
71      */
72     public STGMEDIUM* stgmedium;
73
74     /**
75      * The result field contains the result of converting a
76      * java data type into a platform specific value.
77      * (Warning: This field is platform dependent)
78      * <p>
79      * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT
80      * public API. It is marked public only so that it can be shared
81      * within the packages provided by DWT. It is not available on all
82      * platforms and should never be accessed from application code.
83      * </p>
84      * <p>The value of result is 1 if the conversion was successful.
85      * The value of result is 0 if the conversion failed.</p>
86      */
87     public int result = COM.E_FAIL;
88
89     /**
90      * The pIDataObject is the address of an IDataObject OLE Interface which
91      * provides access to the data associated with the transfer.
92      * (Warning: This field is platform dependent)
93      * <p>
94      * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT
95      * public API. It is marked public only so that it can be shared
96      * within the packages provided by DWT. It is not available on all
97      * platforms and should never be accessed from application code.
98      * </p>
99      */
100     public IDataObject pIDataObject;
101
102     static bool sameType(TransferData data1, TransferData data2) {
103         if (data1 is data2) return true;
104         if (data1 is null || data2 is null) return false;
105         return (data1.type is data2.type &&
106                 data1.formatetc.cfFormat is data2.formatetc.cfFormat &&
107                 data1.formatetc.dwAspect is data2.formatetc.dwAspect &&
108                 data1.formatetc.tymed is data2.formatetc.tymed);
109     }
110
111 }
Note: See TracBrowser for help on using the browser.