Skip to content

Commit

Permalink
Merge pull request picoe#2563 from cwensley/curtis/mac-fix-gridview-b…
Browse files Browse the repository at this point in the history
…ackground-on-sonoma

Mac: Fix setting background of cells on Sonoma
  • Loading branch information
cwensley authored Oct 17, 2023
2 parents fdcd583 + f2a29fc commit 74ef2cf
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Eto.Mac/Forms/Cells/CustomCellHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public override void DrawRect(CGRect dirtyRect)
if (DrawsBackground && BackgroundColor != null && BackgroundColor.AlphaComponent > 0)
{
BackgroundColor.Set();
NSGraphics.RectFill(dirtyRect);
NSGraphics.RectFill(Bounds);
}
base.DrawRect(dirtyRect);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Eto.Mac/Forms/Cells/DrawableCellHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ public override void DrawRect(CGRect dirtyRect)
var nscontext = NSGraphicsContext.CurrentContext;
var isFirstResponder = Window?.FirstResponder == this;

var cellFrame = Bounds;
if (DrawsBackground)
{
var context = nscontext.CGContext;
context.SetFillColor(BackgroundColor.ToCG());
context.FillRect(dirtyRect);
context.FillRect(cellFrame);
}
var cellFrame = Bounds;

var handler = Handler;
if (handler == null)
Expand Down
2 changes: 1 addition & 1 deletion src/Eto.Mac/Forms/Cells/ImageViewCellHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public override void DrawRect(CGRect dirtyRect)
if (BackgroundColor != null && BackgroundColor.AlphaComponent > 0)
{
BackgroundColor.Set();
NSGraphics.RectFill(dirtyRect);
NSGraphics.RectFill(Bounds);
}
base.DrawRect(dirtyRect);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Eto.Mac/Forms/Controls/GridViewHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override void DrawBackground(CGRect clipRect)
if (backgroundColor != Colors.Transparent)
{
backgroundColor.ToNSUI().Set();
NSGraphics.RectFill(clipRect);
NSGraphics.RectFill(Bounds);
}
else
base.DrawBackground(clipRect);
Expand Down
4 changes: 2 additions & 2 deletions src/Eto.Mac/Forms/Controls/MacImageTextView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ NSTextField CreateTextFieldInternal()

public override void DrawRect(CGRect dirtyRect)
{
var bounds = Bounds;
if (BetterBackgroundColor != null)
{
BetterBackgroundColor.SetFill();
NSGraphics.RectFill(dirtyRect);
NSGraphics.RectFill(bounds);
}

if (_image != null)
{
var context = NSGraphicsContext.CurrentContext;
var bounds = Bounds;

var imageRect = new CGRect(0, bounds.Y, _imageSize.Width, _imageSize.Height);
imageRect.Y += (bounds.Height - _imageSize.Height) / 2;
Expand Down
2 changes: 1 addition & 1 deletion src/Eto.Mac/Forms/Controls/TreeViewHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public override void DrawBackground(CGRect clipRect)
if (backgroundColor != Colors.Transparent)
{
backgroundColor.ToNSUI().Set();
NSGraphics.RectFill(clipRect);
NSGraphics.RectFill(Bounds);
return;
}
}
Expand Down

0 comments on commit 74ef2cf

Please sign in to comment.