Fixed compilation for no CG mode

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@62130 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2009-09-25 15:50:22 +00:00
parent 4f9b623763
commit 639cf7e892

View File

@@ -2873,7 +2873,6 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
ThemeDrawingState savedState = NULL; ThemeDrawingState savedState = NULL;
#endif #endif
CGContextRef context = (CGContextRef)list->MacGetDrawingContext(); CGContextRef context = (CGContextRef)list->MacGetDrawingContext();
wxMacCGContextStateSaver top_saver_cg( context );
RGBColor labelColor; RGBColor labelColor;
labelColor.red = 0; labelColor.red = 0;
@@ -2918,13 +2917,14 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
GetThemeBrushAsColor(kThemeBrushSecondaryHighlightColor, 32, true, &backgroundColor); GetThemeBrushAsColor(kThemeBrushSecondaryHighlightColor, 32, true, &backgroundColor);
GetThemeTextColor(kThemeTextColorBlack, gdDepth, colorDevice, &labelColor); GetThemeTextColor(kThemeTextColorBlack, gdDepth, colorDevice, &labelColor);
} }
wxMacCGContextStateSaver cg( context ); CGContextSaveGState(context);
CGContextSetRGBFillColor(context, CGContextSetRGBFillColor(context,
(float)backgroundColor.red / (float)USHRT_MAX, (float)backgroundColor.red / (float)USHRT_MAX,
(float)backgroundColor.green / (float)USHRT_MAX, (float)backgroundColor.green / (float)USHRT_MAX,
(float)backgroundColor.blue / (float)USHRT_MAX, 1.0); (float)backgroundColor.blue / (float)USHRT_MAX, 1.0);
CGContextFillRect(context, enclosingCGRect); CGContextFillRect(context, enclosingCGRect);
CGContextRestoreGState(context);
} }
else else
{ {
@@ -2937,13 +2937,15 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
if (bgColor.Ok()) if (bgColor.Ok())
{ {
backgroundColor = MAC_WXCOLORREF( bgColor.GetPixel() ); backgroundColor = MAC_WXCOLORREF( bgColor.GetPixel() );
wxMacCGContextStateSaver cg( context ); CGContextSaveGState(context);
CGContextSetRGBFillColor(context, CGContextSetRGBFillColor(context,
(float)backgroundColor.red / (float)USHRT_MAX, (float)backgroundColor.red / (float)USHRT_MAX,
(float)backgroundColor.green / (float)USHRT_MAX, (float)backgroundColor.green / (float)USHRT_MAX,
(float)backgroundColor.blue / (float)USHRT_MAX, 1.0); (float)backgroundColor.blue / (float)USHRT_MAX, 1.0);
CGContextFillRect(context, enclosingCGRect); CGContextFillRect(context, enclosingCGRect);
CGContextRestoreGState(context);
} }
} }
@@ -2956,13 +2958,15 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
wxBitmap bmp = imageList->GetBitmap(imgIndex); wxBitmap bmp = imageList->GetBitmap(imgIndex);
IconRef icon = bmp.GetBitmapData()->GetIconRef(); IconRef icon = bmp.GetBitmapData()->GetIconRef();
wxMacCGContextStateSaver cg( context ); CGContextSaveGState(context);
CGContextTranslateCTM(context, 0,iconCGRect.origin.y + CGRectGetMaxY(iconCGRect)); CGContextTranslateCTM(context, 0,iconCGRect.origin.y + CGRectGetMaxY(iconCGRect));
CGContextScaleCTM(context,1.0f,-1.0f); CGContextScaleCTM(context,1.0f,-1.0f);
PlotIconRefInContext(context, &iconCGRect, kAlignNone, PlotIconRefInContext(context, &iconCGRect, kAlignNone,
active ? kTransformNone : kTransformDisabled, NULL, active ? kTransformNone : kTransformDisabled, NULL,
kPlotIconRefNormalFlags, icon); kPlotIconRefNormalFlags, icon);
CGContextRestoreGState(context);
} }
} }
@@ -3012,14 +3016,13 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
info.truncationPosition = kHIThemeTextTruncationEnd; info.truncationPosition = kHIThemeTextTruncationEnd;
info.truncationMaxLines = 1; info.truncationMaxLines = 1;
{ CGContextSaveGState(context);
wxMacCGContextStateSaver cg( context ); CGContextSetRGBFillColor (context, (float)labelColor.red / (float)USHRT_MAX,
CGContextSetRGBFillColor (context, (float)labelColor.red / (float)USHRT_MAX,
(float)labelColor.green / (float)USHRT_MAX, (float)labelColor.green / (float)USHRT_MAX,
(float)labelColor.blue / (float)USHRT_MAX, 1.0); (float)labelColor.blue / (float)USHRT_MAX, 1.0);
HIThemeDrawTextBox(cfString, &textCGRect, &info, context, kHIThemeOrientationNormal); HIThemeDrawTextBox(cfString, &textCGRect, &info, context, kHIThemeOrientationNormal);
} CGContextRestoreGState(context);
#ifndef __LP64__ #ifndef __LP64__
if (savedState != NULL) if (savedState != NULL)