summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
diff options
context:
space:
mode:
authorGrant Gayed <ggayed>2008-11-03 15:25:14 +0000
committerGrant Gayed <ggayed>2008-11-03 15:25:14 +0000
commit10c9ccdbcf7fead3038cbd1567779acfd8cb96df (patch)
treeade335682c51f247485cd554c54d712990c47cde /bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
parenta9df4ead4cfe6173543dbad2f87c16100341a934 (diff)
downloadeclipse.platform.swt-10c9ccdbcf7fead3038cbd1567779acfd8cb96df.tar.gz
eclipse.platform.swt-10c9ccdbcf7fead3038cbd1567779acfd8cb96df.tar.xz
eclipse.platform.swt-10c9ccdbcf7fead3038cbd1567779acfd8cb96df.zip
249015 - implement preferred size for simple controls
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
index ca44f4b6e4..40b645395d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
@@ -171,10 +171,15 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
width = height = 0;
}
} else {
- NSRect rect = new NSRect ();
- rect.width = wHint != SWT.DEFAULT ? wHint : Float.MAX_VALUE;
- rect.height = hHint != SWT.DEFAULT ? hHint : Float.MAX_VALUE;
- NSSize size = textView.cell ().cellSizeForBounds (rect);
+ NSSize size = null;
+ if ((style & SWT.WRAP) != 0 && wHint != SWT.DEFAULT) {
+ NSRect rect = new NSRect ();
+ rect.width = wHint;
+ rect.height = hHint != SWT.DEFAULT ? hHint : Float.MAX_VALUE;
+ size = textView.cell ().cellSizeForBounds (rect);
+ } else {
+ size = textView.cell ().cellSize ();
+ }
width = (int)Math.ceil (size.width);
height = (int)Math.ceil (size.height);
}