<!-- 
MIT License

Original work Copyright (c) 2020 Fichtelcoder
Modified work Copyright 2022 Veloe Aetess

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.
-->
<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"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="VeloeMinecraftLauncher.Views.TitleBar.TitleBarWindow"
		DockPanel.Dock="Top" Height="30">
	<StackPanel>
			<!--The proper way would be not to use white as default, but somehow retrieve the users' window chrome color.-->
			<DockPanel Background="Transparent"
					   IsHitTestVisible="False"
					   Name="TitleBarBackground"></DockPanel>
			<DockPanel Name="TitleBar">
				<StackPanel Orientation="Horizontal"
							DockPanel.Dock="Left"
							Spacing="0">
					<Image Source="/Assets/avalonia-logo.ico"
						   Height="20"
						   Width="20"
						   VerticalAlignment="Center"
						   Margin="5,0,3,0"
						   Name="WindowIcon"></Image>
					<NativeMenuBar DockPanel.Dock="Top"
								   HorizontalAlignment="Left"
								   Name="SeamlessMenuBar"></NativeMenuBar>
					<TextBlock Text="Text"
							   Margin="10 0 0 0"
							   FontSize="12"
							   Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}"
							   VerticalAlignment="Center"
							   HorizontalAlignment="Left"
							   IsHitTestVisible="False"
							   Name="SystemChromeTitle"></TextBlock>
				</StackPanel>
				<StackPanel HorizontalAlignment="Right"
							Orientation="Horizontal"
							Spacing="0">
					<Button Width="46"
							Height="30"
							HorizontalContentAlignment="Center"
							BorderThickness="0"
							Name="MinimizeButton"
							ToolTip.Tip="Minimize">
						<Button.Resources>
							<CornerRadius x:Key="ControlCornerRadius">0</CornerRadius>
						</Button.Resources>
						<Button.Styles>
							<Style Selector="Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
								<Setter Property="Background" Value="#44AAAAAA"/>
							</Style>
							<Style Selector="Button:not(:pointerover) /template/ ContentPresenter#PART_ContentPresenter">
								<Setter Property="Background" Value="Transparent"/>
							</Style>							
						</Button.Styles>
						<Path Margin="10,10,10,0"
							  Stretch="Uniform"
							  Fill="{DynamicResource SystemControlForegroundBaseHighBrush}"
							  Data="M2048 1229v-205h-2048v205h2048z"></Path>
					</Button>

					<Button Width="46"
							VerticalAlignment="Stretch"
							BorderThickness="0"
							Name="MaximizeButton">
						<ToolTip.Tip>
							<ToolTip Content="Maximize"
									 Name="MaximizeToolTip"></ToolTip>
						</ToolTip.Tip>

						<Button.Resources>
							<CornerRadius x:Key="ControlCornerRadius">0</CornerRadius>
						</Button.Resources>
						<Button.Styles>
							<Style Selector="Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
								<Setter Property="Background" Value="#44AAAAAA"/>
							</Style>
							<Style Selector="Button:not(:pointerover) /template/ ContentPresenter#PART_ContentPresenter">
								<Setter Property="Background" Value="Transparent"/>						
							</Style>
						</Button.Styles>
						<Path Margin="10,5,10,0"
							  Stretch="Uniform"
							  Fill="{DynamicResource SystemControlForegroundBaseHighBrush}"
							  Name="MaximizeIcon"
							  Data="M2048 2048v-2048h-2048v2048h2048zM1843 1843h-1638v-1638h1638v1638z"></Path>
					</Button>

					<Button Width="46"
							VerticalAlignment="Stretch"
							BorderThickness="0"
							Name="CloseButton"
							ToolTip.Tip="Close">
						<Button.Resources>
							<CornerRadius x:Key="ControlCornerRadius">0</CornerRadius>
						</Button.Resources>
						<Button.Styles>
							<Style Selector="Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
								<Setter Property="Background" Value="Red"/>
							</Style>
							<Style Selector="Button:not(:pointerover) /template/ ContentPresenter#PART_ContentPresenter">
								<Setter Property="Background" Value="Transparent"/>
							</Style>
							<Style Selector="Button:pointerover > Path">
								<Setter Property="Fill" Value="White"/>
							</Style>
							<Style Selector="Button:not(:pointerover) > Path">
								<Setter Property="Fill" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/>
							</Style>
						</Button.Styles>
						<Path Margin="10,5,10,0"
							  Stretch="Uniform"
							  Data="M1169 1024l879 -879l-145 -145l-879 879l-879 -879l-145 145l879 879l-879 879l145 145l879 -879l879 879l145 -145z"></Path>
					</Button>

				</StackPanel>
			</DockPanel>
		<NativeMenuBar HorizontalAlignment="Left"
					   Name="DefaultMenuBar"></NativeMenuBar>
	</StackPanel>
</UserControl>
