diff options
author | Steve Northover <steve> | 2006-09-21 21:48:39 +0000 |
---|---|---|
committer | Steve Northover <steve> | 2006-09-21 21:48:39 +0000 |
commit | a3a157d38626fc83de615a8399985303171a20b7 (patch) | |
tree | 3029c794760591262e17e65a18e1dd249f47d0ed | |
parent | c922c7880d59121536798e9c5bbcf53ce8c0e290 (diff) | |
download | eclipse.platform.swt-a3a157d38626fc83de615a8399985303171a20b7.tar.gz eclipse.platform.swt-a3a157d38626fc83de615a8399985303171a20b7.tar.xz eclipse.platform.swt-a3a157d38626fc83de615a8399985303171a20b7.zip |
release natives for 148891
11 files changed, 185 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties index 78ebf24066..b45689e37a 100644 --- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties @@ -3211,6 +3211,20 @@ OS_SHBrowseForFolderW_0=cast=(LPBROWSEINFOW) OS_SHCreateMenuBar= OS_SHCreateMenuBar_0=cast=(PSHMENUBARINFO) +OS_SHGetFileInfoA= +OS_SHGetFileInfoA_0=cast=LPCSTR +OS_SHGetFileInfoA_1= +OS_SHGetFileInfoA_2=cast=(SHFILEINFOA *) +OS_SHGetFileInfoA_3= +OS_SHGetFileInfoA_4= + +OS_SHGetFileInfoW= +OS_SHGetFileInfoW_0=cast=LPCWSTR +OS_SHGetFileInfoW_1= +OS_SHGetFileInfoW_2=cast=(SHFILEINFOW *) +OS_SHGetFileInfoW_3= +OS_SHGetFileInfoW_4= + OS_SHGetMalloc= OS_SHGetMalloc_0=cast=(LPMALLOC *) @@ -4419,6 +4433,15 @@ SHELLEXECUTEINFO_dwHotKey= SHELLEXECUTEINFO_hIcon=cast=(HANDLE) SHELLEXECUTEINFO_hProcess=cast=(HANDLE) +org_eclipse_swt_internal_win32_SHFILEINFO= +SHFILEINFO_hIcon=cast=HICON +SHFILEINFO_iIcon= +SHFILEINFO_dwAttributes= + +org_eclipse_swt_internal_win32_SHFILEINFOA= + +org_eclipse_swt_internal_win32_SHFILEINFOW= + org_eclipse_swt_internal_win32_SHMENUBARINFO= SHMENUBARINFO_cbSize= SHMENUBARINFO_hwndParent=cast=(HWND) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c index c44f7603b4..1933a5ce3c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c @@ -8741,6 +8741,44 @@ fail: } #endif +#ifndef NO_SHGetFileInfoA +JNIEXPORT jint JNICALL OS_NATIVE(SHGetFileInfoA) + (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1, jobject arg2, jint arg3, jint arg4) +{ + jbyte *lparg0=NULL; + SHFILEINFO _arg2, *lparg2=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, SHGetFileInfoA_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = getSHFILEINFOFields(env, arg2, &_arg2)) == NULL) goto fail; + rc = (jint)SHGetFileInfoA((LPCSTR)lparg0, arg1, (SHFILEINFOA *)lparg2, arg3, arg4); +fail: + if (arg2 && lparg2) setSHFILEINFOFields(env, arg2, lparg2); + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, SHGetFileInfoA_FUNC); + return rc; +} +#endif + +#ifndef NO_SHGetFileInfoW +JNIEXPORT jint JNICALL OS_NATIVE(SHGetFileInfoW) + (JNIEnv *env, jclass that, jcharArray arg0, jint arg1, jobject arg2, jint arg3, jint arg4) +{ + jchar *lparg0=NULL; + SHFILEINFO _arg2, *lparg2=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, SHGetFileInfoW_FUNC); + if (arg0) if ((lparg0 = (*env)->GetCharArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = getSHFILEINFOFields(env, arg2, &_arg2)) == NULL) goto fail; + rc = (jint)SHGetFileInfoW((LPCWSTR)lparg0, arg1, (SHFILEINFOW *)lparg2, arg3, arg4); +fail: + if (arg2 && lparg2) setSHFILEINFOFields(env, arg2, lparg2); + if (arg0 && lparg0) (*env)->ReleaseCharArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, SHGetFileInfoW_FUNC); + return rc; +} +#endif + #ifndef NO_SHGetMalloc JNIEXPORT jint JNICALL OS_NATIVE(SHGetMalloc) (JNIEnv *env, jclass that, jintArray arg0) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h index 15df48229d..cdc466c5af 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h @@ -353,6 +353,7 @@ #define NO_Shell_1NotifyIconA #define NO_SHBrowseForFolderA #define NO_SHBrowseForFolderW +#define NO_SHGetFileInfoA #define NO_SHGetPathFromIDListA #define NO_SHGetPathFromIDListW #define NO_SendMessageA__IIILorg_eclipse_swt_internal_win32_BUTTON_1IMAGELIST_2 @@ -456,6 +457,7 @@ #define NOTIFYICONDATAW NOTIFYICONDATA #define Shell_NotifyIconW Shell_NotifyIcon #define ShellExecuteExW ShellExecuteEx +#define SHGetFileInfoW SHGetFileInfo #define LPSHELLEXECUTEINFOW LPSHELLEXECUTEINFO #endif /* _WIN32_WCE */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c index b7eeb8b313..5ed1653991 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 706; -int OS_nativeFunctionCallCount[706]; +int OS_nativeFunctionCount = 708; +int OS_nativeFunctionCallCount[708]; char * OS_nativeFunctionNames[] = { "AbortDoc", "ActivateActCtx", @@ -539,6 +539,8 @@ char * OS_nativeFunctionNames[] = { "SHBrowseForFolderA", "SHBrowseForFolderW", "SHCreateMenuBar", + "SHGetFileInfoA", + "SHGetFileInfoW", "SHGetMalloc", "SHGetPathFromIDListA", "SHGetPathFromIDListW", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h index 1c1bd13a6d..0b105c9dff 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h @@ -543,6 +543,8 @@ typedef enum { SHBrowseForFolderA_FUNC, SHBrowseForFolderW_FUNC, SHCreateMenuBar_FUNC, + SHGetFileInfoA_FUNC, + SHGetFileInfoW_FUNC, SHGetMalloc_FUNC, SHGetPathFromIDListA_FUNC, SHGetPathFromIDListW_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c index 312218d287..f87d3ad2e6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c @@ -5194,6 +5194,43 @@ void setSHELLEXECUTEINFOFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFO * } #endif +#ifndef NO_SHFILEINFO +typedef struct SHFILEINFO_FID_CACHE { + int cached; + jclass clazz; + jfieldID hIcon, iIcon, dwAttributes; +} SHFILEINFO_FID_CACHE; + +SHFILEINFO_FID_CACHE SHFILEINFOFc; + +void cacheSHFILEINFOFields(JNIEnv *env, jobject lpObject) +{ + if (SHFILEINFOFc.cached) return; + SHFILEINFOFc.clazz = (*env)->GetObjectClass(env, lpObject); + SHFILEINFOFc.hIcon = (*env)->GetFieldID(env, SHFILEINFOFc.clazz, "hIcon", "I"); + SHFILEINFOFc.iIcon = (*env)->GetFieldID(env, SHFILEINFOFc.clazz, "iIcon", "I"); + SHFILEINFOFc.dwAttributes = (*env)->GetFieldID(env, SHFILEINFOFc.clazz, "dwAttributes", "I"); + SHFILEINFOFc.cached = 1; +} + +SHFILEINFO *getSHFILEINFOFields(JNIEnv *env, jobject lpObject, SHFILEINFO *lpStruct) +{ + if (!SHFILEINFOFc.cached) cacheSHFILEINFOFields(env, lpObject); + lpStruct->hIcon = (HICON)(*env)->GetIntField(env, lpObject, SHFILEINFOFc.hIcon); + lpStruct->iIcon = (*env)->GetIntField(env, lpObject, SHFILEINFOFc.iIcon); + lpStruct->dwAttributes = (*env)->GetIntField(env, lpObject, SHFILEINFOFc.dwAttributes); + return lpStruct; +} + +void setSHFILEINFOFields(JNIEnv *env, jobject lpObject, SHFILEINFO *lpStruct) +{ + if (!SHFILEINFOFc.cached) cacheSHFILEINFOFields(env, lpObject); + (*env)->SetIntField(env, lpObject, SHFILEINFOFc.hIcon, (jint)lpStruct->hIcon); + (*env)->SetIntField(env, lpObject, SHFILEINFOFc.iIcon, (jint)lpStruct->iIcon); + (*env)->SetIntField(env, lpObject, SHFILEINFOFc.dwAttributes, (jint)lpStruct->dwAttributes); +} +#endif + #ifndef NO_SHMENUBARINFO typedef struct SHMENUBARINFO_FID_CACHE { int cached; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h index 3239abd5e0..be02a51dc5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h @@ -1163,6 +1163,18 @@ void setSHELLEXECUTEINFOFields(JNIEnv *env, jobject lpObject, SHELLEXECUTEINFO * #define SHELLEXECUTEINFO_sizeof() 0 #endif +#ifndef NO_SHFILEINFO +void cacheSHFILEINFOFields(JNIEnv *env, jobject lpObject); +SHFILEINFO *getSHFILEINFOFields(JNIEnv *env, jobject lpObject, SHFILEINFO *lpStruct); +void setSHFILEINFOFields(JNIEnv *env, jobject lpObject, SHFILEINFO *lpStruct); +#define SHFILEINFO_sizeof() sizeof(SHFILEINFO) +#else +#define cacheSHFILEINFOFields(a,b) +#define getSHFILEINFOFields(a,b,c) NULL +#define setSHFILEINFOFields(a,b,c) +#define SHFILEINFO_sizeof() 0 +#endif + #ifndef NO_SHMENUBARINFO void cacheSHMENUBARINFOFields(JNIEnv *env, jobject lpObject); SHMENUBARINFO *getSHMENUBARINFOFields(JNIEnv *env, jobject lpObject, SHMENUBARINFO *lpStruct); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java index 6da849a886..d931ef0e99 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java @@ -577,6 +577,7 @@ public class OS extends Platform { public static final int FALT = 0x10; public static final int FCONTROL = 0x8; public static final int FE_FONTSMOOTHINGCLEARTYPE = 0x0002; + public static final int FILE_ATTRIBUTE_NORMAL = 0x00000080; public static final int FNERR_INVALIDFILENAME = 0x3002; public static final int FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100; public static final int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000; @@ -1254,6 +1255,9 @@ public class OS extends Platform { public static final int SHCMBM_OVERRIDEKEY = 0x400 + 403; public static final int SHCMBM_SETSUBMENU = 0x590; public static final int SHCMBM_GETSUBMENU = 0x591; + public static final int SHGFI_ICON = 0x000000100; + public static final int SHGFI_SMALLICON= 0x1; + public static final int SHGFI_USEFILEATTRIBUTES = 0x000000010; public static final int SHMBOF_NODEFAULT = 0x1; public static final int SHMBOF_NOTIFY = 0x2; public static final int SHRG_RETURNCMD = 0x1; @@ -2715,6 +2719,15 @@ public static final boolean ShellExecuteEx (SHELLEXECUTEINFO lpExecInfo) { return ShellExecuteExA (lpExecInfo); } +public static int SHGetFileInfo (TCHAR pszPath, int dwFileAttributes, SHFILEINFO psfi, int cbFileInfo, int uFlags) { + if (IsUnicode) { + char [] pszPath1 = pszPath == null ? null : pszPath.chars; + return SHGetFileInfoW (pszPath1, dwFileAttributes, (SHFILEINFOW) psfi, cbFileInfo, uFlags); + } + byte [] pszPath1 = pszPath == null ? null : pszPath.bytes; + return SHGetFileInfoA (pszPath1, dwFileAttributes, (SHFILEINFOA) psfi, cbFileInfo, uFlags); +} + public static final boolean Shell_NotifyIcon (int dwMessage, NOTIFYICONDATA lpData) { if (IsUnicode) return Shell_NotifyIconW (dwMessage, (NOTIFYICONDATAW)lpData); return Shell_NotifyIconA (dwMessage, (NOTIFYICONDATAA)lpData); @@ -3422,6 +3435,8 @@ public static final native boolean SetWorldTransform(int hdc, float[] lpXform); public static final native int SHBrowseForFolderW (BROWSEINFO lpbi); public static final native int SHBrowseForFolderA (BROWSEINFO lpbi); public static final native boolean SHCreateMenuBar(SHMENUBARINFO pmb); +public static final native int SHGetFileInfoW (char [] pszPath, int dwFileAttributes, SHFILEINFO psfi, int cbFileInfo, int uFlags); +public static final native int SHGetFileInfoA (byte [] pszPath, int dwFileAttributes, SHFILEINFO psfi, int cbFileInfo, int uFlags); public static final native boolean SHHandleWMSettingChange (int hwnd, int wParam, int lParam, SHACTIVATEINFO psai); public static final native int SHRecognizeGesture(SHRGINFO shrg); public static final native void SHSendBackToFocusWindow (int uMsg, int wp, int lp); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHFILEINFO.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHFILEINFO.java new file mode 100644 index 0000000000..760f727860 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHFILEINFO.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 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.win32; + +public class SHFILEINFO { + public int hIcon; + public int iIcon; + public int dwAttributes; + public static int sizeof = OS.IsUnicode ? 692 : 352; +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHFILEINFOA.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHFILEINFOA.java new file mode 100644 index 0000000000..110e79daee --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHFILEINFOA.java @@ -0,0 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 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.win32; + +public class SHFILEINFOA extends SHFILEINFO { + byte [] szDisplayName = new byte [OS.MAX_PATH]; + byte [] szTypeName = new byte [80]; + public static int sizeof = 352; +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHFILEINFOW.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHFILEINFOW.java new file mode 100644 index 0000000000..20e44c9524 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/SHFILEINFOW.java @@ -0,0 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 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.win32; + +public class SHFILEINFOW extends SHFILEINFO { + char [] szDisplayName = new char [OS.MAX_PATH]; + char [] szTypeName = new char [80]; + public static int sizeof = 692; +} |