├── source ├── .nuget │ ├── NuGet.exe │ ├── NuGet.Config │ └── NuGet.cmd ├── MetroRadiance.Chrome.Externals │ ├── ChromeHook32.dll │ ├── ChromeHook64.dll │ ├── ChromeHookCLR32.dll │ ├── ChromeHookCLR64.dll │ ├── ChromeHookService.dll │ ├── ChromeHook.InjectDll32.exe │ ├── Themes │ │ └── Generic.xaml │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── MetroRadiance.Chrome.Externals.targets │ └── MetroRadiance.Chrome.Externals.nuspec ├── MetroRadiance │ ├── Styles │ │ ├── Colors.xaml │ │ ├── Controls.FocusVisualStyle.xaml │ │ ├── Controls.Tooltip.xaml │ │ ├── Controls.xaml │ │ ├── Controls.Expander.xaml │ │ └── Icons.xaml │ ├── UI │ │ ├── Controls │ │ │ ├── BlurWindowThemeMode.cs │ │ │ ├── CaptionButtonMode.cs │ │ │ ├── ITabItem.cs │ │ │ ├── SystemButtons.cs │ │ │ ├── IWindowSettings.cs │ │ │ ├── TabView.cs │ │ │ ├── WindowAction.cs │ │ │ ├── ExpanderButton.cs │ │ │ ├── AcrylicBlurWindow.cs │ │ │ ├── LinkButton.cs │ │ │ ├── Int32Rule.cs │ │ │ ├── ResizeGrip.cs │ │ │ ├── Badge.cs │ │ │ └── PromptTextBox.cs │ │ ├── ThemeExtensions.cs │ │ ├── Interactivity │ │ │ └── DirectWindowAction.cs │ │ ├── Converters │ │ │ └── WindowStateToVisibilityConverter.cs │ │ └── Theme.cs │ ├── Themes │ │ ├── Generic.BlurWindow.xaml │ │ ├── Accents │ │ │ ├── Blue.xaml │ │ │ ├── Orange.xaml │ │ │ └── Purple.xaml │ │ ├── Generic.Badge.xaml │ │ ├── Generic.CaptionIcon.xaml │ │ ├── Generic.xaml │ │ ├── Generic.BindableRichTextBox.xaml │ │ ├── Generic.SystemButtons.xaml │ │ └── Generic.LinkButton.xaml │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Utilities │ │ ├── TypeForwardedTo.tt │ │ └── InternalExtensions.cs │ └── MetroRadiance.nuspec ├── RetroRadiance │ ├── Styles │ │ ├── Colors.xaml │ │ ├── Controls.FocusVisualStyle.xaml │ │ ├── Controls.Tooltip.xaml │ │ ├── Controls.xaml │ │ ├── Controls.Expander.xaml │ │ └── Icons.xaml │ ├── MetroRadiance.Chrome │ │ ├── ChromeMode.cs │ │ └── Internal │ │ │ ├── GlowWindowProcessorLeft.cs │ │ │ ├── GlowWindowProcessorRight.cs │ │ │ ├── GlowWindowProcessorTop.cs │ │ │ └── GlowWindowProcessorBottom.cs │ ├── MetroRadiance.Core │ │ ├── Win32 │ │ │ ├── GWL.cs │ │ │ ├── MonitorDefaultTo.cs │ │ │ ├── SWP.cs │ │ │ ├── ClassLongFlags.cs │ │ │ ├── ClassStyles.cs │ │ │ ├── NativeExtensions.cs │ │ │ ├── HitTestValues.cs │ │ │ ├── WINDOWPLACEMENT.cs │ │ │ └── SW.cs │ │ ├── Extensions.cs │ │ ├── MonitorDpiType.cs │ │ ├── Dpi.cs │ │ └── PerMonitorDpi.cs │ ├── MetroRadiance │ │ ├── Controls │ │ │ ├── CaptionButtonMode.cs │ │ │ ├── ITabItem.cs │ │ │ ├── SystemButtons.cs │ │ │ ├── TabView.cs │ │ │ ├── WindowAction.cs │ │ │ ├── IWindowSettings.cs │ │ │ ├── ExpanderButton.cs │ │ │ ├── LinkButton.cs │ │ │ ├── Int32Rule.cs │ │ │ ├── ResizeGrip.cs │ │ │ ├── PromptTextBox.cs │ │ │ ├── Badge.cs │ │ │ └── ThemeHelper.cs │ │ ├── Internal │ │ │ ├── Disposable.cs │ │ │ └── InternalExtensions.cs │ │ ├── Behaviors │ │ │ └── DirectWindowAction.cs │ │ └── Converters │ │ │ └── WindowStateToVisibilityConverter.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Themes │ │ ├── Accents │ │ │ ├── Blue.xaml │ │ │ ├── Orange.xaml │ │ │ └── Purple.xaml │ │ ├── Generic.SystemButtons.xaml │ │ ├── Generic.Badge.xaml │ │ ├── Generic.CaptionIcon.xaml │ │ ├── Generic.xaml │ │ ├── Generic.BindableRichTextBox.xaml │ │ └── Generic.LinkButton.xaml │ └── readme.md ├── MetroRadiance.Core │ ├── Interop │ │ ├── Win32 │ │ │ ├── WindowLongFlags.cs │ │ │ ├── MonitorDefaultTo.cs │ │ │ ├── PreferredAppMode.cs │ │ │ ├── APPBARDATA.cs │ │ │ ├── AppBarStates.cs │ │ │ ├── SHCore.cs │ │ │ ├── AppBarEdges.cs │ │ │ ├── NCCALCSIZE_PARAMS.cs │ │ │ ├── NativeExtensions.cs │ │ │ ├── Dwmapi.cs │ │ │ ├── MONITORINFOEX.cs │ │ │ ├── HitTestValues.cs │ │ │ ├── Shell32.cs │ │ │ ├── WINDOWPLACEMENT.cs │ │ │ ├── ClassLongPtrIndex.cs │ │ │ ├── ShowWindowFlags.cs │ │ │ ├── DWMWINDOWATTRIBUTE.cs │ │ │ ├── SetWindowPosFlags.cs │ │ │ └── UxTheme.cs │ │ ├── Appbar.cs │ │ ├── InteropExtensions.cs │ │ ├── MonitorDpiType.cs │ │ └── PerMonitorDpi.cs │ ├── Media │ │ ├── Luminosity.cs │ │ └── ColorHelper.cs │ ├── Platform │ │ ├── TransparentWindow.cs │ │ ├── WindowsThemeConstantValue.cs │ │ ├── RawWindow.cs │ │ ├── IWindowsThemeValue.cs │ │ ├── AppMode.cs │ │ └── WindowComposition.cs │ ├── MetroRadiance.Core.nuspec │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Utilities │ │ └── Disposable.cs ├── .editorconfig └── MetroRadiance.Chrome │ ├── Chrome │ ├── SizingMode.cs │ ├── InternalExtensions.cs │ ├── Primitives │ │ ├── ChromeWindow.Right.cs │ │ ├── ChromeWindow.Left.cs │ │ ├── ChromeWindow.Bottom.cs │ │ └── ChromeWindow.Top.cs │ ├── GlowingEdge.Left.cs │ ├── GlowingEdge.Right.cs │ └── GlowingEdge.Top.cs │ ├── Properties │ ├── Settings.settings │ ├── AssemblyInfo.cs │ └── Settings.Designer.cs │ ├── Themes │ └── Generic.xaml │ ├── MetroRadiance.Chrome.nuspec │ ├── app.config │ └── Platform │ └── IChromeOwner.cs ├── samples ├── MetroRadiance.Showcase │ ├── packages.config │ ├── App.config │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ └── AssemblyInfo.cs │ ├── Themes │ │ └── Generic.xaml │ ├── UI │ │ ├── MainWindow.xaml.cs │ │ ├── BrushSamples.xaml.cs │ │ ├── Resources3.xaml │ │ ├── Resources.xaml │ │ ├── Resources2.xaml │ │ ├── ControlSamples.xaml.cs │ │ ├── ImmersiveColorSamples.xaml.cs │ │ ├── HsvSamples.xaml.cs │ │ ├── AcrylicBlurWindowSample.xaml.cs │ │ ├── BlurWindowSample.xaml.cs │ │ ├── ImmersiveColorSamples.xaml │ │ └── HsvSamples.xaml │ ├── Application.xaml.cs │ └── Application.xaml └── ZuneLikeWindow │ ├── App.config │ ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ └── AssemblyInfo.cs │ ├── App.xaml │ ├── App.xaml.cs │ └── Views │ └── MainWindow.xaml.cs ├── LICENSE.txt └── .gitignore /source/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Grabacr07/MetroRadiance/HEAD/source/.nuget/NuGet.exe -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome.Externals/ChromeHook32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Grabacr07/MetroRadiance/HEAD/source/MetroRadiance.Chrome.Externals/ChromeHook32.dll -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome.Externals/ChromeHook64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Grabacr07/MetroRadiance/HEAD/source/MetroRadiance.Chrome.Externals/ChromeHook64.dll -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome.Externals/ChromeHookCLR32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Grabacr07/MetroRadiance/HEAD/source/MetroRadiance.Chrome.Externals/ChromeHookCLR32.dll -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome.Externals/ChromeHookCLR64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Grabacr07/MetroRadiance/HEAD/source/MetroRadiance.Chrome.Externals/ChromeHookCLR64.dll -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome.Externals/ChromeHookService.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Grabacr07/MetroRadiance/HEAD/source/MetroRadiance.Chrome.Externals/ChromeHookService.dll -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome.Externals/ChromeHook.InjectDll32.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Grabacr07/MetroRadiance/HEAD/source/MetroRadiance.Chrome.Externals/ChromeHook.InjectDll32.exe -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /source/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /source/MetroRadiance/Styles/Colors.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /source/RetroRadiance/Styles/Colors.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/ZuneLikeWindow/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome.Externals/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /samples/ZuneLikeWindow/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/WindowLongFlags.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable InconsistentNaming 2 | 3 | namespace MetroRadiance.Interop.Win32 4 | { 5 | public enum WindowLongFlags 6 | { 7 | GWL_STYLE = -16, 8 | GWL_EXSTYLE = -20, 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/BlurWindowThemeMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace MetroRadiance.UI.Controls 5 | { 6 | public enum BlurWindowThemeMode 7 | { 8 | Default, 9 | 10 | Light, 11 | 12 | Dark, 13 | 14 | Accent, 15 | 16 | System, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/.nuget/NuGet.cmd: -------------------------------------------------------------------------------- 1 | nuget.exe pack .\..\MetroRadiance.Core\MetroRadiance.Core.csproj 2 | nuget.exe pack .\..\MetroRadiance.Chrome\MetroRadiance.Chrome.csproj 3 | nuget.exe pack .\..\MetroRadiance.Chrome.Externals\MetroRadiance.Chrome.Externals.csproj 4 | nuget.exe pack .\..\MetroRadiance\MetroRadiance.csproj -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/CaptionButtonMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace MetroRadiance.UI.Controls 7 | { 8 | public enum CaptionButtonMode 9 | { 10 | Normal, 11 | 12 | Toggle, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/MonitorDefaultTo.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable InconsistentNaming 2 | 3 | namespace MetroRadiance.Interop.Win32 4 | { 5 | public enum MonitorDefaultTo 6 | { 7 | MONITOR_DEFAULTTONULL = 0, 8 | MONITOR_DEFAULTTOPRIMARY = 1, 9 | MONITOR_DEFAULTTONEAREST = 2, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Chrome/ChromeMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace MetroRadiance.Chrome 5 | { 6 | [Obsolete] 7 | [EditorBrowsable(EditorBrowsableState.Never)] 8 | public enum ChromeMode 9 | { 10 | VisualStudio2013, 11 | Office2013, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /source/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.{cs,xaml}] 4 | indent_style = tab 5 | indent_size = 4 6 | end_of_line = crlf 7 | insert_final_newline = true 8 | charset = utf-8-bom 9 | 10 | [*.nuspec] 11 | indent_style = space 12 | indent_size = 2 13 | end_of_line = crlf 14 | insert_final_newline = true 15 | charset = utf-8-bom 16 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/PreferredAppMode.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable InconsistentNaming 2 | 3 | namespace MetroRadiance.Interop.Win32 4 | { 5 | public enum PreferredAppMode 6 | { 7 | APPMODE_DEFAULT = 0, 8 | APPMODE_ALLOWDARK = 1, 9 | APPMODE_FORCEDARK = 2, 10 | APPMODE_FORCELIGHT = 3, 11 | APPMODE_MAX = 4 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/ITabItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace MetroRadiance.UI.Controls 7 | { 8 | public interface ITabItem 9 | { 10 | string Name { get; } 11 | int? Badge { get; } 12 | bool IsSelected { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/UI/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace MetroRadiance.Showcase.UI 7 | { 8 | partial class MainWindow 9 | { 10 | public MainWindow() 11 | { 12 | this.InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/UI/BrushSamples.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace MetroRadiance.Showcase.UI 7 | { 8 | partial class BrushSamples 9 | { 10 | public BrushSamples() 11 | { 12 | this.InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/ZuneLikeWindow/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/UI/Resources3.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/Win32/GWL.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace MetroRadiance.Core.Win32 5 | { 6 | [Obsolete] 7 | [EditorBrowsable(EditorBrowsableState.Never)] 8 | // ReSharper disable InconsistentNaming 9 | public enum GWL 10 | { 11 | STYLE = -16, 12 | EXSTYLE = -20, 13 | } 14 | // ReSharper restore InconsistentNaming 15 | } 16 | -------------------------------------------------------------------------------- /samples/ZuneLikeWindow/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace ZuneLikeWindow 10 | { 11 | /// 12 | /// App.xaml の相互作用ロジック 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/CaptionButtonMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace MetroRadiance.Controls 8 | { 9 | [Obsolete] 10 | [EditorBrowsable(EditorBrowsableState.Never)] 11 | public enum CaptionButtonMode 12 | { 13 | Normal, 14 | 15 | Toggle, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/APPBARDATA.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | // ReSharper disable InconsistentNaming 4 | 5 | namespace MetroRadiance.Interop.Win32 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | public struct APPBARDATA 9 | { 10 | public int cbSize; 11 | public IntPtr hWnd; 12 | public uint uCallbackMessage; 13 | public AppBarEdges uEdge; 14 | public RECT rc; 15 | public IntPtr lParam; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/AppBarStates.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | // ReSharper disable InconsistentNaming 3 | 4 | namespace MetroRadiance.Interop.Win32 5 | { 6 | [Flags] 7 | public enum AppBarState : uint 8 | { 9 | /// 10 | /// The taskbar is in the autohide state. 11 | /// 12 | ABS_AUTOHIDE = 0x1, 13 | 14 | /// 15 | /// he taskbar is in the always-on-top state. 16 | /// 17 | ABS_ALWAYSONTOP = 0x2 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Chrome/SizingMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace MetroRadiance.Chrome 7 | { 8 | public enum SizingMode 9 | { 10 | None = 0, 11 | 12 | // HitTestValues 互換 13 | Left = 10, 14 | Top = 12, 15 | Right = 11, 16 | Bottom = 15, 17 | TopLeft = 13, 18 | TopRight = 14, 19 | BottomLeft = 16, 20 | BottomRight = 17, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/ITabItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace MetroRadiance.Controls 9 | { 10 | [Obsolete] 11 | [EditorBrowsable(EditorBrowsableState.Never)] 12 | public interface ITabItem 13 | { 14 | string Name { get; } 15 | int? Badge { get; } 16 | bool IsSelected { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Media/Luminosity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Media; 6 | 7 | namespace MetroRadiance.Media 8 | { 9 | public class Luminosity 10 | { 11 | /// 12 | /// RGB 色空間で表現される色から輝度を求めます。 13 | /// 14 | public static byte FromRgb(Color c) 15 | { 16 | return (byte)(c.R * 0.299 + c.G * 0.587 + c.B * 0.114); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 250 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/UI/Resources.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/SHCore.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace MetroRadiance.Interop.Win32 7 | { 8 | // ReSharper disable once InconsistentNaming 9 | public static class SHCore 10 | { 11 | [DllImport("SHCore.dll", CharSet = CharSet.Unicode, PreserveSig = false)] 12 | public static extern void GetDpiForMonitor(IntPtr hmonitor, MonitorDpiType dpiType, ref uint dpiX, ref uint dpiY); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/ThemeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Media; 6 | 7 | namespace MetroRadiance.UI 8 | { 9 | public static class ThemeExtensions 10 | { 11 | /// 12 | /// 現在の 構造体から、MetroRadiance の で使用する を作成します。 13 | /// 14 | public static Accent ToAccent(this Color color) 15 | { 16 | return Accent.FromColor(color); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/AppBarEdges.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable InconsistentNaming 2 | 3 | namespace MetroRadiance.Interop.Win32 4 | { 5 | public enum AppBarEdges : uint 6 | { 7 | /// 8 | /// Left edge. 9 | /// 10 | ABE_LEFT = 0, 11 | 12 | /// 13 | /// Top edge. 14 | /// 15 | ABE_TOP = 1, 16 | 17 | /// 18 | /// Right edge. 19 | /// 20 | ABE_RIGHT = 2, 21 | 22 | /// 23 | /// Bottom edge. 24 | /// 25 | ABE_BOTTOM = 3 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/Application.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using MetroRadiance.UI; 7 | 8 | namespace MetroRadiance.Showcase 9 | { 10 | public partial class Application 11 | { 12 | protected override void OnStartup(StartupEventArgs e) 13 | { 14 | base.OnStartup(e); 15 | this.ShutdownMode = ShutdownMode.OnMainWindowClose; 16 | 17 | ThemeService.Current.Register(this, Theme.Windows, Accent.Windows); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/Win32/MonitorDefaultTo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace MetroRadiance.Core.Win32 8 | { 9 | [Obsolete] 10 | [EditorBrowsable(EditorBrowsableState.Never)] 11 | public enum MonitorDefaultTo 12 | { 13 | // ReSharper disable InconsistentNaming 14 | MONITOR_DEFAULTTONULL = 0, 15 | MONITOR_DEFAULTTOPRIMARY = 1, 16 | MONITOR_DEFAULTTONEAREST = 2, 17 | // ReSharper restore InconsistentNaming 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Platform/TransparentWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Interop; 5 | using MetroRadiance.Interop.Win32; 6 | 7 | namespace MetroRadiance.Platform 8 | { 9 | public class TransparentWindow : RawWindow 10 | { 11 | public override void Show() 12 | { 13 | var parameters = new HwndSourceParameters(this.Name) 14 | { 15 | Width = 1, 16 | Height = 1, 17 | WindowStyle = (int)WindowStyles.WS_BORDER, 18 | }; 19 | 20 | this.Show(parameters); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/SystemButtons.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | 8 | namespace MetroRadiance.UI.Controls 9 | { 10 | public class SystemButtons : Control 11 | { 12 | static SystemButtons() 13 | { 14 | DefaultStyleKeyProperty.OverrideMetadata(typeof(SystemButtons), new FrameworkPropertyMetadata(typeof(SystemButtons))); 15 | IsTabStopProperty.OverrideMetadata(typeof(SystemButtons), new FrameworkPropertyMetadata(false)); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/MetroRadiance/Themes/Generic.BlurWindow.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/Win32/SWP.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace MetroRadiance.Core.Win32 5 | { 6 | [Obsolete] 7 | [EditorBrowsable(EditorBrowsableState.Never)] 8 | [Flags] 9 | // ReSharper disable InconsistentNaming 10 | public enum SWP 11 | { 12 | NOSIZE = 0x1, 13 | NOMOVE = 0x2, 14 | NOZORDER = 0x4, 15 | NOREDRAW = 0x8, 16 | NOACTIVATE = 0x10, 17 | FRAMECHANGED = 0x20, 18 | SHOWWINDOW = 0x0040, 19 | NOOWNERZORDER = 0x200, 20 | NOSENDCHANGING = 0x0400, 21 | ASYNCWINDOWPOS = 0x4000, 22 | } 23 | // ReSharper restore InconsistentNaming 24 | } 25 | -------------------------------------------------------------------------------- /source/RetroRadiance/Styles/Controls.FocusVisualStyle.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 16 | 17 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/UI/Resources2.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /source/MetroRadiance/Styles/Controls.FocusVisualStyle.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/Win32/ClassLongFlags.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.ComponentModel; 4 | 5 | namespace MetroRadiance.Core.Win32 6 | { 7 | [Obsolete] 8 | [EditorBrowsable(EditorBrowsableState.Never)] 9 | public enum ClassLongFlags 10 | { 11 | // ReSharper disable InconsistentNaming 12 | GclpMenuName = -8, 13 | GclpHBRBackground = -10, 14 | GclpHCursor = -12, 15 | GclpHIcon = -14, 16 | GclpHModule = -16, 17 | GclCBWndExtra = -18, 18 | GclCBClsExtra = -20, 19 | GclpWndProc = -24, 20 | GclStyle = -26, 21 | GclpHIconSm = -34, 22 | GcwAtom = -32 23 | // ReSharper restore InconsistentNaming 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/NCCALCSIZE_PARAMS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | // ReSharper disable InconsistentNaming 4 | 5 | namespace MetroRadiance.Interop.Win32 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | public struct WINDOWPOS 9 | { 10 | public IntPtr hwnd; 11 | public IntPtr hwndInsertAfter; 12 | public int x; 13 | public int y; 14 | public int cx; 15 | public int cy; 16 | public SetWindowPosFlags flags; 17 | } 18 | 19 | [StructLayout(LayoutKind.Sequential)] 20 | public struct NCCALCSIZE_PARAMS 21 | { 22 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] 23 | public RECT[] rgrc; 24 | public WINDOWPOS lppos; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/Win32/ClassStyles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace MetroRadiance.Core.Win32 5 | { 6 | [Obsolete] 7 | [EditorBrowsable(EditorBrowsableState.Never)] 8 | [Flags] 9 | public enum ClassStyles 10 | { 11 | // ReSharper disable InconsistentNaming 12 | ByteAlignClient = 0x1000, 13 | ByteAlignWindow = 0x2000, 14 | ClassDC = 0x40, 15 | DblClks = 8, 16 | DropShadow = 0x20000, 17 | GlobalClass = 0x4000, 18 | HRedraw = 2, 19 | Ime = 0x10000, 20 | NoClose = 0x200, 21 | OwnDC = 0x20, 22 | ParentDC = 0x80, 23 | SaveBits = 0x800, 24 | VRedraw = 1, 25 | // ReSharper restore InconsistentNaming 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/NativeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | 7 | namespace MetroRadiance.Interop.Win32 8 | { 9 | public static class NativeExtensions 10 | { 11 | public static ushort ToLoWord(this IntPtr dword) 12 | { 13 | return (ushort)((uint)dword & 0xffff); 14 | } 15 | 16 | public static ushort ToHiWord(this IntPtr dword) 17 | { 18 | return (ushort)((uint)dword >> 16); 19 | } 20 | 21 | public static Point ToPoint(this IntPtr dword) 22 | { 23 | return new Point((short)((uint)dword & 0xffff), (short)((uint)dword >> 16)); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Platform/WindowsThemeConstantValue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MetroRadiance.Platform 4 | { 5 | public sealed class WindowsThemeConstantValue : IWindowsThemeValue 6 | { 7 | internal WindowsThemeConstantValue(T constant) 8 | { 9 | this.Current = constant; 10 | } 11 | 12 | /// 13 | /// 設定値が動的に変更されるかを取得します。 14 | /// 15 | public bool IsDynamic => false; 16 | 17 | /// 18 | /// 現在の設定値を取得します。 19 | /// 20 | public T Current { get; } 21 | 22 | /// 23 | /// テーマ設定が変更されると発生します。 24 | /// 25 | #pragma warning disable 67 26 | public event EventHandler Changed; 27 | #pragma warning restore 67 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/Dwmapi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace MetroRadiance.Interop.Win32 7 | { 8 | public static class Dwmapi 9 | { 10 | [DllImport("Dwmapi.dll", ExactSpelling = true, PreserveSig = false)] 11 | public static extern void DwmGetColorizationColor([Out] out uint pcrColorization, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfOpaqueBlend); 12 | 13 | [DllImport("Dwmapi.dll", ExactSpelling = true, PreserveSig = false)] 14 | public static extern void DwmGetWindowAttribute(IntPtr hWnd, DWMWINDOWATTRIBUTE dwAttribute, [Out] out RECT pvAttribute, int cbAttribute); 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/MetroRadiance.Core.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $id$ 5 | $title$ 6 | $version$ 7 | $author$ 8 | $author$ 9 | https://github.com/Grabacr07/MetroRadiance/blob/master/LICENSE.txt 10 | https://github.com/Grabacr07/MetroRadiance 11 | false 12 | $description$ 13 | ja-JP 14 | WPF 15 | 16 | 17 | -------------------------------------------------------------------------------- /source/RetroRadiance/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | 5 | [assembly: AssemblyTitle("RetroRadiance")] 6 | [assembly: AssemblyCompany("grabacr.net")] 7 | [assembly: AssemblyProduct("MetroRadiance")] 8 | [assembly: AssemblyDescription("互換性のために残されています。")] 9 | [assembly: AssemblyCopyright("Copyright © 2014 Manato KAMEYA")] 10 | 11 | [assembly: ComVisible(false)] 12 | [assembly: Guid("FE185DDF-930F-4CAD-B8DD-79CF6DDB9BF4")] 13 | 14 | [assembly: ThemeInfo( 15 | ResourceDictionaryLocation.None, 16 | ResourceDictionaryLocation.SourceAssembly)] 17 | 18 | [assembly: AssemblyVersion("1.0.0")] 19 | [assembly: AssemblyInformationalVersion("1.0.0")] 20 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | 5 | [assembly: AssemblyTitle("MetroRadiance.Core")] 6 | [assembly: AssemblyCompany("grabacr.net")] 7 | [assembly: AssemblyProduct("MetroRadiance")] 8 | [assembly: AssemblyDescription("Modern WPF Themes (core)")] 9 | [assembly: AssemblyCopyright("Copyright © 2014 Manato KAMEYA")] 10 | 11 | [assembly: ComVisible(false)] 12 | [assembly: Guid("F3EACB40-2C04-418F-8297-AD00858824A9")] 13 | 14 | [assembly: ThemeInfo( 15 | ResourceDictionaryLocation.None, 16 | ResourceDictionaryLocation.SourceAssembly)] 17 | 18 | [assembly: AssemblyVersion("2.4.1")] 19 | [assembly: AssemblyInformationalVersion("2.4.1")] 20 | -------------------------------------------------------------------------------- /source/MetroRadiance/Themes/Accents/Blue.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | #FF007ACC 5 | 7 | 8 | #FF28A0F0 9 | 11 | 12 | #FF005AAA 13 | 15 | 16 | White 17 | 19 | 20 | -------------------------------------------------------------------------------- /source/MetroRadiance/Themes/Accents/Orange.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | #FFCA5100 5 | 7 | 8 | #FFF07828 9 | 11 | 12 | #FFB43C00 13 | 15 | 16 | White 17 | 19 | 20 | -------------------------------------------------------------------------------- /source/MetroRadiance/Themes/Accents/Purple.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | #FF68217A 5 | 7 | 8 | #FF8C46A0 9 | 11 | 12 | #FF5A1464 13 | 15 | 16 | White 17 | 19 | 20 | -------------------------------------------------------------------------------- /source/RetroRadiance/Themes/Accents/Blue.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | #FF007ACC 5 | 7 | 8 | #FF28A0F0 9 | 11 | 12 | #FF005AAA 13 | 15 | 16 | White 17 | 19 | 20 | -------------------------------------------------------------------------------- /source/RetroRadiance/Themes/Accents/Orange.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | #FFCA5100 5 | 7 | 8 | #FFF07828 9 | 11 | 12 | #FFB43C00 13 | 15 | 16 | White 17 | 19 | 20 | -------------------------------------------------------------------------------- /source/RetroRadiance/Themes/Accents/Purple.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | #FF68217A 5 | 7 | 8 | #FF8C46A0 9 | 11 | 12 | #FF5A1464 13 | 15 | 16 | White 17 | 19 | 20 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome.Externals/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | 5 | [assembly: AssemblyTitle("MetroRadiance.Chrome.Externals")] 6 | [assembly: AssemblyCompany("grabacr.net")] 7 | [assembly: AssemblyProduct("MetroRadiance")] 8 | [assembly: AssemblyDescription("Modern WPF Themes (chrome for external window)")] 9 | [assembly: AssemblyCopyright("Copyright © 2015 Manato KAMEYA")] 10 | 11 | [assembly: ComVisible(false)] 12 | [assembly: Guid("BDDDEB9F-1DEA-4B17-A175-010D8AE36B13")] 13 | 14 | [assembly: ThemeInfo( 15 | ResourceDictionaryLocation.None, 16 | ResourceDictionaryLocation.SourceAssembly)] 17 | 18 | [assembly: AssemblyVersion("2.1.0")] 19 | [assembly: AssemblyInformationalVersion("2.1.0")] 20 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/UI/ControlSamples.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows; 5 | 6 | namespace MetroRadiance.Showcase.UI 7 | { 8 | partial class ControlSamples 9 | { 10 | public ControlSamples() 11 | { 12 | this.InitializeComponent(); 13 | this.DataContext = new SampleValues(); 14 | } 15 | 16 | private void HandleBlurWindowButtonClicked(object sender, RoutedEventArgs e) 17 | { 18 | new BlurWindowSample().Show(); 19 | } 20 | 21 | private void HandleAcrylicBlurWindowButtonClicked(object sender, RoutedEventArgs e) 22 | { 23 | new AcrylicBlurWindowSample().Show(); 24 | } 25 | } 26 | 27 | public class SampleValues 28 | { 29 | public int Int32 { get; set; } = 32; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/MONITORINFOEX.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | // ReSharper disable InconsistentNaming 3 | 4 | namespace MetroRadiance.Interop.Win32 5 | { 6 | public enum MONITORINFOF : uint 7 | { 8 | MONITORINFOF_PRIMARY = 1 9 | } 10 | 11 | [StructLayout(LayoutKind.Sequential)] 12 | public struct MONITORINFO 13 | { 14 | public uint cbSize; 15 | public RECT rcMonitor; 16 | public RECT rcWork; 17 | public MONITORINFOF dwFlags; 18 | } 19 | 20 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 21 | public struct MONITORINFOEX 22 | { 23 | public uint cbSize; 24 | public RECT rcMonitor; 25 | public RECT rcWork; 26 | public MONITORINFOF dwFlags; 27 | 28 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] 29 | public string szDevice; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Utilities/Disposable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace MetroRadiance.Utilities 7 | { 8 | public class Disposable 9 | { 10 | public static IDisposable Create(Action dispose) 11 | { 12 | return new AnonymousDisposable(dispose); 13 | } 14 | 15 | private class AnonymousDisposable : IDisposable 16 | { 17 | private bool _isDisposed; 18 | private readonly Action _dispose; 19 | 20 | public AnonymousDisposable(Action dispose) 21 | { 22 | this._dispose = dispose; 23 | } 24 | 25 | public void Dispose() 26 | { 27 | if (this._isDisposed) return; 28 | 29 | this._isDisposed = true; 30 | this._dispose(); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/IWindowSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using MetroRadiance.Interop.Win32; 8 | 9 | namespace MetroRadiance.UI.Controls 10 | { 11 | public interface IWindowSettings 12 | { 13 | WINDOWPLACEMENT? Placement { get; set; } 14 | void Reload(); 15 | void Save(); 16 | } 17 | 18 | 19 | public class WindowSettings : ApplicationSettingsBase, IWindowSettings 20 | { 21 | public WindowSettings(Window window) : base(window.GetType().FullName) { } 22 | 23 | [UserScopedSetting] 24 | public WINDOWPLACEMENT? Placement 25 | { 26 | get { return (WINDOWPLACEMENT?)this["Placement"]; } 27 | set { this["Placement"] = value; } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/TabView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | 8 | namespace MetroRadiance.UI.Controls 9 | { 10 | public class TabView : ListBox 11 | { 12 | static TabView() 13 | { 14 | DefaultStyleKeyProperty.OverrideMetadata(typeof(TabView), new FrameworkPropertyMetadata(typeof(TabView))); 15 | } 16 | 17 | protected override void OnSelectionChanged(SelectionChangedEventArgs e) 18 | { 19 | base.OnSelectionChanged(e); 20 | 21 | foreach (var item in e.RemovedItems.OfType()) 22 | { 23 | item.IsSelected = false; 24 | } 25 | foreach (var item in e.AddedItems.OfType()) 26 | { 27 | item.IsSelected = true; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/Win32/NativeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace MetroRadiance.Core.Win32 9 | { 10 | [Obsolete] 11 | [EditorBrowsable(EditorBrowsableState.Never)] 12 | public static class NativeExtensions 13 | { 14 | public static ushort ToLoWord(this IntPtr dword) 15 | { 16 | return (ushort)((uint)dword & 0xffff); 17 | } 18 | 19 | public static ushort ToHiWord(this IntPtr dword) 20 | { 21 | return (ushort)((uint)dword >> 16); 22 | } 23 | 24 | public static Point ToPoint(this IntPtr dword) 25 | { 26 | return new Point((short)((uint)dword & 0xffff), (short)((uint)dword >> 16)); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Internal/Disposable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace MetroRadiance.Internal 5 | { 6 | [Obsolete] 7 | [EditorBrowsable(EditorBrowsableState.Never)] 8 | internal class Disposable 9 | { 10 | public static IDisposable Create(Action dispose) 11 | { 12 | return new AnonymousDisposable(dispose); 13 | } 14 | 15 | private class AnonymousDisposable : IDisposable 16 | { 17 | private bool _isDisposed; 18 | private readonly Action _dispose; 19 | 20 | public AnonymousDisposable(Action dispose) 21 | { 22 | this._dispose = dispose; 23 | } 24 | 25 | public void Dispose() 26 | { 27 | if (this._isDisposed) return; 28 | 29 | this._isDisposed = true; 30 | this._dispose(); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /samples/ZuneLikeWindow/Views/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace ZuneLikeWindow.Views 17 | { 18 | /// 19 | /// MainWindow.xaml の相互作用ロジック 20 | /// 21 | public partial class MainWindow : Window 22 | { 23 | public MainWindow() 24 | { 25 | this.InitializeComponent(); 26 | 27 | this.MouseLeftButtonDown += (sender, e) => this.DragMove(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Media/ColorHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Media; 6 | 7 | namespace MetroRadiance.Media 8 | { 9 | public static class ColorHelper 10 | { 11 | /// 12 | /// 現在の RGB 色空間による色から HSV 色空間の 構造体を作成します。 13 | /// 14 | public static HsvColor ToHsv(this Color c) 15 | { 16 | return HsvColor.FromRgb(c); 17 | } 18 | 19 | public static uint GetColorAsUInt32(Color color) 20 | { 21 | return ((uint)color.A << 24) | ((uint)color.B << 16) | ((uint)color.G << 8) | color.R; 22 | } 23 | 24 | public static Color GetColorFromUInt32(uint color) 25 | { 26 | return Color.FromArgb((byte)(color >> 24), (byte)(color >> 16), (byte)(color >> 8), (byte)color); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/MetroRadiance.Chrome.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $id$ 5 | $title$ 6 | $version$ 7 | $author$ 8 | $author$ 9 | https://github.com/Grabacr07/MetroRadiance/blob/master/LICENSE.txt 10 | https://github.com/Grabacr07/MetroRadiance 11 | false 12 | $description$ 13 | ja-JP 14 | WPF 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/HitTestValues.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable InconsistentNaming 2 | 3 | namespace MetroRadiance.Interop.Win32 4 | { 5 | public enum HitTestValues 6 | { 7 | HTERROR = -2, 8 | HTTRANSPARENT = -1, 9 | HTNOWHERE = 0, 10 | HTCLIENT = 1, 11 | HTCAPTION = 2, 12 | HTSYSMENU = 3, 13 | HTGROWBOX = 4, 14 | HTSIZE = HTGROWBOX, 15 | HTMENU = 5, 16 | HTHSCROLL = 6, 17 | HTVSCROLL = 7, 18 | HTMINBUTTON = 8, 19 | HTMAXBUTTON = 9, 20 | HTLEFT = 10, 21 | HTRIGHT = 11, 22 | HTTOP = 12, 23 | HTTOPLEFT = 13, 24 | HTTOPRIGHT = 14, 25 | HTBOTTOM = 15, 26 | HTBOTTOMLEFT = 16, 27 | HTBOTTOMRIGHT = 17, 28 | HTBORDER = 18, 29 | HTREDUCE = HTMINBUTTON, 30 | HTZOOM = HTMAXBUTTON, 31 | HTSIZEFIRST = HTLEFT, 32 | HTSIZELAST = HTBOTTOMRIGHT, 33 | HTOBJECT = 19, 34 | HTCLOSE = 20, 35 | HTHELP = 21, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/SystemButtons.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace MetroRadiance.Controls 18 | { 19 | [Obsolete] 20 | [EditorBrowsable(EditorBrowsableState.Never)] 21 | public class SystemButtons : Control 22 | { 23 | static SystemButtons() 24 | { 25 | DefaultStyleKeyProperty.OverrideMetadata(typeof(SystemButtons), new FrameworkPropertyMetadata(typeof(SystemButtons))); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | using System.Windows.Markup; 5 | 6 | [assembly: AssemblyTitle("MetroRadiance.Chrome")] 7 | [assembly: AssemblyCompany("grabacr.net")] 8 | [assembly: AssemblyProduct("MetroRadiance")] 9 | [assembly: AssemblyDescription("Modern WPF Themes (chrome)")] 10 | [assembly: AssemblyCopyright("Copyright © 2014 Manato KAMEYA")] 11 | 12 | [assembly: ComVisible(false)] 13 | [assembly: Guid("1729250A-21A0-40F5-A763-723E20C02E9C")] 14 | 15 | [assembly: ThemeInfo( 16 | ResourceDictionaryLocation.None, 17 | ResourceDictionaryLocation.SourceAssembly)] 18 | 19 | [assembly: XmlnsDefinition("http://schemes.grabacr.net/winfx/2014/chrome", "MetroRadiance.Chrome")] 20 | 21 | [assembly: AssemblyVersion("2.2.0")] 22 | [assembly: AssemblyInformationalVersion("2.2.0")] 23 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome.Externals/MetroRadiance.Chrome.Externals.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | $(PrepareForRunDependsOn); 12 | CopyNativeBinaries 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/Application.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Appbar.cs: -------------------------------------------------------------------------------- 1 | using MetroRadiance.Interop.Win32; 2 | 3 | namespace MetroRadiance.Interop 4 | { 5 | public static class AppBar 6 | { 7 | // Note: This is constant in every DPI. 8 | private const int _hideAppbarSpace = 2; 9 | 10 | public static bool HasAutoHideAppBar(RECT area, AppBarEdges targetEdge) 11 | { 12 | var appbar = Shell32.SHAppBarGetAutoHideBarEx(targetEdge, area); 13 | return User32.IsWindow(appbar); 14 | } 15 | 16 | public static void ApplyAppbarSpace(RECT monitorArea, ref RECT workArea) 17 | { 18 | if (HasAutoHideAppBar(monitorArea, AppBarEdges.ABE_TOP)) workArea.Top += _hideAppbarSpace; 19 | if (HasAutoHideAppBar(monitorArea, AppBarEdges.ABE_LEFT)) workArea.Left += _hideAppbarSpace; 20 | if (HasAutoHideAppBar(monitorArea, AppBarEdges.ABE_RIGHT)) workArea.Right -= _hideAppbarSpace; 21 | if (HasAutoHideAppBar(monitorArea, AppBarEdges.ABE_BOTTOM)) workArea.Bottom -= _hideAppbarSpace; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/InteropExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Media; 7 | 8 | namespace MetroRadiance.Interop 9 | { 10 | public static class Extensions 11 | { 12 | /// 13 | /// 現在の から、WPF が認識しているシステム DPI を取得します。 14 | /// 15 | /// 16 | /// X 軸 および Y 軸それぞれの DPI 設定値を表す 構造体。 17 | /// 18 | public static Dpi? GetSystemDpi(this Visual visual) 19 | { 20 | var source = PresentationSource.FromVisual(visual); 21 | if (source?.CompositionTarget != null) 22 | { 23 | return new Dpi( 24 | (uint)(Dpi.Default.X * source.CompositionTarget.TransformToDevice.M11), 25 | (uint)(Dpi.Default.Y * source.CompositionTarget.TransformToDevice.M22)); 26 | } 27 | 28 | return null; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/WindowAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace MetroRadiance.UI.Controls 7 | { 8 | /// 9 | /// ウィンドウ操作を示す識別子を定義します。 10 | /// 11 | public enum WindowAction 12 | { 13 | /// 14 | /// ウィンドウ操作は実行されません。 15 | /// 16 | None, 17 | 18 | /// 19 | /// ウィンドウをアクティブ化します。 20 | /// 21 | Active, 22 | 23 | /// 24 | /// ウィンドウを閉じます。 25 | /// 26 | Close, 27 | 28 | /// 29 | /// ウィンドウを通常状態にします。 30 | /// 31 | Normalize, 32 | 33 | /// 34 | /// ウィンドウを最大化します。 35 | /// 36 | Maximize, 37 | 38 | /// 39 | /// ウィンドウを最小化します。 40 | /// 41 | Minimize, 42 | 43 | /// 44 | /// ウィンドウのシステム メニューを開きます。 45 | /// 46 | OpenSystemMenu, 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 250 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/TabView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | 10 | namespace MetroRadiance.Controls 11 | { 12 | [Obsolete] 13 | [EditorBrowsable(EditorBrowsableState.Never)] 14 | public class TabView : ListBox 15 | { 16 | static TabView() 17 | { 18 | DefaultStyleKeyProperty.OverrideMetadata(typeof(TabView), new FrameworkPropertyMetadata(typeof(TabView))); 19 | } 20 | 21 | protected override void OnSelectionChanged(SelectionChangedEventArgs e) 22 | { 23 | base.OnSelectionChanged(e); 24 | 25 | foreach (var item in e.RemovedItems.OfType()) 26 | { 27 | item.IsSelected = false; 28 | } 29 | foreach (var item in e.AddedItems.OfType()) 30 | { 31 | item.IsSelected = true; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/RetroRadiance/Styles/Controls.Tooltip.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 27 | 28 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/UI/ImmersiveColorSamples.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Windows.Media; 6 | using MetroRadiance.Media; 7 | using MetroRadiance.Platform; 8 | 9 | namespace MetroRadiance.Showcase.UI 10 | { 11 | public partial class ImmersiveColorSamples 12 | { 13 | public ImmersiveColorSamples() 14 | { 15 | this.InitializeComponent(); 16 | 17 | this.DataContext = typeof(ImmersiveColorNames).GetFields(BindingFlags.Static | BindingFlags.Public) 18 | .Select(x => (string)x.GetValue(null)) 19 | .Select(name => 20 | { 21 | var background = new SolidColorBrush(ImmersiveColor.GetColorByTypeName(name)); 22 | var luminocity = Luminosity.FromRgb(background.Color); 23 | var foreground = new SolidColorBrush(luminocity < 128 ? Colors.White : Colors.Black); 24 | 25 | return new { name, background, foreground, }; 26 | }) 27 | .ToArray(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Platform/IChromeOwner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using MetroRadiance.Chrome; 7 | 8 | namespace MetroRadiance.Platform 9 | { 10 | /// 11 | /// がアタッチ先として使用するための、Win32 ウィンドウの機能を公開します。 12 | /// 13 | public interface IChromeOwner 14 | { 15 | IntPtr Handle { get; } 16 | 17 | bool IsActive { get; } 18 | WindowState WindowState { get; } 19 | ResizeMode ResizeMode { get; } 20 | Visibility Visibility { get; } 21 | 22 | event EventHandler ContentRendered; 23 | event EventHandler LocationChanged; 24 | event EventHandler SizeChanged; 25 | event EventHandler StateChanged; 26 | event EventHandler Activated; 27 | event EventHandler Deactivated; 28 | event EventHandler Closed; 29 | 30 | bool Activate(); 31 | 32 | void Resize(SizingMode sizingMode); 33 | void DoubleClick(SizingMode sizingMode); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/RetroRadiance/Themes/Generic.SystemButtons.xaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 23 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/WindowAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | 6 | namespace MetroRadiance.Controls 7 | { 8 | /// 9 | /// ウィンドウ操作を示す識別子を定義します。 10 | /// 11 | [Obsolete] 12 | [EditorBrowsable(EditorBrowsableState.Never)] 13 | public enum WindowAction 14 | { 15 | /// 16 | /// ウィンドウ操作は実行されません。 17 | /// 18 | None, 19 | 20 | /// 21 | /// ウィンドウをアクティブ化します。 22 | /// 23 | Active, 24 | 25 | /// 26 | /// ウィンドウを閉じます。 27 | /// 28 | Close, 29 | 30 | /// 31 | /// ウィンドウを通常状態にします。 32 | /// 33 | Normalize, 34 | 35 | /// 36 | /// ウィンドウを最大化します。 37 | /// 38 | Maximize, 39 | 40 | /// 41 | /// ウィンドウを最小化します。 42 | /// 43 | Minimize, 44 | 45 | /// 46 | /// ウィンドウのシステム メニューを開きます。 47 | /// 48 | OpenSystemMenu, 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Interactivity/DirectWindowAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Interactivity; 7 | using MetroRadiance.UI.Controls; 8 | using MetroRadiance.Utilities; 9 | 10 | namespace MetroRadiance.UI.Interactivity 11 | { 12 | internal class DirectWindowAction : TriggerAction 13 | { 14 | #region WindowAction 依存関係プロパティ 15 | 16 | public WindowAction WindowAction 17 | { 18 | get { return (WindowAction)this.GetValue(WindowActionProperty); } 19 | set { this.SetValue(WindowActionProperty, value); } 20 | } 21 | 22 | public static readonly DependencyProperty WindowActionProperty = 23 | DependencyProperty.Register("WindowAction", typeof (WindowAction), typeof (DirectWindowAction), new UIPropertyMetadata(WindowAction.Active)); 24 | 25 | #endregion 26 | 27 | protected override void Invoke(object parameter) 28 | { 29 | this.WindowAction.Invoke(this.AssociatedObject); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/IWindowSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Configuration; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using MetroRadiance.Core.Win32; 10 | 11 | namespace MetroRadiance.Controls 12 | { 13 | [Obsolete] 14 | [EditorBrowsable(EditorBrowsableState.Never)] 15 | public interface IWindowSettings 16 | { 17 | WINDOWPLACEMENT? Placement { get; set; } 18 | void Reload(); 19 | void Save(); 20 | } 21 | 22 | [Obsolete] 23 | [EditorBrowsable(EditorBrowsableState.Never)] 24 | public class WindowSettings : ApplicationSettingsBase, IWindowSettings 25 | { 26 | public WindowSettings(Window window) : base(window.GetType().FullName) { } 27 | 28 | [UserScopedSetting] 29 | public WINDOWPLACEMENT? Placement 30 | { 31 | get { return this["Placement"] != null ? (WINDOWPLACEMENT?)(WINDOWPLACEMENT)this["Placement"] : null; } 32 | set { this["Placement"] = value; } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/MonitorDpiType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace MetroRadiance.Interop 7 | { 8 | /// 9 | /// Identifies dots per inch (dpi) type. 10 | /// 11 | public enum MonitorDpiType 12 | { 13 | /// 14 | /// MDT_Effective_DPI 15 | /// Effective DPI that incorporates accessibility overrides and matches what Desktop Window Manage (DWM) uses to scale desktop applications. 16 | /// 17 | EffectiveDpi = 0, 18 | 19 | /// 20 | /// MDT_Angular_DPI 21 | /// DPI that ensures rendering at a compliant angular resolution on the screen, without incorporating accessibility overrides. 22 | /// 23 | AngularDpi = 1, 24 | 25 | /// 26 | /// MDT_Raw_DPI 27 | /// Linear DPI of the screen as measures on the screen itself. 28 | /// 29 | RawDpi = 2, 30 | 31 | /// 32 | /// MDT_Default 33 | /// 34 | Default = EffectiveDpi, 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/MetroRadiance/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | using System.Windows.Markup; 5 | 6 | [assembly: AssemblyTitle("MetroRadiance")] 7 | [assembly: AssemblyCompany("grabacr.net")] 8 | [assembly: AssemblyProduct("MetroRadiance")] 9 | [assembly: AssemblyDescription("Modern WPF Themes")] 10 | [assembly: AssemblyCopyright("Copyright © 2014 Manato KAMEYA")] 11 | 12 | [assembly: ComVisible(false)] 13 | [assembly: Guid("9A055744-2C4E-465D-A8F2-AD26B43C5F50")] 14 | 15 | [assembly: ThemeInfo( 16 | ResourceDictionaryLocation.None, 17 | ResourceDictionaryLocation.SourceAssembly)] 18 | 19 | [assembly: XmlnsDefinition("http://schemes.grabacr.net/winfx/2014/controls", "MetroRadiance.UI.Controls")] 20 | [assembly: XmlnsDefinition("http://schemes.grabacr.net/winfx/2014/converters", "MetroRadiance.UI.Converters")] 21 | [assembly: XmlnsDefinition("http://schemes.grabacr.net/winfx/2014/interactivity", "MetroRadiance.UI.Interactivity")] 22 | 23 | [assembly: AssemblyVersion("2.4.0")] 24 | [assembly: AssemblyInformationalVersion("2.4.0")] 25 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Media; 9 | using MetroRadiance.Core.Win32; 10 | 11 | namespace MetroRadiance.Core 12 | { 13 | [Obsolete] 14 | [EditorBrowsable(EditorBrowsableState.Never)] 15 | public static class Extensions 16 | { 17 | /// 18 | /// 現在の から、WPF が認識しているシステム DPI を取得します。 19 | /// 20 | /// 21 | /// X 軸 および Y 軸それぞれの DPI 設定値を表す 構造体。 22 | /// 23 | public static Dpi? GetSystemDpi(this Visual visual) 24 | { 25 | var source = PresentationSource.FromVisual(visual); 26 | if (source?.CompositionTarget != null) 27 | { 28 | return new Dpi( 29 | (uint)(Dpi.Default.X * source.CompositionTarget.TransformToDevice.M11), 30 | (uint)(Dpi.Default.Y * source.CompositionTarget.TransformToDevice.M22)); 31 | } 32 | 33 | return null; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/MetroRadiance/Utilities/TypeForwardedTo.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="false" hostspecific="false" language="C#" #> 2 | <#@ assembly name="System.Core" #> 3 | <#@ assembly name="$(SolutionDir)\RetroRadiance\bin\Debug\RetroRadiance.dll" #> 4 | <#@ import namespace="System.Linq" #> 5 | <#@ import namespace="System.Text" #> 6 | <#@ import namespace="System.Collections.Generic" #> 7 | <#@ output extension=".g.cs" #> 8 | // ------------------------------- 9 | // Generated by TypeForwardedTo.tt 10 | // ------------------------------- 11 | using System.Runtime.CompilerServices; 12 | #pragma warning disable 612 13 | 14 | #if RETRO 15 | <# 16 | #pragma warning disable 612 17 | var type = typeof(MetroRadiance.ThemeService); 18 | #pragma warning restore 612 19 | 20 | var attributes = type.Assembly.GetTypes() 21 | .Where(x => x.IsPublic) 22 | .Where(x => x.Namespace.StartsWith("MetroRadiance")) 23 | .Select(x => string.Format("[assembly: TypeForwardedTo(typeof({0}.{1}))]", x.Namespace, x.Name)) 24 | .ToArray(); 25 | 26 | foreach (var attr in attributes) 27 | { 28 | #> 29 | <#= attr #> 30 | <# 31 | } 32 | #> 33 | #endif 34 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Manato KAMEYA 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Behaviors/DirectWindowAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Windows; 6 | using System.Windows.Interactivity; 7 | using MetroRadiance.Controls; 8 | using MetroRadiance.Internal; 9 | 10 | namespace MetroRadiance.Behaviors 11 | { 12 | [Obsolete] 13 | [EditorBrowsable(EditorBrowsableState.Never)] 14 | internal class DirectWindowAction : TriggerAction 15 | { 16 | #region WindowAction 依存関係プロパティ 17 | 18 | public WindowAction WindowAction 19 | { 20 | get { return (WindowAction)this.GetValue(WindowActionProperty); } 21 | set { this.SetValue(WindowActionProperty, value); } 22 | } 23 | 24 | public static readonly DependencyProperty WindowActionProperty = 25 | DependencyProperty.Register("WindowAction", typeof (WindowAction), typeof (DirectWindowAction), new UIPropertyMetadata(WindowAction.Active)); 26 | 27 | #endregion 28 | 29 | protected override void Invoke(object parameter) 30 | { 31 | this.WindowAction.Invoke(this.AssociatedObject); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/RetroRadiance/Themes/Generic.Badge.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 30 | 31 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Chrome/InternalExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using MetroRadiance.Interop; 6 | 7 | namespace MetroRadiance.Chrome 8 | { 9 | internal static class InternalExtensions 10 | { 11 | public static int DpiRoundX(this double value, Dpi dpi) 12 | { 13 | return (int)Math.Round(value * dpi.ScaleX, MidpointRounding.AwayFromZero); 14 | } 15 | 16 | public static int DpiRoundY(this double value, Dpi dpi) 17 | { 18 | return (int)Math.Round(value * dpi.ScaleY, MidpointRounding.AwayFromZero); 19 | } 20 | 21 | public static bool IsAuto(this double value) 22 | { 23 | return double.IsNaN(value); 24 | } 25 | 26 | /// 27 | /// 現在の値が Auto の場合は を、それ以外の場合は現在の値を返します。 28 | /// 29 | public static double SpecifiedOrDefault(this double value, double @default) 30 | { 31 | return double.IsNaN(value) ? @default : value; 32 | } 33 | 34 | public static void Dump(this object obj) 35 | { 36 | System.Diagnostics.Debug.WriteLine(obj); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/MetroRadiance/Themes/Generic.Badge.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /source/MetroRadiance/MetroRadiance.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $id$ 5 | $title$ 6 | $version$ 7 | $author$ 8 | $author$ 9 | https://github.com/Grabacr07/MetroRadiance/blob/master/LICENSE.txt 10 | https://github.com/Grabacr07/MetroRadiance 11 | false 12 | $description$ 13 | ja-JP 14 | WPF 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /samples/ZuneLikeWindow/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18010 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ZuneLikeWindow.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/UI/HsvSamples.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Media; 6 | using MetroRadiance.Media; 7 | 8 | namespace MetroRadiance.Showcase.UI 9 | { 10 | partial class HsvSamples 11 | { 12 | public HsvSamples() 13 | { 14 | this.InitializeComponent(); 15 | 16 | this.hSlider.ValueChanged += (sender, e) => this.Update(); 17 | this.sSlider.ValueChanged += (sender, e) => this.Update(); 18 | this.vSlider.ValueChanged += (sender, e) => this.Update(); 19 | 20 | this.Update(); 21 | } 22 | 23 | 24 | private void Update() 25 | { 26 | var h = this.hSlider.Value; 27 | var s = this.sSlider.Value / 100.0; 28 | var v = this.vSlider.Value / 100.0; 29 | 30 | var hsv = HsvColor.FromHsv(h, s, v); 31 | var c = hsv.ToRgb(); 32 | 33 | var l = Luminosity.FromRgb(c); 34 | var w = l <= 128; 35 | 36 | this.colorbox.Background = new SolidColorBrush(c); 37 | this.colorbox.Foreground = w ? Brushes.White : Brushes.Black; 38 | this.colorbox.Text = $"Color: {c}, Luminosity: {l}"; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Platform/RawWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Interop; 6 | using MetroRadiance.Interop.Win32; 7 | 8 | namespace MetroRadiance.Platform 9 | { 10 | public abstract class RawWindow 11 | { 12 | public string Name { get; set; } 13 | 14 | public HwndSource Source { get; private set; } 15 | 16 | public IntPtr Handle => this.Source?.Handle ?? IntPtr.Zero; 17 | 18 | public virtual void Show() 19 | { 20 | this.Show(new HwndSourceParameters(this.Name)); 21 | } 22 | 23 | protected void Show(HwndSourceParameters parameters) 24 | { 25 | this.Source = new HwndSource(parameters); 26 | this.Source.AddHook(this.WndProc); 27 | } 28 | 29 | public virtual void Close() 30 | { 31 | this.Source?.RemoveHook(this.WndProc); 32 | this.Source?.Dispose(); 33 | this.Source = null; 34 | 35 | User32.CloseWindow(this.Handle); 36 | } 37 | 38 | protected virtual IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) 39 | { 40 | return IntPtr.Zero; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MetroRadiance.Showcase.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/Win32/HitTestValues.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace MetroRadiance.Core.Win32 9 | { 10 | [Obsolete] 11 | [EditorBrowsable(EditorBrowsableState.Never)] 12 | public enum HitTestValues 13 | { 14 | // ReSharper disable InconsistentNaming 15 | HTERROR = -2, 16 | HTTRANSPARENT = -1, 17 | HTNOWHERE = 0, 18 | HTCLIENT = 1, 19 | HTCAPTION = 2, 20 | HTSYSMENU = 3, 21 | HTGROWBOX = 4, 22 | HTSIZE = HTGROWBOX, 23 | HTMENU = 5, 24 | HTHSCROLL = 6, 25 | HTVSCROLL = 7, 26 | HTMINBUTTON = 8, 27 | HTMAXBUTTON = 9, 28 | HTLEFT = 10, 29 | HTRIGHT = 11, 30 | HTTOP = 12, 31 | HTTOPLEFT = 13, 32 | HTTOPRIGHT = 14, 33 | HTBOTTOM = 15, 34 | HTBOTTOMLEFT = 16, 35 | HTBOTTOMRIGHT = 17, 36 | HTBORDER = 18, 37 | HTREDUCE = HTMINBUTTON, 38 | HTZOOM = HTMAXBUTTON, 39 | HTSIZEFIRST = HTLEFT, 40 | HTSIZELAST = HTBOTTOMRIGHT, 41 | HTOBJECT = 19, 42 | HTCLOSE = 20, 43 | HTHELP = 21, 44 | // ReSharper restore InconsistentNaming 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Platform/IWindowsThemeValue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using MetroRadiance.Utilities; 4 | 5 | namespace MetroRadiance.Platform 6 | { 7 | public interface IWindowsThemeValue 8 | { 9 | /// 10 | /// 設定値が動的に変更されるかを取得します。 11 | /// 12 | bool IsDynamic { get; } 13 | 14 | /// 15 | /// 現在の設定値を取得します。 16 | /// 17 | T Current { get; } 18 | 19 | /// 20 | /// テーマ設定が変更されると発生します。 21 | /// 22 | event EventHandler Changed; 23 | } 24 | 25 | public static class IWindowsThemeValueExtensions 26 | { 27 | /// 28 | /// テーマ設定が変更されたときに通知を受け取るメソッドを登録します。 29 | /// 30 | /// テーマ設定が変更されたときに通知を受け取るメソッド。 31 | /// 通知の購読を解除するときに使用する オブジェクト。 32 | [EditorBrowsable(EditorBrowsableState.Never)] 33 | public static IDisposable RegisterListener(this IWindowsThemeValue that, Action callback) 34 | { 35 | EventHandler handler = (sender, e) => callback?.Invoke(e); 36 | that.Changed += handler; 37 | 38 | return Disposable.Create(() => that.Changed -= handler); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Platform/AppMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using MetroRadiance.Interop.Win32; 4 | 5 | namespace MetroRadiance.Platform 6 | { 7 | public static class AppMode 8 | { 9 | public static bool SetAppMode(PreferredAppMode appMode) 10 | { 11 | var build = Environment.OSVersion.Version.Build; 12 | if (build >= 18362) 13 | { 14 | // memo: Workaround for the problem of not switching from dark theme to light theme. 15 | if (appMode == PreferredAppMode.APPMODE_DEFAULT || appMode == PreferredAppMode.APPMODE_FORCELIGHT) 16 | { 17 | UxTheme.SetPreferredAppMode(PreferredAppMode.APPMODE_ALLOWDARK); 18 | UxTheme.RefreshImmersiveColorPolicyState(); 19 | } 20 | 21 | var ret = UxTheme.SetPreferredAppMode(appMode) == appMode; 22 | UxTheme.RefreshImmersiveColorPolicyState(); 23 | return ret; 24 | } 25 | else if (build >= 17763) 26 | { 27 | if (appMode == PreferredAppMode.APPMODE_DEFAULT || appMode == PreferredAppMode.APPMODE_FORCELIGHT) 28 | { 29 | return UxTheme.AllowDarkModeForApp(false); 30 | } 31 | else 32 | { 33 | return UxTheme.AllowDarkModeForApp(true); 34 | } 35 | } 36 | return false; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/MetroRadiance/Styles/Controls.Tooltip.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /source/MetroRadiance/Styles/Controls.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /source/RetroRadiance/Styles/Controls.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/MonitorDpiType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace MetroRadiance.Core 8 | { 9 | /// 10 | /// Identifies dots per inch (dpi) type. 11 | /// 12 | [Obsolete] 13 | [EditorBrowsable(EditorBrowsableState.Never)] 14 | public enum MonitorDpiType 15 | { 16 | /// 17 | /// MDT_Effective_DPI 18 | /// Effective DPI that incorporates accessibility overrides and matches what Desktop Window Manage (DWM) uses to scale desktop applications. 19 | /// 20 | EffectiveDpi = 0, 21 | 22 | /// 23 | /// MDT_Angular_DPI 24 | /// DPI that ensures rendering at a compliant angular resolution on the screen, without incorporating accessibility overrides. 25 | /// 26 | AngularDpi = 1, 27 | 28 | /// 29 | /// MDT_Raw_DPI 30 | /// Linear DPI of the screen as measures on the screen itself. 31 | /// 32 | RawDpi = 2, 33 | 34 | /// 35 | /// MDT_Default 36 | /// 37 | Default = EffectiveDpi, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/ExpanderButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Controls.Primitives; 8 | 9 | namespace MetroRadiance.UI.Controls 10 | { 11 | public class ExpanderButton : ToggleButton 12 | { 13 | static ExpanderButton() 14 | { 15 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ExpanderButton), new FrameworkPropertyMetadata(typeof(ExpanderButton))); 16 | } 17 | 18 | 19 | #region Direction 依存関係プロパティ 20 | 21 | public ExpandDirection Direction 22 | { 23 | get { return (ExpandDirection)this.GetValue(DirectionProperty); } 24 | set { this.SetValue(DirectionProperty, value); } 25 | } 26 | 27 | public static readonly DependencyProperty DirectionProperty = 28 | DependencyProperty.Register("Direction", typeof(ExpandDirection), typeof(ExpanderButton), new UIPropertyMetadata(ExpandDirection.Left, DirectionChangedCallback)); 29 | 30 | private static void DirectionChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) 31 | { 32 | //var instance = (ExpanderButton)d; 33 | } 34 | 35 | #endregion 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Chrome/Primitives/ChromeWindow.Right.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Windows; 4 | using MetroRadiance.Interop.Win32; 5 | 6 | namespace MetroRadiance.Chrome.Primitives 7 | { 8 | internal class RightChromeWindow : ChromeWindow 9 | { 10 | static RightChromeWindow() 11 | { 12 | DefaultStyleKeyProperty.OverrideMetadata( 13 | typeof(RightChromeWindow), 14 | new FrameworkPropertyMetadata(typeof(RightChromeWindow))); 15 | TitleProperty.OverrideMetadata( 16 | typeof(RightChromeWindow), 17 | new FrameworkPropertyMetadata(nameof(RightChromeWindow))); 18 | } 19 | 20 | public RightChromeWindow() 21 | { 22 | this.SizeToContent = SizeToContent.Width; 23 | } 24 | 25 | protected override void UpdateDpiResources() { } 26 | 27 | protected override int GetLeft(RECT owner) 28 | { 29 | return owner.Right; 30 | } 31 | 32 | protected override int GetTop(RECT owner) 33 | { 34 | return owner.Top; 35 | } 36 | 37 | protected override int GetWidth(RECT owner) 38 | { 39 | return this.ActualWidth.DpiRoundX(this.SystemDpi); 40 | } 41 | 42 | protected override int GetHeight(RECT owner) 43 | { 44 | return owner.Height; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/RetroRadiance/readme.md: -------------------------------------------------------------------------------- 1 | ## 概要 2 | 3 | MetroRadiance version 2.0 で名前空間等の整理やリネームを行ったため、version 1.x との互換性がなくなった。 4 | このため、1.x を参照して作られたアセンブリは、2.0 環境で動作させるためには修正および再ビルドをしなければならなくなった。 5 | 6 | 通常の MetroRadiance 依存アプリでは、MetroRadiance 本体をアップデートし、適宜修正することで対応可能。 7 | 一方で、MetroRadiance 2.0 依存となったアプリケーション上で、MetroRadiance 1.x 依存のアセンブリを動作させることができなくなった。 8 | 9 | (プラグイン システムでこの状況が発生しうる。プラグイン システムを搭載した本体が MetroRadiance 2.0、プラグイン側が 1.x、という状況。 10 | この場合、プラグイン側も MetroRadiance 2.0 にアップデートして再ビルドしなければならない) 11 | 12 | そこで、1.x 依存のアセンブリを 2.0 環境で動作させるため、RetroRadiance を用意した。 13 | 14 | 15 | ## 実装 16 | 17 | [MetroRadiance version 1.2](https://github.com/Grabacr07/MetroRadiance/tree/8aebe400e7e3c29df66ed4b5339dd74fd74515dd) 時点での MetroRadiance、MetroRadiance.Chrome、MetroRadiance.Core の内容がこのアセンブリに含まれる。 18 | Style および Themes 以下のリソースもすべて含まれれている。 19 | 20 | ただし、すべての型に対し、以下の属性を付与している。 21 | 22 | ```csharp 23 | [Obsolete] 24 | [EditorBrowsable(EditorBrowsableState.Never)] 25 | ``` 26 | 27 | 28 | ## ビルド 29 | 30 | ソリューション構成「Release RETRO」を選択すると、MetroRadiance プロジェクトはビルド構成「Release RETRO」となり、RetroRadiance への参照と TypeForwardedTo 属性が有効になる。 31 | この場合のみ、MetroRadiance 1.x 依存プロジェクトは、2.0 を参照したとき、1.x 準拠の型を持つ RetroRadiance に型フォワーディングされ、正常動作できる。 32 | 33 | それ以外のソリューション構成、ビルド構成では RetroRadiance への参照と TypeForwardedTo 属性が無効化され、1.x 依存プロジェクトは動作しない。 34 | 35 | -------------------------------------------------------------------------------- /source/RetroRadiance/Themes/Generic.CaptionIcon.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 35 | 36 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/AcrylicBlurWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Media; 4 | using MetroRadiance.Platform; 5 | 6 | namespace MetroRadiance.UI.Controls 7 | { 8 | public class AcrylicBlurWindow : BlurWindow 9 | { 10 | private static bool IsAcrylicBlurEnabled { get; } 11 | 12 | static AcrylicBlurWindow() 13 | { 14 | IsAcrylicBlurEnabled = Environment.OSVersion.Version.Build >= 17004; 15 | } 16 | 17 | internal protected override void HandleThemeChanged() 18 | { 19 | if (WindowsTheme.HighContrast.Current) 20 | { 21 | this.ToHighContrast(); 22 | } 23 | else if (!IsWindows10) 24 | { 25 | this.ToCompatibility(); 26 | } 27 | else if (!WindowsTheme.Transparency.Current) 28 | { 29 | this.ToDefault(); 30 | } 31 | else if (IsAcrylicBlurEnabled) 32 | { 33 | this.ToAcrylicBlur(); 34 | } 35 | else 36 | { 37 | this.ToBlur(); 38 | } 39 | } 40 | 41 | private void ToAcrylicBlur() 42 | { 43 | Color background, foreground; 44 | this.GetColors(out background, out foreground); 45 | 46 | background.A = (byte)(background.A * this.BlurOpacity); 47 | WindowComposition.EnableAcrylicBlur(this, background, this.BordersFlag); 48 | this.ChangeProperties(Color.FromArgb(1, 0, 0, 0), foreground, Colors.Transparent, new Thickness()); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/ExpanderButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Controls.Primitives; 9 | 10 | namespace MetroRadiance.Controls 11 | { 12 | [Obsolete] 13 | [EditorBrowsable(EditorBrowsableState.Never)] 14 | public class ExpanderButton : ToggleButton 15 | { 16 | static ExpanderButton() 17 | { 18 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ExpanderButton), new FrameworkPropertyMetadata(typeof(ExpanderButton))); 19 | } 20 | 21 | 22 | #region Direction 依存関係プロパティ 23 | 24 | public ExpandDirection Direction 25 | { 26 | get { return (ExpandDirection)this.GetValue(DirectionProperty); } 27 | set { this.SetValue(DirectionProperty, value); } 28 | } 29 | 30 | public static readonly DependencyProperty DirectionProperty = 31 | DependencyProperty.Register("Direction", typeof(ExpandDirection), typeof(ExpanderButton), new UIPropertyMetadata(ExpandDirection.Left, DirectionChangedCallback)); 32 | 33 | private static void DirectionChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) 34 | { 35 | //var instance = (ExpanderButton)d; 36 | } 37 | 38 | #endregion 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/MetroRadiance/Themes/Generic.CaptionIcon.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Chrome/Primitives/ChromeWindow.Left.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Windows; 4 | using MetroRadiance.Interop.Win32; 5 | 6 | namespace MetroRadiance.Chrome.Primitives 7 | { 8 | internal class LeftChromeWindow : ChromeWindow 9 | { 10 | static LeftChromeWindow() 11 | { 12 | DefaultStyleKeyProperty.OverrideMetadata( 13 | typeof(LeftChromeWindow), 14 | new FrameworkPropertyMetadata(typeof(LeftChromeWindow))); 15 | TitleProperty.OverrideMetadata( 16 | typeof(LeftChromeWindow), 17 | new FrameworkPropertyMetadata(nameof(LeftChromeWindow))); 18 | } 19 | 20 | public LeftChromeWindow() 21 | { 22 | this.SizeToContent = SizeToContent.Width; 23 | } 24 | 25 | protected override void UpdateDpiResources() { } 26 | 27 | protected override int GetLeft(RECT owner) 28 | { 29 | return owner.Left - this.GetWidth(owner); 30 | } 31 | 32 | protected override int GetTop(RECT owner) 33 | { 34 | return owner.Top; 35 | } 36 | 37 | protected override int GetWidth(RECT owner) 38 | { 39 | return this.ActualWidth.DpiRoundX(this.SystemDpi); 40 | } 41 | 42 | protected override int GetHeight(RECT owner) 43 | { 44 | return owner.Height; 45 | } 46 | 47 | protected override void OwnerSizeChangedCallback(object sender, EventArgs eventArgs) 48 | { 49 | this.UpdateSize(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/UI/AcrylicBlurWindowSample.xaml.cs: -------------------------------------------------------------------------------- 1 | using MetroRadiance.Interop.Win32; 2 | using System; 3 | using System.Linq; 4 | using System.Windows.Input; 5 | 6 | namespace MetroRadiance.Showcase.UI 7 | { 8 | public partial class AcrylicBlurWindowSample 9 | { 10 | public AcrylicBlurWindowSample() 11 | { 12 | this.InitializeComponent(); 13 | 14 | this.blurOpacitySlider.ValueChanged += (sender, e) => this.BlurOpacity = e.NewValue; 15 | this.leftBorderCheckBox.Checked += (sender, e) => this.BordersFlag |= AccentFlags.DrawLeftBorder; 16 | this.leftBorderCheckBox.Unchecked += (sender, e) => this.BordersFlag ^= AccentFlags.DrawLeftBorder; 17 | this.topBorderCheckBox.Checked += (sender, e) => this.BordersFlag |= AccentFlags.DrawTopBorder; 18 | this.topBorderCheckBox.Unchecked += (sender, e) => this.BordersFlag ^= AccentFlags.DrawTopBorder; 19 | this.rightBorderCheckBox.Checked += (sender, e) => this.BordersFlag |= AccentFlags.DrawRightBorder; 20 | this.rightBorderCheckBox.Unchecked += (sender, e) => this.BordersFlag ^= AccentFlags.DrawRightBorder; 21 | this.bottomBorderCheckBox.Checked += (sender, e) => this.BordersFlag |= AccentFlags.DrawBottomBorder; 22 | this.bottomBorderCheckBox.Unchecked += (sender, e) => this.BordersFlag ^= AccentFlags.DrawBottomBorder; 23 | } 24 | 25 | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) 26 | { 27 | base.OnMouseLeftButtonDown(e); 28 | this.DragMove(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/UI/BlurWindowSample.xaml.cs: -------------------------------------------------------------------------------- 1 | using MetroRadiance.Interop.Win32; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Windows.Input; 6 | 7 | namespace MetroRadiance.Showcase.UI 8 | { 9 | public partial class BlurWindowSample 10 | { 11 | public BlurWindowSample() 12 | { 13 | this.InitializeComponent(); 14 | 15 | this.blurOpacitySlider.ValueChanged += (sender, e) => this.BlurOpacity = e.NewValue; 16 | this.leftBorderCheckBox.Checked += (sender, e) => this.BordersFlag |= AccentFlags.DrawLeftBorder; 17 | this.leftBorderCheckBox.Unchecked += (sender, e) => this.BordersFlag ^= AccentFlags.DrawLeftBorder; 18 | this.topBorderCheckBox.Checked += (sender, e) => this.BordersFlag |= AccentFlags.DrawTopBorder; 19 | this.topBorderCheckBox.Unchecked += (sender, e) => this.BordersFlag ^= AccentFlags.DrawTopBorder; 20 | this.rightBorderCheckBox.Checked += (sender, e) => this.BordersFlag |= AccentFlags.DrawRightBorder; 21 | this.rightBorderCheckBox.Unchecked += (sender, e) => this.BordersFlag ^= AccentFlags.DrawRightBorder; 22 | this.bottomBorderCheckBox.Checked += (sender, e) => this.BordersFlag |= AccentFlags.DrawBottomBorder; 23 | this.bottomBorderCheckBox.Unchecked += (sender, e) => this.BordersFlag ^= AccentFlags.DrawBottomBorder; 24 | } 25 | 26 | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) 27 | { 28 | base.OnMouseLeftButtonDown(e); 29 | this.DragMove(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /source/RetroRadiance/Styles/Controls.Expander.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 40 | 41 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/Shell32.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace MetroRadiance.Interop.Win32 6 | { 7 | public static class Shell32 8 | { 9 | [DllImport("shell32")] 10 | internal static extern IntPtr SHAppBarMessage(AppBarMessages dwMessage, ref APPBARDATA pData); 11 | 12 | public static AppBarState SHAppBarGetState(ref APPBARDATA pData) 13 | { 14 | return (AppBarState)SHAppBarMessage(AppBarMessages.ABM_GETSTATE, ref pData); 15 | } 16 | 17 | public static AppBarEdges SHAppBarGetTaskbarPos(RECT rc) 18 | { 19 | var data = new APPBARDATA() 20 | { 21 | cbSize = Marshal.SizeOf(typeof(APPBARDATA)), 22 | rc = rc, 23 | }; 24 | if (SHAppBarMessage(AppBarMessages.ABM_GETTASKBARPOS, ref data) == IntPtr.Zero) 25 | { 26 | throw new Win32Exception(); 27 | } 28 | return data.uEdge; 29 | } 30 | 31 | public static IntPtr SHAppBarGetAutoHideBar(AppBarEdges uEdge) 32 | { 33 | var data = new APPBARDATA() 34 | { 35 | cbSize = Marshal.SizeOf(typeof(APPBARDATA)), 36 | uEdge = uEdge, 37 | }; 38 | return SHAppBarMessage(AppBarMessages.ABM_GETAUTOHIDEBAR, ref data); 39 | } 40 | 41 | public static IntPtr SHAppBarGetAutoHideBarEx(AppBarEdges uEdge, RECT rc) 42 | { 43 | var data = new APPBARDATA() 44 | { 45 | cbSize = Marshal.SizeOf(typeof(APPBARDATA)), 46 | uEdge = uEdge, 47 | rc = rc, 48 | }; 49 | return SHAppBarMessage(AppBarMessages.ABM_GETAUTOHIDEBAREX, ref data); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /source/MetroRadiance/Styles/Controls.Expander.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/WINDOWPLACEMENT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | // ReSharper disable InconsistentNaming 9 | 10 | namespace MetroRadiance.Interop.Win32 11 | { 12 | [Serializable] 13 | [StructLayout(LayoutKind.Sequential)] 14 | public struct WINDOWPLACEMENT 15 | { 16 | public int length; 17 | public int flags; 18 | public ShowWindowFlags showCmd; 19 | public POINT minPosition; 20 | public POINT maxPosition; 21 | public RECT normalPosition; 22 | } 23 | 24 | [Serializable] 25 | [StructLayout(LayoutKind.Sequential)] 26 | public struct POINT 27 | { 28 | public int X; 29 | public int Y; 30 | 31 | public POINT(int x, int y) 32 | { 33 | this.X = x; 34 | this.Y = y; 35 | } 36 | } 37 | 38 | [Serializable] 39 | [StructLayout(LayoutKind.Sequential)] 40 | public struct RECT 41 | { 42 | public int Left; 43 | public int Top; 44 | public int Right; 45 | public int Bottom; 46 | 47 | public int Width => this.Right - this.Left; 48 | public int Height => this.Bottom - this.Top; 49 | 50 | public RECT(int left, int top, int right, int bottom) 51 | { 52 | this.Left = left; 53 | this.Top = top; 54 | this.Right = right; 55 | this.Bottom = bottom; 56 | } 57 | 58 | public static implicit operator Rect(RECT rect) 59 | { 60 | return new Rect(rect.Left, rect.Top, rect.Width, rect.Height); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/UI/ImmersiveColorSamples.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 17 | 18 | 19 | 20 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MetroRadiance.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.ApplicationScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("250")] 29 | public int DelayForMinimizeToNormal { 30 | get { 31 | return ((int)(this["DelayForMinimizeToNormal"])); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/Win32/WINDOWPLACEMENT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace MetroRadiance.Core.Win32 10 | { 11 | // ReSharper disable InconsistentNaming 12 | 13 | [Obsolete] 14 | [EditorBrowsable(EditorBrowsableState.Never)] 15 | [Serializable] 16 | [StructLayout(LayoutKind.Sequential)] 17 | public struct WINDOWPLACEMENT 18 | { 19 | public int length; 20 | public int flags; 21 | public SW showCmd; 22 | public POINT minPosition; 23 | public POINT maxPosition; 24 | public RECT normalPosition; 25 | } 26 | 27 | [Obsolete] 28 | [EditorBrowsable(EditorBrowsableState.Never)] 29 | [Serializable] 30 | [StructLayout(LayoutKind.Sequential)] 31 | public struct POINT 32 | { 33 | public int X; 34 | public int Y; 35 | 36 | public POINT(int x, int y) 37 | { 38 | this.X = x; 39 | this.Y = y; 40 | } 41 | } 42 | 43 | [Obsolete] 44 | [EditorBrowsable(EditorBrowsableState.Never)] 45 | [Serializable] 46 | [StructLayout(LayoutKind.Sequential)] 47 | public struct RECT 48 | { 49 | public int Left; 50 | public int Top; 51 | public int Right; 52 | public int Bottom; 53 | 54 | public RECT(int left, int top, int right, int bottom) 55 | { 56 | this.Left = left; 57 | this.Top = top; 58 | this.Right = right; 59 | this.Bottom = bottom; 60 | } 61 | } 62 | 63 | // ReSharper restore InconsistentNaming 64 | } 65 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Chrome/Primitives/ChromeWindow.Bottom.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Windows; 4 | using MetroRadiance.Interop.Win32; 5 | 6 | namespace MetroRadiance.Chrome.Primitives 7 | { 8 | internal class BottomChromeWindow : ChromeWindow 9 | { 10 | static BottomChromeWindow() 11 | { 12 | DefaultStyleKeyProperty.OverrideMetadata( 13 | typeof(BottomChromeWindow), 14 | new FrameworkPropertyMetadata(typeof(BottomChromeWindow))); 15 | TitleProperty.OverrideMetadata( 16 | typeof(BottomChromeWindow), 17 | new FrameworkPropertyMetadata(nameof(BottomChromeWindow))); 18 | } 19 | 20 | private int _leftScaledOffset = 0; 21 | private int _rightScaledOffset = 0; 22 | 23 | public BottomChromeWindow() 24 | { 25 | this.SizeToContent = SizeToContent.Height; 26 | } 27 | 28 | protected override void UpdateDpiResources() 29 | { 30 | this._leftScaledOffset = this.Offset.Left.DpiRoundX(this.CurrentDpi); 31 | this._rightScaledOffset = this.Offset.Right.DpiRoundX(this.CurrentDpi); 32 | } 33 | 34 | protected override int GetLeft(RECT owner) 35 | { 36 | return owner.Left - this._leftScaledOffset; 37 | } 38 | 39 | protected override int GetTop(RECT owner) 40 | { 41 | return owner.Bottom; 42 | } 43 | 44 | protected override int GetWidth(RECT owner) 45 | { 46 | return owner.Width + this._leftScaledOffset + this._rightScaledOffset; 47 | } 48 | 49 | protected override int GetHeight(RECT owner) 50 | { 51 | return this.ActualHeight.DpiRoundY(this.SystemDpi); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/ClassLongPtrIndex.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable InconsistentNaming 2 | 3 | namespace MetroRadiance.Interop.Win32 4 | { 5 | public enum ClassLongPtrIndex 6 | { 7 | /// 8 | /// ウィンドウクラスを一意的に識別するアトム値を取得します。これは、RegisterClassEx 関数が返すアトムと同じです。 9 | /// 10 | GCW_ATOM = -32, 11 | 12 | /// 13 | /// クラスに関連付けられた拡張クラスメモリのサイズをバイト単位で取得します。 14 | /// 15 | GCL_CBCLSEXTRA = -20, 16 | 17 | /// 18 | /// ウィンドウに関連付けられた拡張ウィンドウメモリのサイズをバイト単位で取得します。 19 | /// 20 | GCL_CBWNDEXTRA = -18, 21 | 22 | /// 23 | /// クラスに関連付けられた背景ブラシのハンドルを取得します。 24 | /// 25 | GCLP_HBRBACKGROUND = -10, 26 | 27 | /// 28 | /// クラスに関連付けられたカーソルのハンドルを取得します。 29 | /// 30 | GCLP_HCURSOR = -12, 31 | 32 | /// 33 | /// クラスに関連付けられたアイコンのハンドルを取得します。 34 | /// 35 | GCLP_HICON = -14, 36 | 37 | /// 38 | /// クラスに関連付けられた小さいアイコンのハンドルを取得します。 39 | /// 40 | GCLP_HICONSM = -34, 41 | 42 | /// 43 | /// クラスを登録したモジュールのハンドルを取得します。 44 | /// 45 | GCLP_HMODULE = -16, 46 | 47 | /// 48 | /// クラスに関連付けられたメニューリソースを識別するメニュー名文字列へのポインタを取得します。 49 | /// 50 | GCLP_MENUNAME = -8, 51 | 52 | /// 53 | /// ウィンドウクラスのスタイルビットを取得します。 54 | /// 55 | GCL_STYLE = -26, 56 | 57 | /// 58 | /// ウィンドウプロシージャのアドレス、またはウィンドウプロシージャのアドレスを表すハンドルを取得します。ウィンドウプロシージャを呼び出すには、CallWindowProc 関数を使わなければなりません。 59 | /// 60 | GCLP_WNDPROC = -24, 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/Dpi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | namespace MetroRadiance.Core 9 | { 10 | /// 11 | /// モニターの DPI (dots per inch) を表します。 12 | /// 13 | [DebuggerDisplay("X = {X} ({ScaleX}), Y = {Y} ({ScaleY})")] 14 | [Obsolete] 15 | [EditorBrowsable(EditorBrowsableState.Never)] 16 | public struct Dpi : IEquatable 17 | { 18 | public static readonly Dpi Default = new Dpi(96, 96); 19 | 20 | public uint X { get; } 21 | public uint Y { get; } 22 | 23 | public double ScaleX => this.X / (double)Default.X; 24 | 25 | public double ScaleY => this.Y / (double)Default.Y; 26 | 27 | public Dpi(uint x, uint y) 28 | : this() 29 | { 30 | this.X = x; 31 | this.Y = y; 32 | } 33 | 34 | public static bool operator ==(Dpi dpi1, Dpi dpi2) 35 | { 36 | return dpi1.X == dpi2.X && dpi1.Y == dpi2.Y; 37 | } 38 | 39 | public static bool operator !=(Dpi dpi1, Dpi dpi2) 40 | { 41 | return !(dpi1 == dpi2); 42 | } 43 | 44 | public bool Equals(Dpi other) 45 | { 46 | return this.X == other.X && this.Y == other.Y; 47 | } 48 | 49 | public override bool Equals(object obj) 50 | { 51 | if (ReferenceEquals(null, obj)) return false; 52 | return obj is Dpi && this.Equals((Dpi)obj); 53 | } 54 | 55 | public override int GetHashCode() 56 | { 57 | unchecked 58 | { 59 | return ((int)this.X * 397) ^ (int)this.Y; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/ShowWindowFlags.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable InconsistentNaming 2 | 3 | namespace MetroRadiance.Interop.Win32 4 | { 5 | public enum ShowWindowFlags 6 | { 7 | /// 8 | /// ウィンドウを非表示にして、ほかのウィンドウをアクティブにします。 9 | /// 10 | SW_HIDE = 0, 11 | 12 | /// 13 | /// ウィンドウをアクティブにし、表示します。ウィンドウが最小化、または最大化されていると、ウィンドウは元の位置とサイズで復元されます。 14 | /// 15 | SW_SHOWNORMAL = 1, 16 | 17 | /// 18 | /// ウィンドウをアクティブにし、アイコンとして表示します。 19 | /// 20 | SW_SHOWMINIMIZED = 2, 21 | 22 | /// 23 | /// ウィンドウをアクティブにし、最大化します。 24 | /// 25 | SW_SHOWMAXIMIZED = 3, 26 | 27 | /// 28 | /// ウィンドウをアイコンとして表示します。 現在アクティブなウィンドウはアクティブなまま表示します。 29 | /// 30 | SW_SHOWNOACTIVATE = 4, 31 | 32 | /// 33 | /// ウィンドウをアクティブにし、現在のサイズと位置で表示します。 34 | /// 35 | SW_SHOW = 5, 36 | 37 | /// 38 | /// 指定されたウィンドウを最小化して、システム リストにあるトップレベル ウィンドウをアクティブにします。 39 | /// 40 | SW_MINIMIZE = 6, 41 | 42 | /// 43 | /// ウィンドウを直前のサイズと位置で表示します。 現在アクティブなウィンドウはアクティブなまま表示します。 44 | /// 45 | SW_SHOWMINNOACTIVE = 7, 46 | 47 | /// 48 | /// ウィンドウを現在の状態で表示します。 現在アクティブなウィンドウはアクティブなまま表示します。 49 | /// 50 | SW_SHOWNA = 8, 51 | 52 | /// 53 | /// ウィンドウをアクティブにし、表示します。 ウィンドウが最小化、または最大化されていると、ウィンドウは元の位置とサイズに復元されます。 54 | /// 55 | SW_RESTORE = 9, 56 | 57 | /// 58 | /// アプリケーションを起動したプログラムが 関数に渡した 構造体で指定された SW_ フラグに従って表示状態を設定します。 59 | /// 60 | SW_SHOWDEFAULT = 10, 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome.Externals/MetroRadiance.Chrome.Externals.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $id$ 5 | $title$ 6 | $version$ 7 | $author$ 8 | $author$ 9 | https://github.com/Grabacr07/MetroRadiance/blob/master/LICENSE.txt 10 | https://github.com/Grabacr07/MetroRadiance 11 | false 12 | $description$ 13 | ja-JP 14 | WPF 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/DWMWINDOWATTRIBUTE.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable InconsistentNaming 2 | 3 | namespace MetroRadiance.Interop.Win32 4 | { 5 | public enum DWMWINDOWATTRIBUTE : uint 6 | { 7 | DWMWA_NCRENDERING_ENABLED = 1, // [get] Is non-client rendering enabled/disabled 8 | DWMWA_NCRENDERING_POLICY, // [set] Non-client rendering policy 9 | DWMWA_TRANSITIONS_FORCEDISABLED, // [set] Potentially enable/forcibly disable transitions 10 | DWMWA_ALLOW_NCPAINT, // [set] Allow contents rendered in the non-client area to be visible on the DWM-drawn frame. 11 | DWMWA_CAPTION_BUTTON_BOUNDS, // [get] Bounds of the caption button area in window-relative space. 12 | DWMWA_NONCLIENT_RTL_LAYOUT, // [set] Is non-client content RTL mirrored 13 | DWMWA_FORCE_ICONIC_REPRESENTATION, // [set] Force this window to display iconic thumbnails. 14 | DWMWA_FLIP3D_POLICY, // [set] Designates how Flip3D will treat the window. 15 | DWMWA_EXTENDED_FRAME_BOUNDS, // [get] Gets the extended frame bounds rectangle in screen space 16 | DWMWA_HAS_ICONIC_BITMAP, // [set] Indicates an available bitmap when there is no better thumbnail representation. 17 | DWMWA_DISALLOW_PEEK, // [set] Don't invoke Peek on the window. 18 | DWMWA_EXCLUDED_FROM_PEEK, // [set] LivePreview exclusion information 19 | DWMWA_CLOAK, // [set] Cloak or uncloak the window 20 | DWMWA_CLOAKED, // [get] Gets the cloaked state of the window 21 | DWMWA_FREEZE_REPRESENTATION, // [set] Force this window to freeze the thumbnail without live update 22 | DWMWA_LAST 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/SetWindowPosFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | // ReSharper disable InconsistentNaming 3 | 4 | namespace MetroRadiance.Interop.Win32 5 | { 6 | [Flags] 7 | public enum SetWindowPosFlags 8 | { 9 | /// 10 | /// Retains the current size (ignores the cx and cy parameters). 11 | /// 12 | SWP_NOSIZE = 0x0001, 13 | 14 | /// 15 | /// Retains the current position (ignores X and Y parameters). 16 | /// 17 | SWP_NOMOVE = 0x0002, 18 | 19 | /// 20 | /// Retains the current Z order (ignores the hWndInsertAfter parameter). 21 | /// 22 | SWP_NOZORDER = 0x0004, 23 | 24 | SWP_NOREDRAW = 0x0008, 25 | SWP_NOACTIVATE = 0x0010, 26 | SWP_FRAMECHANGED = 0x0020, 27 | SWP_SHOWWINDOW = 0x0040, 28 | SWP_HIDEWINDOW = 0x0080, 29 | SWP_NOCOPYBITS = 0x0100, 30 | 31 | /// 32 | /// Does not change the owner window's position in the Z order. 33 | /// 34 | SWP_NOOWNERZORDER = 0x0200, 35 | 36 | /// 37 | /// Prevents the window from receiving the WM_WINDOWPOSCHANGING message. 38 | /// 39 | SWP_NOSENDCHANGING = 0x0400, 40 | 41 | /// 42 | /// Prevents generation of the WM_SYNCPAINT message. 43 | /// 44 | SWP_DEFERERASE = 0x2000, 45 | 46 | /// 47 | /// If the calling thread and the thread that owns the window are attached to different input queues, 48 | /// the system posts the request to the thread that owns the window. 49 | /// This prevents the calling thread from blocking its execution while other threads process the request. 50 | /// 51 | SWP_ASYNCWINDOWPOS = 0x4000, 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /source/MetroRadiance/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Chrome/Primitives/ChromeWindow.Top.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Windows; 4 | using MetroRadiance.Interop.Win32; 5 | 6 | namespace MetroRadiance.Chrome.Primitives 7 | { 8 | internal class TopChromeWindow : ChromeWindow 9 | { 10 | static TopChromeWindow() 11 | { 12 | DefaultStyleKeyProperty.OverrideMetadata( 13 | typeof(TopChromeWindow), 14 | new FrameworkPropertyMetadata(typeof(TopChromeWindow))); 15 | TitleProperty.OverrideMetadata( 16 | typeof(TopChromeWindow), 17 | new FrameworkPropertyMetadata(nameof(TopChromeWindow))); 18 | } 19 | 20 | private int _leftScaledOffset = 0; 21 | private int _rightScaledOffset = 0; 22 | 23 | public TopChromeWindow() 24 | { 25 | this.SizeToContent = SizeToContent.Height; 26 | } 27 | 28 | protected override void UpdateDpiResources() 29 | { 30 | this._leftScaledOffset = this.Offset.Left.DpiRoundX(this.CurrentDpi); 31 | this._rightScaledOffset = this.Offset.Right.DpiRoundX(this.CurrentDpi); 32 | } 33 | 34 | protected override int GetLeft(RECT owner) 35 | { 36 | return owner.Left - this._leftScaledOffset; 37 | } 38 | 39 | protected override int GetTop(RECT owner) 40 | { 41 | return owner.Top - this.GetHeight(owner); 42 | } 43 | 44 | protected override int GetWidth(RECT owner) 45 | { 46 | return owner.Width + this._leftScaledOffset + this._rightScaledOffset; 47 | } 48 | 49 | protected override int GetHeight(RECT owner) 50 | { 51 | return this.ActualHeight.DpiRoundY(this.SystemDpi); 52 | } 53 | 54 | protected override void OwnerSizeChangedCallback(object sender, EventArgs eventArgs) 55 | { 56 | this.UpdateSize(); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /source/MetroRadiance/Utilities/InternalExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using MetroRadiance.UI.Controls; 7 | 8 | namespace MetroRadiance.Utilities 9 | { 10 | internal static class InternalExtensions 11 | { 12 | /// 13 | /// ウィンドウ操作を実行します。 14 | /// 15 | /// 実行するウィンドウ操作。 16 | /// 操作を実行しようとしている UI 要素。この要素をホストするウィンドウに対し、 操作が実行されます。 17 | public static void Invoke(this WindowAction action, FrameworkElement source) 18 | { 19 | var window = Window.GetWindow(source); 20 | if (window == null) return; 21 | 22 | switch (action) 23 | { 24 | case WindowAction.Active: 25 | window.Activate(); 26 | break; 27 | case WindowAction.Close: 28 | window.Close(); 29 | break; 30 | case WindowAction.Maximize: 31 | window.WindowState = WindowState.Maximized; 32 | break; 33 | case WindowAction.Minimize: 34 | window.WindowState = WindowState.Minimized; 35 | break; 36 | case WindowAction.Normalize: 37 | window.WindowState = WindowState.Normal; 38 | break; 39 | case WindowAction.OpenSystemMenu: 40 | var point = source.PointToScreen(new Point(0, source.ActualHeight)); 41 | SystemCommands.ShowSystemMenu(window, point); 42 | break; 43 | } 44 | } 45 | 46 | /// 47 | /// 現在の文字列と、指定した文字列を比較します。大文字と小文字は区別されません。 48 | /// 49 | public static bool Compare(this string strA, string strB) 50 | { 51 | return string.Compare(strA, strB, StringComparison.OrdinalIgnoreCase) == 0; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /source/RetroRadiance/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/Win32/SW.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace MetroRadiance.Core.Win32 5 | { 6 | [Obsolete] 7 | [EditorBrowsable(EditorBrowsableState.Never)] 8 | // ReSharper disable InconsistentNaming 9 | public enum SW 10 | { 11 | /// 12 | /// ウィンドウを非表示にして、ほかのウィンドウをアクティブにします。 13 | /// 14 | HIDE = 0, 15 | 16 | /// 17 | /// ウィンドウをアクティブにし、表示します。ウィンドウが最小化、または最大化されていると、ウィンドウは元の位置とサイズで復元されます。 18 | /// 19 | SHOWNORMAL = 1, 20 | 21 | /// 22 | /// ウィンドウをアクティブにし、アイコンとして表示します。 23 | /// 24 | SHOWMINIMIZED = 2, 25 | 26 | /// 27 | /// ウィンドウをアクティブにし、最大化します。 28 | /// 29 | SHOWMAXIMIZED = 3, 30 | 31 | /// 32 | /// ウィンドウをアイコンとして表示します。 現在アクティブなウィンドウはアクティブなまま表示します。 33 | /// 34 | SHOWNOACTIVATE = 4, 35 | 36 | /// 37 | /// ウィンドウをアクティブにし、現在のサイズと位置で表示します。 38 | /// 39 | SHOW = 5, 40 | 41 | /// 42 | /// 指定されたウィンドウを最小化して、システム リストにあるトップレベル ウィンドウをアクティブにします。 43 | /// 44 | MINIMIZE = 6, 45 | 46 | /// 47 | /// ウィンドウを直前のサイズと位置で表示します。 現在アクティブなウィンドウはアクティブなまま表示します。 48 | /// 49 | SHOWMINNOACTIVE = 7, 50 | 51 | /// 52 | /// ウィンドウを現在の状態で表示します。 現在アクティブなウィンドウはアクティブなまま表示します。 53 | /// 54 | SHOWNA = 8, 55 | 56 | /// 57 | /// ウィンドウをアクティブにし、表示します。 ウィンドウが最小化、または最大化されていると、ウィンドウは元の位置とサイズに復元されます。 58 | /// 59 | RESTORE = 9, 60 | 61 | /// 62 | /// アプリケーションを起動したプログラムが 関数に渡した 構造体で指定された SW_ フラグに従って表示状態を設定します。 63 | /// 64 | SHOWDEFAULT = 10, 65 | } 66 | 67 | // ReSharper restore InconsistentNaming 68 | } 69 | -------------------------------------------------------------------------------- /source/RetroRadiance/Themes/Generic.BindableRichTextBox.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 37 | 38 | -------------------------------------------------------------------------------- /source/MetroRadiance/Themes/Generic.BindableRichTextBox.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/LinkButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | 8 | namespace MetroRadiance.UI.Controls 9 | { 10 | public class LinkButton : Button 11 | { 12 | static LinkButton() 13 | { 14 | DefaultStyleKeyProperty.OverrideMetadata(typeof(LinkButton), new FrameworkPropertyMetadata(typeof(LinkButton))); 15 | } 16 | 17 | #region Text 依存関係プロパティ 18 | 19 | public string Text 20 | { 21 | get { return (string)this.GetValue(TextProperty); } 22 | set { this.SetValue(TextProperty, value); } 23 | } 24 | public static readonly DependencyProperty TextProperty = 25 | DependencyProperty.Register("Text", typeof(string), typeof(LinkButton), new UIPropertyMetadata("")); 26 | 27 | #endregion 28 | 29 | #region TextTrimming 依存関係プロパティ 30 | 31 | public TextTrimming TextTrimming 32 | { 33 | get { return (TextTrimming)this.GetValue(TextTrimmingProperty); } 34 | set { this.SetValue(TextTrimmingProperty, value); } 35 | } 36 | public static readonly DependencyProperty TextTrimmingProperty = 37 | DependencyProperty.Register("TextTrimming", typeof(TextTrimming), typeof(LinkButton), new UIPropertyMetadata(TextTrimming.CharacterEllipsis)); 38 | 39 | #endregion 40 | 41 | #region TextWrapping 依存関係プロパティ 42 | 43 | public TextWrapping TextWrapping 44 | { 45 | get { return (TextWrapping)this.GetValue(TextWrappingProperty); } 46 | set { this.SetValue(TextWrappingProperty, value); } 47 | } 48 | public static readonly DependencyProperty TextWrappingProperty = 49 | DependencyProperty.Register("TextWrapping", typeof(TextWrapping), typeof(LinkButton), new UIPropertyMetadata(TextWrapping.NoWrap)); 50 | 51 | #endregion 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/Int32Rule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows.Controls; 7 | 8 | namespace MetroRadiance.UI.Controls 9 | { 10 | /// 11 | /// 入力された値が有効な 値かどうかを検証します。 12 | /// 13 | public class Int32Rule : ValidationRule 14 | { 15 | /// 16 | /// 入力に空文字を許可するかどうかを示す値を取得または設定します。 17 | /// 18 | public bool AllowsEmpty { get; set; } 19 | 20 | /// 21 | /// 入力可能な最小値を取得または設定します。 22 | /// 23 | /// 24 | /// 入力可能な最小値。最小値がない場合は null。 25 | /// 26 | public int? Min { get; set; } 27 | 28 | /// 29 | /// 入力可能な最大値を取得または設定します。 30 | /// 31 | /// 32 | /// 入力可能な最大値。最大値がない場合は null。 33 | /// 34 | public int? Max { get; set; } 35 | 36 | 37 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) 38 | { 39 | var numberAsString = value as string; 40 | if (string.IsNullOrEmpty(numberAsString)) 41 | { 42 | return this.AllowsEmpty 43 | ? new ValidationResult(true, null) 44 | : new ValidationResult(false, "値を入力してください。"); 45 | } 46 | 47 | int number; 48 | try 49 | { 50 | number = int.Parse(numberAsString); 51 | } 52 | catch (Exception) 53 | { 54 | return new ValidationResult(false, "数値を入力してください。"); 55 | } 56 | 57 | if (this.Min.HasValue && number < this.Min) 58 | { 59 | return new ValidationResult(false, $"{this.Min} 以上の数値を入力してください。"); 60 | } 61 | 62 | if (this.Max.HasValue && this.Max < number) 63 | { 64 | return new ValidationResult(false, $"{this.Max} 以下の数値を入力してください。"); 65 | } 66 | 67 | return new ValidationResult(true, null); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Core/PerMonitorDpi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows.Interop; 7 | using MetroRadiance.Core.Win32; 8 | 9 | namespace MetroRadiance.Core 10 | { 11 | /// 12 | /// Windows 8.1 の Per-Monitor DPI 機能へアクセスします。 13 | /// 14 | [Obsolete] 15 | [EditorBrowsable(EditorBrowsableState.Never)] 16 | public static class PerMonitorDpi 17 | { 18 | /// 19 | /// Per-Monitor DPI 機能をサポートしているかどうかを示す値を取得します。 20 | /// 21 | /// 22 | /// 動作しているオペレーティング システムが Windows 8.1 (NT 6.3) の場合は true、それ以外の場合は false。 23 | /// 24 | public static bool IsSupported 25 | { 26 | get 27 | { 28 | var version = Environment.OSVersion.Version; 29 | return version.Major == 6 && version.Minor == 3; 30 | } 31 | } 32 | 33 | /// 34 | /// 現在の が描画されているモニターの DPI 設定値を取得します。 35 | /// 36 | /// DPI を取得する対象の Win32 ウィンドウを特定する オブジェクト。 37 | /// DPI の種類。規定値は ( と同値) です。 38 | /// が描画されているモニターの DPI 設定値。サポートされていないシステムの場合は 39 | public static Dpi GetDpi(this HwndSource hwndSource, MonitorDpiType dpiType = MonitorDpiType.Default) 40 | { 41 | if (!IsSupported) return Dpi.Default; 42 | 43 | var hmonitor = NativeMethods.MonitorFromWindow( 44 | hwndSource.Handle, 45 | MonitorDefaultTo.MONITOR_DEFAULTTONEAREST); 46 | 47 | uint dpiX = 1, dpiY = 1; 48 | NativeMethods.GetDpiForMonitor(hmonitor, dpiType, ref dpiX, ref dpiY); 49 | 50 | return new Dpi(dpiX, dpiY); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/LinkButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | 9 | namespace MetroRadiance.Controls 10 | { 11 | [Obsolete] 12 | [EditorBrowsable(EditorBrowsableState.Never)] 13 | public class LinkButton : Button 14 | { 15 | static LinkButton() 16 | { 17 | DefaultStyleKeyProperty.OverrideMetadata(typeof(LinkButton), new FrameworkPropertyMetadata(typeof(LinkButton))); 18 | } 19 | 20 | #region Text 依存関係プロパティ 21 | 22 | public string Text 23 | { 24 | get { return (string)this.GetValue(TextProperty); } 25 | set { this.SetValue(TextProperty, value); } 26 | } 27 | public static readonly DependencyProperty TextProperty = 28 | DependencyProperty.Register("Text", typeof(string), typeof(LinkButton), new UIPropertyMetadata("")); 29 | 30 | #endregion 31 | 32 | #region TextTrimming 依存関係プロパティ 33 | 34 | public TextTrimming TextTrimming 35 | { 36 | get { return (TextTrimming)this.GetValue(TextTrimmingProperty); } 37 | set { this.SetValue(TextTrimmingProperty, value); } 38 | } 39 | public static readonly DependencyProperty TextTrimmingProperty = 40 | DependencyProperty.Register("TextTrimming", typeof(TextTrimming), typeof(LinkButton), new UIPropertyMetadata(TextTrimming.CharacterEllipsis)); 41 | 42 | #endregion 43 | 44 | #region TextWrapping 依存関係プロパティ 45 | 46 | public TextWrapping TextWrapping 47 | { 48 | get { return (TextWrapping)this.GetValue(TextWrappingProperty); } 49 | set { this.SetValue(TextWrappingProperty, value); } 50 | } 51 | public static readonly DependencyProperty TextWrappingProperty = 52 | DependencyProperty.Register("TextWrapping", typeof(TextWrapping), typeof(LinkButton), new UIPropertyMetadata(TextWrapping.NoWrap)); 53 | 54 | #endregion 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /samples/ZuneLikeWindow/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 8 | // アセンブリに関連付けられている情報を変更するには、 9 | // これらの属性値を変更してください。 10 | [assembly: AssemblyTitle("ZuneLikeWindow")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("ZuneLikeWindow")] 15 | [assembly: AssemblyCopyright("Copyright © 2012")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから 20 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 21 | // その型の ComVisible 属性を true に設定してください。 22 | [assembly: ComVisible(false)] 23 | 24 | //ローカライズ可能なアプリケーションのビルドを開始するには、 25 | //.csproj ファイルの CultureYouAreCodingWith を 26 | // 内部で設定します。たとえば、 27 | //ソース ファイルで英語を使用している場合、 を en-US に設定します。次に、 28 | //下の NeutralResourceLanguage 属性のコメントを解除します。下の行の "en-US" を 29 | //プロジェクト ファイルの UICulture 設定と一致するよう更新します。 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //テーマ固有のリソース ディクショナリが置かれている場所 36 | //(リソースがページ、 37 | //またはアプリケーション リソース ディクショナリに見つからない場合に使用されます) 38 | ResourceDictionaryLocation.SourceAssembly //汎用リソース ディクショナリが置かれている場所 39 | //(リソースがページ、 40 | //アプリケーション、またはいずれのテーマ固有のリソース ディクショナリにも見つからない場合に使用されます) 41 | )] 42 | 43 | 44 | // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を 52 | // 既定値にすることができます: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/Int32Rule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows.Controls; 8 | 9 | namespace MetroRadiance.Controls 10 | { 11 | /// 12 | /// 入力された値が有効な 値かどうかを検証します。 13 | /// 14 | [Obsolete] 15 | [EditorBrowsable(EditorBrowsableState.Never)] 16 | public class Int32Rule : ValidationRule 17 | { 18 | /// 19 | /// 入力に空文字を許可するかどうかを示す値を取得または設定します。 20 | /// 21 | public bool AllowsEmpty { get; set; } 22 | 23 | /// 24 | /// 入力可能な最小値を取得または設定します。 25 | /// 26 | /// 27 | /// 入力可能な最小値。最小値がない場合は null。 28 | /// 29 | public int? Min { get; set; } 30 | 31 | /// 32 | /// 入力可能な最大値を取得または設定します。 33 | /// 34 | /// 35 | /// 入力可能な最大値。最大値がない場合は null。 36 | /// 37 | public int? Max { get; set; } 38 | 39 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) 40 | { 41 | var numberAsString = value as string; 42 | if (string.IsNullOrEmpty(numberAsString)) 43 | { 44 | return this.AllowsEmpty 45 | ? new ValidationResult(true, null) 46 | : new ValidationResult(false, "値を入力してください。"); 47 | } 48 | 49 | int number; 50 | try 51 | { 52 | number = int.Parse(numberAsString); 53 | } 54 | catch (Exception) 55 | { 56 | return new ValidationResult(false, "数値を入力してください。"); 57 | } 58 | 59 | if (this.Min.HasValue && number < this.Min) 60 | { 61 | return new ValidationResult(false, $"{this.Min} 以上の数値を入力してください。"); 62 | } 63 | 64 | if (this.Max.HasValue && this.Max < number) 65 | { 66 | return new ValidationResult(false, $"{this.Max} 以下の数値を入力してください。"); 67 | } 68 | 69 | return new ValidationResult(true, null); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 8 | // アセンブリに関連付けられている情報を変更するには、 9 | // これらの属性値を変更してください。 10 | [assembly: AssemblyTitle("VS2012LikeWindow2")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("VS2012LikeWindow2")] 15 | [assembly: AssemblyCopyright("Copyright © 2012")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから 20 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 21 | // その型の ComVisible 属性を true に設定してください。 22 | [assembly: ComVisible(false)] 23 | 24 | //ローカライズ可能なアプリケーションのビルドを開始するには、 25 | //.csproj ファイルの CultureYouAreCodingWith を 26 | // 内部で設定します。たとえば、 27 | //ソース ファイルで英語を使用している場合、 を en-US に設定します。次に、 28 | //下の NeutralResourceLanguage 属性のコメントを解除します。下の行の "en-US" を 29 | //プロジェクト ファイルの UICulture 設定と一致するよう更新します。 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //テーマ固有のリソース ディクショナリが置かれている場所 36 | //(リソースがページ、 37 | //またはアプリケーション リソース ディクショナリに見つからない場合に使用されます) 38 | ResourceDictionaryLocation.SourceAssembly //汎用リソース ディクショナリが置かれている場所 39 | //(リソースがページ、 40 | //アプリケーション、またはいずれのテーマ固有のリソース ディクショナリにも見つからない場合に使用されます) 41 | )] 42 | 43 | 44 | // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を 52 | // 既定値にすることができます: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/ResizeGrip.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Interop; 8 | using MetroRadiance.Interop.Win32; 9 | 10 | namespace MetroRadiance.UI.Controls 11 | { 12 | /// 13 | /// ウィンドウをリサイズするためのグリップ コントロールを表します。 14 | /// 15 | public class ResizeGrip : ContentControl 16 | { 17 | static ResizeGrip() 18 | { 19 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ResizeGrip), new FrameworkPropertyMetadata(typeof(ResizeGrip))); 20 | } 21 | 22 | private bool canResize; 23 | private bool isInitialized; 24 | 25 | public ResizeGrip() 26 | { 27 | this.Loaded += this.Initialize; 28 | } 29 | 30 | private void Initialize(object sender, RoutedEventArgs args) 31 | { 32 | if (this.isInitialized) return; 33 | 34 | var window = Window.GetWindow(this); 35 | if (window == null) return; 36 | 37 | var source = (HwndSource)PresentationSource.FromVisual(window); 38 | if (source != null) source.AddHook(this.WndProc); 39 | 40 | window.StateChanged += (_, __) => this.canResize = window.WindowState == WindowState.Normal; 41 | window.ContentRendered += (_, __) => this.canResize = window.WindowState == WindowState.Normal; 42 | 43 | this.isInitialized = true; 44 | } 45 | 46 | private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) 47 | { 48 | if (msg == (int)WindowsMessages.WM_NCHITTEST && this.canResize) 49 | { 50 | var ptScreen = lParam.ToPoint(); 51 | var ptClient = this.PointFromScreen(ptScreen); 52 | 53 | var rectTarget = new Rect(0, 0, this.ActualWidth, this.ActualHeight); 54 | 55 | if (rectTarget.Contains(ptClient)) 56 | { 57 | handled = true; 58 | return (IntPtr)HitTestValues.HTBOTTOMRIGHT; 59 | } 60 | } 61 | 62 | return IntPtr.Zero; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Internal/InternalExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using MetroRadiance.Controls; 9 | 10 | namespace MetroRadiance.Internal 11 | { 12 | [Obsolete] 13 | [EditorBrowsable(EditorBrowsableState.Never)] 14 | internal static class InternalExtensions 15 | { 16 | /// 17 | /// ウィンドウ操作を実行します。 18 | /// 19 | /// 実行するウィンドウ操作。 20 | /// 操作を実行しようとしている UI 要素。この要素をホストするウィンドウに対し、 操作が実行されます。 21 | public static void Invoke(this WindowAction action, FrameworkElement source) 22 | { 23 | var window = Window.GetWindow(source); 24 | if (window == null) return; 25 | 26 | switch (action) 27 | { 28 | case WindowAction.Active: 29 | window.Activate(); 30 | break; 31 | case WindowAction.Close: 32 | window.Close(); 33 | break; 34 | case WindowAction.Maximize: 35 | window.WindowState = WindowState.Maximized; 36 | break; 37 | case WindowAction.Minimize: 38 | window.WindowState = WindowState.Minimized; 39 | break; 40 | case WindowAction.Normalize: 41 | window.WindowState = WindowState.Normal; 42 | break; 43 | case WindowAction.OpenSystemMenu: 44 | var point = source.PointToScreen(new Point(0, source.ActualHeight)); 45 | SystemCommands.ShowSystemMenu(window, point); 46 | break; 47 | } 48 | } 49 | 50 | /// 51 | /// 現在の文字列と、指定した文字列を比較します。大文字と小文字は区別されません。 52 | /// 53 | public static bool Compare(this string strA, string strB) 54 | { 55 | return string.Compare(strA, strB, StringComparison.OrdinalIgnoreCase) == 0; 56 | } 57 | 58 | public static void ForEach(this IEnumerable sequence, Action action) 59 | { 60 | foreach (var item in sequence) action(item); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | ## Ignore Visual Studio temporary files, build results, and 9 | ## files generated by popular Visual Studio add-ons. 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.sln.docstates 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Rr]elease/ 19 | x64/ 20 | *_i.c 21 | *_p.c 22 | *.ilk 23 | *.meta 24 | *.obj 25 | *.pch 26 | *.pdb 27 | *.pgc 28 | *.pgd 29 | *.rsp 30 | *.sbr 31 | *.tlb 32 | *.tli 33 | *.tlh 34 | *.tmp 35 | *.log 36 | *.vspscc 37 | *.vssscc 38 | .builds 39 | 40 | # Visual C++ cache files 41 | ipch/ 42 | *.aps 43 | *.ncb 44 | *.opensdf 45 | *.sdf 46 | 47 | # Visual Studio profiler 48 | *.psess 49 | *.vsp 50 | *.vspx 51 | 52 | # Guidance Automation Toolkit 53 | *.gpState 54 | 55 | # ReSharper is a .NET coding add-in 56 | _ReSharper* 57 | 58 | # NCrunch 59 | *.ncrunch* 60 | .*crunch*.local.xml 61 | 62 | # Installshield output folder 63 | [Ee]xpress 64 | 65 | # DocProject is a documentation generator add-in 66 | DocProject/buildhelp/ 67 | DocProject/Help/*.HxT 68 | DocProject/Help/*.HxC 69 | DocProject/Help/*.hhc 70 | DocProject/Help/*.hhk 71 | DocProject/Help/*.hhp 72 | DocProject/Help/Html2 73 | DocProject/Help/html 74 | 75 | # Click-Once directory 76 | publish 77 | 78 | # Publish Web Output 79 | *.Publish.xml 80 | 81 | # NuGet Packages Directory 82 | packages 83 | 84 | # Windows Azure Build Output 85 | csx 86 | *.build.csdef 87 | 88 | # Windows Store app package directory 89 | AppPackages/ 90 | 91 | # Others 92 | [Bb]in 93 | [Oo]bj 94 | sql 95 | TestResults 96 | [Tt]est[Rr]esult* 97 | *.Cache 98 | ClientBin 99 | [Ss]tyle[Cc]op.* 100 | ~$* 101 | *.dbmdl 102 | Generated_Code #added for RIA/Silverlight projects 103 | 104 | # Backup & report files from converting an old project file to a newer 105 | # Visual Studio version. Backup files are not needed, because we have git ;-) 106 | _UpgradeReport_Files/ 107 | Backup*/ 108 | UpgradeLog*.XML 109 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Chrome/Internal/GlowWindowProcessorLeft.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Input; 8 | using MetroRadiance.Core.Win32; 9 | #pragma warning disable 612 10 | 11 | namespace MetroRadiance.Chrome.Internal 12 | { 13 | internal class GlowWindowProcessorLeft : GlowWindowProcessor 14 | { 15 | public override Orientation Orientation => Orientation.Vertical; 16 | 17 | public override HorizontalAlignment HorizontalAlignment => HorizontalAlignment.Right; 18 | 19 | public override VerticalAlignment VerticalAlignment => VerticalAlignment.Stretch; 20 | 21 | public override double GetLeft(double ownerLeft, double ownerWidth) 22 | { 23 | return ownerLeft - GlowSize; 24 | } 25 | 26 | public override double GetTop(double ownerTop, double ownerHeight) 27 | { 28 | return ownerTop - GlowSize; 29 | } 30 | 31 | public override double GetWidth(double ownerLeft, double ownerWidth) 32 | { 33 | return GlowSize; 34 | } 35 | 36 | public override double GetHeight(double ownerTop, double ownerHeight) 37 | { 38 | return ownerHeight + GlowSize * 2; 39 | } 40 | 41 | public override HitTestValues GetHitTestValue(Point point, double actualWidht, double actualHeight) 42 | { 43 | var leftTop = new Rect(0, 0, actualWidht, EdgeSize); 44 | var leftBottom = new Rect(0, actualHeight - EdgeSize, actualWidht, EdgeSize); 45 | 46 | return leftTop.Contains(point) 47 | ? HitTestValues.HTTOPLEFT 48 | : leftBottom.Contains(point) ? HitTestValues.HTBOTTOMLEFT : HitTestValues.HTLEFT; 49 | } 50 | 51 | public override Cursor GetCursor(Point point, double actualWidht, double actualHeight) 52 | { 53 | var leftTop = new Rect(0, 0, actualWidht, EdgeSize); 54 | var leftBottom = new Rect(0, actualHeight - EdgeSize, actualWidht, EdgeSize); 55 | 56 | return leftTop.Contains(point) 57 | ? Cursors.SizeNWSE 58 | : leftBottom.Contains(point) ? Cursors.SizeNESW : Cursors.SizeWE; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Chrome/Internal/GlowWindowProcessorRight.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Input; 8 | using MetroRadiance.Core.Win32; 9 | #pragma warning disable 612 10 | 11 | namespace MetroRadiance.Chrome.Internal 12 | { 13 | internal class GlowWindowProcessorRight : GlowWindowProcessor 14 | { 15 | public override Orientation Orientation => Orientation.Vertical; 16 | 17 | public override HorizontalAlignment HorizontalAlignment => HorizontalAlignment.Left; 18 | 19 | public override VerticalAlignment VerticalAlignment => VerticalAlignment.Stretch; 20 | 21 | public override double GetLeft(double ownerLeft, double ownerWidth) 22 | { 23 | return ownerLeft + ownerWidth; 24 | } 25 | 26 | public override double GetTop(double ownerTop, double ownerHeight) 27 | { 28 | return ownerTop - GlowSize; 29 | } 30 | 31 | public override double GetWidth(double ownerLeft, double ownerWidth) 32 | { 33 | return GlowSize; 34 | } 35 | 36 | public override double GetHeight(double ownerTop, double ownerHeight) 37 | { 38 | return ownerHeight + GlowSize * 2; 39 | } 40 | 41 | public override HitTestValues GetHitTestValue(Point point, double actualWidht, double actualHeight) 42 | { 43 | var rightTop = new Rect(0, 0, actualWidht, EdgeSize); 44 | var rightBottom = new Rect(0, actualHeight - EdgeSize, actualWidht, EdgeSize); 45 | 46 | return rightTop.Contains(point) 47 | ? HitTestValues.HTTOPRIGHT 48 | : rightBottom.Contains(point) ? HitTestValues.HTBOTTOMRIGHT : HitTestValues.HTRIGHT; 49 | } 50 | 51 | public override Cursor GetCursor(Point point, double actualWidht, double actualHeight) 52 | { 53 | var rightTop = new Rect(0, 0, actualWidht, EdgeSize); 54 | var rightBottom = new Rect(0, actualHeight - EdgeSize, actualWidht, EdgeSize); 55 | 56 | return rightTop.Contains(point) 57 | ? Cursors.SizeNESW 58 | : rightBottom.Contains(point) ? Cursors.SizeNWSE : Cursors.SizeWE; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/ResizeGrip.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Interop; 9 | using MetroRadiance.Core.Win32; 10 | 11 | namespace MetroRadiance.Controls 12 | { 13 | /// 14 | /// ウィンドウをリサイズするためのグリップ コントロールを表します。 15 | /// 16 | [Obsolete] 17 | [EditorBrowsable(EditorBrowsableState.Never)] 18 | public class ResizeGrip : ContentControl 19 | { 20 | static ResizeGrip() 21 | { 22 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ResizeGrip), new FrameworkPropertyMetadata(typeof(ResizeGrip))); 23 | } 24 | 25 | private bool canResize; 26 | private bool isInitialized; 27 | 28 | public ResizeGrip() 29 | { 30 | this.Loaded += this.Initialize; 31 | } 32 | 33 | private void Initialize(object sender, RoutedEventArgs args) 34 | { 35 | if (this.isInitialized) return; 36 | 37 | var window = Window.GetWindow(this); 38 | if (window == null) return; 39 | 40 | var source = (HwndSource)PresentationSource.FromVisual(window); 41 | if (source != null) source.AddHook(this.WndProc); 42 | 43 | window.StateChanged += (_, __) => this.canResize = window.WindowState == WindowState.Normal; 44 | window.ContentRendered += (_, __) => this.canResize = window.WindowState == WindowState.Normal; 45 | 46 | this.isInitialized = true; 47 | } 48 | 49 | private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) 50 | { 51 | if (msg == (int)WM.NCHITTEST && this.canResize) 52 | { 53 | var ptScreen = lParam.ToPoint(); 54 | var ptClient = this.PointFromScreen(ptScreen); 55 | 56 | var rectTarget = new Rect(0, 0, this.ActualWidth, this.ActualHeight); 57 | 58 | if (rectTarget.Contains(ptClient)) 59 | { 60 | handled = true; 61 | return (IntPtr)HitTestValues.HTBOTTOMRIGHT; 62 | } 63 | } 64 | 65 | return IntPtr.Zero; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Chrome/Internal/GlowWindowProcessorTop.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Input; 8 | using MetroRadiance.Core.Win32; 9 | #pragma warning disable 612 10 | 11 | namespace MetroRadiance.Chrome.Internal 12 | { 13 | internal class GlowWindowProcessorTop : GlowWindowProcessor 14 | { 15 | public override Orientation Orientation => Orientation.Horizontal; 16 | 17 | public override HorizontalAlignment HorizontalAlignment => HorizontalAlignment.Stretch; 18 | 19 | public override VerticalAlignment VerticalAlignment => VerticalAlignment.Bottom; 20 | 21 | public override double GetLeft(double ownerLeft, double ownerWidth) 22 | { 23 | return ownerLeft; 24 | } 25 | 26 | public override double GetTop(double ownerTop, double ownerHeight) 27 | { 28 | return ownerTop - GlowSize; 29 | } 30 | 31 | public override double GetWidth(double ownerLeft, double ownerWidth) 32 | { 33 | return ownerWidth; 34 | } 35 | 36 | public override double GetHeight(double ownerTop, double ownerHeight) 37 | { 38 | return GlowSize; 39 | } 40 | 41 | public override HitTestValues GetHitTestValue(Point point, double actualWidht, double actualHeight) 42 | { 43 | var topLeft = new Rect(0, 0, EdgeSize - GlowSize, actualHeight); 44 | var topRight = new Rect(actualWidht - EdgeSize + GlowSize, 0, EdgeSize - GlowSize, actualHeight); 45 | 46 | return topLeft.Contains(point) 47 | ? HitTestValues.HTTOPLEFT 48 | : topRight.Contains(point) ? HitTestValues.HTTOPRIGHT : HitTestValues.HTTOP; 49 | } 50 | 51 | public override Cursor GetCursor(Point point, double actualWidht, double actualHeight) 52 | { 53 | var topLeft = new Rect(0, 0, EdgeSize - GlowSize, actualHeight); 54 | var topRight = new Rect(actualWidht - EdgeSize + GlowSize, 0, EdgeSize - GlowSize, actualHeight); 55 | 56 | return topLeft.Contains(point) 57 | ? Cursors.SizeNWSE 58 | : topRight.Contains(point) ? Cursors.SizeNESW : Cursors.SizeNS; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/Badge.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | 9 | namespace MetroRadiance.UI.Controls 10 | { 11 | [TemplatePart(Name = PART_CountHost, Type = typeof(TextBlock))] 12 | public class Badge : Control 13 | { 14 | private const string PART_CountHost = "PART_CountHost"; 15 | 16 | static Badge() 17 | { 18 | DefaultStyleKeyProperty.OverrideMetadata(typeof(Badge), new FrameworkPropertyMetadata(typeof(Badge))); 19 | } 20 | 21 | private TextBlock block; 22 | private double initialSize; 23 | 24 | #region Count 依存関係プロパティ 25 | 26 | public int? Count 27 | { 28 | get { return (int?)this.GetValue(CountProperty); } 29 | set { this.SetValue(CountProperty, value); } 30 | } 31 | public static readonly DependencyProperty CountProperty = 32 | DependencyProperty.Register(nameof(Count), typeof(int?), typeof(Badge), new UIPropertyMetadata(null, CountPropertyChangedCallback)); 33 | 34 | private static void CountPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) 35 | { 36 | var source = (Badge)d; 37 | source.SetCount((int?)e.NewValue); 38 | } 39 | 40 | #endregion 41 | 42 | public Badge() 43 | { 44 | this.SetCount(null); 45 | } 46 | 47 | public override void OnApplyTemplate() 48 | { 49 | base.OnApplyTemplate(); 50 | 51 | this.block = this.GetTemplateChild(PART_CountHost) as TextBlock; 52 | if (this.block != null) 53 | { 54 | this.initialSize = this.block.FontSize; 55 | this.SetCount(this.Count); 56 | } 57 | } 58 | 59 | private void SetCount(int? count) 60 | { 61 | if (count.HasValue) 62 | { 63 | if (this.block != null) 64 | { 65 | this.block.Text = count.Value.ToString(CultureInfo.InvariantCulture); 66 | this.block.FontSize = count.Value >= 10 ? this.initialSize - 1 : this.initialSize; 67 | } 68 | this.Visibility = Visibility.Visible; 69 | } 70 | else 71 | { 72 | this.Visibility = Visibility.Hidden; 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Chrome/GlowingEdge.Left.cs: -------------------------------------------------------------------------------- 1 | using MetroRadiance.Chrome.Primitives; 2 | using System; 3 | using System.Windows; 4 | using System.Windows.Input; 5 | using System.Windows.Media; 6 | 7 | namespace MetroRadiance.Chrome 8 | { 9 | [TemplatePart(Name = PART_LeftThumb, Type = typeof(FrameworkElement))] 10 | [TemplatePart(Name = PART_TopLeftThumb, Type = typeof(FrameworkElement))] 11 | [TemplatePart(Name = PART_BottomLeftThumb, Type = typeof(FrameworkElement))] 12 | public sealed class LeftGlowingEdge : GlowingEdge 13 | { 14 | private const string PART_LeftThumb = nameof(PART_LeftThumb); 15 | private const string PART_TopLeftThumb = nameof(PART_TopLeftThumb); 16 | private const string PART_BottomLeftThumb = nameof(PART_BottomLeftThumb); 17 | 18 | static LeftGlowingEdge() 19 | { 20 | DefaultStyleKeyProperty.OverrideMetadata( 21 | typeof(LeftGlowingEdge), 22 | new FrameworkPropertyMetadata(typeof(LeftGlowingEdge))); 23 | } 24 | 25 | private FrameworkElement _leftThumb; 26 | private FrameworkElement _topLeftThumb; 27 | private FrameworkElement _bottomLeftThumb; 28 | 29 | public override void OnApplyTemplate() 30 | { 31 | base.OnApplyTemplate(); 32 | 33 | this._leftThumb = (FrameworkElement)this.GetTemplateChild(PART_LeftThumb); 34 | this._topLeftThumb = (FrameworkElement)this.GetTemplateChild(PART_TopLeftThumb); 35 | this._bottomLeftThumb = (FrameworkElement)this.GetTemplateChild(PART_BottomLeftThumb); 36 | } 37 | 38 | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) 39 | { 40 | var point = e.GetPosition(this); 41 | var result = VisualTreeHelper.HitTest(this, point); 42 | if (result == null) 43 | { 44 | base.OnMouseLeftButtonDown(e); 45 | } 46 | 47 | var window = (LeftChromeWindow)Window.GetWindow(this); 48 | if (result.VisualHit == this._leftThumb) 49 | { 50 | window.Resize(SizingMode.Left); 51 | } 52 | else if (result.VisualHit == this._topLeftThumb) 53 | { 54 | window.Resize(SizingMode.TopLeft); 55 | } 56 | else if (result.VisualHit == this._bottomLeftThumb) 57 | { 58 | window.Resize(SizingMode.BottomLeft); 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance.Chrome/Internal/GlowWindowProcessorBottom.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Input; 8 | using MetroRadiance.Core.Win32; 9 | #pragma warning disable 612 10 | 11 | namespace MetroRadiance.Chrome.Internal 12 | { 13 | internal class GlowWindowProcessorBottom : GlowWindowProcessor 14 | { 15 | public override Orientation Orientation => Orientation.Horizontal; 16 | 17 | public override HorizontalAlignment HorizontalAlignment => HorizontalAlignment.Stretch; 18 | 19 | public override VerticalAlignment VerticalAlignment => VerticalAlignment.Top; 20 | 21 | public override double GetLeft(double ownerLeft, double ownerWidth) 22 | { 23 | return ownerLeft; 24 | } 25 | 26 | public override double GetTop(double ownerTop, double ownerHeight) 27 | { 28 | return ownerTop + ownerHeight; 29 | } 30 | 31 | public override double GetWidth(double ownerLeft, double ownerWidth) 32 | { 33 | return ownerWidth; 34 | } 35 | 36 | public override double GetHeight(double ownerTop, double ownerHeight) 37 | { 38 | return GlowSize; 39 | } 40 | 41 | public override HitTestValues GetHitTestValue(Point point, double actualWidht, double actualHeight) 42 | { 43 | var bottomLeft = new Rect(0, 0, EdgeSize - GlowSize, actualHeight); 44 | var bottomRight = new Rect(actualWidht - EdgeSize + GlowSize, 0, EdgeSize - GlowSize, actualHeight); 45 | 46 | return bottomLeft.Contains(point) 47 | ? HitTestValues.HTBOTTOMLEFT 48 | : bottomRight.Contains(point) ? HitTestValues.HTBOTTOMRIGHT : HitTestValues.HTBOTTOM; 49 | } 50 | 51 | public override Cursor GetCursor(Point point, double actualWidht, double actualHeight) 52 | { 53 | var bottomLeft = new Rect(0, 0, EdgeSize - GlowSize, actualHeight); 54 | var bottomRight = new Rect(actualWidht - EdgeSize + GlowSize, 0, EdgeSize - GlowSize, actualHeight); 55 | 56 | return bottomLeft.Contains(point) 57 | ? Cursors.SizeNESW 58 | : bottomRight.Contains(point) ? Cursors.SizeNWSE : Cursors.SizeNS; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /source/MetroRadiance/Themes/Generic.SystemButtons.xaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 48 | 49 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Chrome/GlowingEdge.Right.cs: -------------------------------------------------------------------------------- 1 | using MetroRadiance.Chrome.Primitives; 2 | using System; 3 | using System.Windows; 4 | using System.Windows.Input; 5 | using System.Windows.Media; 6 | 7 | namespace MetroRadiance.Chrome 8 | { 9 | [TemplatePart(Name = PART_RightThumb, Type = typeof(FrameworkElement))] 10 | [TemplatePart(Name = PART_TopRightThumb, Type = typeof(FrameworkElement))] 11 | [TemplatePart(Name = PART_BottomRightThumb, Type = typeof(FrameworkElement))] 12 | public sealed class RightGlowingEdge : GlowingEdge 13 | { 14 | private const string PART_RightThumb = nameof(PART_RightThumb); 15 | private const string PART_TopRightThumb = nameof(PART_TopRightThumb); 16 | private const string PART_BottomRightThumb = nameof(PART_BottomRightThumb); 17 | 18 | static RightGlowingEdge() 19 | { 20 | DefaultStyleKeyProperty.OverrideMetadata( 21 | typeof(RightGlowingEdge), 22 | new FrameworkPropertyMetadata(typeof(RightGlowingEdge))); 23 | } 24 | 25 | private FrameworkElement _rightThumb; 26 | private FrameworkElement _topRightThumb; 27 | private FrameworkElement _bottomRightThumb; 28 | 29 | public override void OnApplyTemplate() 30 | { 31 | base.OnApplyTemplate(); 32 | 33 | this._rightThumb = (FrameworkElement)this.GetTemplateChild(PART_RightThumb); 34 | this._topRightThumb = (FrameworkElement)this.GetTemplateChild(PART_TopRightThumb); 35 | this._bottomRightThumb = (FrameworkElement)this.GetTemplateChild(PART_BottomRightThumb); 36 | } 37 | 38 | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) 39 | { 40 | var point = e.GetPosition(this); 41 | var result = VisualTreeHelper.HitTest(this, point); 42 | if (result == null) 43 | { 44 | base.OnMouseLeftButtonDown(e); 45 | } 46 | 47 | var window = (RightChromeWindow)Window.GetWindow(this); 48 | if (result.VisualHit == this._rightThumb) 49 | { 50 | window.Resize(SizingMode.Right); 51 | } 52 | else if (result.VisualHit == this._topRightThumb) 53 | { 54 | window.Resize(SizingMode.TopRight); 55 | } 56 | else if (result.VisualHit == this._bottomRightThumb) 57 | { 58 | window.Resize(SizingMode.BottomRight); 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Controls/PromptTextBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Media; 8 | 9 | namespace MetroRadiance.UI.Controls 10 | { 11 | /// 12 | /// 未入力時にプロンプトを表示できる を表します。 13 | /// 14 | [TemplateVisualState(Name = "Empty", GroupName = "TextStates")] 15 | [TemplateVisualState(Name = "NotEmpty", GroupName = "TextStates")] 16 | public class PromptTextBox : TextBox 17 | { 18 | static PromptTextBox() 19 | { 20 | DefaultStyleKeyProperty.OverrideMetadata(typeof(PromptTextBox), new FrameworkPropertyMetadata(typeof(PromptTextBox))); 21 | } 22 | 23 | public PromptTextBox() 24 | { 25 | this.UpdateTextStates(true); 26 | this.TextChanged += (sender, e) => this.UpdateTextStates(true); 27 | this.GotKeyboardFocus += (sender, e) => this.UpdateTextStates(true); 28 | } 29 | 30 | #region Prompt 依存関係プロパティ 31 | 32 | public string Prompt 33 | { 34 | get { return (string)this.GetValue(PromptProperty); } 35 | set { this.SetValue(PromptProperty, value); } 36 | } 37 | public static readonly DependencyProperty PromptProperty = 38 | DependencyProperty.Register("Prompt", typeof(string), typeof(PromptTextBox), new UIPropertyMetadata("", PromptChangedCallback)); 39 | 40 | private static void PromptChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) 41 | { 42 | } 43 | 44 | #endregion 45 | 46 | #region PromptBrush 依存関係プロパティ 47 | 48 | public Brush PromptBrush 49 | { 50 | get { return (Brush)this.GetValue(PromptBrushProperty); } 51 | set { this.SetValue(PromptBrushProperty, value); } 52 | } 53 | public static readonly DependencyProperty PromptBrushProperty = 54 | DependencyProperty.Register("PromptBrush", typeof(Brush), typeof(PromptTextBox), new UIPropertyMetadata(Brushes.Gray)); 55 | 56 | #endregion 57 | 58 | 59 | private void UpdateTextStates(bool useTransitions) 60 | { 61 | VisualStateManager.GoToState(this, string.IsNullOrEmpty(this.Text) ? "Empty" : "NotEmpty", useTransitions); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /source/MetroRadiance/Styles/Icons.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 15 | 16 | 28 | 29 | 39 | 40 | 46 | 47 | 57 | 58 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Converters/WindowStateToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | 9 | namespace MetroRadiance.UI.Converters 10 | { 11 | /// 12 | /// 値が 13 | /// のときに 14 | /// へ、 のときに 15 | /// へ変換するコンバーターを定義します。 16 | /// 17 | public class WindowStateToVisibilityConverter : IValueConverter 18 | { 19 | /// 20 | /// 値から 値へ変換します。 21 | /// 22 | /// 変換元の 値。 23 | /// この引数は使用されません。 24 | /// パラメーター。文字列 "Reverse" を指定すると、変換結果が逆になります。それ以外の値を指定しても使用されません。 25 | /// この引数は使用されません。 26 | /// 値から 値への変換結果。 27 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 28 | { 29 | if (!(value is WindowState)) return Visibility.Collapsed; 30 | 31 | var state = (WindowState)value; 32 | var param = parameter as string; 33 | var isReverse = (param != null && (string.Compare(param, "Reverse", StringComparison.OrdinalIgnoreCase) == 0)); 34 | 35 | return state == WindowState.Normal 36 | ? isReverse ? Visibility.Collapsed : Visibility.Visible 37 | : isReverse ? Visibility.Visible : Visibility.Collapsed; 38 | } 39 | 40 | /// 41 | /// この実装は常に をスローします。 42 | /// 43 | /// この引数は使用されません。 44 | /// この引数は使用されません。 45 | /// この引数は使用されません。 46 | /// この引数は使用されません。 47 | /// 値は返されません。 48 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 49 | { 50 | throw new NotImplementedException(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /source/RetroRadiance/Styles/Icons.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 15 | 16 | 28 | 29 | 39 | 40 | 46 | 47 | 57 | 58 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/Win32/UxTheme.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace MetroRadiance.Interop.Win32 7 | { 8 | public static class UxTheme 9 | { 10 | [DllImport("uxtheme.dll", EntryPoint = "#94")] 11 | internal static extern int GetImmersiveColorSetCount(); 12 | 13 | [DllImport("uxtheme.dll", EntryPoint = "#95")] 14 | internal static extern uint GetImmersiveColorFromColorSetEx(uint dwImmersiveColorSet, uint dwImmersiveColorType, bool bIgnoreHighContrast, uint dwHighContrastCacheMode); 15 | 16 | [DllImport("uxtheme.dll", EntryPoint = "#96", CharSet = CharSet.Unicode)] 17 | internal static extern uint GetImmersiveColorTypeFromName(string name); 18 | 19 | [DllImport("uxtheme.dll", EntryPoint = "#98")] 20 | internal static extern uint GetImmersiveUserColorSetPreference(bool bForceCheckRegistry, bool bSkipCheckOnFail); 21 | 22 | [DllImport("uxtheme.dll", EntryPoint = "#100", CharSet = CharSet.Unicode)] 23 | internal static extern IntPtr GetImmersiveColorNamedTypeByIndex(uint dwIndex); 24 | 25 | [DllImport("uxtheme.dll", EntryPoint = "#104")] 26 | internal static extern void RefreshImmersiveColorPolicyState(); // RS5 1809 27 | 28 | [DllImport("uxtheme.dll", EntryPoint = "#132")] 29 | internal static extern bool ShouldAppsUseDarkMode(); // RS5 1809 30 | 31 | [DllImport("uxtheme.dll", EntryPoint = "#133")] 32 | internal static extern bool AllowDarkModeForWindow(IntPtr hWnd, bool bAllowDarkMode); // RS5 1809 33 | 34 | [DllImport("uxtheme.dll", EntryPoint = "#135")] 35 | internal static extern bool AllowDarkModeForApp(bool bAllowDarkMode); // RS5 1809 36 | 37 | [DllImport("uxtheme.dll", EntryPoint = "#137")] 38 | internal static extern bool IsDarkModeAllowedForWindow(); // RS5 1809 39 | 40 | [DllImport("uxtheme.dll", EntryPoint = "#135")] 41 | internal static extern PreferredAppMode SetPreferredAppMode(PreferredAppMode appMode); // RS6 1903 42 | 43 | [DllImport("uxtheme.dll", EntryPoint = "#138")] 44 | internal static extern bool ShouldSystemUseDarkMode(); // RS6 1903 45 | 46 | [DllImport("uxtheme.dll", EntryPoint = "#139")] 47 | internal static extern bool IsDarkModeAllowedForApp(); // RS6 1903 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /source/RetroRadiance/Themes/Generic.LinkButton.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 54 | 55 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/PromptTextBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Media; 9 | 10 | namespace MetroRadiance.Controls 11 | { 12 | /// 13 | /// 未入力時にプロンプトを表示できる を表します。 14 | /// 15 | [Obsolete] 16 | [EditorBrowsable(EditorBrowsableState.Never)] 17 | [TemplateVisualState(Name = "Empty", GroupName = "TextStates")] 18 | [TemplateVisualState(Name = "NotEmpty", GroupName = "TextStates")] 19 | public class PromptTextBox : TextBox 20 | { 21 | static PromptTextBox() 22 | { 23 | DefaultStyleKeyProperty.OverrideMetadata(typeof(PromptTextBox), new FrameworkPropertyMetadata(typeof(PromptTextBox))); 24 | } 25 | 26 | public PromptTextBox() 27 | { 28 | this.UpdateTextStates(true); 29 | this.TextChanged += (sender, e) => this.UpdateTextStates(true); 30 | this.GotKeyboardFocus += (sender, e) => this.UpdateTextStates(true); 31 | } 32 | 33 | #region Prompt 依存関係プロパティ 34 | 35 | public string Prompt 36 | { 37 | get { return (string)this.GetValue(PromptProperty); } 38 | set { this.SetValue(PromptProperty, value); } 39 | } 40 | public static readonly DependencyProperty PromptProperty = 41 | DependencyProperty.Register("Prompt", typeof(string), typeof(PromptTextBox), new UIPropertyMetadata("", PromptChangedCallback)); 42 | 43 | private static void PromptChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) 44 | { 45 | } 46 | 47 | #endregion 48 | 49 | #region PromptBrush 依存関係プロパティ 50 | 51 | public Brush PromptBrush 52 | { 53 | get { return (Brush)this.GetValue(PromptBrushProperty); } 54 | set { this.SetValue(PromptBrushProperty, value); } 55 | } 56 | public static readonly DependencyProperty PromptBrushProperty = 57 | DependencyProperty.Register("PromptBrush", typeof(Brush), typeof(PromptTextBox), new UIPropertyMetadata(Brushes.Gray)); 58 | 59 | #endregion 60 | 61 | 62 | private void UpdateTextStates(bool useTransitions) 63 | { 64 | VisualStateManager.GoToState(this, string.IsNullOrEmpty(this.Text) ? "Empty" : "NotEmpty", useTransitions); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/Badge.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Controls; 10 | 11 | namespace MetroRadiance.Controls 12 | { 13 | [Obsolete] 14 | [EditorBrowsable(EditorBrowsableState.Never)] 15 | [TemplatePart(Name = PART_CountHost, Type = typeof(TextBlock))] 16 | public class Badge : Control 17 | { 18 | // ReSharper disable InconsistentNaming 19 | private const string PART_CountHost = "PART_CountHost"; 20 | // ReSharper restore InconsistentNaming 21 | 22 | static Badge() 23 | { 24 | DefaultStyleKeyProperty.OverrideMetadata(typeof(Badge), new FrameworkPropertyMetadata(typeof(Badge))); 25 | } 26 | 27 | private TextBlock block; 28 | private double initialSize; 29 | 30 | #region Count 依存関係プロパティ 31 | 32 | public int? Count 33 | { 34 | get { return (int?)this.GetValue(CountProperty); } 35 | set { this.SetValue(CountProperty, value); } 36 | } 37 | public static readonly DependencyProperty CountProperty = 38 | DependencyProperty.Register("Count", typeof(int?), typeof(Badge), new UIPropertyMetadata(null, CountPropertyChangedCallback)); 39 | 40 | private static void CountPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) 41 | { 42 | var source = (Badge)d; 43 | source.SetCount((int?)e.NewValue); 44 | } 45 | 46 | #endregion 47 | 48 | public Badge() 49 | { 50 | this.SetCount(null); 51 | } 52 | 53 | public override void OnApplyTemplate() 54 | { 55 | base.OnApplyTemplate(); 56 | 57 | this.block = this.GetTemplateChild(PART_CountHost) as TextBlock; 58 | if (this.block != null) 59 | { 60 | this.initialSize = this.block.FontSize; 61 | this.SetCount(this.Count); 62 | } 63 | } 64 | 65 | private void SetCount(int? count) 66 | { 67 | if (count.HasValue) 68 | { 69 | if (this.block != null) 70 | { 71 | this.block.Text = count.Value.ToString(CultureInfo.InvariantCulture); 72 | this.block.FontSize = count.Value >= 10 ? this.initialSize - 1 : this.initialSize; 73 | } 74 | this.Visibility = Visibility.Visible; 75 | } 76 | else 77 | { 78 | this.Visibility = Visibility.Hidden; 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /source/MetroRadiance/Themes/Generic.LinkButton.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /source/MetroRadiance/UI/Theme.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | 6 | namespace MetroRadiance.UI 7 | { 8 | /// 9 | /// MetroRadiance テーマとして使用する色を識別します。 10 | /// 11 | [Serializable] 12 | public struct Theme : IEquatable 13 | { 14 | /// 15 | /// テーマ専用の色が指定されている場合、その色を示す識別子を取得します。 16 | /// 17 | public SpecifiedColor? Specified { get; private set; } 18 | 19 | /// 20 | /// Windows のテーマと同期するかどうかを示す値を取得します。 21 | /// 22 | public bool SyncToWindows => this.Specified == null; 23 | 24 | private Theme(SpecifiedColor color) : this() 25 | { 26 | this.Specified = color; 27 | } 28 | 29 | public bool Equals(Theme theme) 30 | { 31 | return this == theme; 32 | } 33 | 34 | public override bool Equals(object obj) 35 | { 36 | if (ReferenceEquals(null, obj)) return false; 37 | return obj is Theme && this.Equals((Theme)obj); 38 | } 39 | 40 | public override int GetHashCode() 41 | { 42 | // ReSharper disable NonReadonlyMemberInGetHashCode 43 | return this.Specified.GetHashCode(); 44 | // ReSharper restore NonReadonlyMemberInGetHashCode 45 | } 46 | 47 | public override string ToString() 48 | { 49 | if (this.Specified != null) return this.Specified.Value.ToString(); 50 | 51 | return "(Sync to Windows)"; 52 | } 53 | 54 | public static bool operator ==(Theme theme1, Theme theme2) 55 | { 56 | return theme1.Specified == theme2.Specified; 57 | } 58 | 59 | public static bool operator !=(Theme theme1, Theme theme2) 60 | { 61 | return !(theme1 == theme2); 62 | } 63 | 64 | public static Theme Dark { get; } = new Theme(SpecifiedColor.Dark); 65 | public static Theme Light { get; } = new Theme(SpecifiedColor.Light); 66 | 67 | /// 68 | /// Windows のテーマ設定に追従するテーマを取得します。 69 | /// 70 | public static Theme Windows { get; } = new Theme(); 71 | 72 | public enum SpecifiedColor 73 | { 74 | Dark, 75 | Light, 76 | } 77 | 78 | /// 79 | /// シリアル化インフラストラクチャをサポートします。コードから直接使用するためのものではありません。 80 | /// 81 | [EditorBrowsable(EditorBrowsableState.Never)] 82 | // ReSharper disable once InconsistentNaming 83 | public SpecifiedColor? __Specified 84 | { 85 | get { return this.Specified; } 86 | set { this.Specified = value; } 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Converters/WindowStateToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Data; 9 | 10 | namespace MetroRadiance.Converters 11 | { 12 | /// 13 | /// 値が 14 | /// のときに 15 | /// へ、 のときに 16 | /// へ変換するコンバーターを定義します。 17 | /// 18 | [Obsolete] 19 | [EditorBrowsable(EditorBrowsableState.Never)] 20 | public class WindowStateToVisibilityConverter : IValueConverter 21 | { 22 | /// 23 | /// 値から 値へ変換します。 24 | /// 25 | /// 変換元の 値。 26 | /// この引数は使用されません。 27 | /// パラメーター。文字列 "Reverse" を指定すると、変換結果が逆になります。それ以外の値を指定しても使用されません。 28 | /// この引数は使用されません。 29 | /// 値から 値への変換結果。 30 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 31 | { 32 | if (!(value is WindowState)) return Visibility.Collapsed; 33 | 34 | var state = (WindowState)value; 35 | var param = parameter as string; 36 | var isReverse = (param != null && (string.Compare(param, "Reverse", StringComparison.OrdinalIgnoreCase) == 0)); 37 | 38 | return state == WindowState.Normal 39 | ? isReverse ? Visibility.Collapsed : Visibility.Visible 40 | : isReverse ? Visibility.Visible : Visibility.Collapsed; 41 | } 42 | 43 | /// 44 | /// この実装は常に をスローします。 45 | /// 46 | /// この引数は使用されません。 47 | /// この引数は使用されません。 48 | /// この引数は使用されません。 49 | /// この引数は使用されません。 50 | /// 値は返されません。 51 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 52 | { 53 | throw new NotImplementedException(); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /source/RetroRadiance/MetroRadiance/Controls/ThemeHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace MetroRadiance.Controls 9 | { 10 | [Obsolete] 11 | [EditorBrowsable(EditorBrowsableState.Never)] 12 | public static class ThemeHelper 13 | { 14 | private static readonly Dictionary registeredElements = new Dictionary(); 15 | 16 | #region HasThemeResources 添付プロパティ 17 | 18 | public static readonly DependencyProperty HasThemeResourcesProperty = DependencyProperty.RegisterAttached( 19 | "HasThemeResources", 20 | typeof(bool), 21 | typeof(ThemeService), 22 | new PropertyMetadata(false, HasThemeResourcesChangedCallback)); 23 | 24 | public static void SetHasThemeResources(FrameworkElement element, bool value) 25 | { 26 | element.SetValue(HasThemeResourcesProperty, value); 27 | } 28 | 29 | public static bool GetHasThemeResources(FrameworkElement element) 30 | { 31 | return (bool)element.GetValue(HasThemeResourcesProperty); 32 | } 33 | 34 | private static void HasThemeResourcesChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs args) 35 | { 36 | if (DesignerProperties.GetIsInDesignMode(d)) return; 37 | 38 | var element = (FrameworkElement)d; 39 | var oldValue = (bool)args.OldValue; 40 | var newValue = (bool)args.NewValue; 41 | 42 | Action logic = () => 43 | { 44 | if (oldValue && !newValue) 45 | { 46 | // true -> false 47 | IDisposable disposable; 48 | if (registeredElements.TryGetValue(element, out disposable)) 49 | { 50 | registeredElements.Remove(element); 51 | disposable.Dispose(); 52 | } 53 | } 54 | else if (!oldValue && newValue) 55 | { 56 | // false -> true 57 | registeredElements[element] = ThemeService.Current.Register(element.Resources); 58 | } 59 | }; 60 | 61 | if (element.IsInitialized) 62 | { 63 | logic(); 64 | } 65 | else 66 | { 67 | EventHandler handler = null; 68 | handler = (sender, e) => 69 | { 70 | element.Initialized -= handler; 71 | logic(); 72 | }; 73 | element.Initialized += handler; 74 | } 75 | } 76 | 77 | #endregion 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /samples/MetroRadiance.Showcase/UI/HsvSamples.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 16 | 17 | 18 | 23 | 30 | 31 | 32 | 37 | 44 | 45 | 46 | 51 | 58 | 59 | 60 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /source/MetroRadiance.Chrome/Chrome/GlowingEdge.Top.cs: -------------------------------------------------------------------------------- 1 | using MetroRadiance.Chrome.Primitives; 2 | using System; 3 | using System.Windows; 4 | using System.Windows.Input; 5 | using System.Windows.Media; 6 | 7 | namespace MetroRadiance.Chrome 8 | { 9 | [TemplatePart(Name = PART_TopThumb, Type = typeof(FrameworkElement))] 10 | [TemplatePart(Name = PART_TopLeftThumb, Type = typeof(FrameworkElement))] 11 | [TemplatePart(Name = PART_TopRightThumb, Type = typeof(FrameworkElement))] 12 | public sealed class TopGlowingEdge : GlowingEdge 13 | { 14 | private const string PART_TopThumb = nameof(PART_TopThumb); 15 | private const string PART_TopLeftThumb = nameof(PART_TopLeftThumb); 16 | private const string PART_TopRightThumb = nameof(PART_TopRightThumb); 17 | 18 | static TopGlowingEdge() 19 | { 20 | DefaultStyleKeyProperty.OverrideMetadata( 21 | typeof(TopGlowingEdge), 22 | new FrameworkPropertyMetadata(typeof(TopGlowingEdge))); 23 | } 24 | 25 | private FrameworkElement _topThumb; 26 | private FrameworkElement _topLeftThumb; 27 | private FrameworkElement _topRightThumb; 28 | 29 | public override void OnApplyTemplate() 30 | { 31 | base.OnApplyTemplate(); 32 | 33 | this._topThumb = (FrameworkElement)this.GetTemplateChild(PART_TopThumb); 34 | this._topLeftThumb = (FrameworkElement)this.GetTemplateChild(PART_TopLeftThumb); 35 | this._topRightThumb = (FrameworkElement)this.GetTemplateChild(PART_TopRightThumb); 36 | } 37 | 38 | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) 39 | { 40 | var point = e.GetPosition(this); 41 | var result = VisualTreeHelper.HitTest(this, point); 42 | if (result == null) 43 | { 44 | base.OnMouseLeftButtonDown(e); 45 | } 46 | 47 | var window = (TopChromeWindow)Window.GetWindow(this); 48 | if (result.VisualHit == this._topThumb) 49 | { 50 | window.Resize(SizingMode.Top); 51 | } 52 | else if (result.VisualHit == this._topLeftThumb) 53 | { 54 | window.Resize(SizingMode.TopLeft); 55 | } 56 | else if (result.VisualHit == this._topRightThumb) 57 | { 58 | window.Resize(SizingMode.TopRight); 59 | } 60 | } 61 | 62 | protected override void OnMouseDoubleClick(MouseButtonEventArgs e) 63 | { 64 | var window = (TopChromeWindow)Window.GetWindow(this); 65 | if (e.LeftButton == MouseButtonState.Pressed) 66 | { 67 | window.DoubleClick(SizingMode.Top); 68 | } 69 | else 70 | { 71 | base.OnMouseDoubleClick(e); 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Platform/WindowComposition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | using System.Windows.Interop; 7 | using System.Windows.Media; 8 | using MetroRadiance.Interop.Win32; 9 | using MetroRadiance.Media; 10 | 11 | namespace MetroRadiance.Platform 12 | { 13 | public static class WindowComposition 14 | { 15 | public static void Disable(Window window) 16 | { 17 | var accentPolicy = new AccentPolicy 18 | { 19 | AccentState = AccentState.ACCENT_DISABLED, 20 | }; 21 | SetAccentPolicy(window, accentPolicy); 22 | } 23 | 24 | public static void EnableBlur(Window window, AccentFlags accentFlags) 25 | { 26 | var accentPolicy = new AccentPolicy 27 | { 28 | AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND, 29 | AccentFlags = accentFlags, 30 | }; 31 | SetAccentPolicy(window, accentPolicy); 32 | } 33 | 34 | public static void EnableAcrylicBlur(Window window, Color backgroundColor, AccentFlags accentFlags) 35 | { 36 | var accentPolicy = new AccentPolicy 37 | { 38 | AccentState = AccentState.ACCENT_ENABLE_ACRYLICBLURBEHIND, 39 | AccentFlags = accentFlags, 40 | GradientColor = ColorHelper.GetColorAsUInt32(backgroundColor), 41 | }; 42 | SetAccentPolicy(window, accentPolicy); 43 | } 44 | 45 | public static void SetAccentPolicy(Window window, AccentPolicy accentPolicy) 46 | { 47 | var windowInteropHelper = new WindowInteropHelper(window); 48 | var hWnd = windowInteropHelper.EnsureHandle(); 49 | SetAccentPolicy(hWnd, accentPolicy); 50 | } 51 | 52 | public static void SetAccentPolicy(IntPtr hWnd, AccentPolicy accentPolicy) 53 | { 54 | var accentStructSize = Marshal.SizeOf(typeof(AccentPolicy)); 55 | var accentPtr = IntPtr.Zero; 56 | try 57 | { 58 | accentPtr = Marshal.AllocCoTaskMem(accentStructSize); 59 | Marshal.StructureToPtr(accentPolicy, accentPtr, false); 60 | 61 | var data = new WindowCompositionAttributeData 62 | { 63 | Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY, 64 | SizeOfData = accentStructSize, 65 | Data = accentPtr, 66 | }; 67 | User32.SetWindowCompositionAttribute(hWnd, data); 68 | } 69 | finally 70 | { 71 | if (accentPtr != IntPtr.Zero) 72 | { 73 | Marshal.FreeCoTaskMem(accentPtr); 74 | } 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /source/MetroRadiance.Core/Interop/PerMonitorDpi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Interop; 6 | using MetroRadiance.Interop.Win32; 7 | 8 | namespace MetroRadiance.Interop 9 | { 10 | /// 11 | /// Windows 8.1 の Per-Monitor DPI 機能へアクセスできるようにします。 12 | /// 13 | public static class PerMonitorDpi 14 | { 15 | /// 16 | /// Per-Monitor DPI 機能をサポートしているかどうかを示す値を取得します。 17 | /// 18 | /// 19 | /// 動作しているオペレーティング システムが Windows 8.1 (NT 6.3)、もしくは Windows 10 (10.0.x) の場合は true、それ以外の場合は false。 20 | /// 21 | public static bool IsSupported 22 | { 23 | get 24 | { 25 | #if DEBUG 26 | return true; 27 | #else 28 | var version = Environment.OSVersion.Version; 29 | return (version.Major == 6 && version.Minor == 3) || version.Major == 10; 30 | #endif 31 | } 32 | } 33 | 34 | /// 35 | /// 現在の が描画されているモニターの DPI 設定値を取得します。 36 | /// 37 | /// DPI を取得する対象の Win32 ウィンドウを特定する オブジェクト。 38 | /// DPI の種類。既定値は ( と同値) です。 39 | /// が描画されているモニターの DPI 設定値。サポートされていないシステムの場合は 40 | public static Dpi GetDpi(this HwndSource hwndSource, MonitorDpiType dpiType = MonitorDpiType.Default) 41 | { 42 | return GetDpi(hwndSource.Handle, dpiType); 43 | } 44 | 45 | /// 46 | /// 指定したハンドルのウィンドウが描画されているモニターの DPI 設定値を取得します。 47 | /// 48 | /// DPI を取得する対象の Win32 ウィンドウを示すウィンドウ ハンドル。 49 | /// DPI の種類。既定値は ( と同値) です。 50 | /// のウィンドウが描画されているモニターの DPI 設定値。サポートされていないシステムの場合は 51 | public static Dpi GetDpi(IntPtr hWnd, MonitorDpiType dpiType = MonitorDpiType.Default) 52 | { 53 | if (!IsSupported) return Dpi.Default; 54 | 55 | var hmonitor = User32.MonitorFromWindow( 56 | hWnd, 57 | MonitorDefaultTo.MONITOR_DEFAULTTONEAREST); 58 | 59 | uint dpiX = 1, dpiY = 1; 60 | SHCore.GetDpiForMonitor(hmonitor, dpiType, ref dpiX, ref dpiY); 61 | 62 | return new Dpi(dpiX, dpiY); 63 | } 64 | } 65 | } 66 | --------------------------------------------------------------------------------