- wxClientDC dc(const_cast<wxStaticText*>(this));
- wxCoord width, height ;
- dc.GetMultiLineTextExtent( m_label , &width, &height);
- // FIXME: Some labels seem to have their last characters
- // stripped out. Adding 12 pixels seems to be enough to fix this.
- // Perhaps m_label is not being synced properly...
- bounds.h = width+12;
- bounds.v = height;
+ wxNSStaticTextView* v = (wxNSStaticTextView*)GetWXWidget();
+ wxWindow* wxpeer = GetWXPeer();
+ NSCell* cell = [v cell];
+ wxCFStringRef text( title , encoding );
+
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+ [paragraphStyle setLineBreakMode:m_lineBreak];
+ int style = wxpeer->GetWindowStyleFlag();
+ if (style & wxALIGN_CENTER)
+ [paragraphStyle setAlignment: NSCenterTextAlignment];
+ else if (style & wxALIGN_RIGHT)
+ [paragraphStyle setAlignment: NSRightTextAlignment];
+
+ NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:paragraphStyle, NSParagraphStyleAttributeName, nil];
+ NSAttributedString *attrstring = [[NSAttributedString alloc] initWithString:text.AsNSString() attributes:dict];
+ [cell setAttributedStringValue:attrstring];
+ [attrstring release];
+ [paragraphStyle release];