diff options
author | Veronika Irvine <veronika> | 2004-12-10 19:11:36 +0000 |
---|---|---|
committer | Veronika Irvine <veronika> | 2004-12-10 19:11:36 +0000 |
commit | fca875eb72108e60782c178db548975d58286f47 (patch) | |
tree | 45e0e7d54c6037fb1844acc83f8747e7e9736ed0 | |
parent | c4f1f56c86ea0f324367d5bf40bcbb49d4323f3e (diff) | |
download | eclipse.platform.swt-fca875eb72108e60782c178db548975d58286f47.tar.gz eclipse.platform.swt-fca875eb72108e60782c178db548975d58286f47.tar.xz eclipse.platform.swt-fca875eb72108e60782c178db548975d58286f47.zip |
bug 70318 support multiple lines
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java index 271e33d5b4..e045eccc23 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java @@ -375,8 +375,13 @@ void onPaint(PaintEvent event) { if (shortenText) { extent.x = 0; for(int i = 0; i < lines.length; i++) { - lines[i] = shortenText(gc, lines[i], availableWidth); - extent.x = Math.max(extent.x, getTotalSize(null, lines[i]).x); + Point e = gc.textExtent(lines[i], DRAW_FLAGS); + if (e.x > availableWidth) { + lines[i] = shortenText(gc, lines[i], availableWidth); + extent.x = Math.max(extent.x, getTotalSize(null, lines[i]).x); + } else { + extent.x = Math.max(extent.x, e.x); + } } if (appToolTipText == null) { super.setToolTipText(text); |