mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-03-10 09:04:23 +00:00
misc: chore: add helper constructor parameter to StyleableWindow to auto use custom title bar based on configuration
This commit is contained in:
parent
bed3835718
commit
dd02c8e25d
@ -21,12 +21,10 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
SearchBoxNormal = { Text = titleId ?? string.Empty }
|
||||
});
|
||||
|
||||
public CompatibilityListWindow()
|
||||
public CompatibilityListWindow() : base(useCustomTitleBar: true)
|
||||
{
|
||||
Title = RyujinxApp.FormatTitle(LocaleKeys.CompatibilityListTitle);
|
||||
|
||||
TitleBar.ExtendsContentIntoTitleBar = !ConfigurationState.Instance.ShowTitleBar;
|
||||
TitleBar.TitleBarHitTestType = ConfigurationState.Instance.ShowTitleBar ? TitleBarHitTestType.Simple : TitleBarHitTestType.Complex;
|
||||
TitleBar.Height = 37;
|
||||
|
||||
InitializeComponent();
|
||||
|
@ -76,7 +76,7 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
public readonly double StatusBarHeight;
|
||||
public readonly double MenuBarHeight;
|
||||
|
||||
public MainWindow()
|
||||
public MainWindow() : base(useCustomTitleBar: true)
|
||||
{
|
||||
DataContext = ViewModel = new MainWindowViewModel
|
||||
{
|
||||
@ -90,9 +90,6 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
|
||||
ViewModel.Title = RyujinxApp.FormatTitle();
|
||||
|
||||
TitleBar.ExtendsContentIntoTitleBar = !ConfigurationState.Instance.ShowTitleBar;
|
||||
TitleBar.TitleBarHitTestType = (ConfigurationState.Instance.ShowTitleBar) ? TitleBarHitTestType.Simple : TitleBarHitTestType.Complex;
|
||||
|
||||
// NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point.
|
||||
StatusBarHeight = StatusBarView.StatusBar.MinHeight;
|
||||
MenuBarHeight = MenuBar.MinHeight;
|
||||
|
@ -6,6 +6,7 @@ using Avalonia.Media;
|
||||
using Avalonia.Platform;
|
||||
using FluentAvalonia.UI.Windowing;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Systems.Configuration;
|
||||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -21,7 +22,7 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
await appWindow.ShowDialog(owner ?? RyujinxApp.MainWindow);
|
||||
}
|
||||
|
||||
protected StyleableAppWindow()
|
||||
protected StyleableAppWindow(bool useCustomTitleBar = false)
|
||||
{
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
TransparencyLevelHint = [WindowTransparencyLevel.None];
|
||||
@ -29,6 +30,12 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
LocaleManager.Instance.LocaleChanged += LocaleChanged;
|
||||
LocaleChanged();
|
||||
|
||||
if (useCustomTitleBar)
|
||||
{
|
||||
TitleBar.ExtendsContentIntoTitleBar = !ConfigurationState.Instance.ShowTitleBar;
|
||||
TitleBar.TitleBarHitTestType = ConfigurationState.Instance.ShowTitleBar ? TitleBarHitTestType.Simple : TitleBarHitTestType.Complex;
|
||||
}
|
||||
|
||||
Icon = MainWindowViewModel.IconBitmap;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user