<!--
/**** Git Credential Manager for Windows ****
 *
 * Copyright (c) Atlassian
 * All rights reserved.
 *
 * MIT License
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the """"Software""""), to deal
 * in the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
**/
-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:helpers="clr-namespace:GitHub.Shared.Helpers"
                    mc:Ignorable="PresentationOptions">

    <!--
    Controls

    https://atlassian.design/guidelines/brand/typography
    -->

    <!--
    Base styles set basic font attributes
    Need multiple ones as not all controls derive from the same base classes
    -->
    <Style x:Key="ForegroundStackPanelBorder" TargetType="{x:Type Border}">
        <Setter Property="Background" Value="{DynamicResource PrimaryForeground}" />
        <Setter Property="CornerRadius" Value="5,5,5,5" />
        <Setter Property="BorderThickness" Value="8,8,8,8" />
    </Style>
    
    <Style  x:Key="PrimaryButton" TargetType="{x:Type Button}">
        <Setter Property="Height" Value="39"/>
        <Setter Property="Background" Value="{DynamicResource PrimaryBackground}"/>
        <Setter Property="Foreground" Value="{DynamicResource PrimaryForeground}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border BorderThickness="0"
                            Background="{TemplateBinding Background}"
                            CornerRadius="5">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource SodiumExplosionBrush}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{DynamicResource ChoreCoatBrush}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- Modal dialogs all leave this much of the underlying view showing -->
    <GridLength x:Key="ModalViewLeftOffsetColumnWidth">160</GridLength>

    <!-- Use this focus visual when the control is stretched vertically-->
    <Style x:Key="VerticalMarginFocusVisual" TargetType="Control">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Margin="-2,2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="NoMarginFocusVisual" TargetType="Control">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Margin="0" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--
        This focus rectangle will extend 2px outside of the control boundary.
        Looks way nicer and happens to be the recommended practice. Not suitable for list
        items or elements in constrained places (close to window frame borders etc).

        "...this means that the visual feedback should appear outside the control margins,
         or as temporary or unobtrusive effects that will not block the hit testing on the
         control where the focus visual style is applied."

        http://msdn.microsoft.com/en-us/library/bb613567(v=vs.110).aspx
    -->
    <Style x:Key="NegativeMarginFocusVisual" TargetType="Control">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Margin="-5" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="DialogUserControl" TargetType="UserControl">
        <Setter Property="Margin" Value="30,30,30,0" />
    </Style>

    <Style x:Key="DialogContainerStackPanel" TargetType="StackPanel">
        <Setter Property="Margin" Value="0" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="FocusManager.IsFocusScope" Value="True" />
        <Setter Property="helpers:AccessKeysManagerScoping.IsEnabled" Value="True" />
    </Style>

    <Style x:Key="DialogContainerDockPanel" TargetType="DockPanel">
        <Setter Property="LastChildFill" Value="True" />
        <Setter Property="Margin" Value="0,0,0,30" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="FocusManager.IsFocusScope" Value="True" />
        <Setter Property="helpers:AccessKeysManagerScoping.IsEnabled" Value="True" />
    </Style>
    

</ResourceDictionary>
