Browse Source

Merge branch 'master' into features/win32-allow-cancel-app-shutdown

pull/6310/head
Dan Walmsley 5 years ago
committed by GitHub
parent
commit
cedd5b5774
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      native/Avalonia.Native/src/OSX/window.mm
  2. 20
      src/Avalonia.Visuals/Media/DrawingGroup.cs

2
native/Avalonia.Native/src/OSX/window.mm

@ -52,6 +52,7 @@ public:
[Window setBackingType:NSBackingStoreBuffered]; [Window setBackingType:NSBackingStoreBuffered];
[Window setOpaque:false]; [Window setOpaque:false];
[Window setContentView: StandardContainer];
} }
virtual HRESULT ObtainNSWindowHandle(void** ret) override virtual HRESULT ObtainNSWindowHandle(void** ret) override
@ -124,7 +125,6 @@ public:
SetPosition(lastPositionSet); SetPosition(lastPositionSet);
UpdateStyle(); UpdateStyle();
[Window setContentView: StandardContainer];
[Window setTitle:_lastTitle]; [Window setTitle:_lastTitle];
if(ShouldTakeFocusOnShow() && activate) if(ShouldTakeFocusOnShow() && activate)

20
src/Avalonia.Visuals/Media/DrawingGroup.cs

@ -12,6 +12,12 @@ namespace Avalonia.Media
public static readonly StyledProperty<Transform> TransformProperty = public static readonly StyledProperty<Transform> TransformProperty =
AvaloniaProperty.Register<DrawingGroup, Transform>(nameof(Transform)); AvaloniaProperty.Register<DrawingGroup, Transform>(nameof(Transform));
public static readonly StyledProperty<Geometry> ClipGeometryProperty =
AvaloniaProperty.Register<DrawingGroup, Geometry>(nameof(ClipGeometry));
public static readonly StyledProperty<IBrush> OpacityMaskProperty =
AvaloniaProperty.Register<DrawingGroup, IBrush>(nameof(OpacityMask));
public double Opacity public double Opacity
{ {
get => GetValue(OpacityProperty); get => GetValue(OpacityProperty);
@ -24,6 +30,18 @@ namespace Avalonia.Media
set => SetValue(TransformProperty, value); set => SetValue(TransformProperty, value);
} }
public Geometry ClipGeometry
{
get => GetValue(ClipGeometryProperty);
set => SetValue(ClipGeometryProperty, value);
}
public IBrush OpacityMask
{
get => GetValue(OpacityMaskProperty);
set => SetValue(OpacityMaskProperty, value);
}
[Content] [Content]
public AvaloniaList<Drawing> Children { get; } = new AvaloniaList<Drawing>(); public AvaloniaList<Drawing> Children { get; } = new AvaloniaList<Drawing>();
@ -31,6 +49,8 @@ namespace Avalonia.Media
{ {
using (context.PushPreTransform(Transform?.Value ?? Matrix.Identity)) using (context.PushPreTransform(Transform?.Value ?? Matrix.Identity))
using (context.PushOpacity(Opacity)) using (context.PushOpacity(Opacity))
using (ClipGeometry != null ? context.PushGeometryClip(ClipGeometry) : default(DrawingContext.PushedState))
using (OpacityMask != null ? context.PushOpacityMask(OpacityMask, GetBounds()) : default(DrawingContext.PushedState))
{ {
foreach (var drawing in Children) foreach (var drawing in Children)
{ {

Loading…
Cancel
Save