diff options
author | Veronika Irvine <veronika> | 2004-02-10 21:08:05 +0000 |
---|---|---|
committer | Veronika Irvine <veronika> | 2004-02-10 21:08:05 +0000 |
commit | cafb334312f52d6ad66f6ce068e8f85aafccf77f (patch) | |
tree | 8b608d26f8261e16d0ba320d41fb1d507908f16a | |
parent | b0ec5e7977c3c6ebb8a625387bc0d6380a4a2844 (diff) | |
download | eclipse.platform.swt-cafb334312f52d6ad66f6ce068e8f85aafccf77f.tar.gz eclipse.platform.swt-cafb334312f52d6ad66f6ce068e8f85aafccf77f.tar.xz eclipse.platform.swt-cafb334312f52d6ad66f6ce068e8f85aafccf77f.zip |
*** empty log message ***
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableCursor.java | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableCursor.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableCursor.java index 48a9d39a46..5dbf3188c5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableCursor.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableCursor.java @@ -12,6 +12,7 @@ package org.eclipse.swt.custom; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.Platform; import org.eclipse.swt.widgets.*; import org.eclipse.swt.events.*; @@ -385,21 +386,44 @@ void paint(Event event) { String text = item.getText(column); if (text != "") { Point extent = gc.stringExtent(text); - if (column == 0) { - x += 2; - } else { - TableColumn tableColumn = table.getColumn(column); - int alignmnent = tableColumn.getAlignment(); - switch (alignmnent) { - case SWT.LEFT: - x += 6; - break; - case SWT.RIGHT: - x = tableColumn.getWidth() - extent.x - 6; - break; - case SWT.CENTER: - x += (tableColumn.getWidth() - x - extent.x) / 2; - break; + TableColumn[] columns = table.getColumns(); + // Temporary code - need a better way to determine table trim + String platform = SWT.getPlatform(); + if ("win32".equals(platform)) { //$NON-NLS-1$ + if (table.getColumns().length == 0 || column == 0) { + x += 2; + } else { + TableColumn tableColumn = columns[column]; + int alignmnent = tableColumn.getAlignment(); + switch (alignmnent) { + case SWT.LEFT: + x += 6; + break; + case SWT.RIGHT: + x = tableColumn.getWidth() - extent.x - 6; + break; + case SWT.CENTER: + x += (tableColumn.getWidth() - x - extent.x) / 2; + break; + } + } + } else { + if (table.getColumns().length == 0) { + x += 5; + } else { + TableColumn tableColumn = columns[column]; + int alignmnent = tableColumn.getAlignment(); + switch (alignmnent) { + case SWT.LEFT: + x += 5; + break; + case SWT.RIGHT: + x = tableColumn.getWidth() - extent.x - 3; + break; + case SWT.CENTER: + x += (tableColumn.getWidth() - x - extent.x) / 2 + 1; + break; + } } } int textY = (size.y - extent.y) / 2; @@ -410,7 +434,6 @@ void paint(Event event) { gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); gc.drawFocus(0, 0, size.x, size.y); } - } void tableFocusIn(Event event) { |