Skip to content

Commit

Permalink
edits and WIP SLATE THEME
Browse files Browse the repository at this point in the history
  • Loading branch information
pieckenst committed Nov 23, 2024
1 parent 8aeb170 commit 774fda3
Show file tree
Hide file tree
Showing 37 changed files with 326 additions and 127 deletions.
Binary file modified .vs/handlerlaunch/v17/.suo
Binary file not shown.
5 changes: 3 additions & 2 deletions .vs/handlerlaunch/v17/DocumentLayout.backup.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@
"RelativeDocumentMoniker": "SpinningWheelLib\\CustomLonghornTitleBar.xaml.cs",
"ToolTip": "G:\\code\\WebLaunch\\SpinningWheelLib\\CustomLonghornTitleBar.xaml.cs",
"RelativeToolTip": "SpinningWheelLib\\CustomLonghornTitleBar.xaml.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"ViewState": "AgIAAB0AAAAAAAAAAAApwC8AAAAQAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-23T20:43:57.629Z"
"WhenOpened": "2024-11-23T20:43:57.629Z",
"EditorCaption": ""
},
{
"$type": "Document",
Expand Down
19 changes: 10 additions & 9 deletions .vs/handlerlaunch/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"Version": 1,
"WorkspaceRootPath": "G:\\code\\WebLaunch\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{1629F3CE-F4A2-42EC-ABF2-C9200EB1BD38}|SpinningWheelLib\\SpinningWheelLib.csproj|g:\\code\\weblaunch\\spinningwheellib\\settingswindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{1629F3CE-F4A2-42EC-ABF2-C9200EB1BD38}|SpinningWheelLib\\SpinningWheelLib.csproj|solutionrelative:spinningwheellib\\settingswindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{1629F3CE-F4A2-42EC-ABF2-C9200EB1BD38}|SpinningWheelLib\\SpinningWheelLib.csproj|g:\\code\\weblaunch\\spinningwheellib\\customlonghorntitlebar.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{1629F3CE-F4A2-42EC-ABF2-C9200EB1BD38}|SpinningWheelLib\\SpinningWheelLib.csproj|solutionrelative:spinningwheellib\\customlonghorntitlebar.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{1629F3CE-F4A2-42EC-ABF2-C9200EB1BD38}|SpinningWheelLib\\SpinningWheelLib.csproj|g:\\code\\weblaunch\\spinningwheellib\\settingswindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{1629F3CE-F4A2-42EC-ABF2-C9200EB1BD38}|SpinningWheelLib\\SpinningWheelLib.csproj|solutionrelative:spinningwheellib\\settingswindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{1629F3CE-F4A2-42EC-ABF2-C9200EB1BD38}|SpinningWheelLib\\SpinningWheelLib.csproj|g:\\code\\weblaunch\\spinningwheellib\\customlonghorntitlebar.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{1629F3CE-F4A2-42EC-ABF2-C9200EB1BD38}|SpinningWheelLib\\SpinningWheelLib.csproj|solutionrelative:spinningwheellib\\customlonghorntitlebar.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
Expand All @@ -22,11 +22,11 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"DocumentIndex": 1,
"Title": "SettingsWindow.xaml",
"DocumentMoniker": "G:\\code\\WebLaunch\\SpinningWheelLib\\SettingsWindow.xaml",
"RelativeDocumentMoniker": "SpinningWheelLib\\SettingsWindow.xaml",
Expand All @@ -44,13 +44,14 @@
"RelativeDocumentMoniker": "SpinningWheelLib\\CustomLonghornTitleBar.xaml.cs",
"ToolTip": "G:\\code\\WebLaunch\\SpinningWheelLib\\CustomLonghornTitleBar.xaml.cs",
"RelativeToolTip": "SpinningWheelLib\\CustomLonghornTitleBar.xaml.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"ViewState": "AgIAAB0AAAAAAAAAAAApwC8AAAAQAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-23T20:43:57.629Z"
"WhenOpened": "2024-11-23T20:43:57.629Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 0,
"Title": "CustomLonghornTitleBar.xaml",
"DocumentMoniker": "G:\\code\\WebLaunch\\SpinningWheelLib\\CustomLonghornTitleBar.xaml",
"RelativeDocumentMoniker": "SpinningWheelLib\\CustomLonghornTitleBar.xaml",
Expand Down
120 changes: 69 additions & 51 deletions SpinningWheelLib/CustomLonghornTitleBar.xaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,50 @@
<UserControl x:Class="SpinningWheelLib.Controls.CustomLonghornTitleBar"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SpinningWheelLib.Controls"
mc:Ignorable="d"
x:Name="Root"
Height="74">

<UserControl.Resources>
<ResourceDictionary>
<LinearGradientBrush x:Key="TaskbarBackground" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#DEDEDE" Offset="0.0" />
<GradientStop Color="#767676" Offset="0.25" />
<GradientStop Color="#5C5C5C" Offset="0.50" />
<GradientStop Color="#4E4E4E" Offset="0.75" />
<GradientStop Color="#545454" Offset="1.0" />
</LinearGradientBrush>

<Style x:Key="backButton" TargetType="{x:Type Button}" BasedOn="{x:Null}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Image Name="backButton" Source="/SpinningWheelLib;component/img/128.png" Stretch="Fill" />
<Image Name="back_glow" Width="38" Height="54" Source="/SpinningWheelLib;component/img/back_glow.png"
Stretch="Fill" Opacity="0" />
Stretch="Fill" Opacity="0" />
<ContentPresenter HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" />
VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back_glow"
Storyboard.TargetProperty="Opacity"
To="1" Duration="0:0:0.2"/>
Storyboard.TargetProperty="Opacity"
To="1" Duration="0:0:0.2"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="back_glow"
Storyboard.TargetProperty="Opacity"
To="0" Duration="0:0:0.2"/>
Storyboard.TargetProperty="Opacity"
To="0" Duration="0:0:0.2"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
Expand Down Expand Up @@ -94,7 +102,7 @@
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Image Source="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"
Opacity="0.5" Stretch="Fill">
Opacity="0.5" Stretch="Fill">
<UIElement.BitmapEffect>
<OuterGlowBitmapEffect GlowColor="#FFFFFFFF" GlowSize="3" />
</UIElement.BitmapEffect>
Expand All @@ -120,54 +128,64 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<Grid Name="glassArea" Margin="0,10,8,0" Height="74" Background="#00000000"> <!-- Increased from 54 to 74 -->
<Image Name="nav" HorizontalAlignment="Left" Width="65"
Source="/SpinningWheelLib;component/navigation.png"
Stretch="Fill" VerticalAlignment="Top" Height="54"
Margin="8,10,0,0"/> <!-- Added left margin -->

<Button Name="backButton" Style="{StaticResource backButton}"
HorizontalAlignment="Left" Width="38" Height="54"
Margin="8,10,0,0" VerticalAlignment="Top"/> <!-- Added left margin -->
<Grid Name="glassArea" Margin="0,10,8,0" Height="74">
<Grid.Style>
<Style TargetType="Grid">
<Style.Triggers>
<DataTrigger Binding="{Binding UseSlateTheme, RelativeSource={RelativeSource AncestorType=UserControl}}" Value="True">
<Setter Property="Background" Value="{StaticResource TaskbarBackground}"/>
</DataTrigger>
<DataTrigger Binding="{Binding UseSlateTheme, RelativeSource={RelativeSource AncestorType=UserControl}}" Value="False">
<Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSource AncestorType=Window}}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
<Image Name="nav" HorizontalAlignment="Left" Width="65"
Source="/SpinningWheelLib;component/navigation.png"
Stretch="Fill" VerticalAlignment="Top" Height="54"
Margin="8,10,0,0"/>

