StyleableWindow.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using Avalonia.Controls;
  2. using Avalonia.Controls.Primitives;
  3. using Avalonia.Media;
  4. using Avalonia.Platform;
  5. using FluentAvalonia.UI.Windowing;
  6. using Ryujinx.Ava.Common.Locale;
  7. using Ryujinx.Ava.UI.ViewModels;
  8. namespace Ryujinx.Ava.UI.Windows
  9. {
  10. public class StyleableAppWindow : AppWindow
  11. {
  12. public StyleableAppWindow()
  13. {
  14. WindowStartupLocation = WindowStartupLocation.CenterOwner;
  15. TransparencyLevelHint = [WindowTransparencyLevel.None];
  16. LocaleManager.Instance.LocaleChanged += LocaleChanged;
  17. LocaleChanged();
  18. Icon = MainWindowViewModel.IconBitmap;
  19. }
  20. private void LocaleChanged()
  21. {
  22. FlowDirection = LocaleManager.Instance.IsRTL() ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
  23. }
  24. protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
  25. {
  26. base.OnApplyTemplate(e);
  27. ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome | ExtendClientAreaChromeHints.OSXThickTitleBar;
  28. }
  29. }
  30. public class StyleableWindow : Window
  31. {
  32. public StyleableWindow()
  33. {
  34. WindowStartupLocation = WindowStartupLocation.CenterOwner;
  35. TransparencyLevelHint = [WindowTransparencyLevel.None];
  36. LocaleManager.Instance.LocaleChanged += LocaleChanged;
  37. LocaleChanged();
  38. Icon = new WindowIcon(MainWindowViewModel.IconBitmap);
  39. }
  40. private void LocaleChanged()
  41. {
  42. FlowDirection = LocaleManager.Instance.IsRTL() ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
  43. }
  44. protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
  45. {
  46. base.OnApplyTemplate(e);
  47. ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome | ExtendClientAreaChromeHints.OSXThickTitleBar;
  48. }
  49. }
  50. }