2021-04-29 05:05:55 -07:00
|
|
|
<UserControl x:Class="SourceGit.Views.Widgets.PageTabBar"
|
|
|
|
x:Name="me"
|
|
|
|
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:controls="clr-namespace:SourceGit.Views.Controls"
|
2022-10-14 05:38:53 -07:00
|
|
|
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
2021-04-29 05:05:55 -07:00
|
|
|
mc:Ignorable="d"
|
|
|
|
d:DesignHeight="28" d:DesignWidth="800">
|
2022-10-14 00:30:06 -07:00
|
|
|
<Grid Margin="0,4,0,0">
|
2021-04-29 05:05:55 -07:00
|
|
|
<Grid.ColumnDefinitions>
|
2022-10-14 00:30:06 -07:00
|
|
|
<ColumnDefinition Width="1"/>
|
2021-04-29 05:05:55 -07:00
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
<ColumnDefinition Width="*"/>
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
2022-10-14 00:30:06 -07:00
|
|
|
<!-- Seperator -->
|
|
|
|
<Rectangle
|
|
|
|
Grid.Column="0"
|
|
|
|
x:Name="startSeperator"
|
2022-10-19 00:28:01 -07:00
|
|
|
Width="1" Height="16"
|
2022-10-14 00:30:06 -07:00
|
|
|
Fill="{DynamicResource Brush.FG2}"
|
|
|
|
Opacity=".5"/>
|
|
|
|
|
2021-04-29 05:05:55 -07:00
|
|
|
<!-- Left Scroller -->
|
|
|
|
<controls:IconButton
|
2022-10-14 00:30:06 -07:00
|
|
|
Grid.Column="1"
|
2021-04-29 05:05:55 -07:00
|
|
|
x:Name="leftScroller"
|
|
|
|
Click="ScrollLeft"
|
2022-10-13 22:39:55 -07:00
|
|
|
Width="18" Padding="6"
|
2022-10-25 06:50:58 -07:00
|
|
|
HoverBackground="{DynamicResource Brush.TabButtonHover}"
|
2022-10-13 22:39:55 -07:00
|
|
|
BorderThickness="0"
|
2021-04-29 05:05:55 -07:00
|
|
|
Icon="{StaticResource Icon.ScrollLeft}"
|
|
|
|
WindowChrome.IsHitTestVisibleInChrome="True"
|
|
|
|
Visibility="Collapsed"/>
|
2022-10-14 00:30:06 -07:00
|
|
|
|
2021-04-29 05:05:55 -07:00
|
|
|
<!-- Tabs -->
|
|
|
|
<ScrollViewer
|
2022-10-14 00:30:06 -07:00
|
|
|
Grid.Column="2"
|
2021-04-29 05:05:55 -07:00
|
|
|
x:Name="scroller"
|
|
|
|
HorizontalScrollBarVisibility="Hidden"
|
|
|
|
VerticalScrollBarVisibility="Disabled">
|
|
|
|
<StackPanel Orientation="Horizontal" SizeChanged="CalcScrollerVisibilty">
|
|
|
|
<ListBox
|
2022-10-13 22:39:55 -07:00
|
|
|
x:Name="container"
|
|
|
|
BorderBrush="{DynamicResource Brush.Border0}"
|
2021-04-29 05:05:55 -07:00
|
|
|
ItemsSource="{Binding ElementName=me, Path=Tabs}"
|
|
|
|
WindowChrome.IsHitTestVisibleInChrome="True"
|
|
|
|
SelectionChanged="SelectionChanged">
|
2022-10-14 05:38:53 -07:00
|
|
|
|
|
|
|
<ListBox.Resources>
|
|
|
|
<converters:IntToBookmarkBrush x:Key="IntToBookmarkBrush"/>
|
|
|
|
<converters:BoolToCollapsed x:Key="BoolToCollapsed"/>
|
|
|
|
</ListBox.Resources>
|
2021-04-29 05:05:55 -07:00
|
|
|
|
|
|
|
<ListBox.ItemsPanel>
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
<VirtualizingStackPanel Orientation="Horizontal"/>
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
</ListBox.ItemsPanel>
|
|
|
|
|
|
|
|
<ListBox.ItemContainerStyle>
|
|
|
|
<Style TargetType="{x:Type ListBoxItem}">
|
2021-08-18 17:58:41 -07:00
|
|
|
<EventSetter Event="ContextMenuOpening" Handler="OnTabContextMenuOpening" />
|
2022-10-17 23:50:48 -07:00
|
|
|
<EventSetter Event="MouseMove" Handler="OnMouseMove"/>
|
|
|
|
<EventSetter Event="DragOver" Handler="OnDragOver"/>
|
|
|
|
<EventSetter Event="Drop" Handler="OnDrop"/>
|
|
|
|
<EventSetter Event="GiveFeedback" Handler="OnGiveFeedback"/>
|
|
|
|
|
2021-04-29 05:05:55 -07:00
|
|
|
<Setter Property="AllowDrop" Value="True"/>
|
2021-06-02 02:46:19 -07:00
|
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
2021-04-29 05:05:55 -07:00
|
|
|
<Setter Property="Template">
|
|
|
|
<Setter.Value>
|
|
|
|
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
2022-10-13 22:39:55 -07:00
|
|
|
<Border x:Name="Border" Background="Transparent" BorderBrush="Transparent" BorderThickness="1,1,1,0">
|
2022-10-14 05:38:53 -07:00
|
|
|
<Grid x:Name="Contents" Width="160" VerticalAlignment="Center" Opacity=".5" ToolTip="{Binding Tooltip}">
|
|
|
|
<Path
|
|
|
|
Width="8" Margin="8,0,0,0"
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
Fill="{Binding Bookmark, Converter={StaticResource IntToBookmarkBrush}}"
|
|
|
|
Visibility="{Binding IsRepository, Converter={StaticResource BoolToCollapsed}}">
|
|
|
|
<Path.Data>
|
|
|
|
<EllipseGeometry Center="0,0" RadiusX="14" RadiusY="14"/>
|
|
|
|
</Path.Data>
|
|
|
|
</Path>
|
|
|
|
|
|
|
|
<TextBlock Margin="32,0" HorizontalAlignment="Stretch" TextAlignment="Center" Text="{Binding Title}"/>
|
2021-06-15 02:35:37 -07:00
|
|
|
|
2021-04-29 05:05:55 -07:00
|
|
|
<controls:IconButton
|
|
|
|
Click="CloseTab"
|
2022-10-14 05:38:53 -07:00
|
|
|
x:Name="closer"
|
2021-04-29 05:05:55 -07:00
|
|
|
Width="16" Height="16"
|
2022-10-14 05:38:53 -07:00
|
|
|
Margin="0,1,8,0" Padding="4"
|
2021-07-20 01:26:10 -07:00
|
|
|
ToolTip="{DynamicResource Text.Close}"
|
2021-04-29 05:05:55 -07:00
|
|
|
Icon="{StaticResource Icon.Close}"
|
2022-10-25 06:50:58 -07:00
|
|
|
HoverBackground="{DynamicResource Brush.TabButtonHover}"
|
2022-10-14 05:38:53 -07:00
|
|
|
Visibility="Hidden"
|
|
|
|
HorizontalAlignment="Right"/>
|
2022-10-13 22:39:55 -07:00
|
|
|
|
|
|
|
<Rectangle
|
|
|
|
x:Name="seperator"
|
2022-10-19 00:28:01 -07:00
|
|
|
Margin="4,0,0,0"
|
2022-10-13 22:39:55 -07:00
|
|
|
Width="1"
|
2022-10-14 05:38:53 -07:00
|
|
|
Fill="Transparent"
|
|
|
|
HorizontalAlignment="Right"/>
|
|
|
|
</Grid>
|
2021-04-29 05:05:55 -07:00
|
|
|
</Border>
|
|
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
2022-10-13 22:39:55 -07:00
|
|
|
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource Brush.Border0}"/>
|
2021-07-20 01:26:10 -07:00
|
|
|
<Setter TargetName="Border" Property="Background" Value="{DynamicResource Brush.Window}"/>
|
2021-04-29 05:05:55 -07:00
|
|
|
<Setter TargetName="Contents" Property="Opacity" Value="1"/>
|
2022-10-14 05:38:53 -07:00
|
|
|
<Setter TargetName="closer" Property="Visibility" Value="Visible"/>
|
2021-04-29 05:05:55 -07:00
|
|
|
</Trigger>
|
2022-10-13 22:39:55 -07:00
|
|
|
<DataTrigger Binding="{Binding IsSeperatorVisible}" Value="True">
|
|
|
|
<Setter TargetName="seperator" Property="Fill" Value="{DynamicResource Brush.FG2}"/>
|
|
|
|
</DataTrigger>
|
2021-04-29 05:05:55 -07:00
|
|
|
<MultiTrigger>
|
|
|
|
<MultiTrigger.Conditions>
|
|
|
|
<Condition Property="IsSelected" Value="False"/>
|
|
|
|
<Condition Property="IsMouseOver" Value="True"/>
|
|
|
|
</MultiTrigger.Conditions>
|
|
|
|
<Setter TargetName="Contents" Property="Opacity" Value=".85"/>
|
2022-10-14 05:38:53 -07:00
|
|
|
<Setter TargetName="closer" Property="Visibility" Value="Visible"/>
|
2021-04-29 05:05:55 -07:00
|
|
|
</MultiTrigger>
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
|
|
|
</Style>
|
|
|
|
</ListBox.ItemContainerStyle>
|
|
|
|
</ListBox>
|
2022-10-14 05:38:53 -07:00
|
|
|
|
|
|
|
<Button
|
|
|
|
Width="16" Height="16" Margin="8,0,0,0"
|
|
|
|
Background="Transparent"
|
|
|
|
BorderThickness="0"
|
2021-10-07 19:48:05 -07:00
|
|
|
ToolTip="{DynamicResource Text.PageTabBar.New}"
|
2021-04-29 05:05:55 -07:00
|
|
|
Click="NewTab"
|
2022-10-14 05:38:53 -07:00
|
|
|
WindowChrome.IsHitTestVisibleInChrome="True">
|
|
|
|
<Path Width="12" Data="{StaticResource Icon.NewTab}" Fill="{DynamicResource Brush.FG1}"/>
|
|
|
|
</Button>
|
2021-04-29 05:05:55 -07:00
|
|
|
</StackPanel>
|
|
|
|
</ScrollViewer>
|
|
|
|
|
|
|
|
<!-- Right Scroller -->
|
|
|
|
<controls:IconButton
|
2022-10-14 00:30:06 -07:00
|
|
|
Grid.Column="3"
|
2021-04-29 05:05:55 -07:00
|
|
|
x:Name="rightScroller"
|
|
|
|
Click="ScrollRight"
|
2022-10-13 22:39:55 -07:00
|
|
|
Width="18" Padding="6"
|
2022-10-25 06:50:58 -07:00
|
|
|
HoverBackground="{DynamicResource Brush.TabButtonHover}"
|
2022-10-13 22:39:55 -07:00
|
|
|
BorderThickness="0"
|
2021-04-29 05:05:55 -07:00
|
|
|
Icon="{StaticResource Icon.ScrollRight}"
|
|
|
|
WindowChrome.IsHitTestVisibleInChrome="True"
|
|
|
|
Visibility="Collapsed"/>
|
|
|
|
</Grid>
|
|
|
|
</UserControl>
|