wxMac: Fixed wxListCtrl to respect items' non-default fonts.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@52243 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2008-03-02 10:43:48 +00:00
parent fff10a73bf
commit 17dd3f27e0
3 changed files with 33 additions and 5 deletions

View File

@@ -752,6 +752,12 @@ bool wxListCtrl::Create(wxWindow *parent,
(EventHandlerRef *)&m_macListCtrlEventHandler);
}
// set the default font to slightly smaller font that the native
// DataBrowser control uses:
wxFont font;
font.MacCreateThemeFont(kThemeViewsFont);
m_font = font;
return true;
}
@@ -772,6 +778,18 @@ wxListCtrl::~wxListCtrl()
delete m_renameTimer;
}
/*static*/
wxVisualAttributes wxListCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
{
wxVisualAttributes attr;
attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
attr.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
attr.font.MacCreateThemeFont(kThemeViewsFont);
return attr;
}
// ----------------------------------------------------------------------------
// set/get/change style
// ----------------------------------------------------------------------------
@@ -2707,9 +2725,8 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
if (bgColor == wxNullColour)
bgColor = listBgColor;
wxFont listFont = list->GetFont();
if (font == wxNullFont)
font = listFont;
if (!font.Ok())
font = list->GetFont();
wxMacCFStringHolder cfString;
cfString.Assign( text, wxLocale::GetSystemEncoding() );
@@ -2832,8 +2849,7 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
if (font.Ok())
{
if (font.GetFamily() != wxFONTFAMILY_DEFAULT)
info.fontID = font.MacGetThemeFontID();
info.fontID = font.MacGetThemeFontID();
::TextSize( (short)(font.MacGetFontSize()) ) ;
::TextFace( font.MacGetFontStyle() ) ;