summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Heidrich <fheidric>2008-04-24 18:47:59 +0000
committerFelipe Heidrich <fheidric>2008-04-24 18:47:59 +0000
commitd142aa518d3409a6b4af53c10adc2f21e42e408b (patch)
tree3ae00604163315d4e19db35b66a99553f4d150f7
parenta5c00d57d0ab6fc680c0f540f16c585d6594ffda (diff)
downloadeclipse.platform.swt-d142aa518d3409a6b4af53c10adc2f21e42e408b.tar.gz
eclipse.platform.swt-d142aa518d3409a6b4af53c10adc2f21e42e408b.tar.xz
eclipse.platform.swt-d142aa518d3409a6b4af53c10adc2f21e42e408b.zip
dragsource natives
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com.c44
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.c52
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.h12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDragSourceHelper.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDragSourceHelper2.java20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/SHDRAGIMAGE.java21
9 files changed, 187 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com.c
index 2b4c5bae08..8684fbfe00 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com.c
@@ -961,6 +961,34 @@ JNIEXPORT jint JNICALL COM_NATIVE(RevokeDragDrop)
}
#endif
+#ifndef NO_SHDRAGIMAGE_1sizeof
+JNIEXPORT jint JNICALL COM_NATIVE(SHDRAGIMAGE_1sizeof)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ COM_NATIVE_ENTER(env, that, SHDRAGIMAGE_1sizeof_FUNC);
+ rc = (jint)SHDRAGIMAGE_sizeof();
+ COM_NATIVE_EXIT(env, that, SHDRAGIMAGE_1sizeof_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_SHDoDragDrop
+JNIEXPORT jint JNICALL COM_NATIVE(SHDoDragDrop)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jintArray arg4)
+{
+ jint *lparg4=NULL;
+ jint rc = 0;
+ COM_NATIVE_ENTER(env, that, SHDoDragDrop_FUNC);
+ if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail;
+ rc = (jint)SHDoDragDrop((HWND)arg0, (IDataObject *)arg1, (IDropSource *)arg2, arg3, lparg4);
+fail:
+ if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
+ COM_NATIVE_EXIT(env, that, SHDoDragDrop_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_STATSTG_1sizeof
JNIEXPORT jint JNICALL COM_NATIVE(STATSTG_1sizeof)
(JNIEnv *env, jclass that)
@@ -1834,6 +1862,22 @@ fail:
}
#endif
+#ifndef NO_VtblCall__IILorg_eclipse_swt_internal_ole_win32_SHDRAGIMAGE_2I
+JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IILorg_eclipse_swt_internal_ole_win32_SHDRAGIMAGE_2I)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2, jint arg3)
+{
+ SHDRAGIMAGE _arg2, *lparg2=NULL;
+ jint rc = 0;
+ COM_NATIVE_ENTER(env, that, VtblCall__IILorg_eclipse_swt_internal_ole_win32_SHDRAGIMAGE_2I_FUNC);
+ if (arg2) if ((lparg2 = getSHDRAGIMAGEFields(env, arg2, &_arg2)) == NULL) goto fail;
+ rc = (jint)((jint (STDMETHODCALLTYPE *)(jint, SHDRAGIMAGE *, jint))(*(jint **)arg1)[arg0])(arg1, lparg2, arg3);
+fail:
+ if (arg2 && lparg2) setSHDRAGIMAGEFields(env, arg2, lparg2);
+ COM_NATIVE_EXIT(env, that, VtblCall__IILorg_eclipse_swt_internal_ole_win32_SHDRAGIMAGE_2I_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_VtblCall__IILorg_eclipse_swt_internal_win32_MSG_2
JNIEXPORT jint JNICALL COM_NATIVE(VtblCall__IILorg_eclipse_swt_internal_win32_MSG_2)
(JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c
index b12cd65f41..8f99fe9528 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int COM_nativeFunctionCount = 155;
-int COM_nativeFunctionCallCount[155];
+int COM_nativeFunctionCount = 158;
+int COM_nativeFunctionCallCount[158];
char * COM_nativeFunctionNames[] = {
"AccessibleObjectFromWindow",
"CAUUID_1sizeof",
@@ -79,6 +79,8 @@ char * COM_nativeFunctionNames[] = {
"RegisterDragDrop",
"ReleaseStgMedium",
"RevokeDragDrop",
+ "SHDRAGIMAGE_1sizeof",
+ "SHDoDragDrop",
"STATSTG_1sizeof",
"STGMEDIUM_1sizeof",
"StgCreateDocfile",
@@ -134,6 +136,7 @@ char * COM_nativeFunctionNames[] = {
"VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2Lorg_eclipse_swt_internal_ole_win32_GUID_2_3I",
"VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2_3I",
"VtblCall__IILorg_eclipse_swt_internal_ole_win32_LICINFO_2",
+ "VtblCall__IILorg_eclipse_swt_internal_ole_win32_SHDRAGIMAGE_2I",
"VtblCall__IILorg_eclipse_swt_internal_win32_MSG_2",
"VtblCall__IILorg_eclipse_swt_internal_win32_POINT_2I",
"VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h
index 4405d5f57d..162a61b73b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h
@@ -87,6 +87,8 @@ typedef enum {
RegisterDragDrop_FUNC,
ReleaseStgMedium_FUNC,
RevokeDragDrop_FUNC,
+ SHDRAGIMAGE_1sizeof_FUNC,
+ SHDoDragDrop_FUNC,
STATSTG_1sizeof_FUNC,
STGMEDIUM_1sizeof_FUNC,
StgCreateDocfile_FUNC,
@@ -142,6 +144,7 @@ typedef enum {
VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2Lorg_eclipse_swt_internal_ole_win32_GUID_2_3I_FUNC,
VtblCall__IILorg_eclipse_swt_internal_ole_win32_GUID_2_3I_FUNC,
VtblCall__IILorg_eclipse_swt_internal_ole_win32_LICINFO_2_FUNC,
+ VtblCall__IILorg_eclipse_swt_internal_ole_win32_SHDRAGIMAGE_2I_FUNC,
VtblCall__IILorg_eclipse_swt_internal_win32_MSG_2_FUNC,
VtblCall__IILorg_eclipse_swt_internal_win32_POINT_2I_FUNC,
VtblCall__IILorg_eclipse_swt_internal_win32_RECT_2_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.c
index 0f8b79cf19..63d396e74c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.c
@@ -595,6 +595,58 @@ void setOLEINPLACEFRAMEINFOFields(JNIEnv *env, jobject lpObject, OLEINPLACEFRAME
}
#endif
+#ifndef NO_SHDRAGIMAGE
+typedef struct SHDRAGIMAGE_FID_CACHE {
+ int cached;
+ jclass clazz;
+ jfieldID sizeDragImage, ptOffset, hbmpDragImage, crColorKey;
+} SHDRAGIMAGE_FID_CACHE;
+
+SHDRAGIMAGE_FID_CACHE SHDRAGIMAGEFc;
+
+void cacheSHDRAGIMAGEFields(JNIEnv *env, jobject lpObject)
+{
+ if (SHDRAGIMAGEFc.cached) return;
+ SHDRAGIMAGEFc.clazz = (*env)->GetObjectClass(env, lpObject);
+ SHDRAGIMAGEFc.sizeDragImage = (*env)->GetFieldID(env, SHDRAGIMAGEFc.clazz, "sizeDragImage", "Lorg/eclipse/swt/internal/win32/SIZE;");
+ SHDRAGIMAGEFc.ptOffset = (*env)->GetFieldID(env, SHDRAGIMAGEFc.clazz, "ptOffset", "Lorg/eclipse/swt/internal/win32/POINT;");
+ SHDRAGIMAGEFc.hbmpDragImage = (*env)->GetFieldID(env, SHDRAGIMAGEFc.clazz, "hbmpDragImage", "I");
+ SHDRAGIMAGEFc.crColorKey = (*env)->GetFieldID(env, SHDRAGIMAGEFc.clazz, "crColorKey", "I");
+ SHDRAGIMAGEFc.cached = 1;
+}
+
+SHDRAGIMAGE *getSHDRAGIMAGEFields(JNIEnv *env, jobject lpObject, SHDRAGIMAGE *lpStruct)
+{
+ if (!SHDRAGIMAGEFc.cached) cacheSHDRAGIMAGEFields(env, lpObject);
+ {
+ jobject lpObject1 = (*env)->GetObjectField(env, lpObject, SHDRAGIMAGEFc.sizeDragImage);
+ if (lpObject1 != NULL) getSIZEFields(env, lpObject1, &lpStruct->sizeDragImage);
+ }
+ {
+ jobject lpObject1 = (*env)->GetObjectField(env, lpObject, SHDRAGIMAGEFc.ptOffset);
+ if (lpObject1 != NULL) getPOINTFields(env, lpObject1, &lpStruct->ptOffset);
+ }
+ lpStruct->hbmpDragImage = (*env)->GetIntField(env, lpObject, SHDRAGIMAGEFc.hbmpDragImage);
+ lpStruct->crColorKey = (*env)->GetIntField(env, lpObject, SHDRAGIMAGEFc.crColorKey);
+ return lpStruct;
+}
+
+void setSHDRAGIMAGEFields(JNIEnv *env, jobject lpObject, SHDRAGIMAGE *lpStruct)
+{
+ if (!SHDRAGIMAGEFc.cached) cacheSHDRAGIMAGEFields(env, lpObject);
+ {
+ jobject lpObject1 = (*env)->GetObjectField(env, lpObject, SHDRAGIMAGEFc.sizeDragImage);
+ if (lpObject1 != NULL) setSIZEFields(env, lpObject1, &lpStruct->sizeDragImage);
+ }
+ {
+ jobject lpObject1 = (*env)->GetObjectField(env, lpObject, SHDRAGIMAGEFc.ptOffset);
+ if (lpObject1 != NULL) setPOINTFields(env, lpObject1, &lpStruct->ptOffset);
+ }
+ (*env)->SetIntField(env, lpObject, SHDRAGIMAGEFc.hbmpDragImage, (jint)lpStruct->hbmpDragImage);
+ (*env)->SetIntField(env, lpObject, SHDRAGIMAGEFc.crColorKey, (jint)lpStruct->crColorKey);
+}
+#endif
+
#ifndef NO_STATSTG
typedef struct STATSTG_FID_CACHE {
int cached;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.h
index 580dde632c..9cce35a02e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_structs.h
@@ -167,6 +167,18 @@ void setOLEINPLACEFRAMEINFOFields(JNIEnv *env, jobject lpObject, OLEINPLACEFRAME
#define OLEINPLACEFRAMEINFO_sizeof() 0
#endif
+#ifndef NO_SHDRAGIMAGE
+void cacheSHDRAGIMAGEFields(JNIEnv *env, jobject lpObject);
+SHDRAGIMAGE *getSHDRAGIMAGEFields(JNIEnv *env, jobject lpObject, SHDRAGIMAGE *lpStruct);
+void setSHDRAGIMAGEFields(JNIEnv *env, jobject lpObject, SHDRAGIMAGE *lpStruct);
+#define SHDRAGIMAGE_sizeof() sizeof(SHDRAGIMAGE)
+#else
+#define cacheSHDRAGIMAGEFields(a,b)
+#define getSHDRAGIMAGEFields(a,b,c) NULL
+#define setSHDRAGIMAGEFields(a,b,c)
+#define SHDRAGIMAGE_sizeof() 0
+#endif
+
#ifndef NO_STATSTG
void cacheSTATSTGFields(JNIEnv *env, jobject lpObject);
STATSTG *getSTATSTGFields(JNIEnv *env, jobject lpObject, STATSTG *lpStruct);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java
index e3a30c95b4..2b917f6874 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java
@@ -17,6 +17,7 @@ public class COM extends OS {
public static final GUID CLSID_DragDropHelper = COM.IIDFromString("{4657278A-411B-11d2-839A-00C04FD918D0}"); //$NON-NLS-1$
public static final GUID IID_IDropTargetHelper = COM.IIDFromString("{4657278B-411B-11d2-839A-00C04FD918D0}"); //$NON-NLS-1$
public static final GUID IID_IDragSourceHelper = COM.IIDFromString("{DE5BF786-477A-11d2-839D-00C04FD918D0}"); //$NON-NLS-1$
+ public static final GUID IID_IDragSourceHelper2 = COM.IIDFromString("{83E07D0D-0C5F-4163-BF1A-60B274051E40}"); //$NON-NLS-1$
public static final GUID IIDJavaBeansBridge = COM.IIDFromString("{8AD9C840-044E-11D1-B3E9-00805F499D93}"); //$NON-NLS-1$
public static final GUID IIDShockwaveActiveXControl = COM.IIDFromString("{166B1BCA-3F9C-11CF-8075-444553540000}"); //$NON-NLS-1$
public static final GUID IIDIEditorSiteTime = IIDFromString("{6BD2AEFE-7876-45e6-A6E7-3BFCDF6540AA}"); //$NON-NLS-1$
@@ -224,6 +225,7 @@ public class COM extends OS {
public static final int DROPEFFECT_MOVE = 2;
public static final int DROPEFFECT_LINK = 4;
public static final int DROPEFFECT_SCROLL = 0x80000000;
+ public static final int DSH_ALLOWDROPDESCRIPTIONTEXT = 0x1;
public static final int DV_E_FORMATETC = -2147221404;
public static final int DV_E_STGMEDIUM = -2147221402;
public static final int DV_E_TYMED = -2147221399;
@@ -452,6 +454,7 @@ public static final native int ProgIDFromCLSID(GUID clsid, int /*long*/[] lplpsz
public static final native int RegisterDragDrop(int /*long*/ hwnd, int /*long*/ pDropTarget);
public static final native void ReleaseStgMedium(int /*long*/ pmedium);
public static final native int RevokeDragDrop(int /*long*/ hwnd);
+public static final native int SHDoDragDrop(int /*long*/ hwnd, int /*long*/ pDataObject, int /*long*/ pDropSource, int dwOKEffect, int[] pdwEffect);
public static final native int StgCreateDocfile(char[] pwcsName, int grfMode, int reserved, int /*long*/[] ppstgOpen);
public static final native int StgIsStorageFile(char[] pwcsName);
public static final native int StgOpenStorage(char[] pwcsName, int /*long*/ pstgPriority, int grfMode, int /*long*/ snbExclude, int reserved, int /*long*/[] ppstgOpen);
@@ -470,6 +473,7 @@ public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, char[
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int /*long*/ arg0, int /*long*/ arg1, POINT arg2, int arg3);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, int /*long*/ arg0, POINT arg1, int arg2);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, POINT arg0, int arg1);
+public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, SHDRAGIMAGE arg0, int /*long*/ arg1);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0, int arg1, int arg2, int arg3, int[] arg4);
public static final native int VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0, int arg1, int arg2, int arg3, long[] arg4);
@@ -691,6 +695,7 @@ public static final native int GUID_sizeof();
public static final native int LICINFO_sizeof();
public static final native int OLECMD_sizeof();
public static final native int OLEINPLACEFRAMEINFO_sizeof();
+public static final native int SHDRAGIMAGE_sizeof();
public static final native int STATSTG_sizeof();
public static final native int STGMEDIUM_sizeof();
public static final native int TYPEATTR_sizeof();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDragSourceHelper.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDragSourceHelper.java
new file mode 100644
index 0000000000..b739306765
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDragSourceHelper.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *******************************************************************************/
+package org.eclipse.swt.internal.ole.win32;
+
+import org.eclipse.swt.internal.win32.*;
+
+public class IDragSourceHelper extends IUnknown {
+public IDragSourceHelper(int /*long*/ address) {
+ super(address);
+}
+public int InitializeFromBitmap(SHDRAGIMAGE pshdi, int /*long*/ pDataObject) {
+ return COM.VtblCall(3, address, pshdi, pDataObject);
+}
+public int InitializeFromWindow(int /*long*/ hwnd, POINT ppt, int /*long*/ pDataObject) {
+ return COM.VtblCall(4, address, hwnd, ppt, pDataObject);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDragSourceHelper2.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDragSourceHelper2.java
new file mode 100644
index 0000000000..5a2f611f2f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IDragSourceHelper2.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *******************************************************************************/
+package org.eclipse.swt.internal.ole.win32;
+
+public class IDragSourceHelper2 extends IDragSourceHelper {
+public IDragSourceHelper2(int /*long*/ address) {
+ super(address);
+}
+public int SetFlags(int dwFlags) {
+ return COM.VtblCall(5, address, dwFlags);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/SHDRAGIMAGE.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/SHDRAGIMAGE.java
new file mode 100644
index 0000000000..ffe4a73fa1
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/SHDRAGIMAGE.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *******************************************************************************/
+package org.eclipse.swt.internal.ole.win32;
+
+import org.eclipse.swt.internal.win32.*;
+
+public final class SHDRAGIMAGE {
+ public SIZE sizeDragImage;
+ public POINT ptOffset;
+ public int /*long*/ hbmpDragImage;
+ public int crColorKey;
+ public static final int sizeof = COM.SHDRAGIMAGE_sizeof ();
+}