Mesen2/UI/Styles/DockStyles.xaml

165 lines
No EOL
6.8 KiB
XML

<Styles
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=netstandard"
xmlns:dvm="using:Mesen.Debugger.ViewModels.DebuggerDock"
xmlns:converters="using:Dock.Avalonia.Converters"
xmlns:controls="using:Dock.Model.Controls"
xmlns:core="using:Dock.Model.Core"
>
<Style Selector="ToolControl /template/ Separator#PART_Separator">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="ToolControl /template/ Border#PART_Border">
<Setter Property="BorderThickness" Value="1 0 1 1" />
</Style>
<Style Selector="ToolControl /template/ Border#PART_BorderFill">
<Setter Property="BorderThickness" Value="0 0 0 0" />
</Style>
<Style Selector="ToolControl /template/ DockPanel#PART_DockPanel">
<Setter Property="Margin" Value="0 0 0 1" />
</Style>
<Style Selector="ToolControl /template/ ToolTabStrip#PART_TabStrip">
<Setter Property="Margin" Value="0 -1 0 0" />
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
</Style>
<Style Selector="ToolControl /template/ ToolTabStrip#PART_TabStrip ToolTabStripItem:pointerover">
<Setter Property="Background" Value="{DynamicResource MesenDockTabPointerOverBrush}" />
</Style>
<Style Selector="ToolControl /template/ ToolTabStrip#PART_TabStrip ToolTabStripItem:selected:pointerover">
<Setter Property="Background" Value="{DynamicResource DockThemeBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource DockThemeBorderLowBrush}" />
</Style>
<Style Selector="PinnedDockControl">
<!-- prevent error in binding -->
<Setter Property="PinnedDockAlignment" Value="Unset" />
</Style>
<Style Selector="ToolChromeControl">
<!-- prevent error in binding -->
<Setter Property="IsMaximized" Value="False" />
<!-- Add help icon/tooltip to tool window header -->
<Setter Property="Template">
<ControlTemplate>
<Grid RowDefinitions="Auto,*" x:DataType="controls:IToolDock" x:CompileBindings="True">
<ContentPresenter x:Name="PART_ContentPresenter"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
Padding="{TemplateBinding Padding}"
Grid.Row="1" />
<Border x:Name="PART_Border"
BorderBrush="{TemplateBinding BorderBrush}"
VerticalAlignment="Top"
ContextFlyout="{DynamicResource ToolChromeControlContextMenu}"
Grid.Row="{Binding GripMode, Converter={x:Static converters:GripModeConverters.GridRowAutoHideConverter}}">
<Grid x:Name="PART_Grip">
<DockPanel LastChildFill="True" Margin="8 0">
<Panel DockPanel.Dock="Left">
<WrapPanel>
<TextBlock x:Name="PART_Title"
Text="{Binding ActiveDockable.Title, FallbackValue=TITLE}" />
<ContentControl Content="{Binding ActiveDockable}">
<ContentControl.DataTemplates>
<DataTemplate DataType="dvm:BaseToolContainerViewModel">
<Image
Source="/Assets/Help.png"
Stretch="None"
Margin="0 0 5 0"
ToolTip.Tip="{Binding HelpContent}"
ToolTip.ShowDelay="100"
ToolTip.HorizontalOffset="10"
IsVisible="{Binding HelpContent, Converter={x:Static ObjectConverters.IsNotNull}}"
/>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
</WrapPanel>
</Panel>
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
<Button x:Name="PART_MenuButton" IsVisible="False"
Theme="{StaticResource ChromeButton}"
Flyout="{StaticResource ToolChromeControlContextMenu}">
<Viewbox Margin="2">
<Path x:Name="PART_MenuPath" />
</Viewbox>
</Button>
<Button x:Name="PART_PinButton"
Command="{Binding Owner.Factory.PinDockable}"
CommandParameter="{Binding ActiveDockable}"
Theme="{StaticResource ChromeButton}">
<Button.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="ActiveDockable.CanPin" FallbackValue="{x:False}" />
<TemplateBinding Property="IsFloating" Converter="{x:Static BoolConverters.Not}" />
</MultiBinding>
</Button.IsVisible>
<Viewbox>
<Path x:Name="PART_PinPath" />
</Viewbox>
</Button>
<Button x:Name="PART_MaximizeRestoreButton"
IsVisible="{TemplateBinding IsFloating}"
Theme="{StaticResource ChromeButton}">
<Viewbox>
<Path x:Name="PART_MaximizeRestorePath" />
</Viewbox>
</Button>
<Button x:Name="PART_CloseButton"
Command="{Binding Owner.Factory.CloseDockable}"
CommandParameter="{Binding ActiveDockable}"
IsVisible="{Binding ActiveDockable.CanClose, FallbackValue=False}"
Theme="{StaticResource ChromeButton}">
<Viewbox>
<Path x:Name="PART_ClosePath" />
</Viewbox>
</Button>
</StackPanel>
<Grid x:Name="PART_Grid" />
</DockPanel>
</Grid>
</Border>
<Panel x:Name="PART_Panel"
Background="{TemplateBinding BorderBrush}"
Height="1"
VerticalAlignment="Top"
Grid.Row="{Binding GripMode, Converter={x:Static converters:GripModeConverters.GridRowAutoHideConverter}}" />
</Grid>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="ProportionalDockControl">
<Setter Property="Template">
<ControlTemplate>
<DockableControl TrackingMode="Visible">
<!--
Use name to restrict style, otherwise it gets applied further down the tree
and causes exceptions when trying to bind the values (including in tooltips
attached to a control in the dock control)
-->
<ItemsControl ItemsSource="{ReflectionBinding VisibleDockables}" Name="DockItemsControl">
<ItemsControl.Styles>
<Style Selector="ItemsControl#DockItemsControl > ContentPresenter">
<Setter x:DataType="core:IDock" Property="(ProportionalStackPanel.Proportion)" Value="{Binding Proportion}" />
<!-- prevent error in binding -->
<Setter Property="(ProportionalStackPanel.IsCollapsed)" Value="False" />
</Style>
</ItemsControl.Styles>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<ProportionalStackPanel DockProperties.IsDropArea="True"
Background="Transparent"
Orientation="{ReflectionBinding Orientation, Converter={x:Static converters:OrientationConverter.Instance}}" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</DockableControl>
</ControlTemplate>
</Setter>
</Style>
</Styles>