Mercurial > projects > dwt-win
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/dnd/TransferData.d Wed Feb 13 04:51:22 2008 +0100 @@ -0,0 +1,109 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Port to the D programming language: + * Frank Benoit <benoit@tionex.de> + *******************************************************************************/ +module dwt.dnd.TransferData; + +import dwt.internal.ole.win32.COM; +import dwt.internal.ole.win32.OBJIDL; + +/** + * The <code>TransferData</code> class is a platform specific data structure for + * describing the type and the contents of data being converted by a transfer agent. + * + * <p>As an application writer, you do not need to know the specifics of + * TransferData. TransferData instances are passed to a subclass of Transfer + * and the Transfer object manages the platform specific issues. + * You can ask a Transfer subclass if it can handle this data by calling + * Transfer.isSupportedType(transferData).</p> + * + * <p>You should only need to become familiar with the fields in this class if you + * are implementing a Transfer subclass and you are unable to subclass the + * ByteArrayTransfer class.</p> + */ +public class TransferData { + /** + * The type is a unique identifier of a system format or user defined format. + * (Warning: This field is platform dependent) + * <p> + * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT + * public API. It is marked public only so that it can be shared + * within the packages provided by DWT. It is not available on all + * platforms and should never be accessed from application code. + * </p> + */ + public int type; + + /** + * The formatetc structure is a generalized data transfer format, enhanced to + * encompass a target device, the aspect, or view of the data, and + * a storage medium. + * (Warning: This field is platform dependent) + * <p> + * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT + * public API. It is marked public only so that it can be shared + * within the packages provided by DWT. It is not available on all + * platforms and should never be accessed from application code. + * </p> + */ + public FORMATETC* formatetc; + + /** + * The stgmedium structure is a generalized global memory handle used for + * data transfer operations. + * (Warning: This field is platform dependent) + * <p> + * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT + * public API. It is marked public only so that it can be shared + * within the packages provided by DWT. It is not available on all + * platforms and should never be accessed from application code. + * </p> + */ + public STGMEDIUM* stgmedium; + + /** + * The result field contains the result of converting a + * java data type into a platform specific value. + * (Warning: This field is platform dependent) + * <p> + * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT + * public API. It is marked public only so that it can be shared + * within the packages provided by DWT. It is not available on all + * platforms and should never be accessed from application code. + * </p> + * <p>The value of result is 1 if the conversion was successful. + * The value of result is 0 if the conversion failed.</p> + */ + public int result = COM.E_FAIL; + + /** + * The pIDataObject is the address of an IDataObject OLE Interface which + * provides access to the data associated with the transfer. + * (Warning: This field is platform dependent) + * <p> + * <b>IMPORTANT:</b> This field is <em>not</em> part of the DWT + * public API. It is marked public only so that it can be shared + * within the packages provided by DWT. It is not available on all + * platforms and should never be accessed from application code. + * </p> + */ + public IDataObject pIDataObject; + + static bool sameType(TransferData data1, TransferData data2) { + if (data1 is data2) return true; + if (data1 is null || data2 is null) return false; + return (data1.type is data2.type && + data1.formatetc.cfFormat is data2.formatetc.cfFormat && + data1.formatetc.dwAspect is data2.formatetc.dwAspect && + data1.formatetc.tymed is data2.formatetc.tymed); + } + +}