summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine <veronika>2004-02-12 23:15:06 +0000
committerVeronika Irvine <veronika>2004-02-12 23:15:06 +0000
commit428214eba95c49844e8451c175a480459b24450c (patch)
treec39cfc9e457aae8319bd3aa93219207dcda1ad2f
parentfd1d06d60ded6f60da4d59cc3e5e01163694fe73 (diff)
downloadeclipse.platform.swt-428214eba95c49844e8451c175a480459b24450c.tar.gz
eclipse.platform.swt-428214eba95c49844e8451c175a480459b24450c.tar.xz
eclipse.platform.swt-428214eba95c49844e8451c175a480459b24450c.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TableCursor.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java38
2 files changed, 21 insertions, 29 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 8bab03a743..43399a0f55 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
@@ -384,6 +384,7 @@ void paint(Event event) {
}
String text = item.getText(column);
if (text != "") {
+ Rectangle bounds = item.getBounds(column);
Point extent = gc.stringExtent(text);
TableColumn[] columns = table.getColumns();
// Temporary code - need a better way to determine table trim
@@ -399,10 +400,10 @@ void paint(Event event) {
x += 6;
break;
case SWT.RIGHT:
- x = tableColumn.getWidth() - extent.x - 6;
+ x = bounds.width - extent.x - 6;
break;
case SWT.CENTER:
- x += (tableColumn.getWidth() - x - extent.x) / 2;
+ x += (bounds.width - x - extent.x) / 2;
break;
}
}
@@ -410,17 +411,16 @@ void paint(Event event) {
if (table.getColumns().length == 0) {
x += 5;
} else {
- TableColumn tableColumn = columns[column];
- int alignmnent = tableColumn.getAlignment();
+ int alignmnent = columns[column].getAlignment();
switch (alignmnent) {
case SWT.LEFT:
x += 5;
break;
case SWT.RIGHT:
- x = tableColumn.getWidth() - extent.x - 3;
+ x = bounds.width- extent.x - 2;
break;
case SWT.CENTER:
- x += (tableColumn.getWidth() - x - extent.x) / 2 + 1;
+ x += (bounds.width - x - extent.x) / 2 + 2;
break;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
index 53b34d2b17..347bc1a5f6 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
@@ -146,10 +146,9 @@ public Color getBackground () {
public Color getBackground (int index) {
checkWidget ();
int count = Math.max (1, parent.getColumnCount ());
- if (0 > index || index > count -1) return getBackground ();
- int pixel = (cellBackground != null) ? cellBackground [index] : -1;
- if (pixel == -1) return getBackground ();
- return Color.win32_new (display, pixel);
+ if (0 > index || index > count - 1) return getBackground ();
+ int pixel = cellBackground != null ? cellBackground [index] : -1;
+ return pixel == -1 ? getBackground () : Color.win32_new (display, pixel);
}
/**
@@ -237,7 +236,7 @@ public boolean getChecked () {
*/
public Font getFont () {
checkWidget ();
- return (font == -1) ? parent.getFont () : Font.win32_new (display, font);
+ return font == -1 ? parent.getFont () : Font.win32_new (display, font);
}
/**
@@ -259,7 +258,7 @@ public Font getFont (int index) {
int count = Math.max (1, parent.getColumnCount ());
if (0 > index || index > count -1) return getFont ();
int hFont = (cellFont != null) ? cellFont [index] : font;
- return (hFont == -1) ? getFont () : Font.win32_new (display, hFont);
+ return hFont == -1 ? getFont () : Font.win32_new (display, hFont);
}
/**
@@ -299,9 +298,8 @@ public Color getForeground (int index) {
checkWidget ();
int count = Math.max (1, parent.getColumnCount ());
if (0 > index || index > count -1) return getForeground ();
- int pixel = (cellForeground != null) ? cellForeground [index] : -1;
- if (pixel == -1) return getForeground ();
- return Color.win32_new (display, pixel);
+ int pixel = cellForeground != null ? cellForeground [index] : -1;
+ return pixel == -1 ? getForeground () : Color.win32_new (display, pixel);
}
/**
@@ -576,10 +574,8 @@ public void setBackground (int index, Color color) {
pixel = color.handle;
}
if (cellBackground == null) {
- int hwndHeader = OS.SendMessage (parent.handle, OS.LVM_GETHEADER, 0, 0);
- int itemCount = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- cellBackground = new int [itemCount];
- for (int i = 0; i < itemCount; i++) {
+ cellBackground = new int [count];
+ for (int i = 0; i < count; i++) {
cellBackground [i] = -1;
}
}
@@ -677,17 +673,15 @@ public void setFont (int index, Font font) {
SWT.error (SWT.ERROR_INVALID_ARGUMENT);
}
int count = Math.max (1, parent.getColumnCount ());
- if (0 > index || index > count -1) return;
+ if (0 > index || index > count - 1) return;
int hFont = -1;
if (font != null) {
parent.customDraw = true;
hFont = font.handle;
}
if (cellFont == null) {
- int hwndHeader = OS.SendMessage (parent.handle, OS.LVM_GETHEADER, 0, 0);
- int itemCount = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- cellFont = new int [itemCount];
- for (int i = 0; i < itemCount; i++) {
+ cellFont = new int [count];
+ for (int i = 0; i < count; i++) {
cellFont [i] = -1;
}
}
@@ -751,17 +745,15 @@ public void setForeground (int index, Color color){
SWT.error (SWT.ERROR_INVALID_ARGUMENT);
}
int count = Math.max (1, parent.getColumnCount ());
- if (0 > index || index > count -1) return;
+ if (0 > index || index > count - 1) return;
int pixel = -1;
if (color != null) {
parent.customDraw = true;
pixel = color.handle;
}
if (cellForeground == null) {
- int hwndHeader = OS.SendMessage (parent.handle, OS.LVM_GETHEADER, 0, 0);
- int itemCount = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
- cellForeground = new int [itemCount];
- for (int i = 0; i < itemCount; i++) {
+ cellForeground = new int [count];
+ for (int i = 0; i < count; i++) {
cellForeground [i] = -1;
}
}