summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
diff options
context:
space:
mode:
authorKevin Barnes <krbarnes>2008-12-18 19:07:19 +0000
committerKevin Barnes <krbarnes>2008-12-18 19:07:19 +0000
commit1b615127bcf568e760ea5e7f916b726a40d2a2e7 (patch)
tree4b9bc613ea52f22dccb38e55f1566f6f66dff7d5 /bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
parent81e54d38ec5b6342d15f1f7833dc8f31804e4b00 (diff)
downloadeclipse.platform.swt-1b615127bcf568e760ea5e7f916b726a40d2a2e7.tar.gz
eclipse.platform.swt-1b615127bcf568e760ea5e7f916b726a40d2a2e7.tar.xz
eclipse.platform.swt-1b615127bcf568e760ea5e7f916b726a40d2a2e7.zip
256719 - Label control: alignment settings not applied to text labels
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.java20
1 files changed, 10 insertions, 10 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 05538d4272..aa12ffabaa 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
@@ -260,6 +260,9 @@ NSAttributedString createString() {
NSMutableParagraphStyle paragraphStyle = (NSMutableParagraphStyle)new NSMutableParagraphStyle ().alloc ().init ();
paragraphStyle.autorelease ();
paragraphStyle.setLineBreakMode (OS.NSLineBreakByClipping);
+ if ((style & SWT.RIGHT) != 0) paragraphStyle.setAlignment(OS.NSRightTextAlignment);
+ if ((style & SWT.LEFT) != 0) paragraphStyle.setAlignment(OS.NSLeftTextAlignment);
+ if ((style & SWT.CENTER) != 0) paragraphStyle.setAlignment(OS.NSCenterTextAlignment);
dict.setObject (paragraphStyle, OS.NSParagraphStyleAttributeName);
}
@@ -409,17 +412,14 @@ void setBackground (float [] color) {
}
void _setAlignment() {
- if ((style & SWT.RIGHT) != 0) {
- textView.setAlignment(OS.NSRightTextAlignment);
- imageView.setImageAlignment(OS.NSImageAlignRight);
+ if (image != null) {
+ if ((style & SWT.RIGHT) != 0) imageView.setImageAlignment(OS.NSImageAlignRight);
+ if ((style & SWT.LEFT) != 0) imageView.setImageAlignment(OS.NSImageAlignLeft);
+ if ((style & SWT.CENTER) != 0) imageView.setImageAlignment(OS.NSImageAlignCenter);
}
- if ((style & SWT.LEFT) != 0) {
- textView.setAlignment(OS.NSLeftTextAlignment);
- imageView.setImageAlignment(OS.NSImageAlignLeft);
- }
- if ((style & SWT.CENTER) != 0) {
- textView.setAlignment(OS.NSCenterTextAlignment);
- imageView.setImageAlignment(OS.NSImageAlignCenter);
+ if (text != null) {
+ NSCell cell = new NSCell(textView.cell());
+ cell.setAttributedStringValue(createString());
}
}