<window:StyleableAppWindow
    x:Class="Ryujinx.Ava.UI.Windows.SettingsWindow"
    xmlns="https://github.com/avaloniaui"
    xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:window="clr-namespace:Ryujinx.Ava.UI.Windows"
    xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
    xmlns:settings="clr-namespace:Ryujinx.Ava.UI.Views.Settings"
    xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
    xmlns:helper="clr-namespace:Ryujinx.Common.Helper;assembly=Ryujinx.Common"
    xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
    Width="1100"
    MinWidth="844"
    MinHeight="480"
    Title="{ext:WindowTitle Settings}"
    WindowStartupLocation="CenterOwner"
    x:DataType="viewModels:SettingsViewModel"
    mc:Ignorable="d"
    Focusable="True">
    <Design.DataContext>
        <viewModels:SettingsViewModel />
    </Design.DataContext>
    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinWidth="600" RowDefinitions="Auto,Auto,*,Auto">
        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <controls:RyujinxLogo
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                Margin="7, 7, 7, 0"
                ToolTip.Tip="{ext:WindowTitle Settings}"/>
        </StackPanel>
        <ContentPresenter
            x:Name="ContentPresenter"
            Grid.Row="2"
            IsVisible="False"
            KeyboardNavigation.IsTabStop="False"/>
        <Grid Name="Pages" IsVisible="False" Grid.Row="3">
            <settings:SettingsUiView Name="UiPage" />
            <settings:SettingsInputView Name="InputPage" />
            <settings:SettingsHotkeysView Name="HotkeysPage" />
            <settings:SettingsSystemView Name="SystemPage" />
            <settings:SettingsCPUView Name="CpuPage" />
            <settings:SettingsGraphicsView Name="GraphicsPage" />
            <settings:SettingsAudioView Name="AudioPage" />
            <settings:SettingsNetworkView Name="NetworkPage" />
            <settings:SettingsLoggingView Name="LoggingPage" />
            <settings:SettingsHacksView Name="HacksPage" />
        </Grid>
        <ui:NavigationView
            Grid.Row="2"
            IsSettingsVisible="False"
            Name="NavPanel"
            IsBackEnabled="False"
            Margin="10,10,10,0"
            VerticalAlignment="Stretch"
            HorizontalAlignment="Stretch"
            OpenPaneLength="200">
            <ui:NavigationView.MenuItems>
                <ui:NavigationViewItem
                    IsSelected="True"
                    Content="{ext:Locale SettingsTabGeneral}"
                    Tag="UiPage"
                    IconSource="New" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabInput}"
                    Tag="InputPage"
                    IconSource="Games" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabHotkeys}"
                    Tag="HotkeysPage"
                    IconSource="Keyboard" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabSystem}"
                    Tag="SystemPage"
                    IconSource="Settings" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabCpu}"
                    Tag="CpuPage">
                    <ui:NavigationViewItem.IconSource>
                        <ui:FontIconSource
                            FontFamily="avares://Ryujinx/Assets/Fonts#Segoe Fluent Icons"
                            Glyph="{helpers:GlyphValueConverter Chip}" />
                    </ui:NavigationViewItem.IconSource>
                </ui:NavigationViewItem>
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabGraphics}"
                    Tag="GraphicsPage"
                    IconSource="Image" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabAudio}"
                    IconSource="Audio"
                    Tag="AudioPage" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabNetwork}"
                    Tag="NetworkPage"
                    IconSource="Globe" />
                <ui:NavigationViewItem
                    Content="{ext:Locale SettingsTabLogging}"
                    Tag="LoggingPage"
                    IconSource="Document" />
                <ui:NavigationViewItem
                    IsVisible="{Binding ShowDirtyHacks}"
                    Content="Dirty Hacks"
                    Tag="HacksPage"
                    IconSource="Code" />
            </ui:NavigationView.MenuItems>
            <ui:NavigationView.Styles>
                <Style Selector="Grid#PlaceholderGrid">
                    <Setter Property="Height" Value="40" />
                </Style>
                <Style Selector="ui|NavigationViewItem ui|SymbolIcon">
                    <Setter Property="FlowDirection" Value="LeftToRight" />
                </Style>
            </ui:NavigationView.Styles>
        </ui:NavigationView>
        <Grid Grid.Row="3"
              ColumnDefinitions="Auto,*,Auto">
            <StackPanel Grid.Column="0" Orientation="Horizontal">
                <Button
                    IsEnabled="{Binding WantsToReset}"
                    Margin="10"
                    Content="{ext:Locale SettingsButtonReset}"
                    Command="{Binding ResetButton}" />
                <CheckBox IsChecked="{Binding WantsToReset}"/>
                <TextBlock Text="{ext:Locale SettingsButtonResetConfirm}"/>
            </StackPanel>
            <ReversibleStackPanel
                Grid.Column="2"
                Margin="10"
                Spacing="10"
                Orientation="Horizontal"
                HorizontalAlignment="Right"
                ReverseOrder="{x:Static helper:RunningPlatform.IsMacOS}">
                <Button
                    Classes="accent"
                    Content="{ext:Locale SettingsButtonOk}"
                    Command="{Binding OkButton}" />
                <Button
                    HotKey="Escape"
                    Content="{ext:Locale SettingsButtonCancel}"
                    Command="{Binding CancelButton}" />
                <Button
                    Content="{ext:Locale SettingsButtonApply}"
                    Command="{Binding ApplyButton}" />
            </ReversibleStackPanel>
        </Grid>
    </Grid>
</window:StyleableAppWindow>
