Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java21
6 files changed, 57 insertions, 20 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 6252d862d8..978d8e67f3 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
@@ -4963,6 +4963,32 @@ fail:
}
#endif
+#ifndef NO_GetThemePartSize
+JNIEXPORT jint JNICALL OS_NATIVE(GetThemePartSize)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jint arg3, jobject arg4, jint arg5, jobject arg6)
+{
+ RECT _arg4, *lparg4=NULL;
+ SIZE _arg6, *lparg6=NULL;
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, GetThemePartSize_FUNC);
+ if (arg4) if ((lparg4 = getRECTFields(env, arg4, &_arg4)) == NULL) goto fail;
+ if (arg6) if ((lparg6 = &_arg6) == NULL) goto fail;
+/*
+ rc = (jint)GetThemePartSize(arg0, arg1, arg2, arg3, lparg4, arg5, lparg6);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, GetThemePartSize)
+ if (fp) {
+ rc = (jint)((jint (CALLING_CONVENTION*)(jintLong, jintLong, jint, jint, RECT *, jint, SIZE *))fp)(arg0, arg1, arg2, arg3, lparg4, arg5, lparg6);
+ }
+ }
+fail:
+ if (arg6 && lparg6) setSIZEFields(env, arg6, lparg6);
+ OS_NATIVE_EXIT(env, that, GetThemePartSize_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_GetThemeTextExtent
JNIEXPORT jint JNICALL OS_NATIVE(GetThemeTextExtent)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jint arg3, jcharArray arg4, jint arg5, jint arg6, jobject arg7, jobject arg8)
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 b462daa83c..94d41f5ac9 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
@@ -390,6 +390,7 @@ char * OS_nativeFunctionNames[] = {
"GetTextExtentPoint32W",
"GetTextMetricsA",
"GetTextMetricsW",
+ "GetThemePartSize",
"GetThemeTextExtent",
"GetTouchInputInfo",
"GetUpdateRect",
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 bbff40fbb1..200c80d163 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
@@ -400,6 +400,7 @@ typedef enum {
GetTextExtentPoint32W_FUNC,
GetTextMetricsA_FUNC,
GetTextMetricsW_FUNC,
+ GetThemePartSize_FUNC,
GetThemeTextExtent_FUNC,
GetTouchInputInfo_FUNC,
GetUpdateRect_FUNC,
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 e2de419575..f6cd0e8719 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
@@ -1588,6 +1588,7 @@ public class OS extends C {
public static final int TREIS_NORMAL = 1;
public static final int TREIS_SELECTED = 3;
public static final int TREIS_SELECTEDNOTFOCUS = 5;
+ public static final int TS_TRUE = 1;
public static final int TTDT_AUTOMATIC = 0;
public static final int TTDT_RESHOW = 1;
public static final int TTDT_AUTOPOP = 2;
@@ -3944,6 +3945,12 @@ public static final native int GetMessageTime ();
* @param hrgn cast=(HRGN)
*/
public static final native int GetMetaRgn (long /*int*/ hdc, long /*int*/ hrgn);
+/**
+ * @method flags=dynamic
+ * @param prc flags=no_out
+ * @param psz flags=no_in
+ */
+public static final native int GetThemePartSize(long /*int*/ hTheme, long /*int*/ hdc, int iPartId, int iStateId, RECT prc, int eSize, SIZE psz);
/** @method flags=dynamic */
public static final native int GetThemeTextExtent (long /*int*/ hTheme, long /*int*/ hdc, int iPartId, int iStateId, char[] pszText, int iCharCount, int dwTextFlags, RECT pBoundingRect, RECT pExtentRect);
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
index 0936214622..248276e875 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
@@ -2195,16 +2195,6 @@ void fixCheckboxImageList (boolean fixScroll) {
if (hImageList == 0) return;
int [] cx = new int [1], cy = new int [1];
OS.ImageList_GetIconSize (hImageList, cx, cy);
- /*
- * On Windows when OS level custom zoom is more than 150% then OS
- * doesn't support auto-scaling of the native check-box images and hence
- * the size of native check-box never goes more than 20px wide. So, to
- * handle this special case in Table/Tree, need to apply the same upper
- * cap to the size of custom drawn check-box images, so check-box images
- * look in proper ratio. For more details refer bug 489828.
- */
- cx [0] = Math.min (20, cx [0]);
- cy [0] = Math.min (20, cy [0]);
long /*int*/ hStateList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_STATE, 0);
if (hStateList == 0) return;
int [] stateCx = new int [1], stateCy = new int [1];
@@ -4287,6 +4277,17 @@ void setCheckboxImageList (int width, int height, boolean fixScroll) {
OS.SelectObject (hDC, oldFont);
int itemWidth = Math.min (tm.tmHeight, width);
int itemHeight = Math.min (tm.tmHeight, height);
+ if (OS.IsAppThemed()) {
+ /*
+ * Feature in Windows. DrawThemeBackground stretches the checkbox
+ * bitmap to fill the provided rectangle. To avoid stretching
+ * artifacts, limit the rectangle to actual checkbox bitmap size.
+ */
+ SIZE size = new SIZE();
+ OS.GetThemePartSize(display.hButtonTheme(), memDC, OS.BP_CHECKBOX, 0, null, OS.TS_TRUE, size);
+ itemWidth = Math.min (size.cx, itemWidth);
+ itemHeight = Math.min (size.cy, itemHeight);
+ }
int left = (width - itemWidth) / 2, top = (height - itemHeight) / 2;
OS.SetRect (rect, left, top, left + itemWidth, top + itemHeight);
if (OS.IsAppThemed ()) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
index e9f88b3f63..5386a5cbe6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
@@ -4598,16 +4598,17 @@ void setCheckboxImageList () {
OS.SelectObject (hDC, oldFont);
int itemWidth = Math.min (tm.tmHeight, width);
int itemHeight = Math.min (tm.tmHeight, height);
- /*
- * On Windows when OS level custom zoom is more than 150% then OS
- * doesn't support auto-scaling of the native check-box images and hence
- * the size of native check-box never goes more than 20px wide. So, to
- * handle this special case in Table/Tree, need to apply the same upper
- * cap to the size of custom drawn check-box images, so check-box images
- * look in proper ratio. For more details refer bug 489828.
- */
- itemWidth = Math.min (20, itemWidth);
- itemHeight = Math.min (20, itemHeight);
+ if (OS.IsAppThemed()) {
+ /*
+ * Feature in Windows. DrawThemeBackground stretches the checkbox
+ * bitmap to fill the provided rectangle. To avoid stretching
+ * artifacts, limit the rectangle to actual checkbox bitmap size.
+ */
+ SIZE size = new SIZE();
+ OS.GetThemePartSize(display.hButtonTheme(), memDC, OS.BP_CHECKBOX, 0, null, OS.TS_TRUE, size);
+ itemWidth = Math.min (size.cx, itemWidth);
+ itemHeight = Math.min (size.cy, itemHeight);
+ }
int left = (width - itemWidth) / 2, top = (height - itemHeight) / 2 + 1;
OS.SetRect (rect, left + width, top, left + width + itemWidth, top + itemHeight);
if (OS.IsAppThemed ()) {

Back to the top