summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java
diff options
context:
space:
mode:
authorVeronika Irvine <veronika>2002-05-07 11:44:14 +0000
committerVeronika Irvine <veronika>2002-05-07 11:44:14 +0000
commitd01864955fb125fc04d2f61d759e3f0094bdb63e (patch)
tree8af2660126520b138b8b22bc14a022b3d16b7c80 /bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java
parent24ab2e2d5942b511aea808aadde3c571e63acdf9 (diff)
downloadeclipse.platform.swt-d01864955fb125fc04d2f61d759e3f0094bdb63e.tar.gz
eclipse.platform.swt-d01864955fb125fc04d2f61d759e3f0094bdb63e.tar.xz
eclipse.platform.swt-d01864955fb125fc04d2f61d759e3f0094bdb63e.zip
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java
new file mode 100644
index 0000000000..958e6e8fe7
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java
@@ -0,0 +1,58 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.Converter;
+import org.eclipse.swt.internal.gtk.OS;
+
+/**
+ * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
+ * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
+ *
+ * <p>You should only need to become familiar with this class if you are implementing
+ * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
+ */
+public abstract class Transfer {
+/**
+ * Returns a list of the data types that can be transferred using this Transfer agent.
+ *
+ * <p>Only the data type fields of the TransferData Object are filled in.</p>
+ *
+ * @return a list of the data types that can be transferred using this Transfer agent
+ */
+abstract public TransferData[] getSupportedTypes();
+/**
+ * Returns true if the transferData data type can be transferred using this Transfer agent.
+ *
+ * @param transferData a platform specific description of a data type; only the data type fields
+ * of the TransferData Object need to be filled in
+ *
+ * @return true if the transferData data type can be transferred using this Transfer agent
+ */
+abstract public boolean isSupportedType(TransferData transferData);
+abstract protected String[] getTypeNames();
+abstract protected int[] getTypeIds();
+abstract protected void javaToNative (Object object, TransferData transferData);
+abstract protected Object nativeToJava(TransferData transferData);
+/**
+ * Registers a name for a data type and returns the associated unique identifier.
+ *
+ * <p>You may register the same type more than once, the same unique identifier will be returned if the
+ * type has been previously registered.</p>
+ *
+ * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
+ * or CF_BITMAP because the pre-defined value will not be returned</p>
+ *
+ * @param formatName the name of a data type
+ *
+ * @return the unique identifier associated with this data type
+ */
+public static int registerType(String formatName){
+ if (formatName == null) return OS.GDK_NONE;
+ byte[] buffer = Converter.wcsToMbcs(null, formatName, true);
+ return OS.gdk_atom_intern(buffer, false);
+}
+} \ No newline at end of file