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-03-17 18:37:06 -07:00
|
|
|
private void MinimizeWindow(object sender, RoutedEventArgs e)
|
|
|
|
{
|
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-03-17 18:37:06 -07:00
|
|
|
private void MaximizeOrRestoreWindow(object sender, RoutedEventArgs e)
|
|
|
|
{
|
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-03-17 18:37:06 -07:00
|
|
|
private void CloseWindow(object sender, RoutedEventArgs e)
|
|
|
|
{
|
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
|
|
|
}
|