-#if wxOSX_USE_CARBON
- ControlFontStyleRec controlFont;
- OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont );
- verify_noerr( err );
-
- wxCFStringRef str( m_label, GetFont().GetEncoding() );
-
-#if wxOSX_USE_ATSU_TEXT
- SInt16 baseline;
- if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
- {
- err = GetThemeTextDimensions(
- (!m_label.empty() ? (CFStringRef)str : CFSTR(" ")),
- m_font.MacGetThemeFontID(), kThemeStateActive, false, &bounds, &baseline );
- verify_noerr( err );
- }
- else
-#endif
-#endif
- {
- wxClientDC dc(const_cast<wxStaticText*>(this));
- wxCoord width, height ;
- dc.GetTextExtent( m_label , &width, &height);
- bounds.h = width;
- bounds.v = height;
- }
-
- if ( m_label.empty() )
- bounds.h = 0;
+ m_lineBreak = lineBreak;
+ }
+
+ virtual void SetLabel(const wxString& title, wxFontEncoding encoding)
+ {
+ 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];