<UserControl x:Class="ScratchNet.ScriptPlayer"
             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:fa="http://schemas.fontawesome.io/icons/"
             xmlns:local="clr-namespace:ScratchNet"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <local:ActualWidth43Converter x:Key="ActualWidth43Converter"/>
    </UserControl.Resources>
    <Border BorderBrush="LightGray" BorderThickness="1" CornerRadius="5,5,0,0">
    <Grid Name="PlayerContainer">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        <Border Background="LightGray">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <Button Margin="5" Grid.Column="0" Click="OnChangeSizeClicked">
                    <Button.Template>
                        <ControlTemplate>
                            <fa:FontAwesome FontSize="25" Foreground="DarkBlue" Icon="ArrowsAlt"/>
                        </ControlTemplate>
                    </Button.Template>
                </Button>
                <Button Margin="5" Grid.Column="2" Click="OnRun" Name="ButtonStart">
                    <Button.Template>
                        <ControlTemplate>
                            <fa:FontAwesome Name="StartIcon" FontSize="25" Foreground="Green" Icon="Play"/>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter TargetName="StartIcon" Property="Foreground" Value="Gray"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Button.Template>
                </Button>
                <Button Margin="5" Grid.Column="3" Click="OnStop" Name="ButtonStop">
                    <Button.Template>
                        <ControlTemplate>
                                <fa:FontAwesome Name="Icon" FontSize="25" Foreground="DarkRed" Icon="Stop"/>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                    </Button.Template>
                </Button>
            </Grid>
        </Border>
        <Canvas Name="PlayScreen" ClipToBounds="True" SizeChanged="PlayScreen_SizeChanged" Background="White" Focusable="True"
                Height="{Binding ElementName=PlayerContainer, Path=ActualWidth, Converter={StaticResource ActualWidth43Converter}}" 
                Grid.Row="1" MouseLeftButtonDown="OnMouseLeftDown" MouseLeftButtonUp="OnMouseLeftUp" 
                MouseMove="OnMouseMove" MouseLeave="PlayScreen_MouseLeave" KeyDown="OnPalyerKeyDown" KeyUp="OnPlayerKeyUp"
        >
            
        </Canvas>
        </Grid>
    </Border>
</UserControl>
