summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover <steve>2006-02-13 17:33:14 +0000
committerSteve Northover <steve>2006-02-13 17:33:14 +0000
commit6a8f64aba74c6fc7a655a14fc7ca54a1aef70af2 (patch)
treed0cf72861a799089c6aafe8f53ee4a3e7b2b380c
parentf5a0d3582f75308849543d0ff0517400d5971efe (diff)
downloadeclipse.platform.swt-6a8f64aba74c6fc7a655a14fc7ca54a1aef70af2.tar.gz
eclipse.platform.swt-6a8f64aba74c6fc7a655a14fc7ca54a1aef70af2.tar.xz
eclipse.platform.swt-6a8f64aba74c6fc7a655a14fc7ca54a1aef70af2.zip
clear full row selection when custom draw (temporary code to avoid cheese)
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java36
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java30
2 files changed, 47 insertions, 19 deletions
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 5a56761aba..31a39853b1 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
@@ -2553,17 +2553,6 @@ LRESULT sendMouseDownEvent (int type, int button, int msg, int wParam, int lPara
void setBackgroundImage (int hBitmap) {
setBackgroundTransparent (hBitmap != 0);
- if (hBitmap != 0) {
- if ((style & SWT.FULL_SELECTION) != 0) {
- int bits = OS.LVS_EX_FULLROWSELECT;
- OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, 0);
- }
- } else {
- if ((style & SWT.FULL_SELECTION) != 0) {
- int bits = OS.LVS_EX_FULLROWSELECT;
- OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, bits);
- }
- }
}
void setBackgroundPixel (int newPixel) {
@@ -2584,17 +2573,30 @@ void setBackgroundPixel (int newPixel) {
}
void setBackgroundTransparent (boolean transparent) {
+ /*
+ * Bug in Windows. When the table has the extended style
+ * LVS_EX_FULLROWSELECT and LVM_SETBKCOLOR is used with
+ * CLR_NONE to make the table transparent, Windows draws
+ * a black rectangle around the first column. The fix is
+ * to set and clear LVS_EX_FULLROWSELECT.
+ */
int oldPixel = OS.SendMessage (handle, OS.LVM_GETBKCOLOR, 0, 0);
if (transparent) {
if (oldPixel != OS.CLR_NONE) {
- OS.SendMessage (handle, OS.LVM_SETBKCOLOR, 0, OS.CLR_NONE);
- OS.SendMessage (handle, OS.LVM_SETTEXTBKCOLOR, 0, OS.CLR_NONE);
/*
* Feature in Windows. When the background color is changed,
* the table does not redraw until the next WM_PAINT. The fix
* is to force a redraw.
*/
+ OS.SendMessage (handle, OS.LVM_SETBKCOLOR, 0, OS.CLR_NONE);
+ OS.SendMessage (handle, OS.LVM_SETTEXTBKCOLOR, 0, OS.CLR_NONE);
OS.InvalidateRect (handle, null, true);
+
+ /* Clear LVS_EX_FULLROWSELECT */
+ if ((style & SWT.FULL_SELECTION) != 0) {
+ int bits = OS.LVS_EX_FULLROWSELECT;
+ OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, 0);
+ }
}
} else {
if (oldPixel == OS.CLR_NONE) {
@@ -2603,6 +2605,14 @@ void setBackgroundTransparent (boolean transparent) {
if (control.backgroundImage == null) {
setBackgroundPixel (control.getBackgroundPixel ());
}
+
+ /* Set LVS_EX_FULLROWSELECT */
+ if ((style & SWT.FULL_SELECTION) != 0) {
+ if (!hooks (SWT.EraseItem) && !hooks (SWT.PaintItem)) {
+ int bits = OS.LVS_EX_FULLROWSELECT;
+ OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, bits);
+ }
+ }
}
}
}
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 6f00698654..961e230913 100755
--- 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
@@ -125,11 +125,20 @@ void _addListener (int eventType, Listener listener) {
case SWT.MeasureItem:
case SWT.EraseItem:
case SWT.PaintItem:
- if (hwndHeader == 0) {
- createParent ();
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- bits |= OS.TVS_NOHSCROLL;
- OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
+ if (hwndHeader == 0) createParent ();
+ int oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE), newBits = oldBits;
+ /*
+ * Feature in Windows. When the tree has the style
+ * TVS_FULLROWSELECT, the background color for the
+ * entire row is filled when an item is painted,
+ * drawing on top of any custom drawing. The fix
+ * is to clear TVS_FULLROWSELECT.
+ */
+ if ((style & SWT.FULL_SELECTION) != 0) newBits &= ~OS.TVS_FULLROWSELECT;
+ newBits |= OS.TVS_NOHSCROLL;
+ if (newBits != oldBits) {
+ OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
+ OS.InvalidateRect (handle, null, true);
/*
* Bug in Windows. When TVS_NOHSCROLL is set after items
* have been inserted into the tree, Windows shows the
@@ -2479,12 +2488,21 @@ void setBackgroundImage (int hBitmap) {
setBackgroundPixel (control.getBackgroundPixel ());
}
}
+ /*
+ * Feature in Windows. When the tree has the style
+ * TVS_FULLROWSELECT, the background color for the
+ * entire row is filled when an item is painted,
+ * drawing on top of the background image. The fix
+ * is to set and clear TVS_FULLROWSELECT.
+ */
if ((style & SWT.FULL_SELECTION) != 0) {
int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
if (hBitmap != 0) {
bits &= ~OS.TVS_FULLROWSELECT;
} else {
- bits |= OS.TVS_FULLROWSELECT;
+ if (!hooks (SWT.EraseItem) && !hooks (SWT.PaintItem)) {
+ bits |= OS.TVS_FULLROWSELECT;
+ }
}
OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
OS.InvalidateRect (handle, null, true);