forked from AvaloniaUI/Avalonia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace WindowTransparencyLevel enum with list of structs
The transparency level is not yet communicated to the backends though. Co-Authored-By: Max Katz <[email protected]>
- Loading branch information
Showing
13 changed files
with
211 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,51 @@ | ||
namespace Avalonia.Controls | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
|
||
namespace Avalonia.Controls; | ||
|
||
public readonly record struct WindowTransparencyLevel | ||
{ | ||
public enum WindowTransparencyLevel | ||
private readonly string _value; | ||
|
||
private WindowTransparencyLevel(string value) | ||
{ | ||
/// <summary> | ||
/// The window background is Black where nothing is drawn in the window. | ||
/// </summary> | ||
None, | ||
|
||
/// <summary> | ||
/// The window background is Transparent where nothing is drawn in the window. | ||
/// </summary> | ||
Transparent, | ||
|
||
/// <summary> | ||
/// The window background is a blur-behind where nothing is drawn in the window. | ||
/// </summary> | ||
Blur, | ||
|
||
/// <summary> | ||
/// The window background is a blur-behind with a high blur radius. This level may fallback to Blur. | ||
/// </summary> | ||
AcrylicBlur, | ||
|
||
/// <summary> | ||
/// Force acrylic on some incompatible versions of Windows 10. | ||
/// </summary> | ||
ForceAcrylicBlur, | ||
|
||
/// <summary> | ||
/// The window background is based on desktop wallpaper tint with a blur. This will only work on Windows 11 | ||
/// </summary> | ||
Mica | ||
_value = value; | ||
} | ||
|
||
/// <summary> | ||
/// The window background is Black where nothing is drawn in the window. | ||
/// </summary> | ||
public static WindowTransparencyLevel None { get; } = new(nameof(None)); | ||
|
||
/// <summary> | ||
/// The window background is Transparent where nothing is drawn in the window. | ||
/// </summary> | ||
public static WindowTransparencyLevel Transparent { get; } = new(nameof(Transparent)); | ||
|
||
/// <summary> | ||
/// The window background is a blur-behind where nothing is drawn in the window. | ||
/// </summary> | ||
public static WindowTransparencyLevel Blur { get; } = new(nameof(Blur)); | ||
|
||
/// <summary> | ||
/// The window background is a blur-behind with a high blur radius. This level may fallback to Blur. | ||
/// </summary> | ||
public static WindowTransparencyLevel AcrylicBlur { get; } = new(nameof(AcrylicBlur)); | ||
|
||
/// <summary> | ||
/// The window background is based on desktop wallpaper tint with a blur. This will only work on Windows 11 | ||
/// </summary> | ||
public static WindowTransparencyLevel Mica { get; } = new(nameof(Mica)); | ||
|
||
public override string ToString() | ||
{ | ||
return _value; | ||
} | ||
} | ||
|
||
public class WindowTransparencyLevelCollection : ReadOnlyCollection<WindowTransparencyLevel> | ||
{ | ||
public WindowTransparencyLevelCollection(IList<WindowTransparencyLevel> list) : base(list) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.