|
@@ -10,6 +10,12 @@ namespace PixiEditor.AvaloniaUI.Views.Dialogs;
|
|
|
|
|
|
internal partial class DialogTitleBar : UserControl, ICustomTranslatorElement
|
|
|
{
|
|
|
+ public static readonly StyledProperty<bool> CanMinimizeProperty = AvaloniaProperty.Register<DialogTitleBar, bool>(
|
|
|
+ nameof(CanMinimize), defaultValue: true);
|
|
|
+
|
|
|
+ public static readonly StyledProperty<bool> CanFullscreenProperty = AvaloniaProperty.Register<DialogTitleBar, bool>(
|
|
|
+ nameof(CanFullscreen), defaultValue: true);
|
|
|
+
|
|
|
public static readonly StyledProperty<string> TitleKeyProperty =
|
|
|
AvaloniaProperty.Register<DialogTitleBar, string>(nameof(TitleKey), string.Empty);
|
|
|
|
|
@@ -30,6 +36,18 @@ internal partial class DialogTitleBar : UserControl, ICustomTranslatorElement
|
|
|
get => GetValue(TitleKeyProperty);
|
|
|
set => SetValue(TitleKeyProperty, value);
|
|
|
}
|
|
|
+
|
|
|
+ public bool CanMinimize
|
|
|
+ {
|
|
|
+ get => GetValue(CanMinimizeProperty);
|
|
|
+ set => SetValue(CanMinimizeProperty, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool CanFullscreen
|
|
|
+ {
|
|
|
+ get => GetValue(CanFullscreenProperty);
|
|
|
+ set => SetValue(CanFullscreenProperty, value);
|
|
|
+ }
|
|
|
|
|
|
public DialogTitleBar()
|
|
|
{
|
|
@@ -59,21 +77,21 @@ internal partial class DialogTitleBar : UserControl, ICustomTranslatorElement
|
|
|
|
|
|
private void MaximizeWindow(object? sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- if (VisualRoot is not Window window)
|
|
|
+ if (VisualRoot is not Window window || !CanFullscreen)
|
|
|
return;
|
|
|
window.WindowState = WindowState.Maximized;
|
|
|
}
|
|
|
|
|
|
private void RestoreWindow(object? sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- if (VisualRoot is not Window window)
|
|
|
+ if (VisualRoot is not Window window || !CanFullscreen)
|
|
|
return;
|
|
|
window.WindowState = WindowState.Normal;
|
|
|
}
|
|
|
|
|
|
private void MinimizeWindow(object? sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- if (VisualRoot is not Window window)
|
|
|
+ if (VisualRoot is not Window window || !CanMinimize)
|
|
|
return;
|
|
|
window.WindowState = WindowState.Minimized;
|
|
|
}
|