X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8b4b586ce92d44e8689b8eab5c25be4bc56d98f6..3e1924dd5f5744c3e2a8973de9b3e4f372b7fd85:/src/mac/carbon/listctrl_mac.cpp diff --git a/src/mac/carbon/listctrl_mac.cpp b/src/mac/carbon/listctrl_mac.cpp index fc27f289ef..e307203d98 100644 --- a/src/mac/carbon/listctrl_mac.cpp +++ b/src/mac/carbon/listctrl_mac.cpp @@ -30,6 +30,7 @@ #ifndef WX_PRECOMP #include "wx/intl.h" + #include "wx/settings.h" #endif #include "wx/mac/uma.h" @@ -772,6 +773,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.MacCreateFromThemeFont(kThemeViewsFont); + + return attr; +} + // ---------------------------------------------------------------------------- // set/get/change style // ---------------------------------------------------------------------------- @@ -967,7 +980,7 @@ bool wxListCtrl::SetColumn(int col, wxListItem& item) { wxFontEncoding enc; if ( m_font.Ok() ) - enc = m_font.GetEncoding(); + enc = GetFont().GetEncoding(); else enc = wxLocale::GetSystemEncoding(); wxCFStringRef cfTitle; @@ -2700,9 +2713,8 @@ void wxMacDataBrowserListCtrlControl::DrawItem( if (bgColor == wxNullColour) bgColor = listBgColor; - wxFont listFont = list->GetFont(); - if (font == wxNullFont) - font = listFont; + if (!font.Ok()) + font = list->GetFont(); wxCFStringRef cfString( text, wxLocale::GetSystemEncoding() ); @@ -2755,9 +2767,9 @@ void wxMacDataBrowserListCtrlControl::DrawItem( } CGContextSaveGState(context); - CGContextSetRGBFillColor(context, (float)backgroundColor.red / (float)USHRT_MAX, - (float)backgroundColor.green / (float)USHRT_MAX, - (float)backgroundColor.blue / (float)USHRT_MAX, 1.0); + CGContextSetRGBFillColor(context, (CGFloat)backgroundColor.red / (CGFloat)USHRT_MAX, + (CGFloat)backgroundColor.green / (CGFloat)USHRT_MAX, + (CGFloat)backgroundColor.blue / (CGFloat)USHRT_MAX, (CGFloat) 1.0); CGContextFillRect(context, enclosingCGRect); CGContextRestoreGState(context); @@ -2775,9 +2787,9 @@ void wxMacDataBrowserListCtrlControl::DrawItem( bgColor.GetRGBColor(&backgroundColor); CGContextSaveGState(context); - CGContextSetRGBFillColor(context, (float)backgroundColor.red / (float)USHRT_MAX, - (float)backgroundColor.green / (float)USHRT_MAX, - (float)backgroundColor.blue / (float)USHRT_MAX, 1.0); + CGContextSetRGBFillColor(context, (CGFloat)backgroundColor.red / (CGFloat)USHRT_MAX, + (CGFloat)backgroundColor.green / (CGFloat)USHRT_MAX, + (CGFloat)backgroundColor.blue / (CGFloat)USHRT_MAX, (CGFloat) 1.0); CGContextFillRect(context, enclosingCGRect); CGContextRestoreGState(context); @@ -2828,8 +2840,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() ) ; @@ -2860,9 +2871,9 @@ void wxMacDataBrowserListCtrlControl::DrawItem( info.truncationMaxLines = 1; CGContextSaveGState(context); - CGContextSetRGBFillColor (context, (float)labelColor.red / (float)USHRT_MAX, - (float)labelColor.green / (float)USHRT_MAX, - (float)labelColor.blue / (float)USHRT_MAX, 1.0); + CGContextSetRGBFillColor (context, (CGFloat)labelColor.red / (CGFloat)USHRT_MAX, + (CGFloat)labelColor.green / (CGFloat)USHRT_MAX, + (CGFloat)labelColor.blue / (CGFloat)USHRT_MAX, (CGFloat) 1.0); HIThemeDrawTextBox(cfString, &textCGRect, &info, context, kHIThemeOrientationNormal); @@ -2885,7 +2896,7 @@ OSStatus wxMacDataBrowserListCtrlControl::GetSetItemData(DataBrowserItemID itemI OSStatus err = errDataBrowserPropertyNotSupported; wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl ); - wxMacListCtrlItem* lcItem; + wxMacListCtrlItem* lcItem = NULL; if (listColumn >= 0) {