<?xml version="1.0" encoding="utf-8"?>
<UserControl
    x:Class="Sonex.Client.Controls.ToolBar"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    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"
    mc:Ignorable="d">

    <UserControl.Resources>
        <StaticResource x:Key="PaintToolBarBackgroundBrush" ResourceKey="SolidBackgroundFillColorTertiaryBrush" />
        <StaticResource x:Key="PaintToolBarBorderBrush" ResourceKey="CardStrokeColorDefaultBrush" />
        <StaticResource x:Key="PaintToolBarSeparatorBrush" ResourceKey="ControlStrokeColorDefaultBrush" />

        <StaticResource x:Key="ButtonBackground" ResourceKey="ControlFillColorTransparentBrush" />
        <StaticResource x:Key="ButtonBackgroundPointerOver" ResourceKey="SubtleFillColorSecondaryBrush" />
        <StaticResource x:Key="ButtonBackgroundPressed" ResourceKey="SubtleFillColorTertiaryBrush" />
        <StaticResource x:Key="ButtonBackgroundDisabled" ResourceKey="SubtleFillColorTransparentBrush" />
        <StaticResource x:Key="ButtonForeground" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="ButtonForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="ButtonForegroundPressed" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="ButtonForegroundDisabled" ResourceKey="TextFillColorDisabledBrush" />
        <StaticResource x:Key="ButtonBorderBrush" ResourceKey="ControlFillColorTransparentBrush" />
        <StaticResource x:Key="ButtonBorderBrushPointerOver" ResourceKey="ControlStrokeColorDefaultBrush" />
        <StaticResource x:Key="ButtonBorderBrushPressed" ResourceKey="ControlStrokeColorSecondaryBrush" />
        <StaticResource x:Key="ButtonBorderBrushDisabled" ResourceKey="ControlFillColorTransparentBrush" />

        <StaticResource x:Key="ToggleButtonBackground" ResourceKey="ControlFillColorTransparentBrush" />
        <StaticResource x:Key="ToggleButtonBorderBrush" ResourceKey="ControlFillColorTransparentBrush" />
        <StaticResource x:Key="ToggleButtonForeground" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="ToggleButtonBackgroundPointerOver" ResourceKey="SubtleFillColorSecondaryBrush" />
        <StaticResource x:Key="ToggleButtonBorderBrushPointerOver" ResourceKey="ControlStrokeColorDefaultBrush" />
        <StaticResource x:Key="ToggleButtonForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="ToggleButtonBackgroundPressed" ResourceKey="SubtleFillColorTertiaryBrush" />
        <StaticResource x:Key="ToggleButtonBorderBrushPressed" ResourceKey="ControlStrokeColorSecondaryBrush" />
        <StaticResource x:Key="ToggleButtonForegroundPressed" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="ToggleButtonBackgroundDisabled" ResourceKey="SubtleFillColorTransparentBrush" />
        <StaticResource x:Key="ToggleButtonBorderBrushDisabled" ResourceKey="ControlFillColorTransparentBrush" />
        <StaticResource x:Key="ToggleButtonForegroundDisabled" ResourceKey="TextFillColorDisabledBrush" />
        <StaticResource x:Key="ToggleButtonBackgroundChecked" ResourceKey="SubtleFillColorSecondaryBrush" />
        <StaticResource x:Key="ToggleButtonBorderBrushChecked" ResourceKey="AccentFillColorDefaultBrush" />
        <StaticResource x:Key="ToggleButtonForegroundChecked" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="ToggleButtonBackgroundCheckedPointerOver" ResourceKey="SubtleFillColorTertiaryBrush" />
        <StaticResource x:Key="ToggleButtonBorderBrushCheckedPointerOver" ResourceKey="AccentFillColorSecondaryBrush" />
        <StaticResource x:Key="ToggleButtonForegroundCheckedPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="ToggleButtonBackgroundCheckedPressed" ResourceKey="SubtleFillColorTertiaryBrush" />
        <StaticResource x:Key="ToggleButtonBorderBrushCheckedPressed" ResourceKey="AccentFillColorTertiaryBrush" />
        <StaticResource x:Key="ToggleButtonForegroundCheckedPressed" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="ToggleButtonBackgroundCheckedDisabled" ResourceKey="SubtleFillColorDisabledBrush" />
        <StaticResource x:Key="ToggleButtonBorderBrushCheckedDisabled" ResourceKey="AccentFillColorDisabledBrush" />
        <StaticResource x:Key="ToggleButtonForegroundCheckedDisabled" ResourceKey="TextFillColorDisabledBrush" />

        <StaticResource x:Key="DropDownButtonForegroundSecondary" ResourceKey="TextFillColorSecondaryBrush" />
        <StaticResource x:Key="DropDownButtonForegroundSecondaryPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="DropDownButtonForegroundSecondaryPressed" ResourceKey="TextFillColorPrimaryBrush" />

        <StaticResource x:Key="SplitButtonBackground" ResourceKey="ControlFillColorTransparentBrush" />
        <StaticResource x:Key="SplitButtonBackgroundPointerOver" ResourceKey="SubtleFillColorSecondaryBrush" />
        <StaticResource x:Key="SplitButtonBackgroundPressed" ResourceKey="SubtleFillColorTertiaryBrush" />
        <StaticResource x:Key="SplitButtonBackgroundDisabled" ResourceKey="SubtleFillColorTransparentBrush" />
        <StaticResource x:Key="SplitButtonBackgroundChecked" ResourceKey="SubtleFillColorSecondaryBrush" />
        <StaticResource x:Key="SplitButtonBackgroundCheckedPointerOver" ResourceKey="SubtleFillColorTertiaryBrush" />
        <StaticResource x:Key="SplitButtonBackgroundCheckedPressed" ResourceKey="SubtleFillColorTertiaryBrush" />
        <StaticResource x:Key="SplitButtonBorderBrush" ResourceKey="ControlFillColorTransparentBrush" />
        <StaticResource x:Key="SplitButtonBorderBrushPointerOver" ResourceKey="ControlStrokeColorDefaultBrush" />
        <StaticResource x:Key="SplitButtonBorderBrushPressed" ResourceKey="ControlStrokeColorSecondaryBrush" />
        <StaticResource x:Key="SplitButtonBorderBrushDisabled" ResourceKey="ControlFillColorTransparentBrush" />
        <StaticResource x:Key="SplitButtonBorderBrushDivider" ResourceKey="ControlStrokeColorSecondaryBrush" />
        <StaticResource x:Key="SplitButtonBorderBrushChecked" ResourceKey="AccentFillColorDefaultBrush" />
        <StaticResource x:Key="SplitButtonBorderBrushCheckedDivider" ResourceKey="AccentFillColorSecondaryBrush" />
        <StaticResource x:Key="SplitButtonBorderBrushCheckedPressed" ResourceKey="AccentFillColorTertiaryBrush" />
        <StaticResource x:Key="SplitButtonForeground" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="SplitButtonForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="SplitButtonForegroundPressed" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="SplitButtonForegroundDisabled" ResourceKey="TextFillColorDisabledBrush" />
        <StaticResource x:Key="SplitButtonForegroundChecked" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="SplitButtonForegroundCheckedPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="SplitButtonForegroundCheckedPressed" ResourceKey="TextFillColorPrimaryBrush" />
        <StaticResource x:Key="SplitButtonForegroundSecondary" ResourceKey="TextFillColorSecondaryBrush" />
        <StaticResource x:Key="SplitButtonForegroundSecondaryPressed" ResourceKey="TextFillColorPrimaryBrush" />

        <Style x:Key="ToolBarButtonStyle" TargetType="Button">
            <Setter Property="MinWidth" Value="32" />
            <Setter Property="Width" Value="32" />
            <Setter Property="Height" Value="32" />
            <Setter Property="Padding" Value="6" />
            <Setter Property="CornerRadius" Value="4" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
            <Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
            <Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
            <Setter Property="Transitions" Value="{x:Null}" />
            <Setter Property="UseSystemFocusVisuals" Value="False" />
            <Setter Property="FocusVisualPrimaryThickness" Value="0" />
            <Setter Property="FocusVisualSecondaryThickness" Value="0" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>

        <Style TargetType="Button" BasedOn="{StaticResource ToolBarButtonStyle}" />

        <Style TargetType="ToggleButton">
            <Setter Property="MinWidth" Value="32" />
            <Setter Property="Width" Value="32" />
            <Setter Property="Height" Value="32" />
            <Setter Property="Padding" Value="6" />
            <Setter Property="CornerRadius" Value="4" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Background" Value="{ThemeResource ToggleButtonBackground}" />
            <Setter Property="BorderBrush" Value="{ThemeResource ToggleButtonBorderBrush}" />
            <Setter Property="Foreground" Value="{ThemeResource ToggleButtonForeground}" />
            <Setter Property="Transitions" Value="{x:Null}" />
            <Setter Property="UseSystemFocusVisuals" Value="False" />
            <Setter Property="FocusVisualPrimaryThickness" Value="0" />
            <Setter Property="FocusVisualSecondaryThickness" Value="0" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>

        <Style TargetType="DropDownButton">
            <Setter Property="MinWidth" Value="32" />
            <Setter Property="Height" Value="32" />
            <Setter Property="Padding" Value="6,0,6,0" />
            <Setter Property="CornerRadius" Value="4" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
            <Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
            <Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
            <Setter Property="Transitions" Value="{x:Null}" />
            <Setter Property="UseSystemFocusVisuals" Value="False" />
            <Setter Property="FocusVisualPrimaryThickness" Value="0" />
            <Setter Property="FocusVisualSecondaryThickness" Value="0" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>

        <Style TargetType="SplitButton">
            <Setter Property="MinWidth" Value="32" />
            <Setter Property="Height" Value="32" />
            <Setter Property="Padding" Value="6" />
            <Setter Property="CornerRadius" Value="4" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Background" Value="{ThemeResource SplitButtonBackground}" />
            <Setter Property="BorderBrush" Value="{ThemeResource SplitButtonBorderBrush}" />
            <Setter Property="Foreground" Value="{ThemeResource SplitButtonForeground}" />
            <Setter Property="Transitions" Value="{x:Null}" />
            <Setter Property="UseSystemFocusVisuals" Value="False" />
            <Setter Property="FocusVisualPrimaryThickness" Value="0" />
            <Setter Property="FocusVisualSecondaryThickness" Value="0" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
    </UserControl.Resources>

    <Border
        x:Name="_RootBorder"
        Padding="{x:Bind ChromePadding, Mode=OneWay}"
        CornerRadius="{x:Bind ChromeCornerRadius, Mode=OneWay}"
        BorderThickness="{x:Bind ChromeBorderThickness, Mode=OneWay}"
        Background="{StaticResource PaintToolBarBackgroundBrush}"
        BorderBrush="{StaticResource PaintToolBarBorderBrush}">
        <StackPanel
            x:Name="_ChildrenHost"
            Orientation="Horizontal"
            Spacing="0" />
    </Border>
</UserControl>
