<UserControl x:Class="FasdDesktopUi.Pages.DetailsPage.UserControls.DetailsPageWindowStateBar"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:FasdDesktopUi.Pages.DetailsPage.UserControls"
             xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
             xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
             mc:Ignorable="d"
             d:DesignHeight="450"
             d:DesignWidth="800"
             d:Background="White"
             DataContext="{Binding RelativeSource={RelativeSource Self}}" Loaded="UserControl_Loaded">

    <UserControl.Resources>
        <vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
    </UserControl.Resources>

    <Border Height="40"
            Padding="0,15,15,0">

        <StackPanel Orientation="Horizontal"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    Height="25"
                    WindowChrome.IsHitTestVisibleInChrome="True">

            <StackPanel.Resources>
                <Style TargetType="ico:AdaptableIcon">
                    <Setter Property="Cursor"
                            Value="Hand" />
                    <Setter Property="PrimaryIconColor"
                            Value="{DynamicResource Color.Menu.Icon}" />
                    <Setter Property="Margin"
                            Value="7.5 0" />
                    <Setter Property="BorderPadding"
                            Value="0" />
                    <Setter Property="IconHeight"
                            Value="25" />
                    <Setter Property="IconWidth"
                            Value="25" />

                    <Style.Triggers>
                        <Trigger Property="IsMouseOver"
                                 Value="True">
                            <Setter Property="PrimaryIconColor"
                                    Value="{DynamicResource Color.Menu.Icon.Hover}" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </StackPanel.Resources>

            <ico:AdaptableIcon x:Name="RawValuesButton"
                               Margin="7.5 0 0 0"
                               Visibility="Collapsed"
                               ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.ShowRawValues}"
                               SelectedMaterialIcon="ic_view_list"
                               MouseUp="RawValuesButton_Click"
                               TouchDown="RawValuesButton_Click"
                               />

            <ico:AdaptableIcon x:Name="MinimizeButton"
                               BorderPadding="0 10 0 0"
                               VerticalAlignment="Bottom"
                               MouseUp="MinimizeButton_Click"
                               TouchDown="MinimizeButton_Click"
                               ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.Minimize}"
                               SelectedInternIcon="window_minimize" />

            <ico:AdaptableIcon x:Name="WindowSizeButton"
                               MouseUp="WindowSizeButton_Click"
                               TouchDown="WindowSizeButton_Click">

                <ico:AdaptableIcon.Resources>
                    <Style TargetType="ico:AdaptableIcon"
                           BasedOn="{StaticResource {x:Type ico:AdaptableIcon}}">

                        <Setter Property="SelectedInternIcon"
                                Value="window_fullscreen" />
                        <Setter Property="ToolTip"
                                Value="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.Maximize}" />
                        <Style.Triggers>

                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=WindowState}"
                                         Value="Normal">
                                <Setter Property="SelectedInternIcon"
                                        Value="window_fullscreen" />
                            </DataTrigger>

                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=WindowState}"
                                         Value="Maximized">
                                <Setter Property="SelectedInternIcon"
                                        Value="window_fullscreenExit" />
                                <Setter Property="ToolTip"
                                        Value="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.UnMaximize}" />
                            </DataTrigger>

                        </Style.Triggers>
                    </Style>
                </ico:AdaptableIcon.Resources>

            </ico:AdaptableIcon>

            <ico:AdaptableIcon x:Name="CloseButton"
                               MouseUp="CloseButton_Click"
                               TouchDown="CloseButton_Click"
                               Margin="7.5 0 0 0"
                               ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.Close}"
                               SelectedInternIcon="window_close" />
        </StackPanel>
    </Border>
</UserControl>
