2024-02-05 23:08:37 -08:00
|
|
|
using Avalonia.Controls;
|
|
|
|
using Avalonia.Interactivity;
|
|
|
|
using Avalonia.VisualTree;
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
namespace SourceGit.Views
|
|
|
|
{
|
|
|
|
public partial class CaptionButtonsMacOS : UserControl
|
|
|
|
{
|
|
|
|
public CaptionButtonsMacOS()
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
2024-07-14 00:55:15 -07:00
|
|
|
private void MinimizeWindow(object _1, RoutedEventArgs _2)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
var window = this.FindAncestorOfType<Window>();
|
2024-03-17 18:37:06 -07:00
|
|
|
if (window != null)
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
window.WindowState = WindowState.Minimized;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-14 00:55:15 -07:00
|
|
|
private void MaximizeOrRestoreWindow(object _1, RoutedEventArgs _2)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
var window = this.FindAncestorOfType<Window>();
|
2024-03-17 18:37:06 -07:00
|
|
|
if (window != null)
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
window.WindowState = window.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-14 00:55:15 -07:00
|
|
|
private void CloseWindow(object _1, RoutedEventArgs _2)
|
2024-03-17 18:37:06 -07:00
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
var window = this.FindAncestorOfType<Window>();
|
2024-03-17 18:37:06 -07:00
|
|
|
if (window != null)
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
window.Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-03-31 01:54:29 -07:00
|
|
|
}
|