feat: remove caption buttons on macOS.

This commit is contained in:
Zhang Dian
2024-07-18 12:41:59 +08:00
parent dcde3c0e91
commit 1304d9e0c7
2 changed files with 40 additions and 17 deletions

View File

@@ -11,7 +11,7 @@
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:CompileBindings="True" x:CompileBindings="True"
IsFullScreenButtonVisible="True" IsFullScreenButtonVisible="{OnPlatform True,macOS=False}"
x:DataType="viewModels:MainWindowViewModel" x:DataType="viewModels:MainWindowViewModel"
Icon="/Assets/Ursa.ico" Icon="/Assets/Ursa.ico"
mc:Ignorable="d"> mc:Ignorable="d">

View File

@@ -2,7 +2,6 @@
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa"> xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here -->
<ControlTheme x:Key="{x:Type u:UrsaWindow}" TargetType="u:UrsaWindow"> <ControlTheme x:Key="{x:Type u:UrsaWindow}" TargetType="u:UrsaWindow">
<Setter Property="Background" Value="{DynamicResource WindowDefaultBackground}" /> <Setter Property="Background" Value="{DynamicResource WindowDefaultBackground}" />
<Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource WindowDefaultBackground}" /> <Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource WindowDefaultBackground}" />
@@ -11,23 +10,47 @@
<Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}" /> <Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}" />
<Setter Property="ExtendClientAreaTitleBarHeightHint" Value="-1" /> <Setter Property="ExtendClientAreaTitleBarHeightHint" Value="-1" />
<Setter Property="ExtendClientAreaToDecorationsHint" Value="True" /> <Setter Property="ExtendClientAreaToDecorationsHint" Value="True" />
<Setter Property="u:OverlayDialogHost.IsModalStatusScope" Value="True"/> <Setter Property="u:OverlayDialogHost.IsModalStatusScope" Value="True" />
<Setter Property="IsMinimizeButtonVisible">
<OnPlatform>
<On Options="Default, Windows, Linux">
<x:Boolean>True</x:Boolean>
</On>
<On Options="macOS">
<x:Boolean>False</x:Boolean>
</On>
</OnPlatform>
</Setter>
<Setter Property="IsRestoreButtonVisible">
<OnPlatform>
<On Options="Default, Windows, Linux">
<x:Boolean>True</x:Boolean>
</On>
<On Options="macOS">
<x:Boolean>False</x:Boolean>
</On>
</OnPlatform>
</Setter>
<Setter Property="IsCloseButtonVisible">
<OnPlatform>
<On Options="Default, Windows, Linux">
<x:Boolean>True</x:Boolean>
</On>
<On Options="macOS">
<x:Boolean>False</x:Boolean>
</On>
</OnPlatform>
</Setter>
<Setter Property="SystemDecorations"> <Setter Property="SystemDecorations">
<OnPlatform> <OnPlatform>
<OnPlatform.Default> <On Options="Default, Windows, macOS">
<SystemDecorations>Full</SystemDecorations> <SystemDecorations>Full</SystemDecorations>
</OnPlatform.Default> </On>
<OnPlatform.macOS> <On Options="Linux">
<SystemDecorations>Full</SystemDecorations>
</OnPlatform.macOS>
<OnPlatform.Linux>
<SystemDecorations>None</SystemDecorations> <SystemDecorations>None</SystemDecorations>
</OnPlatform.Linux> </On>
<OnPlatform.Windows>
<SystemDecorations>Full</SystemDecorations>
</OnPlatform.Windows>
</OnPlatform> </OnPlatform>
</Setter> </Setter>
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="u:UrsaWindow"> <ControlTemplate TargetType="u:UrsaWindow">
<Panel> <Panel>
@@ -41,7 +64,7 @@
Margin="{Binding $parent[u:UrsaWindow].TitleBarMargin}" Margin="{Binding $parent[u:UrsaWindow].TitleBarMargin}"
LeftContent="{Binding $parent[u:UrsaWindow].LeftContent}" LeftContent="{Binding $parent[u:UrsaWindow].LeftContent}"
RightContent="{Binding $parent[u:UrsaWindow].RightContent}" /> RightContent="{Binding $parent[u:UrsaWindow].RightContent}" />
<u:OverlayDialogHost/> <u:OverlayDialogHost />
</VisualLayerManager.ChromeOverlayLayer> </VisualLayerManager.ChromeOverlayLayer>
<Panel> <Panel>
<ContentPresenter <ContentPresenter
@@ -121,7 +144,7 @@
Data="{DynamicResource WindowMinimizeGlyph}" Data="{DynamicResource WindowMinimizeGlyph}"
Foreground="{Binding $parent[Button].Foreground}" /> Foreground="{Binding $parent[Button].Foreground}" />
</Button> </Button>
<Button x:Name="PART_RestoreButton" Theme="{DynamicResource CaptionButton}" > <Button x:Name="PART_RestoreButton" Theme="{DynamicResource CaptionButton}">
<PathIcon <PathIcon
Name="PART_RestoreButtonIcon" Name="PART_RestoreButtonIcon"
Width="12" Width="12"
@@ -152,4 +175,4 @@
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</ControlTheme> </ControlTheme>
</ResourceDictionary> </ResourceDictionary>