Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover2006-12-04 19:21:21 +0000
committerSteve Northover2006-12-04 19:21:21 +0000
commitc1a797a57543b30a9f6230fdbf16251b30301bfa (patch)
tree35b12cdcc2603a1a4cf2cef657844432dc84f148
parent28341f36b2b474d250bcbc993c3af8734c20f08e (diff)
downloadeclipse.platform.swt-c1a797a57543b30a9f6230fdbf16251b30301bfa.tar.gz
eclipse.platform.swt-c1a797a57543b30a9f6230fdbf16251b30301bfa.tar.xz
eclipse.platform.swt-c1a797a57543b30a9f6230fdbf16251b30301bfa.zip
fix redraw problems when background image used and explorer theme
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java1
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java29
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java53
3 files changed, 58 insertions, 25 deletions
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 ffd1b841c2..db31e0e6bb 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
@@ -963,6 +963,7 @@ public class OS extends Platform {
public static final int LVS_EX_ONECLICKACTIVATE = 0x40;
public static final int LVS_EX_SUBITEMIMAGES = 0x2;
public static final int LVS_EX_TRACKSELECT = 0x8;
+ public static final int LVS_EX_TRANSPARENTBKGND = 0x800000;
public static final int LVS_EX_TWOCLICKACTIVATE = 0x80;
public static final int LVS_LIST = 0x3;
public static final int LVS_NOCOLUMNHEADER = 0x4000;
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 429898c26c..a39353ac42 100755
--- 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
@@ -3197,6 +3197,35 @@ void setBackgroundPixel (int newPixel) {
}
void setBackgroundTransparent (boolean transparent) {
+ if (EXPLORER_THEME) {
+ if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
+ int bits = transparent ? OS.LVS_EX_TRANSPARENTBKGND : 0;
+ OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, OS.LVS_EX_TRANSPARENTBKGND, bits);
+ /*
+ * Feature in Windows. When LVM_SETEXTENDEDLISTVIEWSTYLE is
+ * used with LVS_EX_TRANSPARENTBKGND and LVM_SETSELECTEDCOLUMN
+ * is used to select a column, Windows fills the column with
+ * the selection color, drawing on top of the background image
+ * and any other custom drawing. The fix is to clear (or set)
+ * the selected column.
+ */
+ if ((sortDirection & (SWT.UP | SWT.DOWN)) != 0) {
+ if (sortColumn != null && !sortColumn.isDisposed ()) {
+ int column = transparent ? -1 : indexOf (sortColumn);
+ OS.SendMessage (handle, OS.LVM_SETSELECTEDCOLUMN, column, 0);
+ if (column != OS.SendMessage (handle, OS.LVM_SETSELECTEDCOLUMN, column, 0)) {
+ /*
+ * Bug in Windows. When LVM_SETSELECTEDCOLUMN is set, Windows
+ * does not redraw either the new or the previous selected column.
+ * The fix is to force a redraw.
+ */
+ OS.InvalidateRect (handle, null, true);
+ }
+ }
+ }
+ return;
+ }
+ }
/*
* Bug in Windows. When the table has the extended style
* LVS_EX_FULLROWSELECT and LVM_SETBKCOLOR is used with
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
index abb046b528..0ff63da7a0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
@@ -711,32 +711,35 @@ void setSortDirection (int direction) {
* selected column.
*/
if (OS.SendMessage (hwnd, OS.LVM_GETBKCOLOR, 0, 0) != OS.CLR_NONE) {
- int oldColumn = OS.SendMessage (hwnd, OS.LVM_GETSELECTEDCOLUMN, 0, 0);
- int newColumn = direction == SWT.NONE ? -1 : index;
- OS.SendMessage (hwnd, OS.LVM_SETSELECTEDCOLUMN, newColumn, 0);
- /*
- * Bug in Windows. When LVM_SETSELECTEDCOLUMN is used to
- * specify a selected column, Windows does not redraw either
- * the new or the previous selected column. The fix is to
- * force a redraw of both.
- */
- parent.forceResize ();
- RECT rect = new RECT (), headerRect = new RECT ();
- OS.GetClientRect (hwnd, rect);
- if (oldColumn != -1) {
- if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, oldColumn, headerRect) != 0) {
- OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2);
- rect.left = headerRect.left;
- rect.right = headerRect.right;
- OS.InvalidateRect (hwnd, rect, true);
+ int bits = OS.SendMessage (hwnd, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
+ if ((bits & OS.LVS_EX_TRANSPARENTBKGND) == 0) {
+ int oldColumn = OS.SendMessage (hwnd, OS.LVM_GETSELECTEDCOLUMN, 0, 0);
+ int newColumn = direction == SWT.NONE ? -1 : index;
+ OS.SendMessage (hwnd, OS.LVM_SETSELECTEDCOLUMN, newColumn, 0);
+ /*
+ * Bug in Windows. When LVM_SETSELECTEDCOLUMN is used to
+ * specify a selected column, Windows does not redraw either
+ * the new or the previous selected column. The fix is to
+ * force a redraw of both.
+ */
+ parent.forceResize ();
+ RECT rect = new RECT (), headerRect = new RECT ();
+ OS.GetClientRect (hwnd, rect);
+ if (oldColumn != -1) {
+ if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, oldColumn, headerRect) != 0) {
+ OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2);
+ rect.left = headerRect.left;
+ rect.right = headerRect.right;
+ OS.InvalidateRect (hwnd, rect, true);
+ }
}
- }
- if (newColumn != -1) {
- if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, newColumn, headerRect) != 0) {
- OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2);
- rect.left = headerRect.left;
- rect.right = headerRect.right;
- OS.InvalidateRect (hwnd, rect, true);
+ if (newColumn != -1) {
+ if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, newColumn, headerRect) != 0) {
+ OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2);
+ rect.left = headerRect.left;
+ rect.right = headerRect.right;
+ OS.InvalidateRect (hwnd, rect, true);
+ }
}
}
}

Back to the top