LANCommander/LANCommander.Launcher/App.axaml
2026-06-14 21:24:07 -05:00

109 lines
5.8 KiB
XML

<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:LANCommander.Launcher.Converters"
x:Class="LANCommander.Launcher.App"
RequestedThemeVariant="Dark">
<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://LANCommander.Launcher/Theme/LANCommander.axaml" />
<StyleInclude Source="avares://LANCommander.Launcher/Theme/Carousel.axaml" />
<StyleInclude Source="avares://LANCommander.Launcher/Theme/Badge.axaml" />
<!-- Global control defaults -->
<Style Selector="Button,IconButton">
<Setter Property="Cursor" Value="Hand" />
</Style>
<Style Selector="ToggleButton">
<Setter Property="Cursor" Value="Hand" />
</Style>
<Style Selector="Button.Large, SplitButton.Large">
<Setter Property="Padding" Value="24, 14" />
<Setter Property="FontSize" Value="16" />
</Style>
<!-- System tray menu. Avalonia's Win32 tray popup is a Window named
"AvaloniaTrayPopupRoot_<tooltip>"; our tooltip is "LANCommander"
(see TrayIconExtensions). The menu mixes icon items (recently played
games) with text-only items (Depot/Library/Settings/Exit). These styles
are scoped to that window so the in-app menus are unaffected. -->
<!-- Symmetric padding so item text is vertically centered. The Fluent default
(11,4,11,7) is bottom-heavy, which leaves the text a couple px above center. -->
<Style Selector="Window#AvaloniaTrayPopupRoot_LANCommander MenuItem">
<Setter Property="Padding" Value="11,6,11,6" />
</Style>
<!-- Text-only items have no icon, but Fluent reserves a shared icon column so
every item aligns. That column can't be removed from a style (the template
sets the shared-size scope as a local value), so instead pull icon-less
items' text left by the icon column width (icon 16 + 12 right margin = 28)
so they sit flush-left at the games' icon edge, not at the game titles. -->
<Style Selector="Window#AvaloniaTrayPopupRoot_LANCommander MenuItem:not(:icon) /template/ ContentPresenter#PART_HeaderPresenter">
<Setter Property="Margin" Value="-28,0,0,0" />
</Style>
<!-- Make the section separators span the full menu width. -->
<Style Selector="Window#AvaloniaTrayPopupRoot_LANCommander Separator">
<Setter Property="Margin" Value="0,4,0,4" />
</Style>
<!-- Offset the vertical scrollbar so it doesn't overlap the floating titlebar -->
<Style Selector="ScrollViewer.TitlebarOffset /template/ ScrollBar#PART_VerticalScrollBar">
<Setter Property="Margin" Value="0,40,0,0" />
</Style>
<Style Selector="ListBox.TitlebarOffset /template/ ScrollViewer /template/ ScrollBar#PART_VerticalScrollBar">
<Setter Property="Margin" Value="0,40,0,0" />
</Style>
<!-- Icon control template (PathIcon ControlTheme is not inherited by subclasses in Avalonia 11) -->
<!-- Default: stroke-based rendering for Regular, Light, Thin, DuoTone, Bold variants -->
<Style Selector="Icon">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="ClipToBounds" Value="False" />
<Setter Property="Template">
<ControlTemplate>
<Path Fill="Transparent"
Stroke="{TemplateBinding Foreground}"
StrokeThickness="1"
Data="{TemplateBinding Data}"
Stretch="Uniform"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</ControlTemplate>
</Setter>
</Style>
<!-- Fill variant: fill-based rendering (closed shapes, no stroke needed) -->
<Style Selector="Icon[Type=Fill]">
<Setter Property="Template">
<ControlTemplate>
<Path Fill="{TemplateBinding Foreground}"
Stroke="Transparent"
Data="{TemplateBinding Data}"
Stretch="Uniform"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</ControlTemplate>
</Setter>
</Style>
</Application.Styles>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://LANCommander.Launcher/Assets/Icons/Bold.axaml" />
<ResourceInclude Source="avares://LANCommander.Launcher/Assets/Icons/DuoTone.axaml" />
<ResourceInclude Source="avares://LANCommander.Launcher/Assets/Icons/Fill.axaml" />
<ResourceInclude Source="avares://LANCommander.Launcher/Assets/Icons/Light.axaml" />
<ResourceInclude Source="avares://LANCommander.Launcher/Assets/Icons/Regular.axaml" />
<ResourceInclude Source="avares://LANCommander.Launcher/Assets/Icons/Thin.axaml" />
<ResourceInclude Source="avares://LANCommander.Launcher/Assets/Localization/en-US.axaml" />
<ResourceInclude Source="avares://LANCommander.Launcher/Theme/ColorPalette.axaml" />
</ResourceDictionary.MergedDictionaries>
<converters:MultiplyConverter x:Key="MultiplyConverter" />
<converters:StringFormatConverter x:Key="StringFormatConverter" />
</ResourceDictionary>
</Application.Resources>
</Application>