feat: windows条件编译

This commit is contained in:
liushuai07 2024-10-20 00:57:22 +08:00
parent cb6ab3c8b3
commit dad221f0a5
7 changed files with 1129 additions and 1115 deletions

View File

@ -1,5 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<DefineConstants>PLATFORM_WINDOWS</DefineConstants>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\..\build\Common.props"/>
<Import Project="$(MSBuildThisFileDirectory)..\..\build\Nuget.props"/>

View File

@ -5,7 +5,10 @@ using Avalonia.Controls.Primitives.PopupPositioning;
using Avalonia.Media;
using Avalonia.Platform;
using Avalonia.VisualTree;
#if PLATFORM_WINDOWS
using AtomUI.Platform.Windows;
#endif
namespace AtomUI.MotionScene;
@ -39,10 +42,12 @@ internal class SceneLayer : WindowBase, IHostedVisualTreeRoot, IDisposable
{
ParentTopLevel = parent;
impl.SetWindowManagerAddShadowHint(false);
#if PLATFORM_WINDOWS
if (this is WindowBase window)
{
window.SetTransparentForMouseEvents(true);
}
#endif
if (PlatformImpl?.PopupPositioner is ManagedPopupPositioner managedPopupPositioner)
{

View File

@ -10,8 +10,6 @@
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.ArrowDecoratedBoxTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.Badge.CountBadgeAdornerTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.Badge.DotBadgeAdornerTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.ButtonSpinnerInnerBoxTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.ButtonSpinnerTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.DefaultButtonTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.DropdownButtonTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.IconButtonTheme());
@ -20,6 +18,8 @@
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.SplitButtonTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.TextButtonTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.ToggleIconButtonTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.ButtonSpinnerInnerBoxTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.ButtonSpinnerTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.BaseCalendarButtonTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.BaseCalendarDayButtonTheme());
ThemeManager.Current.RegisterControlTheme(new AtomUI.Controls.CalendarItemTheme());

View File

@ -8,8 +8,8 @@
ThemeManager.Current.RegisterControlTokenType(typeof(AtomUI.Controls.AlertToken));
ThemeManager.Current.RegisterControlTokenType(typeof(AtomUI.Controls.ArrowDecoratedBoxToken));
ThemeManager.Current.RegisterControlTokenType(typeof(AtomUI.Controls.BadgeToken));
ThemeManager.Current.RegisterControlTokenType(typeof(AtomUI.Controls.ButtonSpinnerToken));
ThemeManager.Current.RegisterControlTokenType(typeof(AtomUI.Controls.ButtonToken));
ThemeManager.Current.RegisterControlTokenType(typeof(AtomUI.Controls.ButtonSpinnerToken));
ThemeManager.Current.RegisterControlTokenType(typeof(AtomUI.Controls.CalendarToken));
ThemeManager.Current.RegisterControlTokenType(typeof(AtomUI.Controls.CheckBoxToken));
ThemeManager.Current.RegisterControlTokenType(typeof(AtomUI.Controls.CollapseToken));

View File

@ -70,18 +70,6 @@ namespace AtomUI.Theme.Styling
public static readonly TokenResourceKey CountBadgeCornerRadiusSM = new TokenResourceKey("Badge.CountBadgeCornerRadiusSM", "AtomUI.Token");
}
public static class ButtonSpinnerTokenResourceKey
{
public static readonly TokenResourceKey ControlWidth = new TokenResourceKey("ButtonSpinner.ControlWidth", "AtomUI.Token");
public static readonly TokenResourceKey HandleWidth = new TokenResourceKey("ButtonSpinner.HandleWidth", "AtomUI.Token");
public static readonly TokenResourceKey HandleIconSize = new TokenResourceKey("ButtonSpinner.HandleIconSize", "AtomUI.Token");
public static readonly TokenResourceKey HandleBg = new TokenResourceKey("ButtonSpinner.HandleBg", "AtomUI.Token");
public static readonly TokenResourceKey HandleActiveBg = new TokenResourceKey("ButtonSpinner.HandleActiveBg", "AtomUI.Token");
public static readonly TokenResourceKey HandleHoverColor = new TokenResourceKey("ButtonSpinner.HandleHoverColor", "AtomUI.Token");
public static readonly TokenResourceKey HandleBorderColor = new TokenResourceKey("ButtonSpinner.HandleBorderColor", "AtomUI.Token");
public static readonly TokenResourceKey FilledHandleBg = new TokenResourceKey("ButtonSpinner.FilledHandleBg", "AtomUI.Token");
}
public static class ButtonTokenResourceKey
{
public static readonly TokenResourceKey FontWeight = new TokenResourceKey("Button.FontWeight", "AtomUI.Token");
@ -132,6 +120,18 @@ namespace AtomUI.Theme.Styling
public static readonly TokenResourceKey IconOnyPaddingSM = new TokenResourceKey("Button.IconOnyPaddingSM", "AtomUI.Token");
}
public static class ButtonSpinnerTokenResourceKey
{
public static readonly TokenResourceKey ControlWidth = new TokenResourceKey("ButtonSpinner.ControlWidth", "AtomUI.Token");
public static readonly TokenResourceKey HandleWidth = new TokenResourceKey("ButtonSpinner.HandleWidth", "AtomUI.Token");
public static readonly TokenResourceKey HandleIconSize = new TokenResourceKey("ButtonSpinner.HandleIconSize", "AtomUI.Token");
public static readonly TokenResourceKey HandleBg = new TokenResourceKey("ButtonSpinner.HandleBg", "AtomUI.Token");
public static readonly TokenResourceKey HandleActiveBg = new TokenResourceKey("ButtonSpinner.HandleActiveBg", "AtomUI.Token");
public static readonly TokenResourceKey HandleHoverColor = new TokenResourceKey("ButtonSpinner.HandleHoverColor", "AtomUI.Token");
public static readonly TokenResourceKey HandleBorderColor = new TokenResourceKey("ButtonSpinner.HandleBorderColor", "AtomUI.Token");
public static readonly TokenResourceKey FilledHandleBg = new TokenResourceKey("ButtonSpinner.FilledHandleBg", "AtomUI.Token");
}
public static class CalendarTokenResourceKey
{
public static readonly TokenResourceKey CellHoverBg = new TokenResourceKey("Calendar.CellHoverBg", "AtomUI.Token");

View File

@ -2,7 +2,10 @@
using System.Reflection;
using AtomUI.Controls.Primitives;
using AtomUI.Media;
#if PLATFORM_WINDOWS
using AtomUI.Platform.Windows;
#endif
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
@ -41,10 +44,12 @@ internal class PopupShadowLayer : LiteWindow, IShadowDecorator
: base(topLevel, topLevel.PlatformImpl?.CreatePopup()!)
{
Background = new SolidColorBrush(Colors.Transparent);
#if PLATFORM_WINDOWS
if (this is WindowBase window)
{
window.SetTransparentForMouseEvents(true);
}
#endif
if (PlatformImpl?.PopupPositioner is ManagedPopupPositioner managedPopupPositioner)
{