Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover2006-12-04 18:51:35 -0500
committerSteve Northover2006-12-04 18:51:35 -0500
commita975ef9f91d82b046bdbfc26d01710e99e6e893d (patch)
treed676bd71246533df2172ac0e280eb5d9d07ae28b
parent54d61f64a3cfcc4bdc1e0a884e2f49d46252416e (diff)
downloadeclipse.platform.swt-a975ef9f91d82b046bdbfc26d01710e99e6e893d.tar.gz
eclipse.platform.swt-a975ef9f91d82b046bdbfc26d01710e99e6e893d.tar.xz
eclipse.platform.swt-a975ef9f91d82b046bdbfc26d01710e99e6e893d.zip
revert back to old transparency in table because custom draw was broken
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java56
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java53
2 files changed, 41 insertions, 68 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 f910d59b95..7bcbe2bacf 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
@@ -69,7 +69,7 @@ public class Table extends Composite {
TableItem currentItem;
TableColumn sortColumn;
boolean ignoreCustomDraw, ignoreDrawForeground, ignoreDrawBackground, ignoreDrawSelection;
- boolean customDraw, dragStarted, firstColumnImage, fixScrollWidth, tipRequested, wasSelected, wasResized;
+ boolean customDraw, dragStarted, explorerTheme, firstColumnImage, fixScrollWidth, tipRequested, wasSelected, wasResized;
boolean ignoreActivate, ignoreSelect, ignoreShrink, ignoreResize, ignoreColumnMove, ignoreColumnResize;
int headerToolTipHandle, itemHeight, lastIndexOf, lastWidth, sortDirection, resizeCount, selectionForeground;
static /*final*/ int HeaderProc;
@@ -130,17 +130,18 @@ void _addListener (int eventType, Listener listener) {
switch (eventType) {
case SWT.MeasureItem:
case SWT.EraseItem:
- case SWT.PaintItem:
- setCustomDraw (true);
- style |= SWT.DOUBLE_BUFFERED;
- setBackgroundTransparent (true);
- //TODO - LVS_EX_LABELTIP causes white rectangles (turn it off)
- OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, OS.LVS_EX_LABELTIP, 0);
+ case SWT.PaintItem:
if (EXPLORER_THEME) {
if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
+ explorerTheme = false;
OS.SetWindowTheme (handle, null, null);
}
}
+ setCustomDraw (true);
+ style |= SWT.DOUBLE_BUFFERED;
+ setBackgroundTransparent (true);
+ //TODO - LVS_EX_LABELTIP causes white rectangles (turn it off)
+ OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, OS.LVS_EX_LABELTIP, 0);
break;
}
}
@@ -355,7 +356,7 @@ LRESULT CDDS_POSTPAINT (int wParam, int lParam) {
* custom draw.
*/
if (--customCount == 0 && OS.IsWindowVisible (handle)) {
- if ((style & SWT.FULL_SELECTION) != 0) {
+ if (!explorerTheme && (style & SWT.FULL_SELECTION) != 0) {
if (OS.SendMessage (handle, OS.LVM_GETBKCOLOR, 0, 0) == OS.CLR_NONE) {
int dwExStyle = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
if ((dwExStyle & OS.LVS_EX_FULLROWSELECT) == 0) {
@@ -394,7 +395,7 @@ LRESULT CDDS_PREPAINT (int wParam, int lParam) {
* custom draw.
*/
if (customCount++ == 0 && OS.IsWindowVisible (handle)) {
- if ((style & SWT.FULL_SELECTION) != 0) {
+ if (!explorerTheme && (style & SWT.FULL_SELECTION) != 0) {
if (OS.SendMessage (handle, OS.LVM_GETBKCOLOR, 0, 0) == OS.CLR_NONE) {
int dwExStyle = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
if ((dwExStyle & OS.LVS_EX_FULLROWSELECT) != 0) {
@@ -980,6 +981,7 @@ void createHandle () {
/* Use the Explorer theme */
if (EXPLORER_THEME) {
if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
+ explorerTheme = true;
OS.SetWindowTheme (handle, Display.EXPLORER, null);
}
}
@@ -3197,35 +3199,6 @@ 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
@@ -3253,10 +3226,11 @@ void setBackgroundTransparent (boolean transparent) {
OS.InvalidateRect (handle, null, true);
/* Clear LVS_EX_FULLROWSELECT */
- if ((style & SWT.FULL_SELECTION) != 0) {
+ if (!explorerTheme && (style & SWT.FULL_SELECTION) != 0) {
int bits = OS.LVS_EX_FULLROWSELECT;
OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, 0);
}
+
/* Clear LVM_SETSELECTEDCOLUMN */
if ((sortDirection & (SWT.UP | SWT.DOWN)) != 0) {
if (sortColumn != null && !sortColumn.isDisposed ()) {
@@ -3277,13 +3251,15 @@ void setBackgroundTransparent (boolean transparent) {
if (control.backgroundImage == null) {
setBackgroundPixel (control.getBackgroundPixel ());
}
+
/* Set LVS_EX_FULLROWSELECT */
- if ((style & SWT.FULL_SELECTION) != 0) {
+ if (!explorerTheme && (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);
}
}
+
/* Set LVM_SETSELECTEDCOLUMN */
if ((sortDirection & (SWT.UP | SWT.DOWN)) != 0) {
if (sortColumn != null && !sortColumn.isDisposed ()) {
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 0ff63da7a0..abb046b528 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,35 +711,32 @@ void setSortDirection (int direction) {
* selected column.
*/
if (OS.SendMessage (hwnd, OS.LVM_GETBKCOLOR, 0, 0) != OS.CLR_NONE) {
- 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);
- }
+ 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