diff options
author | Felipe Heidrich <Felipe_Heidrich@ca.ibm.com> | 2011-10-11 14:59:19 -0400 |
---|---|---|
committer | Felipe Heidrich <Felipe_Heidrich@ca.ibm.com> | 2011-10-11 14:59:19 -0400 |
commit | dd68464e07d5cea843b48822a51f9e4342c9a154 (patch) | |
tree | 430059911bca7bed7678f09b05a900bdedc2a72f | |
parent | bfde54eafc5754c2f1cba3be1018cbd4ab30e93c (diff) | |
download | eclipse.platform.swt-dd68464e07d5cea843b48822a51f9e4342c9a154.tar.gz eclipse.platform.swt-dd68464e07d5cea843b48822a51f9e4342c9a154.tar.xz eclipse.platform.swt-dd68464e07d5cea843b48822a51f9e4342c9a154.zip |
adding natives for aero work: drawThemeTextEx
9 files changed, 210 insertions, 2 deletions
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 bee066174f..e5fd6e3c23 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 @@ -2044,6 +2044,18 @@ JNIEXPORT jint JNICALL OS_NATIVE(DROPFILES_1sizeof) } #endif +#ifndef NO_DTTOPTS_1sizeof +JNIEXPORT jint JNICALL OS_NATIVE(DTTOPTS_1sizeof) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, DTTOPTS_1sizeof_FUNC); + rc = (jint)DTTOPTS_sizeof(); + OS_NATIVE_EXIT(env, that, DTTOPTS_1sizeof_FUNC); + return rc; +} +#endif + #ifndef NO_DWM_1BLURBEHIND_1sizeof JNIEXPORT jint JNICALL OS_NATIVE(DWM_1BLURBEHIND_1sizeof) (JNIEnv *env, jclass that) @@ -2692,6 +2704,36 @@ fail: } #endif +#ifndef NO_DrawThemeTextEx +JNIEXPORT jint JNICALL OS_NATIVE(DrawThemeTextEx) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jint arg3, jcharArray arg4, jint arg5, jint arg6, jobject arg7, jobject arg8) +{ + jchar *lparg4=NULL; + RECT _arg7, *lparg7=NULL; + DTTOPTS _arg8, *lparg8=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, DrawThemeTextEx_FUNC); + if (arg4) if ((lparg4 = (*env)->GetCharArrayElements(env, arg4, NULL)) == NULL) goto fail; + if (arg7) if ((lparg7 = getRECTFields(env, arg7, &_arg7)) == NULL) goto fail; + if (arg8) if ((lparg8 = getDTTOPTSFields(env, arg8, &_arg8)) == NULL) goto fail; +/* + rc = (jint)DrawThemeTextEx(arg0, arg1, arg2, arg3, lparg4, arg5, arg6, lparg7, lparg8); +*/ + { + OS_LOAD_FUNCTION(fp, DrawThemeTextEx) + if (fp) { + rc = (jint)((jint (CALLING_CONVENTION*)(jintLong, jintLong, jint, jint, jchar *, jint, jint, RECT *, DTTOPTS *))fp)(arg0, arg1, arg2, arg3, lparg4, arg5, arg6, lparg7, lparg8); + } + } +fail: + if (arg8 && lparg8) setDTTOPTSFields(env, arg8, lparg8); + if (arg7 && lparg7) setRECTFields(env, arg7, lparg7); + if (arg4 && lparg4) (*env)->ReleaseCharArrayElements(env, arg4, lparg4, 0); + OS_NATIVE_EXIT(env, that, DrawThemeTextEx_FUNC); + return rc; +} +#endif + #ifndef NO_DuplicateHandle JNIEXPORT jboolean JNICALL OS_NATIVE(DuplicateHandle) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLongArray arg3, jint arg4, jboolean arg5, jint arg6) 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 0f44973263..b7bb630401 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 @@ -712,6 +712,41 @@ typedef struct _DWM_BLURBEHIND { } DWM_BLURBEHIND, *PDWM_BLURBEHIND; #endif +#ifndef DTT_CALLBACK_PROC +typedef +int +(WINAPI *DTT_CALLBACK_PROC) +( + __in HDC hdc, + __inout_ecount(cchText) LPWSTR pszText, + __in int cchText, + __inout LPRECT prc, + __in UINT dwFlags, + __in LPARAM lParam); +#endif + +#ifndef _DTTOPTS +typedef struct _DTTOPTS +{ + DWORD dwSize; + DWORD dwFlags; + COLORREF crText; + COLORREF crBorder; + COLORREF crShadow; + int iTextShadowType; + POINT ptShadowOffset; + int iBorderSize; + int iFontPropId; + int iColorPropId; + int iStateId; + BOOL fApplyOverlay; + int iGlowSize; + DTT_CALLBACK_PROC pfnDrawTextCallback; + LPARAM lParam; +} DTTOPTS, *PDTTOPTS; +#endif + + #if (_WIN32_IE <= 0x0600) typedef struct tagTVITEMCHANGE { NMHDR hdr; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.h index 4f6df827c4..22ce0ec683 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.h @@ -38,6 +38,7 @@ #define DrawThemeIcon_LIB "uxtheme.dll" #define DrawThemeParentBackground_LIB "uxtheme.dll" #define DrawThemeText_LIB "uxtheme.dll" +#define DrawThemeTextEx_LIB "uxtheme.dll" #define DwmEnableBlurBehindWindow_LIB "dwmapi.dll" #define DwmExtendFrameIntoClientArea_LIB "dwmapi.dll" #define DwmIsCompositionEnabled_LIB "dwmapi.dll" 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 012dbc97b2..e0932640d5 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 = 1065; -int OS_nativeFunctionCallCount[1065]; +int OS_nativeFunctionCount = 1067; +int OS_nativeFunctionCallCount[1067]; char * OS_nativeFunctionNames[] = { "ACCEL_1sizeof", "ACTCTX_1sizeof", @@ -166,6 +166,7 @@ char * OS_nativeFunctionNames[] = { "DPtoLP", "DRAWITEMSTRUCT_1sizeof", "DROPFILES_1sizeof", + "DTTOPTS_1sizeof", "DWM_1BLURBEHIND_1sizeof", "DefFrameProcA", "DefFrameProcW", @@ -207,6 +208,7 @@ char * OS_nativeFunctionNames[] = { "DrawThemeIcon", "DrawThemeParentBackground", "DrawThemeText", + "DrawThemeTextEx", "DuplicateHandle", "DwmEnableBlurBehindWindow", "DwmExtendFrameIntoClientArea", 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 704a728436..617be7433d 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 @@ -174,6 +174,7 @@ typedef enum { DPtoLP_FUNC, DRAWITEMSTRUCT_1sizeof_FUNC, DROPFILES_1sizeof_FUNC, + DTTOPTS_1sizeof_FUNC, DWM_1BLURBEHIND_1sizeof_FUNC, DefFrameProcA_FUNC, DefFrameProcW_FUNC, @@ -215,6 +216,7 @@ typedef enum { DrawThemeIcon_FUNC, DrawThemeParentBackground_FUNC, DrawThemeText_FUNC, + DrawThemeTextEx_FUNC, DuplicateHandle_FUNC, DwmEnableBlurBehindWindow_FUNC, DwmExtendFrameIntoClientArea_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 3e2d07c17b..d97d093d86 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 @@ -1807,6 +1807,85 @@ void setDROPFILESFields(JNIEnv *env, jobject lpObject, DROPFILES *lpStruct) } #endif +#ifndef NO_DTTOPTS +typedef struct DTTOPTS_FID_CACHE { + int cached; + jclass clazz; + jfieldID dwSize, dwFlags, crText, crBorder, crShadow, iTextShadowType, ptShadowOffset, iBorderSize, iFontPropId, iColorPropId, iStateId, fApplyOverlay, iGlowSize, pfnDrawTextCallback, lParam; +} DTTOPTS_FID_CACHE; + +DTTOPTS_FID_CACHE DTTOPTSFc; + +void cacheDTTOPTSFields(JNIEnv *env, jobject lpObject) +{ + if (DTTOPTSFc.cached) return; + DTTOPTSFc.clazz = (*env)->GetObjectClass(env, lpObject); + DTTOPTSFc.dwSize = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "dwSize", "I"); + DTTOPTSFc.dwFlags = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "dwFlags", "I"); + DTTOPTSFc.crText = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "crText", I_J); + DTTOPTSFc.crBorder = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "crBorder", I_J); + DTTOPTSFc.crShadow = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "crShadow", I_J); + DTTOPTSFc.iTextShadowType = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "iTextShadowType", "I"); + DTTOPTSFc.ptShadowOffset = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "ptShadowOffset", "Lorg/eclipse/swt/internal/win32/POINT;"); + DTTOPTSFc.iBorderSize = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "iBorderSize", "I"); + DTTOPTSFc.iFontPropId = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "iFontPropId", "I"); + DTTOPTSFc.iColorPropId = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "iColorPropId", "I"); + DTTOPTSFc.iStateId = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "iStateId", "I"); + DTTOPTSFc.fApplyOverlay = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "fApplyOverlay", "Z"); + DTTOPTSFc.iGlowSize = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "iGlowSize", "I"); + DTTOPTSFc.pfnDrawTextCallback = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "pfnDrawTextCallback", I_J); + DTTOPTSFc.lParam = (*env)->GetFieldID(env, DTTOPTSFc.clazz, "lParam", I_J); + DTTOPTSFc.cached = 1; +} + +DTTOPTS *getDTTOPTSFields(JNIEnv *env, jobject lpObject, DTTOPTS *lpStruct) +{ + if (!DTTOPTSFc.cached) cacheDTTOPTSFields(env, lpObject); + lpStruct->dwSize = (*env)->GetIntField(env, lpObject, DTTOPTSFc.dwSize); + lpStruct->dwFlags = (*env)->GetIntField(env, lpObject, DTTOPTSFc.dwFlags); + lpStruct->crText = (*env)->GetIntLongField(env, lpObject, DTTOPTSFc.crText); + lpStruct->crBorder = (*env)->GetIntLongField(env, lpObject, DTTOPTSFc.crBorder); + lpStruct->crShadow = (*env)->GetIntLongField(env, lpObject, DTTOPTSFc.crShadow); + lpStruct->iTextShadowType = (*env)->GetIntField(env, lpObject, DTTOPTSFc.iTextShadowType); + { + jobject lpObject1 = (*env)->GetObjectField(env, lpObject, DTTOPTSFc.ptShadowOffset); + if (lpObject1 != NULL) getPOINTFields(env, lpObject1, &lpStruct->ptShadowOffset); + } + lpStruct->iBorderSize = (*env)->GetIntField(env, lpObject, DTTOPTSFc.iBorderSize); + lpStruct->iFontPropId = (*env)->GetIntField(env, lpObject, DTTOPTSFc.iFontPropId); + lpStruct->iColorPropId = (*env)->GetIntField(env, lpObject, DTTOPTSFc.iColorPropId); + lpStruct->iStateId = (*env)->GetIntField(env, lpObject, DTTOPTSFc.iStateId); + lpStruct->fApplyOverlay = (*env)->GetBooleanField(env, lpObject, DTTOPTSFc.fApplyOverlay); + lpStruct->iGlowSize = (*env)->GetIntField(env, lpObject, DTTOPTSFc.iGlowSize); + lpStruct->pfnDrawTextCallback = (DTT_CALLBACK_PROC)(*env)->GetIntLongField(env, lpObject, DTTOPTSFc.pfnDrawTextCallback); + lpStruct->lParam = (*env)->GetIntLongField(env, lpObject, DTTOPTSFc.lParam); + return lpStruct; +} + +void setDTTOPTSFields(JNIEnv *env, jobject lpObject, DTTOPTS *lpStruct) +{ + if (!DTTOPTSFc.cached) cacheDTTOPTSFields(env, lpObject); + (*env)->SetIntField(env, lpObject, DTTOPTSFc.dwSize, (jint)lpStruct->dwSize); + (*env)->SetIntField(env, lpObject, DTTOPTSFc.dwFlags, (jint)lpStruct->dwFlags); + (*env)->SetIntLongField(env, lpObject, DTTOPTSFc.crText, (jintLong)lpStruct->crText); + (*env)->SetIntLongField(env, lpObject, DTTOPTSFc.crBorder, (jintLong)lpStruct->crBorder); + (*env)->SetIntLongField(env, lpObject, DTTOPTSFc.crShadow, (jintLong)lpStruct->crShadow); + (*env)->SetIntField(env, lpObject, DTTOPTSFc.iTextShadowType, (jint)lpStruct->iTextShadowType); + { + jobject lpObject1 = (*env)->GetObjectField(env, lpObject, DTTOPTSFc.ptShadowOffset); + if (lpObject1 != NULL) setPOINTFields(env, lpObject1, &lpStruct->ptShadowOffset); + } + (*env)->SetIntField(env, lpObject, DTTOPTSFc.iBorderSize, (jint)lpStruct->iBorderSize); + (*env)->SetIntField(env, lpObject, DTTOPTSFc.iFontPropId, (jint)lpStruct->iFontPropId); + (*env)->SetIntField(env, lpObject, DTTOPTSFc.iColorPropId, (jint)lpStruct->iColorPropId); + (*env)->SetIntField(env, lpObject, DTTOPTSFc.iStateId, (jint)lpStruct->iStateId); + (*env)->SetBooleanField(env, lpObject, DTTOPTSFc.fApplyOverlay, (jboolean)lpStruct->fApplyOverlay); + (*env)->SetIntField(env, lpObject, DTTOPTSFc.iGlowSize, (jint)lpStruct->iGlowSize); + (*env)->SetIntLongField(env, lpObject, DTTOPTSFc.pfnDrawTextCallback, (jintLong)lpStruct->pfnDrawTextCallback); + (*env)->SetIntLongField(env, lpObject, DTTOPTSFc.lParam, (jintLong)lpStruct->lParam); +} +#endif + #ifndef NO_DWM_BLURBEHIND typedef struct DWM_BLURBEHIND_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 aa120cbb01..2028c725ea 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 @@ -383,6 +383,18 @@ void setDROPFILESFields(JNIEnv *env, jobject lpObject, DROPFILES *lpStruct); #define DROPFILES_sizeof() 0 #endif +#ifndef NO_DTTOPTS +void cacheDTTOPTSFields(JNIEnv *env, jobject lpObject); +DTTOPTS *getDTTOPTSFields(JNIEnv *env, jobject lpObject, DTTOPTS *lpStruct); +void setDTTOPTSFields(JNIEnv *env, jobject lpObject, DTTOPTS *lpStruct); +#define DTTOPTS_sizeof() sizeof(DTTOPTS) +#else +#define cacheDTTOPTSFields(a,b) +#define getDTTOPTSFields(a,b,c) NULL +#define setDTTOPTSFields(a,b,c) +#define DTTOPTS_sizeof() 0 +#endif + #ifndef NO_DWM_BLURBEHIND void cacheDWM_BLURBEHINDFields(JNIEnv *env, jobject lpObject); DWM_BLURBEHIND *getDWM_BLURBEHINDFields(JNIEnv *env, jobject lpObject, DWM_BLURBEHIND *lpStruct); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DTTOPTS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DTTOPTS.java new file mode 100644 index 0000000000..224d91df4e --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DTTOPTS.java @@ -0,0 +1,32 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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 DTTOPTS {
+ public int dwSize;
+ public int dwFlags;
+ public int /*long*/ crText;
+ public int /*long*/ crBorder;
+ public int /*long*/ crShadow;
+ public int iTextShadowType;
+ public POINT ptShadowOffset;
+ public int iBorderSize;
+ public int iFontPropId;
+ public int iColorPropId;
+ public int iStateId;
+ public boolean fApplyOverlay;
+ public int iGlowSize;
+ /** @field cast=(DTT_CALLBACK_PROC) */
+ public int /*long*/ pfnDrawTextCallback;
+ public int /*long*/ lParam;
+ public static final int sizeof = OS.DTTOPTS_sizeof ();
+}
\ No newline at end of file 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 91eaf9df39..468689c544 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 @@ -2267,6 +2267,7 @@ public static final native int DOCHOSTUIINFO_sizeof (); public static final native int DOCINFO_sizeof (); public static final native int DRAWITEMSTRUCT_sizeof (); public static final native int DROPFILES_sizeof (); +public static final native int DTTOPTS_sizeof (); public static final native int DWM_BLURBEHIND_sizeof (); public static final native int EMR_sizeof (); public static final native int EMREXTCREATEFONTINDIRECTW_sizeof (); @@ -4026,6 +4027,8 @@ public static final native int DrawThemeIcon (int /*long*/ hTheme, int /*long*/ public static final native int DrawThemeParentBackground (int /*long*/ hwnd, int /*long*/ hdc, RECT prc); /** @method flags=dynamic */ public static final native int DrawThemeText (int /*long*/ hTheme, int /*long*/ hdc, int iPartId, int iStateId, char[] pszText, int iCharCount, int dwTextFlags, int dwTextFlags2, RECT pRect); +/** @method flags=dynamic */ +public static final native int DrawThemeTextEx (int /*long*/ hTheme, int /*long*/ hdc, int iPartId, int iStateId, char[] pszText, int iCharCount, int dwFlags, RECT pRect, DTTOPTS pOptions); /** * @method flags=dynamic * @param hWnd cast=(HWND) |