<Button Name="forwardButton" Style="{StaticResource forwardButton}"
HorizontalAlignment="Left" Margin="46,10,0,0" Width="27"
IsEnabled="False" Height="54" VerticalAlignment="Top"/> <!-- Adjusted margin -->
<Button Name="backButton" Style="{StaticResource backButton}"
HorizontalAlignment="Left" Width="38" Height="54"
Margin="8,10,0,0" VerticalAlignment="Top"/>

<TextBlock Name="WindowTitle"
Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=Title, FallbackValue='Window Title'}"
FontSize="22" Margin="85,10,86,24" Foreground="#FF132550" VerticalAlignment="Center">
<TextBlock.BitmapEffect>
<OuterGlowBitmapEffect GlowColor="#FFFFFFFF" GlowSize="3" />
</TextBlock.BitmapEffect>
</TextBlock>
<Button Name="forwardButton" Style="{StaticResource forwardButton}"
HorizontalAlignment="Left" Margin="46,10,0,0" Width="27"
IsEnabled="False" Height="54" VerticalAlignment="Top"/>

<ContentPresenter Content="{Binding TitleBarContent, ElementName=Root}"
Margin="85,35,100,0" VerticalAlignment="Center"/>
<TextBlock Name="WindowTitle"
Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=Title, FallbackValue='Window Title'}"
FontSize="22" Margin="85,10,86,24" Foreground="#FF132550" VerticalAlignment="Center">
<TextBlock.BitmapEffect>
<OuterGlowBitmapEffect GlowColor="#FFFFFFFF" GlowSize="3" />
</TextBlock.BitmapEffect>
</TextBlock>

