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 27a3ab3 commit 0273c2e
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/Constants.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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-->

<x:Static x:Key="EmptyString" Member="sys:String.Empty" />
Expand Down
60 changes: 60 additions & 0 deletions source/CustomControls/TopPanelItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,64 @@
</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="8,0,0,0" />
<Setter Property="Background" Value="{DynamicResource TopPanelItemBackgroundBrush}" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Foreground" Value="{DynamicResource TopPanelItemForegroundBrush}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="3" />
<Setter Property="Opacity" Value="0.75" />
<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="{DynamicResource FontIcoFont}" Text="&#xEA5C;"
FontSize="24"
Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="True">
<Setter Property="Foreground" Value="{DynamicResource TopPanelItemIsMouseOverForegroundBrush}" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsEnabled" Value="True" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<Setter Property="Foreground" Value="{DynamicResource GlyphBrush}" />
</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="{DynamicResource FontIcoFont}" Text="&#xEA5D;"
FontSize="24"
Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>
11 changes: 11 additions & 0 deletions source/Views/TopPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@
WindowChrome.IsHitTestVisibleInChrome="True"
MinWidth="120"
Width="{Settings DetailsListWitdh}" />

<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>

<StackPanel x:Name="PART_PanelMainItems" Orientation="Horizontal"
VerticalAlignment="Stretch" Margin="0,6,0,6"/>
Expand Down
2 changes: 2 additions & 0 deletions source/thememodifier.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Constants:
- "Top Panel"
- ShowNavigationButtons: 'Show navigation buttons'
- "Details View"
- DetailsViewDescriptionWidth(150,2400): 'Width of description'
- DetailsViewDescriptionDockToRight: 'Dock description to the right'
Expand Down

0 comments on commit 0273c2e

Please sign in to comment.