<!--
    Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
    the MIT License. See LICENSE in the project root for license information.
-->
<ContentPresenter x:Class="TerminalApp.TabRowControl"
                  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:local="using:TerminalApp"
                  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                  xmlns:mux="using:Microsoft.UI.Xaml.Controls"
                  Background="{ThemeResource TabViewBackground}"
                  mc:Ignorable="d">

    <!--
        GH#13143: Make sure that the Background is actually TabViewBackground
        here, not Transparent. This is load bearing, for showTabsInTitlebar=false.
    -->

    <!--
        Set the padding to -1 on the bottom. This prevents a small 1px gap that
        can appear on 150% scale displays between the tab item and the content.
        The 1 on top helps keep the tab the correct relative height within the
        tab row.
    -->

    <mux:TabView x:Name="TabView"
                 VerticalAlignment="Bottom"
                 HorizontalContentAlignment="Stretch"
                 AllowDropTabs="True"
                 Background="Transparent"
                 CanDragTabs="True"
                 CanReorderTabs="True"
                 IsAddTabButtonVisible="false"
                 TabWidthMode="Equal">

        <mux:TabView.TabStripHeader>
            <!--  EA18 is the "Shield" glyph  -->
            <FontIcon x:Uid="ElevationShield"
                      Margin="9,4,0,4"
                      FontFamily="{ThemeResource SymbolThemeFontFamily}"
                      FontSize="16"
                      Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}"
                      Glyph="&#xEA18;"
                      Visibility="{x:Bind ShowElevationShield, Mode=OneWay}" />
        </mux:TabView.TabStripHeader>

        <mux:TabView.TabStripFooter>
            <Grid>
                <!--  Remove this border after WinUI 2.8  -->
                <Border Height="1"
                        VerticalAlignment="Bottom"
                        Background="{ThemeResource CardStrokeColorDefaultBrush}" />

                <mux:SplitButton x:Name="NewTabButton"
                                 x:Uid="NewTabSplitButton"
                                 Height="24"
                                 Margin="0,4"
                                 Padding="0"
                                 HorizontalAlignment="Left"
                                 VerticalAlignment="Stretch"
                                 AllowDrop="True"
                                 AutomationProperties.AccessibilityView="Control"
                                 BorderThickness="0"
                                 Click="OnNewTabButtonClick"
                                 Content="&#xE710;"
                                 DragOver="OnNewTabButtonDragOver"
                                 Drop="OnNewTabButtonDrop"
                                 FontFamily="{ThemeResource SymbolThemeFontFamily}"
                                 FontSize="12">
                    <ToolTipService.ToolTip>
                        <ToolTip Placement="Mouse">
                            <TextBlock TextWrapping="Wrap">
                                <Run x:Uid="NewTabRun" /> <LineBreak />
                                <Run x:Uid="NewPaneRun"
                                     FontStyle="Italic" /> <LineBreak />
                                <Run x:Uid="NewWindowRun"
                                     FontStyle="Italic" />
                            </TextBlock>
                        </ToolTip>
                    </ToolTipService.ToolTip>
                    <!--  U+E710 is the fancy plus icon.  -->
                    <mux:SplitButton.Resources>
                        <!--  Override the SplitButton* resources to match the tab view's button's styles.  -->
                        <ResourceDictionary>
                            <ResourceDictionary.ThemeDictionaries>
                                <ResourceDictionary x:Key="Light">
                                    <StaticResource x:Key="SplitButtonBackground"
                                                    ResourceKey="TabViewButtonBackground" />
                                    <StaticResource x:Key="SplitButtonForeground"
                                                    ResourceKey="TabViewButtonForeground" />
                                    <StaticResource x:Key="SplitButtonBackgroundPressed"
                                                    ResourceKey="TabViewButtonBackgroundPressed" />
                                    <StaticResource x:Key="SplitButtonForegroundPressed"
                                                    ResourceKey="TabViewButtonForegroundPressed" />
                                    <StaticResource x:Key="SplitButtonBackgroundPointerOver"
                                                    ResourceKey="TabViewButtonBackgroundPointerOver" />
                                    <StaticResource x:Key="SplitButtonForegroundPointerOver"
                                                    ResourceKey="TabViewButtonForegroundPointerOver" />
                                </ResourceDictionary>
                                <ResourceDictionary x:Key="Dark">
                                    <StaticResource x:Key="SplitButtonBackground"
                                                    ResourceKey="TabViewButtonBackground" />
                                    <StaticResource x:Key="SplitButtonForeground"
                                                    ResourceKey="TabViewButtonForeground" />
                                    <StaticResource x:Key="SplitButtonBackgroundPressed"
                                                    ResourceKey="TabViewButtonBackgroundPressed" />
                                    <StaticResource x:Key="SplitButtonForegroundPressed"
                                                    ResourceKey="TabViewButtonForegroundPressed" />
                                    <StaticResource x:Key="SplitButtonBackgroundPointerOver"
                                                    ResourceKey="TabViewButtonBackgroundPointerOver" />
                                    <StaticResource x:Key="SplitButtonForegroundPointerOver"
                                                    ResourceKey="TabViewButtonForegroundPointerOver" />
                                </ResourceDictionary>
                                <ResourceDictionary x:Key="HighContrast">
                                    <StaticResource x:Key="SplitButtonBackground"
                                                    ResourceKey="TabViewButtonBackground" />
                                    <StaticResource x:Key="SplitButtonForeground"
                                                    ResourceKey="TabViewButtonForeground" />
                                    <StaticResource x:Key="SplitButtonBackgroundPressed"
                                                    ResourceKey="TabViewButtonBackgroundPressed" />
                                    <StaticResource x:Key="SplitButtonForegroundPressed"
                                                    ResourceKey="TabViewButtonForegroundPressed" />
                                    <StaticResource x:Key="SplitButtonBackgroundPointerOver"
                                                    ResourceKey="TabViewButtonBackgroundPointerOver" />
                                    <StaticResource x:Key="SplitButtonForegroundPointerOver"
                                                    ResourceKey="TabViewButtonForegroundPointerOver" />
                                </ResourceDictionary>
                            </ResourceDictionary.ThemeDictionaries>
                            <x:Double x:Key="SplitButtonPrimaryButtonSize">31</x:Double>
                            <x:Double x:Key="SplitButtonSecondaryButtonSize">31</x:Double>
                        </ResourceDictionary>
                    </mux:SplitButton.Resources>
                </mux:SplitButton>
            </Grid>
        </mux:TabView.TabStripFooter>

    </mux:TabView>

</ContentPresenter>