<Button Name="favButton" Style="{StaticResource favButton}"
HorizontalAlignment="Right" Margin="0,15,48,0"
Width="50" Height="44" Visibility="Collapsed" VerticalAlignment="Center"/>
<ContentPresenter Content="{Binding TitleBarContent, ElementName=Root}"
Margin="85,35,100,0" VerticalAlignment="Center"/>

<StackPanel HorizontalAlignment="Right" Margin="0,10,8,24"
Orientation="Horizontal" VerticalAlignment="Center">
<Button Style="{StaticResource windowControlButton}"
Name="MinButton" Tag="/SpinningWheelLib;component/img/MinNormal.png" Margin="0,0,4,0"/>
<Button Style="{StaticResource windowControlButton}"
Name="MaxButton" Tag="/SpinningWheelLib;component/img/MaxNormal.png" Margin="0,0,4,0"/>
<Button Style="{StaticResource windowControlButton}"
Name="CloseButton" Tag="/SpinningWheelLib;component/img/CloseNormal.png"/>
</StackPanel>
<Button Name="favButton" Style="{StaticResource favButton}"
HorizontalAlignment="Right" Margin="0,15,48,0"
Width="50" Height="44" Visibility="Collapsed" VerticalAlignment="Center"/>

<StackPanel HorizontalAlignment="Right" Margin="0,10,8,24"
Orientation="Horizontal" VerticalAlignment="Center">
<Button Style="{StaticResource windowControlButton}"
Name="MinButton" Tag="/SpinningWheelLib;component/img/MinNormal.png" Margin="0,0,4,0"/>
<Button Style="{StaticResource windowControlButton}"
Name="MaxButton" Tag="/SpinningWheelLib;component/img/MaxNormal.png" Margin="0,0,4,0"/>
<Button Style="{StaticResource windowControlButton}"
Name="CloseButton" Tag="/SpinningWheelLib;component/img/CloseNormal.png"/>
</StackPanel>

<ContentPresenter Content="{Binding BreadcrumbContent, ElementName=Root}"
Margin="85,35,100,0" VerticalAlignment="Center"/>
</Grid>
<ContentPresenter Content="{Binding BreadcrumbContent, ElementName=Root}"
Margin="85,35,100,0" VerticalAlignment="Center"/>
</Grid>

