diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs index c12362c..12f16b1 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/CommonBrushLayer.cs @@ -6,13 +6,19 @@ using Xamarin.PropertyEditing.Drawing; namespace Xamarin.PropertyEditing.Mac { - internal class CommonBrushLayer : CALayer + internal class CommonBrushLayer + : CALayer { - public CommonBrushLayer () + public CommonBrushLayer (IHostResourceProvider hostResources) { - this.CornerRadius = 3; - this.BorderColor = new CGColor (.5f, .5f, .5f, .5f); - this.BorderWidth = 1; + if (hostResources == null) + throw new ArgumentNullException (nameof (hostResources)); + + this.hostResources = hostResources; + + CornerRadius = 3; + BorderColor = new CGColor (.5f, .5f, .5f, .5f); + BorderWidth = 1; MasksToBounds = true; } @@ -63,7 +69,7 @@ namespace Xamarin.PropertyEditing.Mac { base.LayoutSublayers (); BrushLayer.Frame = Bounds; - Contents = DrawingExtensions.GenerateCheckerboard (Bounds); + Contents = DrawingExtensions.GenerateCheckerboard (Bounds, this.hostResources.GetNamedColor (NamedResources.Checkerboard0Color), this.hostResources.GetNamedColor (NamedResources.Checkerboard0Color)); } public NSImage RenderPreview () @@ -84,5 +90,7 @@ namespace Xamarin.PropertyEditing.Mac } } } + + private readonly IHostResourceProvider hostResources; } } |