<!--
    Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
    the MIT License. See LICENSE in the project root for license information.
-->
<UserControl x:Class="Microsoft.Terminal.Settings.Editor.IconPicker"
             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:Microsoft.Terminal.Settings.Editor"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:model="using:Microsoft.Terminal.Settings.Model"
             xmlns:mtu="using:Microsoft.Terminal.UI"
             xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
             mc:Ignorable="d">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="CommonResources.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid ColumnSpacing="12">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="auto" />
        </Grid.ColumnDefinitions>

        <!--  Icon Type  -->
        <ComboBox x:Uid="IconPicker_IconType"
                  Grid.Column="0"
                  ItemsSource="{x:Bind IconTypes}"
                  SelectedItem="{x:Bind CurrentIconType, Mode=TwoWay}">
            <ComboBox.ItemTemplate>
                <DataTemplate x:DataType="local:EnumEntry">
                    <TextBlock Text="{x:Bind EnumName}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>

        <!--  Built-In Icon  -->
        <AutoSuggestBox x:Uid="IconPicker_BuiltInIcon"
                        Grid.Column="1"
                        GotFocus="BuiltInIconPicker_GotFocus"
                        ItemsSource="{x:Bind FilteredBuiltInIconList, Mode=OneWay}"
                        QuerySubmitted="BuiltInIconPicker_QuerySubmitted"
                        Text="{x:Bind CurrentBuiltInIcon.EnumName, Mode=OneWay}"
                        TextBoxStyle="{StaticResource TextBoxSettingStyle}"
                        TextChanged="BuiltInIconPicker_TextChanged"
                        Visibility="{x:Bind UsingBuiltInIcon, Mode=OneWay}">
            <AutoSuggestBox.ItemTemplate>
                <DataTemplate x:DataType="local:EnumEntry">
                    <Grid ColumnSpacing="12">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="16" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <IconSourceElement Grid.Column="0"
                                           Width="16"
                                           Height="16"
                                           IconSource="{x:Bind local:IconPicker.BuiltInIconConverter(EnumValue), Mode=OneTime}" />
                        <TextBlock Grid.Column="1"
                                   Text="{x:Bind EnumName}" />
                    </Grid>
                </DataTemplate>
            </AutoSuggestBox.ItemTemplate>
        </AutoSuggestBox>

        <!--  Image (File) Icon  -->
        <TextBox x:Uid="IconPicker_ImagePathBox"
                 Grid.Column="1"
                 MaxWidth="Infinity"
                 HorizontalAlignment="Stretch"
                 FontFamily="Segoe UI, Segoe Fluent Icons, Segoe MDL2 Assets"
                 IsSpellCheckEnabled="False"
                 Style="{StaticResource TextBoxSettingStyle}"
                 Text="{x:Bind CurrentIconPath, Mode=TwoWay}"
                 Visibility="{x:Bind UsingImageIcon, Mode=OneWay}" />
        <Button x:Uid="IconPicker_IconBrowse"
                Grid.Column="2"
                Margin="0"
                VerticalAlignment="Top"
                Click="Icon_Click"
                Style="{StaticResource BrowseButtonStyle}"
                Visibility="{x:Bind UsingImageIcon, Mode=OneWay}" />

        <!--  Emoji Icon  -->
        <TextBox x:Uid="IconPicker_EmojiBox"
                 Grid.Column="1"
                 MaxWidth="Infinity"
                 FontFamily="Segoe UI, Segoe Fluent Icons, Segoe MDL2 Assets"
                 IsSpellCheckEnabled="False"
                 Style="{StaticResource TextBoxSettingStyle}"
                 Text="{x:Bind CurrentEmojiIcon, Mode=TwoWay}"
                 Visibility="{x:Bind UsingEmojiIcon, Mode=OneWay}" />
    </Grid>
</UserControl>
