diff --git a/demo/Ursa.Demo/Views/MainView.axaml b/demo/Ursa.Demo/Views/MainView.axaml index 9e31e57..57f79a7 100644 --- a/demo/Ursa.Demo/Views/MainView.axaml +++ b/demo/Ursa.Demo/Views/MainView.axaml @@ -21,17 +21,9 @@ - - - + ColumnDefinitions="Auto, *" > - - diff --git a/demo/Ursa.Demo/Views/MainWindow.axaml b/demo/Ursa.Demo/Views/MainWindow.axaml index 054e043..a6ee9eb 100644 --- a/demo/Ursa.Demo/Views/MainWindow.axaml +++ b/demo/Ursa.Demo/Views/MainWindow.axaml @@ -1,17 +1,24 @@ - + + + - \ No newline at end of file + \ No newline at end of file diff --git a/demo/Ursa.Demo/Views/MainWindow.axaml.cs b/demo/Ursa.Demo/Views/MainWindow.axaml.cs index 73e4f8a..f6466c3 100644 --- a/demo/Ursa.Demo/Views/MainWindow.axaml.cs +++ b/demo/Ursa.Demo/Views/MainWindow.axaml.cs @@ -1,9 +1,11 @@ +using System; using Avalonia.Controls; using Avalonia.Interactivity; +using Ursa.Controls; namespace Ursa.Demo.Views; -public partial class MainWindow : Window +public partial class MainWindow : UrsaWindow { public MainWindow() { diff --git a/src/Ursa.Themes.Semi/Controls/UrsaWindow.axaml b/src/Ursa.Themes.Semi/Controls/UrsaWindow.axaml new file mode 100644 index 0000000..8f04853 --- /dev/null +++ b/src/Ursa.Themes.Semi/Controls/UrsaWindow.axaml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + Full + + + Full + + + None + + + Full + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Ursa.Themes.Semi/Controls/_index.axaml b/src/Ursa.Themes.Semi/Controls/_index.axaml index 95a65ca..05be946 100644 --- a/src/Ursa.Themes.Semi/Controls/_index.axaml +++ b/src/Ursa.Themes.Semi/Controls/_index.axaml @@ -46,6 +46,7 @@ + diff --git a/src/Ursa/Controls/TitleBar/CaptionButtons.cs b/src/Ursa/Controls/TitleBar/CaptionButtons.cs new file mode 100644 index 0000000..2ff0aeb --- /dev/null +++ b/src/Ursa/Controls/TitleBar/CaptionButtons.cs @@ -0,0 +1,75 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.Metadata; +using Avalonia.Controls.Primitives; +using Irihi.Avalonia.Shared.Helpers; +using Irihi.Avalonia.Shared.Reactive; + +namespace Ursa.Controls; + +[TemplatePart(PART_CloseButton, typeof (Button))] +[TemplatePart(PART_RestoreButton, typeof (Button))] +[TemplatePart(PART_MinimizeButton, typeof (Button))] +[TemplatePart(PART_FullScreenButton, typeof (Button))] +[PseudoClasses(":minimized", ":normal", ":maximized", ":fullscreen")] +public class CaptionButtons: Avalonia.Controls.Chrome.CaptionButtons +{ + private const string PART_CloseButton = "PART_CloseButton"; + private const string PART_RestoreButton = "PART_RestoreButton"; + private const string PART_MinimizeButton = "PART_MinimizeButton"; + private const string PART_FullScreenButton = "PART_FullScreenButton"; + + private Button? _closeButton; + private Button? _restoreButton; + private Button? _minimizeButton; + private Button? _fullScreenButton; + + private IDisposable? _visibilityDisposable; + + protected override void OnApplyTemplate(TemplateAppliedEventArgs e) + { + _closeButton = e.NameScope.Get