From d54c6f125e19d330d4f30acaa2f2a514966d706f Mon Sep 17 00:00:00 2001 From: Lamparter <71598437+Lamparter@users.noreply.github.com> Date: Tue, 11 Mar 2025 17:36:46 +0000 Subject: [PATCH 01/10] Added Generic.xaml back for Riverside.Toolkit.Icons --- .../Themes/Generic.xaml | 27 +++++++++++++++++++ .../Riverside.Toolkit.Wpf.Icons.csproj | 3 +++ 2 files changed, 30 insertions(+) create mode 100644 src/core/Riverside.Toolkit.Icons/Themes/Generic.xaml diff --git a/src/core/Riverside.Toolkit.Icons/Themes/Generic.xaml b/src/core/Riverside.Toolkit.Icons/Themes/Generic.xaml new file mode 100644 index 0000000..10cd82e --- /dev/null +++ b/src/core/Riverside.Toolkit.Icons/Themes/Generic.xaml @@ -0,0 +1,27 @@ + + + + + \ No newline at end of file diff --git a/src/platforms/Riverside.Toolkit.Wpf.Icons/Riverside.Toolkit.Wpf.Icons.csproj b/src/platforms/Riverside.Toolkit.Wpf.Icons/Riverside.Toolkit.Wpf.Icons.csproj index 35e3d84..07e992d 100644 --- a/src/platforms/Riverside.Toolkit.Wpf.Icons/Riverside.Toolkit.Wpf.Icons.csproj +++ b/src/platforms/Riverside.Toolkit.Wpf.Icons/Riverside.Toolkit.Wpf.Icons.csproj @@ -1,2 +1,5 @@ + + + From efc8d9b13f621b9214d8a4398815f12152d78b40 Mon Sep 17 00:00:00 2001 From: Lamparter <71598437+Lamparter@users.noreply.github.com> Date: Tue, 11 Mar 2025 17:43:34 +0000 Subject: [PATCH 02/10] Added a filler generic.xaml for wpf (Riverside.Toolkit.Icons) bad practice] kids, don't do this --- .../Themes/Generic.xaml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/platforms/Riverside.Toolkit.Wpf.Icons/Themes/Generic.xaml diff --git a/src/platforms/Riverside.Toolkit.Wpf.Icons/Themes/Generic.xaml b/src/platforms/Riverside.Toolkit.Wpf.Icons/Themes/Generic.xaml new file mode 100644 index 0000000..5e48122 --- /dev/null +++ b/src/platforms/Riverside.Toolkit.Wpf.Icons/Themes/Generic.xaml @@ -0,0 +1,28 @@ + + + + + \ No newline at end of file From 6539ea91c60050b571b167f80410d1056e36782b Mon Sep 17 00:00:00 2001 From: Lamparter <71598437+Lamparter@users.noreply.github.com> Date: Tue, 11 Mar 2025 18:00:40 +0000 Subject: [PATCH 03/10] Rename Riverside.Toolkit.Brushes to Riverside.Toolkit.Media Preparing for GlowUI (Riverside.GlowUI.Materials will be here) --- CubeKit.slnx | 6 +++--- .../ApplicationBrushes.xaml | 0 .../BackdropKind.cs | 2 +- .../MicaAltBrush.cs | 2 +- .../MicaBrushes.xaml | 2 +- .../Riverside.Toolkit.Media.projitems} | 2 +- .../Riverside.Toolkit.Media.shproj} | 2 +- .../StyleBrushes.xaml | 0 .../Riverside.Toolkit.Uwp.Media.csproj} | 0 .../Riverside.Toolkit.WinUI.Media.csproj} | 0 10 files changed, 8 insertions(+), 8 deletions(-) rename src/core/{Riverside.Toolkit.Brushes => Riverside.Toolkit.Media}/ApplicationBrushes.xaml (100%) rename src/core/{Riverside.Toolkit.Brushes => Riverside.Toolkit.Media}/BackdropKind.cs (67%) rename src/core/{Riverside.Toolkit.Brushes => Riverside.Toolkit.Media}/MicaAltBrush.cs (99%) rename src/core/{Riverside.Toolkit.Brushes => Riverside.Toolkit.Media}/MicaBrushes.xaml (98%) rename src/core/{Riverside.Toolkit.Brushes/Riverside.Toolkit.Brushes.projitems => Riverside.Toolkit.Media/Riverside.Toolkit.Media.projitems} (91%) rename src/core/{Riverside.Toolkit.Brushes/Riverside.Toolkit.Brushes.shproj => Riverside.Toolkit.Media/Riverside.Toolkit.Media.shproj} (92%) rename src/core/{Riverside.Toolkit.Brushes => Riverside.Toolkit.Media}/StyleBrushes.xaml (100%) rename src/platforms/{Riverside.Toolkit.Uwp.Brushes/Riverside.Toolkit.Uwp.Brushes.csproj => Riverside.Toolkit.Uwp.Media/Riverside.Toolkit.Uwp.Media.csproj} (100%) rename src/platforms/{Riverside.Toolkit.WinUI.Brushes/Riverside.Toolkit.WinUI.Brushes.csproj => Riverside.Toolkit.WinUI.Media/Riverside.Toolkit.WinUI.Media.csproj} (100%) diff --git a/CubeKit.slnx b/CubeKit.slnx index 204be4b..f247e43 100644 --- a/CubeKit.slnx +++ b/CubeKit.slnx @@ -33,7 +33,7 @@ - + @@ -65,7 +65,7 @@ - + @@ -87,7 +87,7 @@ - + diff --git a/src/core/Riverside.Toolkit.Brushes/ApplicationBrushes.xaml b/src/core/Riverside.Toolkit.Media/ApplicationBrushes.xaml similarity index 100% rename from src/core/Riverside.Toolkit.Brushes/ApplicationBrushes.xaml rename to src/core/Riverside.Toolkit.Media/ApplicationBrushes.xaml diff --git a/src/core/Riverside.Toolkit.Brushes/BackdropKind.cs b/src/core/Riverside.Toolkit.Media/BackdropKind.cs similarity index 67% rename from src/core/Riverside.Toolkit.Brushes/BackdropKind.cs rename to src/core/Riverside.Toolkit.Media/BackdropKind.cs index fc79f2a..da517fd 100644 --- a/src/core/Riverside.Toolkit.Brushes/BackdropKind.cs +++ b/src/core/Riverside.Toolkit.Media/BackdropKind.cs @@ -1,4 +1,4 @@ -namespace Riverside.Toolkit.Brushes; +namespace Riverside.Toolkit.Media; public enum BackdropKind { diff --git a/src/core/Riverside.Toolkit.Brushes/MicaAltBrush.cs b/src/core/Riverside.Toolkit.Media/MicaAltBrush.cs similarity index 99% rename from src/core/Riverside.Toolkit.Brushes/MicaAltBrush.cs rename to src/core/Riverside.Toolkit.Media/MicaAltBrush.cs index e7e55ad..876f009 100644 --- a/src/core/Riverside.Toolkit.Brushes/MicaAltBrush.cs +++ b/src/core/Riverside.Toolkit.Media/MicaAltBrush.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using Windows.ApplicationModel; -namespace Riverside.Toolkit.Brushes; +namespace Riverside.Toolkit.Media; public class MicaAltBrush : XamlCompositionBrushBase, INotifyPropertyChanged { diff --git a/src/core/Riverside.Toolkit.Brushes/MicaBrushes.xaml b/src/core/Riverside.Toolkit.Media/MicaBrushes.xaml similarity index 98% rename from src/core/Riverside.Toolkit.Brushes/MicaBrushes.xaml rename to src/core/Riverside.Toolkit.Media/MicaBrushes.xaml index f539e88..9dbad50 100644 --- a/src/core/Riverside.Toolkit.Brushes/MicaBrushes.xaml +++ b/src/core/Riverside.Toolkit.Media/MicaBrushes.xaml @@ -1,7 +1,7 @@  diff --git a/src/core/Riverside.Toolkit.Brushes/Riverside.Toolkit.Brushes.projitems b/src/core/Riverside.Toolkit.Media/Riverside.Toolkit.Media.projitems similarity index 91% rename from src/core/Riverside.Toolkit.Brushes/Riverside.Toolkit.Brushes.projitems rename to src/core/Riverside.Toolkit.Media/Riverside.Toolkit.Media.projitems index 92c12b0..6666f4c 100644 --- a/src/core/Riverside.Toolkit.Brushes/Riverside.Toolkit.Brushes.projitems +++ b/src/core/Riverside.Toolkit.Media/Riverside.Toolkit.Media.projitems @@ -6,7 +6,7 @@ bcdc11ec-a933-4b7b-829b-58af5aa5dd14 - Riverside.Toolkit.Brushes + Riverside.Toolkit.Media diff --git a/src/core/Riverside.Toolkit.Brushes/Riverside.Toolkit.Brushes.shproj b/src/core/Riverside.Toolkit.Media/Riverside.Toolkit.Media.shproj similarity index 92% rename from src/core/Riverside.Toolkit.Brushes/Riverside.Toolkit.Brushes.shproj rename to src/core/Riverside.Toolkit.Media/Riverside.Toolkit.Media.shproj index 38d35ea..b22dc55 100644 --- a/src/core/Riverside.Toolkit.Brushes/Riverside.Toolkit.Brushes.shproj +++ b/src/core/Riverside.Toolkit.Media/Riverside.Toolkit.Media.shproj @@ -8,6 +8,6 @@ - + diff --git a/src/core/Riverside.Toolkit.Brushes/StyleBrushes.xaml b/src/core/Riverside.Toolkit.Media/StyleBrushes.xaml similarity index 100% rename from src/core/Riverside.Toolkit.Brushes/StyleBrushes.xaml rename to src/core/Riverside.Toolkit.Media/StyleBrushes.xaml diff --git a/src/platforms/Riverside.Toolkit.Uwp.Brushes/Riverside.Toolkit.Uwp.Brushes.csproj b/src/platforms/Riverside.Toolkit.Uwp.Media/Riverside.Toolkit.Uwp.Media.csproj similarity index 100% rename from src/platforms/Riverside.Toolkit.Uwp.Brushes/Riverside.Toolkit.Uwp.Brushes.csproj rename to src/platforms/Riverside.Toolkit.Uwp.Media/Riverside.Toolkit.Uwp.Media.csproj diff --git a/src/platforms/Riverside.Toolkit.WinUI.Brushes/Riverside.Toolkit.WinUI.Brushes.csproj b/src/platforms/Riverside.Toolkit.WinUI.Media/Riverside.Toolkit.WinUI.Media.csproj similarity index 100% rename from src/platforms/Riverside.Toolkit.WinUI.Brushes/Riverside.Toolkit.WinUI.Brushes.csproj rename to src/platforms/Riverside.Toolkit.WinUI.Media/Riverside.Toolkit.WinUI.Media.csproj From 606d4f4f18628f44380de06d744d3bb22fae7820 Mon Sep 17 00:00:00 2001 From: Lamparter <71598437+Lamparter@users.noreply.github.com> Date: Tue, 11 Mar 2025 18:05:14 +0000 Subject: [PATCH 04/10] Reorder SLN and remove WPF icons generic.xaml --- CubeKit.slnx | 10 +++---- .../Themes/Generic.xaml | 28 ------------------- 2 files changed, 5 insertions(+), 33 deletions(-) delete mode 100644 src/platforms/Riverside.Toolkit.Wpf.Icons/Themes/Generic.xaml diff --git a/CubeKit.slnx b/CubeKit.slnx index f247e43..a4da1da 100644 --- a/CubeKit.slnx +++ b/CubeKit.slnx @@ -33,13 +33,13 @@ - + @@ -65,9 +65,6 @@ - - - @@ -83,17 +80,20 @@ + + + - + diff --git a/src/platforms/Riverside.Toolkit.Wpf.Icons/Themes/Generic.xaml b/src/platforms/Riverside.Toolkit.Wpf.Icons/Themes/Generic.xaml deleted file mode 100644 index 5e48122..0000000 --- a/src/platforms/Riverside.Toolkit.Wpf.Icons/Themes/Generic.xaml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - \ No newline at end of file From 9efc37e25271a3df325d61bd4368dbf1c1585110 Mon Sep 17 00:00:00 2001 From: Lamparter <71598437+Lamparter@users.noreply.github.com> Date: Tue, 11 Mar 2025 18:24:54 +0000 Subject: [PATCH 05/10] Added `Riverside.Toolkit.Media` (Riverside.GlowUI.Materials) --- .../Riverside.Toolkit.Media/AuroraLite.xaml | 741 ++++++++++++++ .../AuroraLite.xaml.cs | 9 + src/core/Riverside.Toolkit.Media/Bloom.html | 917 ++++++++++++++++++ .../Riverside.Toolkit.Media/BloomView.xaml | 18 + .../Riverside.Toolkit.Media/BloomView.xaml.cs | 25 + .../Riverside.Toolkit.Media.projitems | 4 + .../Windows11Danger.html | 908 +++++++++++++++++ 7 files changed, 2622 insertions(+) create mode 100644 src/core/Riverside.Toolkit.Media/AuroraLite.xaml create mode 100644 src/core/Riverside.Toolkit.Media/AuroraLite.xaml.cs create mode 100644 src/core/Riverside.Toolkit.Media/Bloom.html create mode 100644 src/core/Riverside.Toolkit.Media/BloomView.xaml create mode 100644 src/core/Riverside.Toolkit.Media/BloomView.xaml.cs create mode 100644 src/core/Riverside.Toolkit.Media/Windows11Danger.html diff --git a/src/core/Riverside.Toolkit.Media/AuroraLite.xaml b/src/core/Riverside.Toolkit.Media/AuroraLite.xaml new file mode 100644 index 0000000..ae18033 --- /dev/null +++ b/src/core/Riverside.Toolkit.Media/AuroraLite.xaml @@ -0,0 +1,741 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/core/Riverside.Toolkit.Media/AuroraLite.xaml.cs b/src/core/Riverside.Toolkit.Media/AuroraLite.xaml.cs new file mode 100644 index 0000000..d65f342 --- /dev/null +++ b/src/core/Riverside.Toolkit.Media/AuroraLite.xaml.cs @@ -0,0 +1,9 @@ +namespace Riverside.Toolkit.Media; + +public sealed partial class AuroraLite : UserControl +{ + public AuroraLite() + { + this.InitializeComponent(); + } +} \ No newline at end of file diff --git a/src/core/Riverside.Toolkit.Media/Bloom.html b/src/core/Riverside.Toolkit.Media/Bloom.html new file mode 100644 index 0000000..d9a9cb1 --- /dev/null +++ b/src/core/Riverside.Toolkit.Media/Bloom.html @@ -0,0 +1,917 @@ + + + + + + + + + + +
+
+
+
+ [ ] +
+
+
+
+
+
+ [After your PC is ready] +
+
+ [Swipe in from any edge] +
+
+
+ + + + +
+
+
+ + + + + + + + + + + + + + +
+
+
+ + + + + +
+
+ + + + + + + +
+
+
+ + + + + + + +
+
+
+ + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
+
+
+
+ [After your PC is ready] +
+
+ [With mouse, go to corners] +
+
+
+ + + + +
+
+
+ + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+
+
+
+ + + + + +
+
+
+ + + + + + +
+
+
+
+
+
+
+ [After your PC is ready] +
+
+ [With touch, swipe in from any edge] +
+
+
+ + + + +
+
+
+ + + + + + + + + + + + + + +
+
+
+ + + + + +
+
+ + + + + + + +
+
+
+ + + + + + + +
+
+
+ + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
+
+
+
+ [After your PC is ready] +
+
+ [With mouse, go to corners] +
+
+
+ + + + +
+
+
+ + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+
+
+
+ + + + + +
+
+
+ + + + + + +
+
+
+
+ +
+ + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/core/Riverside.Toolkit.Media/BloomView.xaml b/src/core/Riverside.Toolkit.Media/BloomView.xaml new file mode 100644 index 0000000..c199bc3 --- /dev/null +++ b/src/core/Riverside.Toolkit.Media/BloomView.xaml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/src/core/Riverside.Toolkit.Media/BloomView.xaml.cs b/src/core/Riverside.Toolkit.Media/BloomView.xaml.cs new file mode 100644 index 0000000..1f903ed --- /dev/null +++ b/src/core/Riverside.Toolkit.Media/BloomView.xaml.cs @@ -0,0 +1,25 @@ +namespace Riverside.Toolkit.Media; + +public sealed partial class BloomView : UserControl +{ + public BloomView() + { + this.InitializeComponent(); + BloomWebView.Height = Window.Current.Bounds.Height; + BloomWebView.Width = Window.Current.Bounds.Width; +#if Uwp + BloomWebView.Source = new("ms-appx-web:///Riverside.Toolkit.Uwp.Media/Bloom.html"); +#elif WinUI + BloomWebView.Source = new("ms-appx-web:///Riverside.Toolkit.WinUI.Media/Bloom.html"); +#endif +#if WinUI + BloomWebView.DefaultBackgroundColor = Colors.Transparent; +#endif + } + + private void Bloom_SizeChanged(object sender, SizeChangedEventArgs e) + { + BloomWebView.Height = Window.Current.Bounds.Height; + BloomWebView.Width = Window.Current.Bounds.Width; + } +} \ No newline at end of file diff --git a/src/core/Riverside.Toolkit.Media/Riverside.Toolkit.Media.projitems b/src/core/Riverside.Toolkit.Media/Riverside.Toolkit.Media.projitems index 6666f4c..eb5b849 100644 --- a/src/core/Riverside.Toolkit.Media/Riverside.Toolkit.Media.projitems +++ b/src/core/Riverside.Toolkit.Media/Riverside.Toolkit.Media.projitems @@ -16,4 +16,8 @@ Designer + + + +
\ No newline at end of file diff --git a/src/core/Riverside.Toolkit.Media/Windows11Danger.html b/src/core/Riverside.Toolkit.Media/Windows11Danger.html new file mode 100644 index 0000000..a8feaa0 --- /dev/null +++ b/src/core/Riverside.Toolkit.Media/Windows11Danger.html @@ -0,0 +1,908 @@ + + + + + + + + + +
+
+
+
+ [ ] +
+
+
+
+
+
+ [After your PC is ready] +
+
+ [Swipe in from any edge] +
+
+
+ + + + +
+
+
+ + + + + + + + + + + + + + +
+
+
+ + + + + +
+
+ + + + + + + +
+
+
+ + + + + + + +
+
+
+ + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
+
+
+
+ [After your PC is ready] +
+
+ [With mouse, go to corners] +
+
+
+ + + + +
+
+
+ + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+
+
+
+ + + + + +
+
+
+ + + + + + +
+
+
+
+
+
+
+ [After your PC is ready] +
+
+ [With touch, swipe in from any edge] +
+
+
+ + + + +
+
+
+ + + + + + + + + + + + + + +
+
+
+ + + + + +
+
+ + + + + + + +
+
+
+ + + + + + + +
+
+
+ + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+
+
+
+
+ [After your PC is ready] +
+
+ [With mouse, go to corners] +
+
+
+ + + + +
+
+
+ + + + + + + + + + + + + + +
+
+
+
+ + + + + + + +
+
+
+
+ + + + + +
+
+
+ + + + + + +
+
+
+
+ +
+ + + +
+
+
+
+
+ + + \ No newline at end of file From a45522ff93e996e62227ee7dd6cba729cf3c45a7 Mon Sep 17 00:00:00 2001 From: Lamparter <71598437+Lamparter@users.noreply.github.com> Date: Tue, 11 Mar 2025 18:31:42 +0000 Subject: [PATCH 06/10] Add back `Generic.xaml` for TitleBarEx --- .../Themes/Generic.xaml | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 src/core/Riverside.Toolkit.Controls.TitleBar/Themes/Generic.xaml diff --git a/src/core/Riverside.Toolkit.Controls.TitleBar/Themes/Generic.xaml b/src/core/Riverside.Toolkit.Controls.TitleBar/Themes/Generic.xaml new file mode 100644 index 0000000..94c8e0a --- /dev/null +++ b/src/core/Riverside.Toolkit.Controls.TitleBar/Themes/Generic.xaml @@ -0,0 +1,148 @@ + + + \ No newline at end of file From f724550c95b5982a382ce9d454129c2b3d3ad8c8 Mon Sep 17 00:00:00 2001 From: Lamparter <71598437+Lamparter@users.noreply.github.com> Date: Tue, 11 Mar 2025 19:43:02 +0000 Subject: [PATCH 07/10] Add GlowUI --- CubeKit.slnx | 10 + Directory.Packages.props | 1 + .../Riverside.GlowUI.Styles/ComboBox.xaml | 1095 +++++ .../CubeThemeDictionary.xaml | 175 + src/core/Riverside.GlowUI.Styles/CubeUI.xaml | 591 +++ .../Riverside.GlowUI.Styles/FlipView.xaml | 259 ++ src/core/Riverside.GlowUI.Styles/Flyout.xaml | 69 + .../GlowGradientUI.xaml | 3761 +++++++++++++++++ src/core/Riverside.GlowUI.Styles/InfoBar.xaml | 234 + .../NavigationView.xaml | 1653 ++++++++ src/core/Riverside.GlowUI.Styles/Pivot.xaml | 590 +++ src/core/Riverside.GlowUI.Styles/Radio.xaml | 370 ++ .../Riverside.GlowUI.Styles/RichEditBox.xaml | 217 + .../Riverside.GlowUI.Styles.projitems | 19 + .../Riverside.GlowUI.Styles.shproj | 13 + src/core/Riverside.GlowUI.Styles/Slider.xaml | 542 +++ .../Riverside.GlowUI.Styles/SplitView.xaml | 743 ++++ src/core/Riverside.GlowUI.Styles/TabView.xaml | 856 ++++ src/core/Riverside.GlowUI.Styles/TextBox.xaml | 343 ++ .../ToggleSwitches.xaml | 1328 ++++++ src/core/Riverside.GlowUI.Styles/ToolTip.xaml | 58 + .../Riverside.GlowUI.Styles/WindowChrome.xaml | 558 +++ .../GlowBall.xaml | 23 + .../GlowBall.xaml.cs | 18 + .../GlowLine.xaml | 23 + .../GlowLine.xaml.cs | 9 + ...verside.Toolkit.Controls.Crimson.projitems | 19 + .../Riverside.Toolkit.Controls.Crimson.shproj | 13 + .../Riverside.GlowUI.Uwp.Styles.csproj | 13 + .../Riverside.GlowUI.WinUI.Styles.csproj | 11 + ...erside.Toolkit.Uwp.Controls.Crimson.csproj | 7 + ...side.Toolkit.WinUI.Controls.Crimson.csproj | 5 + 32 files changed, 13626 insertions(+) create mode 100644 src/core/Riverside.GlowUI.Styles/ComboBox.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/CubeThemeDictionary.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/CubeUI.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/FlipView.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/Flyout.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/GlowGradientUI.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/InfoBar.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/NavigationView.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/Pivot.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/Radio.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/RichEditBox.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/Riverside.GlowUI.Styles.projitems create mode 100644 src/core/Riverside.GlowUI.Styles/Riverside.GlowUI.Styles.shproj create mode 100644 src/core/Riverside.GlowUI.Styles/Slider.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/SplitView.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/TabView.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/TextBox.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/ToggleSwitches.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/ToolTip.xaml create mode 100644 src/core/Riverside.GlowUI.Styles/WindowChrome.xaml create mode 100644 src/core/Riverside.Toolkit.Controls.Crimson/GlowBall.xaml create mode 100644 src/core/Riverside.Toolkit.Controls.Crimson/GlowBall.xaml.cs create mode 100644 src/core/Riverside.Toolkit.Controls.Crimson/GlowLine.xaml create mode 100644 src/core/Riverside.Toolkit.Controls.Crimson/GlowLine.xaml.cs create mode 100644 src/core/Riverside.Toolkit.Controls.Crimson/Riverside.Toolkit.Controls.Crimson.projitems create mode 100644 src/core/Riverside.Toolkit.Controls.Crimson/Riverside.Toolkit.Controls.Crimson.shproj create mode 100644 src/platforms/Riverside.GlowUI.Uwp.Styles/Riverside.GlowUI.Uwp.Styles.csproj create mode 100644 src/platforms/Riverside.GlowUI.WinUI.Styles/Riverside.GlowUI.WinUI.Styles.csproj create mode 100644 src/platforms/Riverside.Toolkit.Uwp.Controls.Crimson/Riverside.Toolkit.Uwp.Controls.Crimson.csproj create mode 100644 src/platforms/Riverside.Toolkit.WinUI.Controls.Crimson/Riverside.Toolkit.WinUI.Controls.Crimson.csproj diff --git a/CubeKit.slnx b/CubeKit.slnx index a4da1da..c7eb810 100644 --- a/CubeKit.slnx +++ b/CubeKit.slnx @@ -32,7 +32,9 @@ + + @@ -56,6 +58,10 @@ + + + + @@ -65,6 +71,9 @@ + + + @@ -87,6 +96,7 @@ + diff --git a/Directory.Packages.props b/Directory.Packages.props index 5d00f37..bfeb8c9 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,6 +8,7 @@ + diff --git a/src/core/Riverside.GlowUI.Styles/ComboBox.xaml b/src/core/Riverside.GlowUI.Styles/ComboBox.xaml new file mode 100644 index 0000000..f841c06 --- /dev/null +++ b/src/core/Riverside.GlowUI.Styles/ComboBox.xaml @@ -0,0 +1,1095 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/core/Riverside.GlowUI.Styles/Pivot.xaml b/src/core/Riverside.GlowUI.Styles/Pivot.xaml new file mode 100644 index 0000000..68bf00e --- /dev/null +++ b/src/core/Riverside.GlowUI.Styles/Pivot.xaml @@ -0,0 +1,590 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dev/Riverside.GlowUI/Styles/Pivot.xaml b/dev/Riverside.GlowUI/Styles/Pivot.xaml deleted file mode 100644 index 28b5136..0000000 --- a/dev/Riverside.GlowUI/Styles/Pivot.xaml +++ /dev/null @@ -1,590 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev/Riverside.Toolkit.Flyouts/FlyoutWindow.xaml.cs b/dev/Riverside.Toolkit.Flyouts/FlyoutWindow.xaml.cs deleted file mode 100644 index 1bbcd14..0000000 --- a/dev/Riverside.Toolkit.Flyouts/FlyoutWindow.xaml.cs +++ /dev/null @@ -1,61 +0,0 @@ -using H.NotifyIcon.Core; -using Microsoft.UI; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls.Primitives; -using Riverside.Toolkit.Flyouts.Helpers; -using Riverside.Toolkit.Flyouts.Interfaces; -using WinUIEx; -// To learn more about WinUI, the WinUI project structure, -// and more about our project templates, see: http://aka.ms/winui-project-info. - -namespace Riverside.Toolkit.Flyouts; - -/// -/// A flyout window -/// -public partial class FlyoutWindow : BaseWindow, IFlyoutWindow -{ - public IPositionHelper FlyoutPositionHelper = new PositionHelper(); - - - public FlyoutWindow() - { - FlyoutPositionHelper.Positionflyout(this); - this.InitializeComponent(); - this.SetTitleBarBackgroundColors(Colors.Transparent); - this.Activated += Flyout_Activated; - this.Show(); - this.BringToFront(); - this.SetForegroundWindow(); - // Icon.Create(); - // Icon.MessageWindow.MouseEventReceived += MessageWindow_MouseEventReceived; - } - - private void MessageWindow_MouseEventReceived(object sender, MessageWindow.MouseEventReceivedEventArgs e) - { - if (e.MouseEvent is MouseEvent.IconLeftMouseUp) - { - this.Show(); - this.BringToFront(); - this.SetForegroundWindow(); - FlyoutBase.ShowAttachedFlyout(FlyoutGrid); - } - } - - private void Flyout_Activated(object sender, Microsoft.UI.Xaml.WindowActivatedEventArgs args) - { - // if (args.WindowActivationState == WindowActivationState.Deactivated) - // this.Hide(); - } - - private void Flyout_Closed(object sender, object e) - { - FlyoutBase.ShowAttachedFlyout(FlyoutGrid); - // this.Hide(); - } - - private void Button_Click(object sender, RoutedEventArgs e) - { - FlyoutBase.ShowAttachedFlyout(FlyoutGrid); - } -} diff --git a/dev/Riverside.Toolkit.Flyouts/Helpers/NativeHelper.cs b/dev/Riverside.Toolkit.Flyouts/Helpers/NativeHelper.cs deleted file mode 100644 index 9d3f1d2..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Helpers/NativeHelper.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Runtime.InteropServices; - -namespace Riverside.Toolkit.Flyouts.Helpers; - -public static class NativeHelper -{ - public const int MONITOR_DEFAULTTOPRIMARY = 1; - public const int MONITOR_DEFAULTTONEAREST = 2; - - [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); - - [DllImport("user32.dll")] - public static extern IntPtr MonitorFromWindow(IntPtr hwnd, uint dwFlags); - - [DllImport("shcore.dll")] - public static extern IntPtr GetScaleFactorForMonitor(IntPtr hwnd, out DeviceScaleFactor dwFlags); - - public enum DeviceScaleFactor - { - DEVICE_SCALE_FACTOR_INVALID = 0, - SCALE_100_PERCENT = 100, - SCALE_120_PERCENT = 120, - SCALE_125_PERCENT = 125, - SCALE_140_PERCENT = 140, - SCALE_150_PERCENT = 150, - SCALE_160_PERCENT = 160, - SCALE_175_PERCENT = 175, - SCALE_180_PERCENT = 180, - SCALE_200_PERCENT = 200, - SCALE_225_PERCENT = 225, - SCALE_250_PERCENT = 250, - SCALE_300_PERCENT = 300, - SCALE_350_PERCENT = 350, - SCALE_400_PERCENT = 400, - SCALE_450_PERCENT = 450, - SCALE_500_PERCENT = 500, - } -} diff --git a/dev/Riverside.Toolkit.Flyouts/Helpers/PositionHelper.cs b/dev/Riverside.Toolkit.Flyouts/Helpers/PositionHelper.cs deleted file mode 100644 index 2d7d964..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Helpers/PositionHelper.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Microsoft.UI.Windowing; -using Riverside.Toolkit.Flyouts.Interfaces; -using WinUIEx; - -namespace Riverside.Toolkit.Flyouts.Helpers; - -public class PositionHelper : IPositionHelper -{ - public void Positionflyout(BaseWindow Flyout) - { - double Scale = GetScale(); - double DisplayHeight = DisplayArea.Primary.OuterBounds.Height; - double DisplayWidth = DisplayArea.Primary.OuterBounds.Width; - - double W = Flyout.Width; - double H = Flyout.Height; - - Flyout.MoveAndResize((DisplayWidth / 1.17) - (W / 2), (DisplayHeight / 1.17) - (H / 2), W, H); - // Flyout.MoveAndResize(DisplayWidth - W , DisplayHeight - H , Flyout.Width, Flyout.Height); - } - - private double GetScale() - { - var progmanWindow = NativeHelper.FindWindow("Shell_TrayWnd", null); - var monitor = NativeHelper.MonitorFromWindow(progmanWindow, NativeHelper.MONITOR_DEFAULTTOPRIMARY); - - NativeHelper.DeviceScaleFactor scale; - NativeHelper.GetScaleFactorForMonitor(monitor, out scale); - - if (scale == NativeHelper.DeviceScaleFactor.DEVICE_SCALE_FACTOR_INVALID) - scale = NativeHelper.DeviceScaleFactor.SCALE_100_PERCENT; - - return Convert.ToDouble(scale) / 100; - } -} diff --git a/dev/Riverside.Toolkit.Flyouts/Interfaces/IFlyoutWindow.cs b/dev/Riverside.Toolkit.Flyouts/Interfaces/IFlyoutWindow.cs deleted file mode 100644 index 726f600..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Interfaces/IFlyoutWindow.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Riverside.Toolkit.Flyouts.Interfaces; - -public interface IFlyoutWindow -{ - -} diff --git a/dev/Riverside.Toolkit.Flyouts/Interfaces/IIconManager.cs b/dev/Riverside.Toolkit.Flyouts/Interfaces/IIconManager.cs deleted file mode 100644 index 2ea3afd..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Interfaces/IIconManager.cs +++ /dev/null @@ -1,12 +0,0 @@ -using H.NotifyIcon.Core; - -namespace Riverside.Toolkit.Flyouts.Interfaces; - -public interface IIconManager -{ - public TrayIcon FlyoutIcon { get; set; } - - public bool Initialize(); - - public void Dispose(); -} diff --git a/dev/Riverside.Toolkit.Flyouts/Interfaces/IPositionHelper.cs b/dev/Riverside.Toolkit.Flyouts/Interfaces/IPositionHelper.cs deleted file mode 100644 index 2213466..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Interfaces/IPositionHelper.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Riverside.Toolkit.Flyouts.Interfaces; - -public interface IPositionHelper -{ - void Positionflyout(BaseWindow Flyout); -} diff --git a/dev/Riverside.Toolkit.Flyouts/NativeMethods.txt b/dev/Riverside.Toolkit.Flyouts/NativeMethods.txt deleted file mode 100644 index 5be548a..0000000 --- a/dev/Riverside.Toolkit.Flyouts/NativeMethods.txt +++ /dev/null @@ -1,4 +0,0 @@ -WINDOW_EX_STYLE -GetWindowLong -WM_ERASEBKGND -SetWindowLong \ No newline at end of file diff --git a/dev/Riverside.Toolkit.Flyouts/Riverside.Toolkit.Flyouts.csproj b/dev/Riverside.Toolkit.Flyouts/Riverside.Toolkit.Flyouts.csproj deleted file mode 100644 index 1f83541..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Riverside.Toolkit.Flyouts.csproj +++ /dev/null @@ -1,57 +0,0 @@ - - - net6.0-windows10.0.19041.0 - 10.0.17763.0 - Riverside.Toolkit.Flyouts - win10-x86;win10-x64;win10-arm64 - true - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - MSBuild:Compile - - - - - - MSBuild:Compile - - - - - - MSBuild:Compile - - - - - - MSBuild:Compile - - - $(DefaultXamlRuntime) - Designer - - - diff --git a/dev/Riverside.Toolkit.Flyouts/Styles/FlyoutTheme.xaml b/dev/Riverside.Toolkit.Flyouts/Styles/FlyoutTheme.xaml deleted file mode 100644 index 474c9b3..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Styles/FlyoutTheme.xaml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - White - - - - - - - - - - - - - - - - - - - - - - - - Black - - - - - - - - - - - - - - - - - - - - - White - - - - - - - - - - - - - - - - - diff --git a/dev/Riverside.Toolkit.Flyouts/Transparency/TransparentBackdrop.cs b/dev/Riverside.Toolkit.Flyouts/Transparency/TransparentBackdrop.cs deleted file mode 100644 index b6676f1..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Transparency/TransparentBackdrop.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.UI.Xaml.Media; -using Compositor = Windows.UI.Composition.Compositor; -using ICompositionSupportsSystemBackdrop = Microsoft.UI.Composition.ICompositionSupportsSystemBackdrop; - -namespace Riverside.Toolkit.Flyouts.Transparency; - -internal class TransparentBackdrop : SystemBackdrop -{ - static readonly Lazy _Compositor = new(() => - { - WindowsSystemDispatcherQueueHelper.EnsureWindowsSystemDispatcherQueueController(); - return new(); - }); - static Compositor Compositor => _Compositor.Value; - protected override void OnTargetConnected(ICompositionSupportsSystemBackdrop connectedTarget, Microsoft.UI.Xaml.XamlRoot xamlRoot) - { - connectedTarget.SystemBackdrop = Compositor.CreateColorBrush( - Windows.UI.Color.FromArgb(0, 255, 255, 255) - ); - } - protected override void OnTargetDisconnected(ICompositionSupportsSystemBackdrop disconnectedTarget) - { - disconnectedTarget.SystemBackdrop = null; - } -} diff --git a/dev/Riverside.Toolkit.Flyouts/Transparency/WindowsSystemDispatcherQueueHelper.cs b/dev/Riverside.Toolkit.Flyouts/Transparency/WindowsSystemDispatcherQueueHelper.cs deleted file mode 100644 index a1ea626..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Transparency/WindowsSystemDispatcherQueueHelper.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Runtime.InteropServices; -using Windows.System; - -namespace Riverside.Toolkit.Flyouts.Transparency; - -public static class WindowsSystemDispatcherQueueHelper -{ - [StructLayout(LayoutKind.Sequential)] - struct DispatcherQueueOptions - { - internal int dwSize; - internal int threadType; - internal int apartmentType; - } - - [DllImport("CoreMessaging.dll")] - private static extern int CreateDispatcherQueueController([In] DispatcherQueueOptions options, [In, Out, MarshalAs(UnmanagedType.IUnknown)] ref object? dispatcherQueueController); - - static object? m_dispatcherQueueController = null; - public static void EnsureWindowsSystemDispatcherQueueController() - { - if (DispatcherQueue.GetForCurrentThread() != null) - // one already exists, so we'll just use it. - return; - - if (m_dispatcherQueueController == null) - { - DispatcherQueueOptions options; - options.dwSize = Marshal.SizeOf(typeof(DispatcherQueueOptions)); - options.threadType = 2; // DQTYPE_THREAD_CURRENT - options.apartmentType = 2; // DQTAT_COM_STA - - _ = CreateDispatcherQueueController(options, ref m_dispatcherQueueController); - } - } -} diff --git a/dev/Riverside.Toolkit.Flyouts/Widgets/LegacyTransparentWindow.xaml b/dev/Riverside.Toolkit.Flyouts/Widgets/LegacyTransparentWindow.xaml deleted file mode 100644 index 1d034ab..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Widgets/LegacyTransparentWindow.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - diff --git a/dev/Riverside.Toolkit.Flyouts/Widgets/LegacyTransparentWindow.xaml.cs b/dev/Riverside.Toolkit.Flyouts/Widgets/LegacyTransparentWindow.xaml.cs deleted file mode 100644 index 20e6e2f..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Widgets/LegacyTransparentWindow.xaml.cs +++ /dev/null @@ -1,854 +0,0 @@ -using Microsoft.UI; -using Microsoft.UI.Windowing; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Input; -using System.Runtime.InteropServices; - -// To learn more about WinUI, the WinUI project structure, -// and more about our project templates, see: http://aka.ms/winui-project-info. - -namespace Riverside.Toolkit.Flyouts; - -/// -/// An empty window that can be used on its own or navigated to within a Frame. -/// -public sealed partial class LegacyTransparentWindow : Window -{ - public const int WM_CREATE = 0x0001; - public const int WM_NCHITTEST = 0x0084; - public const int WM_COMMAND = 0x0111; - public const int WM_NCLBUTTONDOWN = 0x00A1; - public const int WM_NCLBUTTONUP = 0x00A2; - public const int WM_NCLBUTTONDBLCLK = 0x00A3; - public const int WM_NCRBUTTONDOWN = 0x00A4; - public const int WM_NCRBUTTONUP = 0x00A5; - public const int WM_MOUSEMOVE = 0x0200; - public const int WM_LBUTTONDOWN = 0x0201; - public const int WM_LBUTTONUP = 0x0202; - public const int WM_LBUTTONDBLCLK = 0x0203; - public const int WM_RBUTTONDOWN = 0x0204; - public const int WM_RBUTTONUP = 0x0205; - public const int WM_RBUTTONDBLCLK = 0x0206; - public const int WM_MOUSEFIRST = 0x0200; - public const int WM_MOUSELAST = 0x020E; - public const int WM_SYSCOMMAND = 0x0112; - public const int WM_MOVE = 0x0003; - public const int WM_NCPOINTERDOWN = 0x0242; - public const int WM_NCPOINTERUP = 0x0243; - public const int WM_POINTERUPDATE = 0x0245; - public const int WM_POINTERDOWN = 0x0246; - public const int WM_POINTERUP = 0x0247; - public const int WM_DESTROY = 2; - public const int WM_PAINT = 0x0f; - - public const int WS_THICKFRAME = 0x00040000; - public const int WS_CHILD = 0x40000000; - public const int WS_POPUP = unchecked((int)0x80000000); - - public const int SC_MOVE = 0xF010; - public const int SC_MOUSEMOVE = SC_MOVE + 0x02; - - public const int HTERROR = (-2); - public const int HTTRANSPARENT = (-1); - public const int HTNOWHERE = 0; - public const int HTCLIENT = 1; - public const int HTCAPTION = 2; - public const int HTSYSMENU = 3; - public const int HTGROWBOX = 4; - public const int HTLEFT = 10; - public const int HTRIGHT = 11; - public const int HTTOP = 12; - public const int HTTOPLEFT = 13; - public const int HTTOPRIGHT = 14; - public const int HTBOTTOM = 15; - public const int HTBOTTOMLEFT = 16; - public const int HTBOTTOMRIGHT = 17; - - public const int WS_EX_DLGMODALFRAME = 0x00000001; - public const int WS_EX_NOPARENTNOTIFY = 0x00000004; - public const int WS_EX_TOPMOST = 0x00000008; - public const int WS_EX_ACCEPTFILES = 0x00000010; - public const int WS_EX_TRANSPARENT = 0x00000020; - public const int WS_EX_MDICHILD = 0x00000040; - public const int WS_EX_TOOLWINDOW = 0x00000080; - public const int WS_EX_WINDOWEDGE = 0x00000100; - public const int WS_EX_CLIENTEDGE = 0x00000200; - public const int WS_EX_CONTEXTHELP = 0x00000400; - public const int WS_EX_RIGHT = 0x00001000; - public const int WS_EX_LEFT = 0x00000000; - public const int WS_EX_RTLREADING = 0x00002000; - public const int WS_EX_LTRREADING = 0x00000000; - public const int WS_EX_LEFTSCROLLBAR = 0x00004000; - public const int WS_EX_RIGHTSCROLLBAR = 0x00000000; - public const int WS_EX_CONTROLPARENT = 0x00010000; - public const int WS_EX_STATICEDGE = 0x00020000; - public const int WS_EX_APPWINDOW = 0x00040000; - public const int WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE); - public const int WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST); - public const int WS_EX_LAYERED = 0x00080000; - public const int WS_EX_NOINHERITLAYOUT = 0x00100000; // Disable inheritence of mirroring by children - public const int WS_EX_NOREDIRECTIONBITMAP = 0x00200000; - public const int WS_EX_LAYOUTRTL = 0x00400000; // Right to left mirroring - public const int WS_EX_COMPOSITED = 0x02000000; - public const int WS_EX_NOACTIVATE = 0x08000000; - - public const uint LWA_COLORKEY = 0x00000001; - public const uint LWA_ALPHA = 0x00000002; - - [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); - - private static long MakeArgb(byte alpha, byte red, byte green, byte blue) - { - return (long)(((ulong)((((red << 0x10) | (green << 8)) | blue) | (alpha << 0x18))) & 0xffffffffL); - } - - const int GWL_STYLE = (-16); - const int GWL_EXSTYLE = (-20); - public static IntPtr SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong) - { - if (IntPtr.Size == 4) - { - return SetWindowLongPtr32(hWnd, nIndex, dwNewLong); - } - return SetWindowLongPtr64(hWnd, nIndex, dwNewLong); - } - - [DllImport("User32.dll", CharSet = CharSet.Auto, EntryPoint = "SetWindowLong")] - public static extern IntPtr SetWindowLongPtr32(IntPtr hWnd, int nIndex, IntPtr dwNewLong); - - [DllImport("User32.dll", CharSet = CharSet.Auto, EntryPoint = "SetWindowLongPtr")] - public static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, int nIndex, IntPtr dwNewLong); - - // public static IntPtr GetWindowLong(HandleRef hWnd, int nIndex) - public static long GetWindowLong(IntPtr hWnd, int nIndex) - { - if (IntPtr.Size == 4) - { - return GetWindowLong32(hWnd, nIndex); - } - return GetWindowLongPtr64(hWnd, nIndex); - } - - [DllImport("User32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)] - public static extern long GetWindowLong32(IntPtr hWnd, int nIndex); - - [DllImport("User32.dll", EntryPoint = "GetWindowLongPtr", CharSet = CharSet.Auto)] - public static extern long GetWindowLongPtr64(IntPtr hWnd, int nIndex); - - [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern bool DestroyWindow(IntPtr hWnd); - - [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Auto)] - public static extern bool ShowWindow(IntPtr hWnd, int nShowCmd); - - public const int SW_HIDE = 0; - public const int SW_SHOWNORMAL = 1; - public const int SW_SHOWMINIMIZED = 2; - public const int SW_SHOWMAXIMIZED = 3; - public const int SW_SHOWNOACTIVATE = 4; - public const int SW_SHOW = 5; - - [DllImport("User32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern int SendMessage(IntPtr hWnd, uint msg, int wParam, IntPtr lParam); - - [DllImport("User32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern int PostMessage(IntPtr hWnd, uint msg, int wParam, IntPtr lParam); - - [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Auto)] - public static extern int DefWindowProc(IntPtr hWnd, uint uMsg, int wParam, IntPtr lParam); - - [DllImport("Gdi32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern IntPtr CreateRectRgn(int x1, int y1, int x2, int y2); - - [DllImport("Gdi32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern int CombineRgn(IntPtr hrgnDest, IntPtr hrgnSrc1, IntPtr hrgnSrc2, int iMode); - - [DllImport("User32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern int SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool bRedraw); - - [DllImport("Gdi32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern IntPtr CreateRoundRectRgn(int x1, int y1, int x2, int y2, int cx, int cy); - - public const int RGN_AND = 1; - public const int RGN_OR = 2; - public const int RGN_XOR = 3; - public const int RGN_DIFF = 4; - public const int RGN_COPY = 5; - public const int RGN_MIN = RGN_AND; - public const int RGN_MAX = RGN_COPY; - - public const int ERROR = 0; - public const int NULLREGION = 1; - public const int SIMPLEREGION = 2; - public const int COMPLEXREGION = 3; - - [DllImport("Gdi32.dll", SetLastError = true)] - public static extern bool DeleteObject(IntPtr hObject); - - public delegate int SUBCLASSPROC(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam, IntPtr uIdSubclass, uint dwRefData); - - [DllImport("Comctl32.dll", SetLastError = true)] - public static extern bool SetWindowSubclass(IntPtr hWnd, SUBCLASSPROC pfnSubclass, uint uIdSubclass, uint dwRefData); - - [DllImport("Comctl32.dll", SetLastError = true)] - public static extern int DefSubclassProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam); - - [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); - - [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); - - [DllImport("User32.dll", SetLastError = true)] - public static extern bool ScreenToClient(IntPtr hWnd, ref POINT lpPoint); - - [DllImport("User32.dll", SetLastError = true)] - public static extern bool ClientToScreen(IntPtr hWnd, ref POINT lpPoint); - - [DllImport("User32.dll", SetLastError = true)] - public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect); - - [StructLayout(LayoutKind.Sequential)] - public struct RECT - { - public int left; - public int top; - public int right; - public int bottom; - public RECT(int Left, int Top, int Right, int Bottom) - { - left = Left; - top = Top; - right = Right; - bottom = Bottom; - } - } - - public static int GET_X_LPARAM(IntPtr lParam) - { - return LOWORD(lParam.ToInt32()); - } - - public static int GET_Y_LPARAM(IntPtr lParam) - { - return HIWORD(lParam.ToInt32()); - } - public static int HIWORD(int i) - { - return (short)(i >> 16); - } - public static int LOWORD(int i) - { - return (short)(i & 0xFFFF); - } - - private static int MakeLParam(int LoWord, int HiWord) - { - int res = (int)((HiWord << 16) | (LoWord & 0xffff)); - return res; - } - - [StructLayout(LayoutKind.Sequential)] - public struct POINT - { - public int x; - public int y; - - public POINT(int X, int Y) - { - this.x = X; - this.y = Y; - } - } - - [DllImport("User32.dll", SetLastError = true)] - public static extern bool PtInRect(ref RECT lprc, POINT pt); - - [DllImport("User32.dll", SetLastError = true)] - public static extern bool ReleaseCapture(); - - [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Auto)] - public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int cx, int cy, bool repaint); - - public const int SWP_NOSIZE = 0x0001; - public const int SWP_NOMOVE = 0x0002; - public const int SWP_NOZORDER = 0x0004; - public const int SWP_NOREDRAW = 0x0008; - public const int SWP_NOACTIVATE = 0x0010; - public const int SWP_FRAMECHANGED = 0x0020; /* The frame changed: send WM_NCCALCSIZE */ - public const int SWP_SHOWWINDOW = 0x0040; - public const int SWP_HIDEWINDOW = 0x0080; - public const int SWP_NOCOPYBITS = 0x0100; - public const int SWP_NOOWNERZORDER = 0x0200; /* Don't do owner Z ordering */ - public const int SWP_NOSENDCHANGING = 0x0400; /* Don't send WM_WINDOWPOSCHANGING */ - public const int SWP_DRAWFRAME = SWP_FRAMECHANGED; - public const int SWP_NOREPOSITION = SWP_NOOWNERZORDER; - public const int SWP_DEFERERASE = 0x2000; - public const int SWP_ASYNCWINDOWPOS = 0x4000; - - [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); - - [DllImport("User32.dll", SetLastError = true)] - public static extern bool RedrawWindow(IntPtr hWnd, IntPtr lprcUpdate, IntPtr hrgnUpdate, uint flags); - - public const int RDW_INVALIDATE = 0x0001; - public const int RDW_INTERNALPAINT = 0x0002; - public const int RDW_ERASE = 0x0004; - - public const int RDW_VALIDATE = 0x0008; - public const int RDW_NOINTERNALPAINT = 0x0010; - public const int RDW_NOERASE = 0x0020; - - public const int RDW_NOCHILDREN = 0x0040; - public const int RDW_ALLCHILDREN = 0x0080; - - public const int RDW_UPDATENOW = 0x0100; - public const int RDW_ERASENOW = 0x0200; - - public const int RDW_FRAME = 0x0400; - public const int RDW_NOFRAME = 0x0800; - - [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern int MessageBox(IntPtr hWnd, string lpText, string lpCaption, uint uType); - - [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - public static extern short GetAsyncKeyState(int nVirtKey); - - public const int VK_LBUTTON = 0x01; - public const int VK_RBUTTON = 0x02; - - [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Auto)] - public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo); - - public const int MOUSEEVENTF_MOVE = 0x0001; /* mouse move */ - public const int MOUSEEVENTF_LEFTDOWN = 0x0002; /* left button down */ - public const int MOUSEEVENTF_LEFTUP = 0x0004; /* left button up */ - public const int MOUSEEVENTF_RIGHTDOWN = 0x0008; /* right button down */ - public const int MOUSEEVENTF_RIGHTUP = 0x0010; /* right button up */ - public const int MOUSEEVENTF_MIDDLEDOWN = 0x0020; /* middle button down */ - public const int MOUSEEVENTF_MIDDLEUP = 0x0040; /* middle button up */ - public const int MOUSEEVENTF_XDOWN = 0x0080; /* x button down */ - public const int MOUSEEVENTF_XUP = 0x0100; /* x button down */ - public const int MOUSEEVENTF_WHEEL = 0x0800; /* wheel button rolled */ - public const int MOUSEEVENTF_HWHEEL = 0x01000; /* hwheel button rolled */ - public const int MOUSEEVENTF_MOVE_NOCOALESCE = 0x2000; /* do not coalesce mouse moves */ - public const int MOUSEEVENTF_VIRTUALDESK = 0x4000; /* map to entire virtual desktop */ - public const int MOUSEEVENTF_ABSOLUTE = 0x8000; /* absolute move */ - - [DllImport("User32.dll", SetLastError = true)] - public static extern int SendInput(int nInputs, [MarshalAs(UnmanagedType.LPArray)] INPUT[] pInput, int cbSize); - - public const int INPUT_MOUSE = 0; - public const int INPUT_KEYBOARD = 1; - public const int INPUT_HARDWARE = 2; - - public const int KEYEVENTF_EXTENDEDKEY = 0x0001; - public const int KEYEVENTF_KEYUP = 0x0002; - public const int KEYEVENTF_UNICODE = 0x0004; - - [StructLayout(LayoutKind.Sequential)] - public struct MOUSEINPUT - { - public int dx; - public int dy; - public int mouseData; - public int dwFlags; - public int time; - public IntPtr dwExtraInfo; - } - - [StructLayout(LayoutKind.Sequential)] - public struct KEYBDINPUT - { - public short wVk; - public short wScan; - public int dwFlags; - public int time; - public IntPtr dwExtraInfo; - } - - [StructLayout(LayoutKind.Sequential)] - public struct HARDWAREINPUT - { - public int uMsg; - public short wParamL; - public short wParamH; - } - - [StructLayout(LayoutKind.Sequential)] - public struct INPUT - { - public int type; - public INPUTUNION inputUnion; - } - - [StructLayout(LayoutKind.Explicit)] - public struct INPUTUNION - { - [FieldOffset(0)] - public MOUSEINPUT mi; - [FieldOffset(0)] - public KEYBDINPUT ki; - [FieldOffset(0)] - public HARDWAREINPUT hi; - } - - [DllImport("User32.dll", SetLastError = true)] - public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); - - [DllImport("User32.dll", SetLastError = true)] - public static extern IntPtr GetCapture(); - - [DllImport("User32.dll", SetLastError = true)] - public static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName); - - [DllImport("User32.dll", CharSet = CharSet.Auto)] - public static extern IntPtr CallWindowProc(IntPtr wndProc, IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam); - - //[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - [DllImport("User32.dll", SetLastError = true, EntryPoint = "RegisterClassW")] - public static extern short RegisterClass(ref WNDCLASS wc); - - [DllImport("User32.dll", SetLastError = true, EntryPoint = "RegisterClassExW")] - public static extern short RegisterClassEx(ref WNDCLASSEX lpwcx); - - public delegate int WNDPROC(IntPtr hwnd, uint uMsg, int wParam, IntPtr lParam); - - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct WNDCLASS - { - [MarshalAs(UnmanagedType.U4)] - public uint style; - public WNDPROC lpfnWndProc; - public int cbClsExtra; - public int cbWndExtra; - public IntPtr hInstance; - public IntPtr hIcon; - public IntPtr hCursor; - public IntPtr hbrBackground; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string lpszMenuName; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string lpszClassName; - } - - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] - public struct WNDCLASSEX - { - [MarshalAs(UnmanagedType.U4)] - public int cbSize; - [MarshalAs(UnmanagedType.U4)] - public int style; - public WNDPROC lpfnWndProc; - public int cbClsExtra; - public int cbWndExtra; - public IntPtr hInstance; - public IntPtr hIcon; - public IntPtr hCursor; - public IntPtr hbrBackground; - public string lpszMenuName; - public string lpszClassName; - public IntPtr hIconSm; - } - - public const int WS_OVERLAPPEDWINDOW = 0xcf0000; - public const int WS_VISIBLE = 0x10000000; - public const int CS_USEDEFAULT = unchecked((int)0x80000000); - public const int CS_DBLCLKS = 8; - public const int CS_VREDRAW = 1; - public const int CS_HREDRAW = 2; - public const int COLOR_BACKGROUND = 1; - public const int COLOR_WINDOW = 5; - public const int IDC_ARROW = 32512; - public const int IDC_IBEAM = 32513; - public const int IDC_WAIT = 32514; - public const int IDC_CROSS = 32515; - public const int IDC_UPARROW = 32516; - - public const int BS_PUSHLIKE = 0x00001000; - public const int BN_CLICKED = 0; - - [DllImport("User32.dll", SetLastError = true)] - public static extern IntPtr CreateWindowEx(int dwExStyle, string lpClassName, string lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam); - - [DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] - public static extern IntPtr GetModuleHandle(string modName); - - - public LegacyTransparentWindow() - { - this.InitializeComponent(); - - // WinUIDesktopWin32WindowClass - // Microsoft.UI.Content.ContentWindowSiteBridge - // DRAG_BAR_WINDOW_CLASS - hWnd = WinRT.Interop.WindowNative.GetWindowHandle(this); - WindowId myWndId = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(hWnd); - _apw = AppWindow.GetFromWindowId(myWndId); - - hWndChild = FindWindowEx(hWnd, IntPtr.Zero, "Microsoft.UI.Content.ContentWindowSiteBridge", null); - - //SetWindowPos(hWndChild, new IntPtr(-1), 0, 0, 800, 800, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW); - - //ShowWindow(hWndChild, SW_HIDE); - - _apw.Title = "Test WindowsAppSDK"; - _apw.Resize(new Windows.Graphics.SizeInt32(320, 200)); - - Grid grid1 = (Grid)this.Content; - grid1.PointerPressed += Grid1_PointerPressed; - //grid1.PointerReleased += Grid1_PointerReleased; - - _presenter = _apw.Presenter as OverlappedPresenter; - _presenter.IsResizable = false; - _presenter.IsMinimizable = false; - _presenter.IsAlwaysOnTop = true; - _presenter.SetBorderAndTitleBar(false, false); - - SubClassDelegate = new SUBCLASSPROC(WindowSubClass); - bool bRet = SetWindowSubclass(hWnd, SubClassDelegate, 0, 0); - - //SetParent(hWndChild, IntPtr.Zero); - //long nStyleChild = GetWindowLong(hWndChild, GWL_STYLE); - ////nStyleChild = (nStyleChild | WS_POPUP) & (~WS_CHILD); - //nStyleChild = (nStyleChild) & (~WS_CHILD); - //SetWindowLong(hWndChild, GWL_STYLE, (IntPtr)(nStyleChild)); - - ////SetWindowPos(hWnd, (IntPtr)(-1), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - //SetWindowPos(hWndChild, (IntPtr)(-1), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - - //long nExStyleChild = GetWindowLong(hWndChild, GWL_EXSTYLE); - //SetWindowLong(hWndChild, GWL_EXSTYLE, (IntPtr)(nExStyleChild | WS_EX_TOPMOST)); - - - long nExStyle = GetWindowLong(hWnd, GWL_EXSTYLE); - if ((nExStyle & WS_EX_LAYERED) == 0) - { - SetWindowLong(hWnd, GWL_EXSTYLE, (IntPtr)(nExStyle | WS_EX_LAYERED)); - //nExStyle = GetWindowLong(hWnd, GWL_EXSTYLE); - //SetWindowLong(hWnd, GWL_EXSTYLE, (IntPtr)(nExStyle | WS_EX_TRANSPARENT)); - SetLayeredWindowAttributes(hWnd, (uint)0, (byte)(255 * nOpacity / 100), LWA_ALPHA); - - //SetLayeredWindowAttributes(hWnd, (uint)MakeArgb(0, 0, 0, 0), (byte)(255 * nOpacity / 100), LWA_COLORKEY); - //SetLayeredWindowAttributes(hWnd, (uint)MakeArgb(0, 0, 0, 0), 255, LWA_ALPHA | LWA_COLORKEY); - - } - nExStyle = GetWindowLong(hWnd, GWL_EXSTYLE); - SetWindowLong(hWnd, GWL_EXSTYLE, (IntPtr)(nExStyle | WS_EX_NOACTIVATE)); - - //nExStyle = GetWindowLong(hWnd, GWL_EXSTYLE); - //SetWindowLong(hWnd, GWL_EXSTYLE, (IntPtr)(nExStyle | WS_EX_NOREDIRECTIONBITMAP)); - - int nX = (int)(_apw.Size.Width - myButton.ActualOffset.X - myButton.Width); - int nY = (int)myButton.ActualOffset.Y; - ////IntPtr HoleRgn = CreateRectRgn((int)myButton.ActualOffset.X, (int)myButton.ActualOffset.Y, (int)(myButton.ActualOffset.X + myButton.Width), (int)(myButton.ActualOffset.Y + myButton.Height)); - //IntPtr HoleRgn = CreateRectRgn(nX, nY, (int)(nX + myButton.Width), (int)(nY + myButton.Height)); - //CombineRgn(WindowRgn, WindowRgn, HoleRgn, RGN_DIFF); - //SetWindowRgn(hWndChild, WindowRgn, true); - //DeleteObject(HoleRgn); - - IntPtr WindowRgn = CreateRectRgn(0, 0, _apw.Size.Width, _apw.Size.Height); - IntPtr HoleRgn = CreateRectRgn(nX, nY, (int)(nX + myButton.Width), (int)(nY + myButton.Height)); - - IntPtr HoleRgn2 = CreateRectRgn(0, 0, _apw.Size.Width, 20); - IntPtr WindowRgn2 = CreateRectRgn(0, 0, 0, 0); - int nRet = CombineRgn(WindowRgn2, HoleRgn2, HoleRgn, RGN_OR); - - - //CombineRgn(WindowRgn, WindowRgn, HoleRgn, RGN_DIFF); - CombineRgn(WindowRgn, HoleRgn, WindowRgn, RGN_MIN); - //CombineRgn(WindowRgn, WindowRgn2, WindowRgn, RGN_MIN); - - //SetWindowRgn(hWndChild, WindowRgn, true); - DeleteObject(HoleRgn); - - //nExStyle = GetWindowLong(hWnd, GWL_EXSTYLE); - //SetWindowLong(hWnd, GWL_EXSTYLE, (IntPtr)(nExStyle | WS_EX_TRANSPARENT)); - //SetWindowRgn(hWnd, IntPtr.Zero, true); - - return; - } - - private AppWindow _apw; - private OverlappedPresenter _presenter; - private CompactOverlayPresenter _compact; - - private SUBCLASSPROC SubClassDelegate; - - private IntPtr hWnd = IntPtr.Zero; - private IntPtr hWndChild = IntPtr.Zero; - - - private void Grid1_PointerReleased(object sender, PointerRoutedEventArgs e) - { - Console.Beep(6000, 10); - //SetWindowPos(hWnd, hWndChild, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW); - RECT rc; - GetWindowRect(hWnd, out rc); - //SetWindowPos(hWnd, hWndChild, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW); - SetWindowPos(hWnd, (IntPtr)(-1), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - SetWindowPos(hWndChild, (IntPtr)(-2), rc.left, rc.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS); - - } - - private void Grid1_PointerPressed(object sender, PointerRoutedEventArgs e) - { - var properties = e.GetCurrentPoint((Grid)sender).Properties; - if (properties.IsLeftButtonPressed) - { - long nExStyle = GetWindowLong(hWndChild, GWL_EXSTYLE); - if ((nExStyle & WS_EX_LAYERED) == 0) - { - SetWindowLong(hWndChild, GWL_EXSTYLE, (IntPtr)(nExStyle | WS_EX_LAYERED)); - nExStyle = GetWindowLong(hWndChild, GWL_EXSTYLE); - // break events/UI - SetWindowLong(hWndChild, GWL_EXSTYLE, (IntPtr)(nExStyle | WS_EX_TRANSPARENT)); - //Console.Beep(6000, 10); - - //SetLayeredWindowAttributes(hWndChild, (uint)MakeArgb(0, 0, 0, 0), 100, LWA_ALPHA); - } - INPUT[] mi = new INPUT[2]; - mi[0].type = INPUT_MOUSE; - mi[0].inputUnion.mi.dwFlags = MOUSEEVENTF_LEFTUP; - mi[1].inputUnion.mi.dwFlags = MOUSEEVENTF_LEFTDOWN; - SendInput(2, mi, Marshal.SizeOf(mi[0])); - } - else if (properties.IsRightButtonPressed) - { - System.Threading.Thread.Sleep(200); - Application.Current.Exit(); - } - e.Handled = true; - } - - int nOpacity = 80; - private async void myButton_Click(object sender, RoutedEventArgs e) - { - { - delegateWndProc = Win32WndProc; - WNDCLASSEX wcex = new WNDCLASSEX(); - wcex.cbSize = Marshal.SizeOf(typeof(WNDCLASSEX)); - wcex.style = (CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS); - wcex.hbrBackground = (IntPtr)COLOR_BACKGROUND + 1; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = Marshal.GetHINSTANCE(this.GetType().Module); // Process.GetCurrentProcess().Handle; - wcex.hIcon = IntPtr.Zero; - wcex.hCursor = LoadCursor(IntPtr.Zero, (int)IDC_ARROW); - wcex.lpszMenuName = null; - wcex.lpszClassName = "Win32Class"; - //wind_class.lpfnWndProc = Marshal.GetFunctionPointerForDelegate(delegWndProc); - wcex.lpfnWndProc = delegateWndProc; - wcex.hIconSm = IntPtr.Zero; - short nRet = RegisterClassEx(ref wcex); - if (nRet == 0) - { - int nError = Marshal.GetLastWin32Error(); - if (nError != 1410) //0x582 ERROR_CLASS_ALREADY_EXISTS - return; - } - string sClassName = wcex.lpszClassName; - IntPtr hWnd2 = CreateWindowEx(0, sClassName, "Win32 window", WS_OVERLAPPEDWINDOW | WS_VISIBLE, _apw.Position.X, _apw.Position.Y, 270, 270, hWnd, IntPtr.Zero, wcex.hInstance, IntPtr.Zero); - } - return; - - // 0x8001010E (RPC_E_WRONG_THREAD))' - //var thread = new System.Threading.Thread(() => - //{ - // Window window = new Window(); - // window.Content = new TextBlock() { Text = "Hello" }; - // window.Activate(); - // //window.Closed += (_, __) => w.DispatcherQueue.InvokeShutdown(); - - // var syncContext = new Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext(Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread()); - // System.Threading.SynchronizationContext.SetSynchronizationContext(syncContext); - - // //this.ProcessEvents(); // Message pump - //}); - - //thread.SetApartmentState(System.Threading.ApartmentState.STA); - //thread.Start(); - //return; - - // MessageBox(hWnd, "Button clicked !", "Information", 0); - - // 0xc000027b - //Window window = new Window(); - //window.Content = new TextBlock() { Text = "Hello" }; - //window.Activate(); - //return; - - //IntPtr WindowRgn = CreateRectRgn(0, 0, _apw.Size.Width / 2, _apw.Size.Height); - //SetWindowRgn(hWnd, WindowRgn, true); - - TeachingTip.IsOpen = true; - TeachingTip.XamlRoot = this.Content.XamlRoot; - return; - - myButton.Content = "Clicked"; - var cd = new ContentDialog - { - Title = "Information", - Content = "You clicked the button !", - CloseButtonText = "Ok" - }; - - cd.XamlRoot = this.Content.XamlRoot; - var result = await cd.ShowAsync(); - } - - int n = 0; - private int WindowSubClass(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam, IntPtr uIdSubclass, uint dwRefData) - { - System.Diagnostics.Debug.WriteLine(String.Format("uMsg({0}) = {1:x}", n, uMsg)); - n++; - switch (uMsg) - { - //case WM_MOVE: - // { - // RECT rc; - // GetWindowRect(hWnd, out rc); - // //SetWindowPos(hWndChild, hWnd, rc.left, rc.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW | SWP_FRAMECHANGED ); - // //SetWindowPos(hWnd, hWndChild, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW); - // SetWindowPos(hWndChild, (IntPtr)(-1), rc.left, rc.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW | SWP_FRAMECHANGED); - // return 0; - // } - // break; - - // case WM_POINTERDOWN: - // case WM_NCLBUTTONDOWN: - // { - // Console.Beep(1000, 10); - // //SetWindowPos(hWnd, hWndChild, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW); - - // //SetWindowPos(hWnd, hWndChild, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW); - // SetWindowPos(hWnd, (IntPtr)(-2), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - // SetWindowPos(hWndChild, (IntPtr)(-1), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_FRAMECHANGED); - // //return 0; - // } - // break; - //case WM_NCPOINTERUP: - //case WM_LBUTTONUP: - //case WM_POINTERUP: - ////case WM_POINTERUPDATE: - // { - // Console.Beep(6000, 10); - // //SetWindowPos(hWnd, hWndChild, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW); - // RECT rc; - // GetWindowRect(hWnd, out rc); - // //SetWindowPos(hWnd, hWndChild, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW); - // SetWindowPos(hWnd, (IntPtr)(-1), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - // SetWindowPos(hWndChild, (IntPtr)(-2), rc.left, rc.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS); - // //return 0; - // } - // break; - //case WM_NCHITTEST: - // { - // //SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, lParam); - // //bool bLeftButton = (GetAsyncKeyState((int)VK_LBUTTON) & 0x8000) == 0x8000; - // //if (GetCapture() == IntPtr.Zero) - // //{ - // // Console.Beep(6000, 10); - // // return HTCAPTION; - // //} - // //if (bLeftButton) - // { - // return HTCAPTION; - // } - // } - // break; - case WM_NCHITTEST: - { - POINT pt = new POINT(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); - ScreenToClient(hWnd, ref pt); - int nWidth = 0; - int nCaptionSize = 0; - RECT rc = new RECT((int)myButton.ActualOffset.X + nWidth, (int)myButton.ActualOffset.Y + nCaptionSize, (int)(myButton.ActualOffset.X + nWidth + myButton.Width), (int)(myButton.ActualOffset.Y + nCaptionSize + myButton.Height)); - bool bRet = PtInRect(ref rc, pt); - bool bRightButton = (GetAsyncKeyState((int)VK_RBUTTON) & 0x8000) == 0x8000; - bool bLeftButton = (GetAsyncKeyState((int)VK_LBUTTON) & 0x8000) == 0x8000; - if (!bLeftButton) - { - long nExStyle = GetWindowLong(hWndChild, GWL_EXSTYLE); - if ((nExStyle & WS_EX_LAYERED) == WS_EX_LAYERED) - { - SetWindowLong(hWndChild, GWL_EXSTYLE, (IntPtr)(nExStyle & ~(WS_EX_LAYERED | WS_EX_TRANSPARENT))); - } - break; - } - - int nRet = DefWindowProc(hWnd, WM_NCHITTEST, 0, lParam); - //System.Diagnostics.Debug.WriteLine(String.Format("WM_NCHITTEST = {0}", nRet)); - switch (nRet) - { - case HTLEFT: - case HTTOP: - case HTBOTTOM: - case HTRIGHT: - case HTBOTTOMLEFT: - case HTBOTTOMRIGHT: - case HTTOPLEFT: - case HTTOPRIGHT: - return nRet; - - } - return HTCAPTION; - } - break; - } - return DefSubclassProc(hWnd, uMsg, wParam, lParam); - } - private const int IDC_BUTTON = 10; - private WNDPROC delegateWndProc; - private int Win32WndProc(IntPtr hwnd, uint msg, int wParam, IntPtr lParam) - { - int wmId, wmEvent; - switch (msg) - { - case WM_CREATE: - { - IntPtr hWndButton = CreateWindowEx(0, "Button", "Click", WS_CHILD | WS_VISIBLE | BS_PUSHLIKE, 100, 92, 60, 32, hwnd, (IntPtr)IDC_BUTTON, GetModuleHandle(null), IntPtr.Zero); - } - break; - case WM_COMMAND: - { - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - switch (wmId) - { - case IDC_BUTTON: - { - if (wmEvent == BN_CLICKED) - { - nOpacity -= 10; - SetLayeredWindowAttributes(hWnd, 0, (byte)(255 * nOpacity / 100), LWA_ALPHA); - } - } - break; - default: - return DefWindowProc(hwnd, msg, wParam, lParam); - } - } - break; - //case WM_PAINT: - // break; - - //case WM_LBUTTONDBLCLK: - // Console.Beep(5000, 10); - // //System.Windows.Forms.MessageBox.Show("Doubleclick"); - // break; - - //case WM_DESTROY: - // DestroyWindow(hWnd); - // //PostQuitMessage(0); - // break; - - default: - break; - } - return DefWindowProc(hwnd, msg, wParam, lParam); - } -} diff --git a/dev/Riverside.Toolkit.Flyouts/Widgets/TestWidget.xaml b/dev/Riverside.Toolkit.Flyouts/Widgets/TestWidget.xaml deleted file mode 100644 index 82e8b1e..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Widgets/TestWidget.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - diff --git a/dev/Riverside.Toolkit.Flyouts/Widgets/TestWidget.xaml.cs b/dev/Riverside.Toolkit.Flyouts/Widgets/TestWidget.xaml.cs deleted file mode 100644 index fce2497..0000000 --- a/dev/Riverside.Toolkit.Flyouts/Widgets/TestWidget.xaml.cs +++ /dev/null @@ -1,303 +0,0 @@ -using Microsoft.UI.Xaml; -using System.Runtime.InteropServices; -using System.Text; -using WinUIEx; - -// To learn more about WinUI, the WinUI project structure, -// and more about our project templates, see: http://aka.ms/winui-project-info. - -namespace FluentFlyouts3.Flyouts; - -/// -/// An empty window that can be used on its own or navigated to within a Frame. -/// -public sealed partial class TestWidget : WindowEx -{ - public Rect MonitorRect { get; private set; } - public TestWidget() - { - this.InitializeComponent(); - } - - private void Grid_Loaded(object sender, RoutedEventArgs e) - { - var rect = new Rect(); - var handle = this.GetWindowHandle(); - SendMessageToProgman(); - EnableExToolWindow(handle, true); - var workerWHandle = GetWorkerW(handle); - SetWindowPos(handle, (IntPtr)1, MonitorRect.Left, MonitorRect.Top, MonitorRect.Width, MonitorRect.Height, 0 | 0x0010); - MapWindowPoints(handle, workerWHandle, ref rect, 2); - - SetParent(handle, workerWHandle); - - SetWindowPos(handle, (IntPtr)1, rect.Left, rect.Top, MonitorRect.Width, MonitorRect.Height, 0 | 0x0010); - RefreshDesktop(); - } - public static void EnableExToolWindow(IntPtr hwnd, bool enable) - { - var exStyle = GetWindowLong(hwnd, GWL_EXSTYLE); - if (enable) - { - exStyle |= WS_EX_TOOLWINDOW; - } - else - { - exStyle &= ~WS_EX_TOOLWINDOW; - } - SetWindowLong(hwnd, GWL_EXSTYLE, exStyle); - } - public static void SendMessageToProgman() - { - var progmanHandle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null); - SendMessageTimeout(progmanHandle, 0x052C, 0, 0, SendMessageTimeoutFlags.SMTO_NORMAL, 1000, out var result); - //SendMessage(progmanHandle, 0x052C, 0, 0); - //SendMessage(progmanHandle, 0x052C, 0x0000000D, 0); - //SendMessage(progmanHandle, 0x052C, 0x0000000D, 1); - } - public static void RefreshDesktop() - { - SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, null, SPIF_UPDATEINIFILE); - } - public static IntPtr GetWorkerW(IntPtr hwnd) - { - var workerWHandle = IntPtr.Zero; - EnumWindows(new EnumWindowsProc((topHandle, topParamHandle) => - { - var shellHandle = FindWindowEx(topHandle, IntPtr.Zero, "SHELLDLL_DefView", null); - if (shellHandle != IntPtr.Zero) - { - workerWHandle = FindWindowEx(IntPtr.Zero, topHandle, "WorkerW", null); - } - return true; - }), IntPtr.Zero); - return workerWHandle; - } - public const int GWL_EXSTYLE = -20; - public const int WS_EX_NOACTIVATE = 0x8000000; - public const int WS_EX_TOOLWINDOW = 0x00000080; - public const int HWND_TOP = 0; - public const int HWND_BOTTOM = 1; - public const int SWP_NOMOVE = 2; - public const int SWP_NOSIZE = 1; - public const int SWP_NOACTIVATE = 0x10; - public const int SWP_NOZORDER = 4; - public const int WM_WINDOWPOSCHANGING = 0x46; - public const int WM_DPICHANGED = 0x02E0; - public const uint SPI_SETDESKWALLPAPER = 20; - public const uint SPIF_UPDATEINIFILE = 0x1; - public const uint SPI_SETCLIENTAREAANIMATION = 0x1043; - public const int SRCCOPY = 0x00CC0020; - public const int WM_GETTEXT = 0x000D; - public const int WM_GETTEXTLENGTH = 0x000E; - public const int WM_CLOSE = 0x0010; - - // MonitorFromWindow - public const uint MONITOR_DEFAULTTONULL = 0; - public const uint MONITOR_DEFAULTTOPRIMARY = 1; - public const uint MONITOR_DEFAULTTONEAREST = 2; - public delegate bool EnumMonitorProc(IntPtr hMonitor, IntPtr hdcMonitor, ref Rect rcMonitor, IntPtr data); - - public delegate bool EnumWindowsProc(IntPtr hwnd, IntPtr lParam); - - public delegate void WinEventDelegate(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime); - - [DllImport("user32")] - public static extern IntPtr SetWindowPos(IntPtr hWnd, IntPtr hWndAfter, int x, int y, int dx, int cy, uint flags); - - [DllImport("user32.dll")] - public static extern bool MoveWindow(IntPtr handle, int x, int y, int nWidth, int nHeight, bool bRepaint); - - [DllImport("user32")] - public static extern bool EnumDisplayMonitors(IntPtr hDC, IntPtr clipRect, EnumMonitorProc proc, IntPtr data); - - [DllImport("user32")] - public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); - - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool IsWindow(IntPtr hWnd); - - [DllImport("user32")] - public static extern int SetWindowLong(IntPtr hWnd, int index, int value); - - [DllImport("user32")] - public static extern int GetWindowLong(IntPtr hWnd, int index); - - [DllImport("user32.dll", SetLastError = true)] - public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId); - - [DllImport("user32.dll", SetLastError = true)] - public static extern uint GetWindowThreadProcessId(IntPtr hWnd, IntPtr processId); - - [DllImport("user32")] - public static extern IntPtr GetDesktopWindow(); - - [DllImport("user32")] - public static extern IntPtr GetShellWindow(); - - [DllImport("user32")] - public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); - - [DllImport("user32")] - public static extern IntPtr FindWindowEx(IntPtr hWndParent, IntPtr hWndChildAfter, string lpWindowClass, string lpWindowName); - - [DllImport("user32")] - public static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam); - - [DllImport("user32")] - public static extern IntPtr SetWinEventHook(uint eventMin, uint eventMax, IntPtr hmodWinEventProc, WinEventDelegate lpfnWinEventProc, uint idProcess, uint idThread, uint dwFlags); - - [DllImport("user32")] - public static extern bool UnhookWinEvent(IntPtr hWinEventHook); - - [DllImport("user32")] - public static extern int GetClassName(IntPtr hwnd, StringBuilder name, int count); - - [DllImport("user32")] - public static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam); - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern bool SendMessage(IntPtr hWnd, uint Msg, int wParam, StringBuilder lParam); - - [DllImport("user32.dll")] - public static extern int SendMessageTimeout(IntPtr hWnd, int wMsg, int wParam, int lParam, SendMessageTimeoutFlags fuFlags, uint uTimeout, out int lpdwResult); - - [DllImport("user32")] - public static extern int PostMessage(IntPtr hWnd, int wMsg, int wParam, int lParam); - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern int SystemParametersInfo(uint uiAction, uint uiParam, string pvParam, uint fWinIni); - - [DllImport("user32.dll")] - public static extern int GetWindowRect(IntPtr hwnd, out Rect rect); - - [DllImport("user32.dll")] - public static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); - - [DllImport("user32")] - public static extern int MapWindowPoints(IntPtr hWndFrom, IntPtr hWndTo, [In, Out] ref Rect rect, [MarshalAs(UnmanagedType.U4)] int cPoints); - - [DllImport("user32")] - public static extern int MapWindowPoints(IntPtr hWndFrom, IntPtr hWndTo, [In, Out] ref System.Drawing.Point pt, [MarshalAs(UnmanagedType.U4)] int cPoints); - - [DllImport("gdi32.dll")] - public static extern bool BitBlt(IntPtr hObject, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hObjectSource, int nXSrc, int nYSrc, int dwRop); - - [DllImport("gdi32.dll")] - public static extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int nWidth, int nHeight); - - [DllImport("gdi32.dll")] - public static extern IntPtr CreateCompatibleDC(IntPtr hDC); - - [DllImport("gdi32.dll")] - public static extern bool DeleteDC(IntPtr hDC); - - [DllImport("gdi32.dll")] - public static extern bool DeleteObject(IntPtr hObject); - - [DllImport("gdi32.dll")] - public static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject); - - [DllImport("user32.dll")] - public static extern IntPtr GetWindowDC(IntPtr hWnd); - - [DllImport("user32.dll")] - public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDC); - - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool PrintWindow(IntPtr hWnd, IntPtr hdc, int nFlags); - - [DllImport("user32.dll")] - public static extern IntPtr SetCursor(IntPtr hWnd); - - [DllImport("user32.dll")] - public static extern IntPtr WindowFromPoint(System.Drawing.Point p); - - [DllImport("user32.dll")] - public static extern IntPtr GetParent(IntPtr hWnd); - - [DllImport("user32.dll")] - public static extern IntPtr MonitorFromWindow(IntPtr hwnd, uint dwFlags); - - [StructLayout(LayoutKind.Sequential)] - public struct PerformanceInformation - { - public int cb; - public IntPtr CommitTotal; - public IntPtr CommitLimit; - public IntPtr CommitPeak; - public IntPtr PhysicalTotal; - public IntPtr PhysicalAvailable; - public IntPtr SystemCache; - public IntPtr KernelTotal; - public IntPtr KernelPaged; - public IntPtr KernelNonpaged; - public IntPtr PageSize; - public uint HandleCount; - public uint ProcessCount; - public uint ThreadCount; - } - - [StructLayout(LayoutKind.Sequential)] - public struct OSVersionInfoEx - { - public int dwOSVersionInfoSize; - public uint dwMajorVersion; - public uint dwMinorVersion; - public uint dwBuildNumber; - public uint dwPlatformId; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string szCSDVersion; - public ushort wServicePackMajor; - public ushort wServicePackMinor; - public ushort wSuiteMask; - public byte wProductType; - public byte wReserved; - } - - [StructLayout(LayoutKind.Sequential)] - public struct WindowPos - { - public IntPtr hwnd; - public IntPtr hwndInsertAfter; - public int x; - public int y; - public int cx; - public int cy; - public uint flags; - } - - [StructLayout(LayoutKind.Sequential)] - public struct Rect - { - public int Left, Top, Right, Bottom; - - public int Width => Right - Left; - public int Height => Bottom - Top; - } - - [StructLayout(LayoutKind.Sequential)] - public struct MonitorInfo - { - public uint cbSize; - public Rect rcMonitor; - public Rect rcWork; - public uint dwFlags; - - public void Init() - { - cbSize = (uint)Marshal.SizeOf(this); - } - } - - [Flags] - public enum SendMessageTimeoutFlags : uint - { - SMTO_NORMAL = 0x0, - SMTO_BLOCK = 0x1, - SMTO_ABORTIFHUNG = 0x2, - SMTO_NOTIMEOUTIFNOTHUNG = 0x8, - SMTO_ERRORONEXIT = 0x20 - } -}