diff options
author | Grant Gayed <ggayed> | 2008-11-03 15:25:14 +0000 |
---|---|---|
committer | Grant Gayed <ggayed> | 2008-11-03 15:25:14 +0000 |
commit | 10c9ccdbcf7fead3038cbd1567779acfd8cb96df (patch) | |
tree | ade335682c51f247485cd554c54d712990c47cde /bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java | |
parent | a9df4ead4cfe6173543dbad2f87c16100341a934 (diff) | |
download | eclipse.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-x | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java | 13 |
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); } |