Give the application a settings area built from what really exists

This commit is contained in:
2026-08-08 14:17:19 +02:00
parent 422d5ca10e
commit c8507b44fe
42 changed files with 3810 additions and 1083 deletions
@@ -0,0 +1,47 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
namespace DodoSSH.Client.App.Views;
/// <summary>Settings mode's own titlebar — see the remark in the markup for why it is not TitleBar itself.</summary>
internal sealed partial class SettingsTitleBar : UserControl
{
public SettingsTitleBar() => InitializeComponent();
private Window? Host => TopLevel.GetTopLevel(this) as Window;
/// <summary>Left button only, and only on a press nothing inside the bar has already handled.</summary>
private void OnDrag(object? sender, PointerPressedEventArgs e)
{
if (e.Handled || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
{
return;
}
Host?.BeginMoveDrag(e);
}
private void OnMinimise(object? sender, RoutedEventArgs e)
{
if (Host is { } window)
{
window.WindowState = WindowState.Minimized;
}
}
/// <summary>Both the button and a double-click on the bar arrive here, as Windows convention expects.</summary>
private void OnToggleMaximised(object? sender, RoutedEventArgs e)
{
if (Host is not { } window)
{
return;
}
window.WindowState = window.WindowState == WindowState.Maximized
? WindowState.Normal
: WindowState.Maximized;
}
private void OnClose(object? sender, RoutedEventArgs e) => Host?.Close();
}