<UserControl
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
    xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
    xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
    mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
    x:Class="Ryujinx.Ava.UI.Views.Main.MainStatusBarView"
    x:CompileBindings="True"
    x:DataType="viewModels:MainWindowViewModel">
    <Design.DataContext>
        <viewModels:MainWindowViewModel />
    </Design.DataContext>
    <Grid
        Name="StatusBar"
        Margin="0"
        MinHeight="22"
        HorizontalAlignment="Stretch"
        VerticalAlignment="Bottom"
        Background="{DynamicResource ThemeContentBackgroundColor}"
        DockPanel.Dock="Bottom"
        IsVisible="{Binding ShowMenuAndStatusBar}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <StackPanel
            Grid.Column="0"
            Margin="5"
            VerticalAlignment="Center"
            IsVisible="{Binding EnableNonGameRunningControls}">
            <Grid Margin="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Button
                    Width="25"
                    Height="25"
                    MinWidth="0"
                    Margin="0,0,5,0"
                    VerticalAlignment="Center"
                    Background="Transparent"
                    Command="{ReflectionBinding LoadApplications}">
                    <ui:SymbolIcon
                        Width="50"
                        Height="100"
                        Symbol="Refresh" />
                </Button>
                <TextBlock
                    Name="LoadStatus"
                    Grid.Column="1"
                    Margin="0,0,5,0"
                    VerticalAlignment="Center"
                    IsVisible="{Binding EnableNonGameRunningControls}"
                    Text="{locale:Locale StatusBarGamesLoaded}" />
                <ProgressBar
                    Name="LoadProgressBar"
                    Grid.Column="2"
                    Height="6"
                    VerticalAlignment="Center"
                    Foreground="{DynamicResource HighlightColor}"
                    IsVisible="{Binding StatusBarVisible}"
                    Maximum="{Binding StatusBarProgressMaximum}"
                    Value="{Binding StatusBarProgressValue}" />
            </Grid>
        </StackPanel>
        <StackPanel
            Grid.Column="1"
            Margin="0,2"
            HorizontalAlignment="Left"
            VerticalAlignment="Center"
            IsVisible="{Binding IsGameRunning}"
            MaxHeight="18"
            Orientation="Horizontal">
            <TextBlock
                Name="VsyncStatus"
                Margin="5,0,5,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                Foreground="{Binding VsyncColor}"
                IsVisible="{Binding !ShowLoadProgress}"
                PointerReleased="VsyncStatus_PointerReleased"
                Text="VSync"
                TextAlignment="Left" />
            <Border
                Width="2"
                Height="12"
                Margin="0"
                BorderBrush="Gray"
                BorderThickness="1"
                IsVisible="{Binding !ShowLoadProgress}" />
            <TextBlock
                Name="DockedStatus"
                Margin="5,0,5,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                IsVisible="{Binding !ShowLoadProgress}"
                PointerReleased="DockedStatus_PointerReleased"
                Text="{Binding DockedStatusText}"
                TextAlignment="Left" />
            <Border
                Width="2"
                Height="12"
                Margin="0"
                BorderBrush="Gray"
                BorderThickness="1"
                IsVisible="{Binding !ShowLoadProgress}" />
            <TextBlock
                Name="AspectRatioStatus"
                Margin="5,0,5,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                IsVisible="{Binding !ShowLoadProgress}"
                PointerReleased="AspectRatioStatus_PointerReleased"
                Text="{Binding AspectRatioStatusText}"
                TextAlignment="Left" />
            <Border
                Width="2"
                Height="12"
                Margin="0"
                BorderBrush="Gray"
                BorderThickness="1"
                IsVisible="{Binding !ShowLoadProgress}" />
            <ui:ToggleSplitButton
                Name="VolumeStatus"
                Padding="5,0,5,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                VerticalContentAlignment="Center"
                Background="{DynamicResource ThemeContentBackgroundColor}"
                BorderThickness="0"
                Content="{Binding VolumeStatusText}"
                IsChecked="{Binding VolumeMuted}"
                IsVisible="{Binding !ShowLoadProgress}">
                <ui:ToggleSplitButton.Flyout>
                    <Flyout Placement="Bottom" ShowMode="TransientWithDismissOnPointerMoveAway">
                        <Grid Margin="0">
                            <Slider
                                MaxHeight="40"
                                Width="150"
                                Margin="0"
                                Padding="0"
                                IsSnapToTickEnabled="True"
                                LargeChange="0.05"
                                Maximum="1"
                                Minimum="0"
                                SmallChange="0.01"
                                TickFrequency="0.05"
                                ToolTip.Tip="{locale:Locale AudioVolumeTooltip}"
                                Value="{Binding Volume}" />
                        </Grid>
                    </Flyout>
                </ui:ToggleSplitButton.Flyout>
            </ui:ToggleSplitButton>
            <Border
                Width="2"
                Height="12"
                Margin="0"
                BorderBrush="Gray"
                BorderThickness="1"
                IsVisible="{Binding !ShowLoadProgress}" />
            <TextBlock
                Margin="5,0,5,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                IsVisible="{Binding !ShowLoadProgress}"
                Text="{Binding GameStatusText}"
                TextAlignment="Left" />
            <Border
                Width="2"
                Height="12"
                Margin="0"
                BorderBrush="Gray"
                BorderThickness="1"
                IsVisible="{Binding !ShowLoadProgress}" />
            <TextBlock
                Margin="5,0,5,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                IsVisible="{Binding !ShowLoadProgress}"
                Text="{Binding FifoStatusText}"
                TextAlignment="Left" />
            <Border
                Width="2"
                Height="12"
                Margin="0"
                BorderBrush="Gray"
                BorderThickness="1"
                IsVisible="{Binding !ShowLoadProgress}" />
            <TextBlock
                Margin="5,0,5,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                IsVisible="{Binding !ShowLoadProgress}"
                Text="{Binding BackendText}"
                TextAlignment="Left" />
            <Border
                Width="2"
                Height="12"
                Margin="0"
                BorderBrush="Gray"
                BorderThickness="1"
                IsVisible="{Binding !ShowLoadProgress}" />
            <TextBlock
                Margin="5,0,5,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                IsVisible="{Binding !ShowLoadProgress}"
                Text="{Binding GpuNameText}"
                TextAlignment="Left" />
        </StackPanel>
        <StackPanel
            Grid.Column="3"
            Margin="0,0,5,0"
            VerticalAlignment="Center"
            IsVisible="{Binding ShowFirmwareStatus}"
            Orientation="Horizontal">
            <TextBlock
                Name="FirmwareStatus"
                Margin="0"
                HorizontalAlignment="Right"
                VerticalAlignment="Center"
                Text="{locale:Locale StatusBarSystemVersion}" />
        </StackPanel>
    </Grid>
</UserControl>