<?xml version="1.0" encoding="UTF-8"?>
<!--
    This file is part of QTTabBar, a shell extension for Microsoft
    Windows Explorer.
    Copyright (C) 2007-2021  Quizo, Paul Accisano

    QTTabBar is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QTTabBar is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QTTabBar.  If not, see <http://www.gnu.org/licenses/>.
-->

<UserControl x:Class="QTTabBarLib.EditableHeader" x:Name="EditableHeaderControl"
             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" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Border BorderThickness="3">
            <TextBlock x:Name="txtHeader"
               Text="{Binding Path=Text, ElementName=EditableHeaderControl}"
               VerticalAlignment="Center"
               Padding="{Binding Path=Padding, ElementName=txtHeaderEdit}"
               MinWidth="{Binding Path=MinWidth, ElementName=txtHeaderEdit}"
               MouseDown="txtHeader_MouseDown"
               MouseUp="txtHeader_MouseUp"/>
        </Border>
        <TextBox x:Name="txtHeaderEdit"
                 Text="{Binding Path=Text, ElementName=EditableHeaderControl}"
                 Padding="{Binding Path=Padding, ElementName=EditableHeaderControl}"
                 VerticalContentAlignment="Center"
                 MinWidth="10"
                 LostFocus="txtHeaderEdit_LostFocus"
                 LostKeyboardFocus="txtHeaderEdit_LostFocus"
                 KeyDown="txtHeaderEdit_KeyDown"
                 Visibility="Hidden" />
    </Grid>
</UserControl>
