mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
127 lines
6.7 KiB
XML
127 lines
6.7 KiB
XML
<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"
|
|
HoverBackground="{DynamicResource Brush.Accent1}"
|
|
BorderBrush="{DynamicResource Brush.Border0}"
|
|
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"/>
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
|
<Border x:Name="Border" Background="Transparent" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="0,0,1,0">
|
|
<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}"/>
|
|
|
|
<controls:IconButton
|
|
Click="CloseTab"
|
|
Width="16" Height="16"
|
|
Margin="4,0,0,0" Padding="4"
|
|
ToolTip="{DynamicResource Text.Close}"
|
|
Icon="{StaticResource Icon.Close}"
|
|
HoverBackground="{DynamicResource Brush.NewPageHover}"/>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsSelected" Value="True">
|
|
<Setter TargetName="Border" Property="Background" Value="{DynamicResource Brush.Window}"/>
|
|
<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}"
|
|
HoverBackground="{DynamicResource Brush.NewPageHover}"
|
|
ToolTip="{DynamicResource Text.PageSwitcher.New}"
|
|
Click="NewTab"
|
|
WindowChrome.IsHitTestVisibleInChrome="True"/>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
|
|
<!-- Right Scroller -->
|
|
<controls:IconButton
|
|
Grid.Column="2"
|
|
x:Name="rightScroller"
|
|
Click="ScrollRight"
|
|
Width="18" Padding="5"
|
|
HoverBackground="{DynamicResource Brush.Accent1}"
|
|
BorderBrush="{DynamicResource Brush.Border0}"
|
|
BorderThickness="1,0"
|
|
Icon="{StaticResource Icon.ScrollRight}"
|
|
WindowChrome.IsHitTestVisibleInChrome="True"
|
|
Visibility="Collapsed"/>
|
|
</Grid>
|
|
</UserControl>
|