]> git.saurik.com Git - wxWidgets.git/commitdiff
Translate the wxALIGN flags to the Cocoa alignment type in wxStaticText::Create
authorDavid Elliott <dfe@tgwbd.org>
Wed, 8 Aug 2007 04:25:57 +0000 (04:25 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Wed, 8 Aug 2007 04:25:57 +0000 (04:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47955 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/cocoa/stattext.mm

index 8fc1b823dfd83739236e465570081df029279b26..6470799b585ba26af5d343c6a87ef2b10f317d1f 100644 (file)
@@ -50,6 +50,15 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID winid,
     [GetNSTextField() setEditable: NO];
     [GetNSTextField() setDrawsBackground: NO];
 
+    NSTextAlignment alignStyle;
+    if (style & wxALIGN_RIGHT)
+        alignStyle = NSRightTextAlignment;
+    else if (style & wxALIGN_CENTRE)
+        alignStyle = NSCenterTextAlignment;
+    else // default to wxALIGN_LEFT because it is 0 and can't be tested
+        alignStyle = NSLeftTextAlignment;
+    [GetNSControl() setAlignment:(NSTextAlignment)alignStyle];
+
     [GetNSControl() sizeToFit];
     // Round-up to next integer size
     NSRect nsrect = [m_cocoaNSView frame];