<!-- Below the title bar area -->
<ContentPresenter Grid.Row="1" Content="{Binding MenuBarContent, ElementName=Root}"
Margin="8,0,8,0"/>
<ContentPresenter Grid.Row="2" Content="{Binding AdditionalContent, ElementName=Root}"
Margin="8,0,8,0"/>
<ContentPresenter Grid.Row="1" Content="{Binding MenuBarContent, ElementName=Root}"
Margin="8,0,8,0"/>
<ContentPresenter Grid.Row="2" Content="{Binding AdditionalContent, ElementName=Root}"
Margin="8,0,8,0"/>
</Grid>
</UserControl>
106 changes: 71 additions & 35 deletions SpinningWheelLib/CustomLonghornTitleBar.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace SpinningWheelLib.Controls
{
Expand All @@ -17,6 +18,40 @@ public partial class CustomLonghornTitleBar : UserControl
public static readonly DependencyProperty AdditionalContentProperty =
DependencyProperty.Register("AdditionalContent", typeof(object), typeof(CustomLonghornTitleBar), new PropertyMetadata(null));

public static readonly DependencyProperty UseSlateThemeProperty =
DependencyProperty.Register("UseSlateTheme", typeof(bool), typeof(CustomLonghornTitleBar),
new PropertyMetadata(true, OnUseSlateThemeChanged));



public bool UseSlateTheme
{
get { return (bool)GetValue(UseSlateThemeProperty); }
set { SetValue(UseSlateThemeProperty, value); }
}

private static void OnUseSlateThemeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = d as CustomLonghornTitleBar;
if (control != null)
{
control.UpdateBackground();
}
}

private void UpdateBackground()
{
if (UseSlateTheme)
{
glassArea.Background = (LinearGradientBrush)FindResource("TaskbarBackground");
}
else
{
// Use Aero/Window background
glassArea.Background = Background;
}
}

public object TitleBarContent
{
get => GetValue(TitleBarContentProperty);
Expand All @@ -42,28 +77,29 @@ public object AdditionalContent
}

public CustomLonghornTitleBar()
{
InitializeComponent();

MinButton.Click += (s, e) => {
var window = Window.GetWindow(this);
if (window != null) window.WindowState = WindowState.Minimized;
};

MaxButton.Click += (s, e) => {
var window = Window.GetWindow(this);
if (window != null) {
window.WindowState = window.WindowState == WindowState.Maximized
? WindowState.Normal
: WindowState.Maximized;
{
InitializeComponent();

MinButton.Click += (s, e) => {
var window = Window.GetWindow(this);
if (window != null) window.WindowState = WindowState.Minimized;
};

MaxButton.Click += (s, e) => {
var window = Window.GetWindow(this);
if (window != null)
{
window.WindowState = window.WindowState == WindowState.Maximized
? WindowState.Normal
: WindowState.Maximized;
}
};

CloseButton.Click += (s, e) => {
var window = Window.GetWindow(this);
if (window != null) window.Close();
};
}
};

CloseButton.Click += (s, e) => {
var window = Window.GetWindow(this);
if (window != null) window.Close();
};
}


public void ShowFavoriteButton(bool show)
Expand All @@ -77,21 +113,21 @@ public void EnableForwardButton(bool enable)
}

public event RoutedEventHandler FavoriteClick
{
add { favButton.Click += value; }
remove { favButton.Click -= value; }
}
{
add { favButton.Click += value; }
remove { favButton.Click -= value; }
}

public event RoutedEventHandler BackClick
{
add { backButton.Click += value; }
remove { backButton.Click -= value; }
}
public event RoutedEventHandler BackClick
{
add { backButton.Click += value; }
remove { backButton.Click -= value; }
}

public event RoutedEventHandler ForwardClick
{
add { forwardButton.Click += value; }
remove { forwardButton.Click -= value; }
}
public event RoutedEventHandler ForwardClick
{
add { forwardButton.Click += value; }
remove { forwardButton.Click -= value; }
}
}
}
2 changes: 1 addition & 1 deletion SpinningWheelLib/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
</Grid.RowDefinitions>

<!-- Custom Title Bar -->
<controls:CustomLonghornTitleBar>
<controls:CustomLonghornTitleBar UseSlateTheme="True">
<controls:CustomLonghornTitleBar.TitleBarContent>
<TextBlock Text="Additional Title Bar Content" Foreground="#666666"/>
</controls:CustomLonghornTitleBar.TitleBarContent>
Expand Down
Binary file not shown.
Binary file modified SpinningWheelLib/bin/Debug/net9.0-windows7.0/SpinningWheelLib.pdb
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 774fda3

Please sign in to comment.