From 9f113153b2e8d4107f60b26adf7c25ac92e31dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaro=20Mart=C3=ADnez?= Date: Tue, 5 Jul 2022 18:48:20 -0500 Subject: [PATCH 1/9] Context menu styling --- RetroBar/Controls/TaskButton.xaml.cs | 42 ++- RetroBar/Controls/TaskList.xaml.cs | 10 +- RetroBar/Themes/System XP.xaml | 15 +- RetroBar/Themes/System.xaml | 280 +++++++++++++++++++- RetroBar/Themes/Windows 2000.xaml | 17 +- RetroBar/Themes/Windows 95-98.xaml | 21 +- RetroBar/Themes/Windows XP Blue.xaml | 126 ++++++++- RetroBar/Themes/Windows XP Olive Green.xaml | 2 + RetroBar/Themes/Windows XP Silver.xaml | 5 +- 9 files changed, 472 insertions(+), 46 deletions(-) diff --git a/RetroBar/Controls/TaskButton.xaml.cs b/RetroBar/Controls/TaskButton.xaml.cs index bd4149c6..91761de6 100644 --- a/RetroBar/Controls/TaskButton.xaml.cs +++ b/RetroBar/Controls/TaskButton.xaml.cs @@ -159,50 +159,68 @@ private void AppButton_OnContextMenuOpening(object sender, ContextMenuEventArgs int ws = Window.WindowStyles; // disable window operations depending on current window state. originally tried implementing via bindings but found there is no notification we get regarding maximized state - MaximizeMenuItem.IsEnabled = wss != NativeMethods.WindowShowStyle.ShowMaximized && (ws & (int)NativeMethods.WindowStyles.WS_MAXIMIZEBOX) != 0; - MinimizeMenuItem.IsEnabled = wss != NativeMethods.WindowShowStyle.ShowMinimized && Window.CanMinimize; - if (RestoreMenuItem.IsEnabled = wss != NativeMethods.WindowShowStyle.ShowNormal) + MaximizeMenuItem.StaysOpenOnClick = !(wss != NativeMethods.WindowShowStyle.ShowMaximized && (ws & (int)NativeMethods.WindowStyles.WS_MAXIMIZEBOX) != 0); + MinimizeMenuItem.StaysOpenOnClick = !(wss != NativeMethods.WindowShowStyle.ShowMinimized && (ws & (int)NativeMethods.WindowStyles.WS_MINIMIZEBOX) != 0); + if (!(RestoreMenuItem.StaysOpenOnClick = wss == NativeMethods.WindowShowStyle.ShowNormal)) { CloseMenuItem.FontWeight = FontWeights.Normal; RestoreMenuItem.FontWeight = FontWeights.Bold; } - if (!RestoreMenuItem.IsEnabled || RestoreMenuItem.IsEnabled && !MaximizeMenuItem.IsEnabled) + if (RestoreMenuItem.StaysOpenOnClick || !RestoreMenuItem.StaysOpenOnClick && MaximizeMenuItem.StaysOpenOnClick) { CloseMenuItem.FontWeight = FontWeights.Bold; RestoreMenuItem.FontWeight = FontWeights.Normal; } - MoveMenuItem.IsEnabled = wss == NativeMethods.WindowShowStyle.ShowNormal; - SizeMenuItem.IsEnabled = wss == NativeMethods.WindowShowStyle.ShowNormal && (ws & (int)NativeMethods.WindowStyles.WS_MAXIMIZEBOX) != 0; + MoveMenuItem.StaysOpenOnClick = wss != NativeMethods.WindowShowStyle.ShowNormal; + SizeMenuItem.StaysOpenOnClick = !(wss == NativeMethods.WindowShowStyle.ShowNormal && (ws & (int)NativeMethods.WindowStyles.WS_MAXIMIZEBOX) != 0); } private void CloseMenuItem_OnClick(object sender, RoutedEventArgs e) { - Window?.Close(); + if (!((MenuItem)sender).StaysOpenOnClick) + { + Window?.Close(); + } } private void RestoreMenuItem_OnClick(object sender, RoutedEventArgs e) { - Window?.Restore(); + if (!((MenuItem)sender).StaysOpenOnClick) + { + Window?.Restore(); + } } private void MoveMenuItem_OnClick(object sender, RoutedEventArgs e) { - Window?.Move(); + if (!((MenuItem)sender).StaysOpenOnClick) + { + Window?.Move(); + } } private void SizeMenuItem_OnClick(object sender, RoutedEventArgs e) { - Window?.Size(); + if (!((MenuItem)sender).StaysOpenOnClick) + { + Window?.Size(); + } } private void MinimizeMenuItem_OnClick(object sender, RoutedEventArgs e) { - Window?.Minimize(); + if (!((MenuItem)sender).StaysOpenOnClick) + { + Window?.Minimize(); + } } private void MaximizeMenuItem_OnClick(object sender, RoutedEventArgs e) { - Window?.Maximize(); + if (!((MenuItem)sender).StaysOpenOnClick) + { + Window?.Maximize(); + } } private void AppButton_OnClick(object sender, RoutedEventArgs e) diff --git a/RetroBar/Controls/TaskList.xaml.cs b/RetroBar/Controls/TaskList.xaml.cs index 6407905c..9eb86e17 100644 --- a/RetroBar/Controls/TaskList.xaml.cs +++ b/RetroBar/Controls/TaskList.xaml.cs @@ -262,10 +262,16 @@ private void SetScrollable(bool canScroll) private void TasksScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e) { - if (!isScrollable) + if (e.Delta > 0) { - e.Handled = true; + TasksScrollViewer.PageUp(); } + if (e.Delta < 0) + { + TasksScrollViewer.PageDown(); + } + + e.Handled = true; } } } \ No newline at end of file diff --git a/RetroBar/Themes/System XP.xaml b/RetroBar/Themes/System XP.xaml index f4429529..415f5a5b 100644 --- a/RetroBar/Themes/System XP.xaml +++ b/RetroBar/Themes/System XP.xaml @@ -26,7 +26,20 @@ + + diff --git a/RetroBar/Themes/System.xaml b/RetroBar/Themes/System.xaml index 2c436ea8..75186554 100644 --- a/RetroBar/Themes/System.xaml +++ b/RetroBar/Themes/System.xaml @@ -17,10 +17,11 @@ - - - + + + + @@ -28,6 +29,10 @@ + + + + @@ -41,12 +46,6 @@ Value="LeftToRight" /> - - 11 Bold @@ -62,9 +61,185 @@ Value="{DynamicResource GlobalFontSize}" /> - + + + + + + + + @@ -716,6 +723,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + M0 2 0 5 2.5 7.6 7.1 3 7.1 0 2.5 4.6Z - - + Value="{DynamicResource MenuDisabledForeground}" /> + + @@ -152,11 +197,6 @@ Property="Effect" Value="{x:Null}" /> - - - @@ -419,6 +459,8 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +