From 122821317f14cc968b78c61b342f36cf762b0c9e Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 23 Jun 2020 17:44:34 -0300 Subject: [PATCH] remove unused hint flags. --- .../Pages/WindowCustomizationsPage.xaml | 6 +- .../ViewModels/MainWindowViewModel.cs | 71 +++++-------------- .../Platform/ExtendClientAreaChromeHints.cs | 11 +-- 3 files changed, 22 insertions(+), 66 deletions(-) diff --git a/samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml b/samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml index e3fdbeaa69..db2a8a465a 100644 --- a/samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml +++ b/samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml @@ -6,10 +6,8 @@ x:Class="ControlCatalog.Pages.WindowCustomizationsPage"> - - - - + + None diff --git a/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs b/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs index 2dab49cf0a..e8dd12269b 100644 --- a/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs +++ b/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs @@ -16,6 +16,12 @@ namespace ControlCatalog.ViewModels private bool _isMenuItemChecked = true; private WindowState _windowState; private WindowState[] _windowStates; + private int _transparencyLevel; + private ExtendClientAreaChromeHints _chromeHints; + private bool _extendClientAreaEnabled; + private bool _systemTitleBarEnabled; + private bool _preferSystemChromeEnabled; + private double _titleBarHeight; public MainWindowViewModel(IManagedNotificationManager notificationManager) { @@ -65,27 +71,17 @@ namespace ControlCatalog.ViewModels WindowState.FullScreen, }; - this.WhenAnyValue(x => x.SystemChromeButtonsEnabled, x=>x.ManagedChromeButtonsEnabled, x => x.SystemTitleBarEnabled, x=>x.PreferSystemChromeButtonsEnabled) + this.WhenAnyValue(x => x.SystemTitleBarEnabled, x=>x.PreferSystemChromeEnabled) .Subscribe(x => { var hints = ExtendClientAreaChromeHints.NoChrome | ExtendClientAreaChromeHints.OSXThickTitleBar; if(x.Item1) - { - hints |= ExtendClientAreaChromeHints.SystemChromeButtons; - } - - if(x.Item2) - { - hints |= ExtendClientAreaChromeHints.ManagedChromeButtons; - } - - if(x.Item3) { hints |= ExtendClientAreaChromeHints.SystemTitleBar; } - if(x.Item4) + if(x.Item2) { hints |= ExtendClientAreaChromeHints.PreferSystemChromeButtons; } @@ -93,69 +89,39 @@ namespace ControlCatalog.ViewModels ChromeHints = hints; }); - SystemTitleBarEnabled = true; - SystemChromeButtonsEnabled = true; + SystemTitleBarEnabled = true; TitleBarHeight = -1; - } - - private int _transparencyLevel; + } public int TransparencyLevel { get { return _transparencyLevel; } set { this.RaiseAndSetIfChanged(ref _transparencyLevel, value); } - } - - private ExtendClientAreaChromeHints _chromeHints; + } public ExtendClientAreaChromeHints ChromeHints { get { return _chromeHints; } set { this.RaiseAndSetIfChanged(ref _chromeHints, value); } - } - - - private bool _extendClientAreaEnabled; + } public bool ExtendClientAreaEnabled { get { return _extendClientAreaEnabled; } set { this.RaiseAndSetIfChanged(ref _extendClientAreaEnabled, value); } - } - - private bool _systemTitleBarEnabled; + } public bool SystemTitleBarEnabled { get { return _systemTitleBarEnabled; } set { this.RaiseAndSetIfChanged(ref _systemTitleBarEnabled, value); } - } - - private bool _systemChromeButtonsEnabled; + } - public bool SystemChromeButtonsEnabled + public bool PreferSystemChromeEnabled { - get { return _systemChromeButtonsEnabled; } - set { this.RaiseAndSetIfChanged(ref _systemChromeButtonsEnabled, value); } - } - - private bool _managedChromeButtonsEnabled; - - public bool ManagedChromeButtonsEnabled - { - get { return _managedChromeButtonsEnabled; } - set { this.RaiseAndSetIfChanged(ref _managedChromeButtonsEnabled, value); } - } - - private bool _preferSystemChromeButtonsEnabled; - - public bool PreferSystemChromeButtonsEnabled - { - get { return _preferSystemChromeButtonsEnabled; } - set { this.RaiseAndSetIfChanged(ref _preferSystemChromeButtonsEnabled, value); } - } - - private double _titleBarHeight; + get { return _preferSystemChromeEnabled; } + set { this.RaiseAndSetIfChanged(ref _preferSystemChromeEnabled, value); } + } public double TitleBarHeight { @@ -163,7 +129,6 @@ namespace ControlCatalog.ViewModels set { this.RaiseAndSetIfChanged(ref _titleBarHeight, value); } } - public WindowState WindowState { get { return _windowState; } diff --git a/src/Avalonia.Controls/Platform/ExtendClientAreaChromeHints.cs b/src/Avalonia.Controls/Platform/ExtendClientAreaChromeHints.cs index 022b609699..fb6a4056db 100644 --- a/src/Avalonia.Controls/Platform/ExtendClientAreaChromeHints.cs +++ b/src/Avalonia.Controls/Platform/ExtendClientAreaChromeHints.cs @@ -8,14 +8,7 @@ namespace Avalonia.Platform NoChrome, Default = SystemTitleBar, SystemTitleBar = 0x01, - ManagedChromeButtons = 0x02, - SystemChromeButtons = 0x04, - - OSXThickTitleBar = 0x08, - - PreferSystemChromeButtons = 0x10, - - AdaptiveChromeWithTitleBar = SystemTitleBar | PreferSystemChromeButtons, - AdaptiveChromeWithoutTitleBar = PreferSystemChromeButtons, + PreferSystemChromeButtons = 0x02, + OSXThickTitleBar = 0x08, } }