Use Cocoa methods instead of wx ones in wxDVC font setting code.

Use NSFontManager to create bold or italic version of the font instead of
using wxFont. This works better for the bold attribute, but setting the italic
one still doesn't do anything.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62388 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-10-12 17:30:35 +00:00
parent a65452ba5d
commit 67c4b73f9b

View File

@@ -1525,12 +1525,19 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
{
if ( attr.HasFont() )
{
wxFont font(dvc->GetFont());
if ( attr.GetBold() )
font.MakeBold();
if ( attr.GetItalic() )
font.MakeItalic();
[cell setFont:font.OSXGetNSFont()];
// FIXME: using wxFont methods here doesn't work for some reason
NSFontManager * const fm = [NSFontManager sharedFontManager];
NSFont *font = [cell font];
if ( font )
{
if ( attr.GetBold() )
font = [fm convertFont:font toHaveTrait:NSBoldFontMask];
if ( attr.GetItalic() )
font = [fm convertFont:font toHaveTrait:NSItalicFontMask];
[cell setFont:font];
}
//else: can't change font if the cell doesn't have any
}
// we can set font for any cell but only NSTextFieldCell provides a