Skip to content

Commit

Permalink
TopPanel: Add support for ThemeExtras navigation buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
darklinkpower committed Mar 14, 2024
1 parent 5b94387 commit 5aa04ec
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 1 deletion.
1 change: 1 addition & 0 deletions source/Constants.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<sys:Int32 x:Key="GridViewSectionOrderCheckDlc">10</sys:Int32>
<sys:Int32 x:Key="GridViewSectionOrderGameRelations">11</sys:Int32>
<sys:Boolean x:Key="GridViewCoverZoomOnHover">True</sys:Boolean>
<sys:Boolean x:Key="ShowNavigationButtons">True</sys:Boolean>
<!--region end-->

<sys:Double x:Key="GlyphColorObscureOpacity">0.5</sys:Double>
Expand Down
63 changes: 63 additions & 0 deletions source/CustomControls/TopPanelItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,67 @@
</MultiTrigger>
</Style.Triggers>
</Style>

<Style TargetType="{x:Type Button}" x:Key="TopPanelNavigateBackButtonStyle">
<Setter Property="MinWidth" Value="35" />
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
<Setter Property="Margin" Value="6,0,6,0" />
<Setter Property="Background" Value="{DynamicResource TopPanelItemBackgroundBrush}" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Foreground" Value="{DynamicResource GlyphBrush}" />
<Setter Property="Opacity" Value="0.5" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="{DynamicResource TopPanelItemPadding}" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="{DynamicResource TopPanelItemBorderThickness}" />
<Setter Property="Padding" Value="{DynamicResource TopPanelItemPadding}" />
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Border" BorderThickness="0" Background="{TemplateBinding Background}"
CornerRadius="{DynamicResource ControlCornerRadius}" BorderBrush="{TemplateBinding BorderBrush}">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE72B;"
FontSize="16"
x:Name="Icon"
Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.20" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsEnabled" Value="True" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<Setter Property="Opacity" Value="1.0" />
</MultiTrigger>
</Style.Triggers>
</Style>

<Style x:Key="TopPanelNavigateForwardButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource TopPanelNavigateBackButtonStyle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Border" BorderThickness="0" Background="{TemplateBinding Background}"
CornerRadius="{DynamicResource ControlCornerRadius}" BorderBrush="{TemplateBinding BorderBrush}">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE72A;"
FontSize="16"
Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
12 changes: 11 additions & 1 deletion source/Views/TopPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@
Height="40" RenderOptions.BitmapScalingMode="Fant"
Margin="10,0,5,0"/>
</Border>

<Border DockPanel.Dock="Left"
Visibility="{Binding ElementName=PART_TextMainSearch}">
<Border.Style>
Expand All @@ -225,6 +224,17 @@
Width="250" />
</Border>

<Border Tag="{DynamicResource ShowNavigationButtons}"
DockPanel.Dock="Left"
Visibility="{Binding Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel Visibility="{PluginStatus Plugin=felixkmh_Extras_Plugin}"
Margin="{Binding ElementName=PART_ToggleNotifications, Path=Margin}"
Orientation="Horizontal">
<Button Style="{DynamicResource TopPanelNavigateBackButtonStyle}" Command="{PluginSettings Plugin=ThemeExtras, Path=Commands.BackCommand, FallbackValue={x:Null}}" />
<Button Style="{DynamicResource TopPanelNavigateForwardButtonStyle}" Command="{PluginSettings Plugin=ThemeExtras, Path=Commands.ForwardCommand, FallbackValue={x:Null}}" />
</StackPanel>
</Border>

<Border DockPanel.Dock="Left"
Margin="15,6,0,6"
Padding="15,0,15,0"
Expand Down
2 changes: 2 additions & 0 deletions source/thememodifier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Constants:
- GlyphBrush: 'Primary Color'
- WindowBackgroundBrush: 'Window background color'
- PlayButtonTextBrush: 'Play button text color'
- "Top Panel"
- ShowNavigationButtons: 'Show navigation buttons'
- "Library"
- LibraryUseLowPerformanceBlurBackground: 'Use low performance blurred game background image'
- LibraryUseNoiseOpacityLayer: 'Use noise opacity layer'
Expand Down

0 comments on commit 5aa04ec

Please sign in to comment.