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"
|
|
|
|
mc:Ignorable="d"
|
|
|
|
d:DesignHeight="28" d:DesignWidth="800">
|
|
|
|
<Grid>
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
<ColumnDefinition Width="*"/>
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
|
|
<!-- Left Scroller -->
|
|
|
|
<controls:IconButton
|
|
|
|
Grid.Column="0"
|
|
|
|
x:Name="leftScroller"
|
|
|
|
Click="ScrollLeft"
|
|
|
|
Width="18" Padding="5"
|
2021-07-20 01:26:10 -07:00
|
|
|
HoverBackground="{DynamicResource Brush.Accent1}"
|
|
|
|
BorderBrush="{DynamicResource Brush.Border0}"
|
2021-04-29 05:05:55 -07:00
|
|
|
BorderThickness="0,0,1,0"
|
|
|
|
Icon="{StaticResource Icon.ScrollLeft}"
|
|
|
|
WindowChrome.IsHitTestVisibleInChrome="True"
|
|
|
|
Visibility="Collapsed"/>
|
|
|
|
|
|
|
|
<!-- Tabs -->
|
|
|
|
<ScrollViewer
|
|
|
|
Grid.Column="1"
|
|
|
|
x:Name="scroller"
|
|
|
|
HorizontalScrollBarVisibility="Hidden"
|
|
|
|
VerticalScrollBarVisibility="Disabled">
|
|
|
|
<StackPanel Orientation="Horizontal" SizeChanged="CalcScrollerVisibilty">
|
|
|
|
<ListBox
|
|
|
|
x:Name="container"
|
|
|
|
ItemsSource="{Binding ElementName=me, Path=Tabs}"
|
|
|
|
WindowChrome.IsHitTestVisibleInChrome="True"
|
|
|
|
SelectionChanged="SelectionChanged">
|
|
|
|
|
|
|
|
<ListBox.ItemsPanel>
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
<VirtualizingStackPanel Orientation="Horizontal"/>
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
</ListBox.ItemsPanel>
|
|
|
|
|
|
|
|
<ListBox.ItemContainerStyle>
|
|
|
|
<Style TargetType="{x:Type ListBoxItem}">
|
|
|
|
<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}">
|
2021-07-20 01:26:10 -07:00
|
|
|
<Border x:Name="Border" Background="Transparent" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="0,0,1,0">
|
2021-06-15 02:35:37 -07:00
|
|
|
<StackPanel Margin="8,0" x:Name="Contents" Orientation="Horizontal" VerticalAlignment="Center" Opacity=".5" ToolTip="{Binding Tooltip}">
|
|
|
|
<controls:Bookmark
|
|
|
|
Width="14" Height="14"
|
|
|
|
IsNewPage="{Binding IsWelcomePage}"
|
|
|
|
Color="{Binding Bookmark}"
|
|
|
|
HideOnZero="False"/>
|
|
|
|
|
|
|
|
<TextBlock
|
|
|
|
Grid.Column="1"
|
|
|
|
Margin="4,0"
|
|
|
|
FontWeight="Bold"
|
|
|
|
Text="{Binding Title}"/>
|
2021-04-29 05:05:55 -07:00
|
|
|
|
|
|
|
<controls:IconButton
|
|
|
|
Click="CloseTab"
|
|
|
|
Width="16" Height="16"
|
|
|
|
Margin="4,0,0,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}"
|
2021-07-20 01:26:10 -07:00
|
|
|
HoverBackground="{DynamicResource Brush.NewPageHover}"/>
|
2021-04-29 05:05:55 -07:00
|
|
|
</StackPanel>
|
|
|
|
</Border>
|
|
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
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"/>
|
|
|
|
</Trigger>
|
|
|
|
<MultiTrigger>
|
|
|
|
<MultiTrigger.Conditions>
|
|
|
|
<Condition Property="IsSelected" Value="False"/>
|
|
|
|
<Condition Property="IsMouseOver" Value="True"/>
|
|
|
|
</MultiTrigger.Conditions>
|
|
|
|
<Setter TargetName="Contents" Property="Opacity" Value=".85"/>
|
|
|
|
</MultiTrigger>
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
|
|
|
|
|
|
|
<EventSetter Event="MouseMove" Handler="OnMouseMove"/>
|
|
|
|
<EventSetter Event="Drop" Handler="OnDrop"/>
|
|
|
|
</Style>
|
|
|
|
</ListBox.ItemContainerStyle>
|
|
|
|
</ListBox>
|
|
|
|
|
|
|
|
<controls:IconButton
|
|
|
|
Width="20" Height="20"
|
|
|
|
Margin="4,0" Padding="4"
|
|
|
|
Icon="{StaticResource Icon.NewTab}"
|
2021-07-20 01:26:10 -07:00
|
|
|
HoverBackground="{DynamicResource Brush.NewPageHover}"
|
|
|
|
ToolTip="{DynamicResource Text.PageSwitcher.New}"
|
2021-04-29 05:05:55 -07:00
|
|
|
Click="NewTab"
|
|
|
|
WindowChrome.IsHitTestVisibleInChrome="True"/>
|
|
|
|
</StackPanel>
|
|
|
|
</ScrollViewer>
|
|
|
|
|
|
|
|
<!-- Right Scroller -->
|
|
|
|
<controls:IconButton
|
|
|
|
Grid.Column="2"
|
|
|
|
x:Name="rightScroller"
|
|
|
|
Click="ScrollRight"
|
|
|
|
Width="18" Padding="5"
|
2021-07-20 01:26:10 -07:00
|
|
|
HoverBackground="{DynamicResource Brush.Accent1}"
|
|
|
|
BorderBrush="{DynamicResource Brush.Border0}"
|
2021-04-29 05:05:55 -07:00
|
|
|
BorderThickness="1,0"
|
|
|
|
Icon="{StaticResource Icon.ScrollRight}"
|
|
|
|
WindowChrome.IsHitTestVisibleInChrome="True"
|
|
|
|
Visibility="Collapsed"/>
|
|
|
|
</Grid>
|
|
|
|
</UserControl>
|