diff --git a/demo/Ursa.Demo/App.axaml b/demo/Ursa.Demo/App.axaml index 9ac19d2b..418891cc 100644 --- a/demo/Ursa.Demo/App.axaml +++ b/demo/Ursa.Demo/App.axaml @@ -1,7 +1,7 @@ diff --git a/demo/Ursa.Demo/App.axaml.cs b/demo/Ursa.Demo/App.axaml.cs index 1b2ba8ae..980608c6 100644 --- a/demo/Ursa.Demo/App.axaml.cs +++ b/demo/Ursa.Demo/App.axaml.cs @@ -1,4 +1,5 @@ using Avalonia; +using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; using Ursa.Demo.ViewModels; diff --git a/demo/Ursa.Demo/Views/MainWindow.axaml b/demo/Ursa.Demo/Views/MainWindow.axaml index 45760f58..d548ae68 100644 --- a/demo/Ursa.Demo/Views/MainWindow.axaml +++ b/demo/Ursa.Demo/Views/MainWindow.axaml @@ -16,9 +16,7 @@ Icon="/Assets/Ursa.ico" mc:Ignorable="d"> - + \ No newline at end of file diff --git a/demo/Ursa.Demo/Views/SingleView.axaml b/demo/Ursa.Demo/Views/SingleView.axaml index 20659738..f447a48d 100644 --- a/demo/Ursa.Demo/Views/SingleView.axaml +++ b/demo/Ursa.Demo/Views/SingleView.axaml @@ -1,4 +1,4 @@ - - - - - - + + + + + diff --git a/demo/Ursa.Demo/Views/SingleView.axaml.cs b/demo/Ursa.Demo/Views/SingleView.axaml.cs index 5a20b4f5..ca15c4c7 100644 --- a/demo/Ursa.Demo/Views/SingleView.axaml.cs +++ b/demo/Ursa.Demo/Views/SingleView.axaml.cs @@ -1,8 +1,9 @@ using Avalonia.Controls; +using Ursa.Controls; namespace Ursa.Demo.Views; -public partial class SingleView : UserControl +public partial class SingleView : UrsaView { public SingleView() { diff --git a/demo/Ursa.Demo/Views/TitleBarRightContent.axaml b/demo/Ursa.Demo/Views/TitleBarRightContent.axaml new file mode 100644 index 00000000..dd4d12b9 --- /dev/null +++ b/demo/Ursa.Demo/Views/TitleBarRightContent.axaml @@ -0,0 +1,20 @@ + + + + + + diff --git a/demo/Ursa.Demo/Views/TitleBarRightContent.axaml.cs b/demo/Ursa.Demo/Views/TitleBarRightContent.axaml.cs new file mode 100644 index 00000000..fe9da4da --- /dev/null +++ b/demo/Ursa.Demo/Views/TitleBarRightContent.axaml.cs @@ -0,0 +1,23 @@ +using System; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Interactivity; +using Avalonia.Markup.Xaml; + +namespace Ursa.Demo.Views; + +public partial class TitleBarRightContent : UserControl +{ + public TitleBarRightContent() + { + InitializeComponent(); + } + + private async void OpenRepository(object? sender, RoutedEventArgs e) + { + var top = TopLevel.GetTopLevel(this); + if (top is null) return; + var launcher = top.Launcher; + await launcher.LaunchUriAsync(new Uri("https://github.com/irihitech/Ursa.Avalonia")); + } +} \ No newline at end of file diff --git a/src/Ursa.Themes.Semi/Controls/UrsaView.axaml b/src/Ursa.Themes.Semi/Controls/UrsaView.axaml new file mode 100644 index 00000000..fb7bb62f --- /dev/null +++ b/src/Ursa.Themes.Semi/Controls/UrsaView.axaml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Ursa.Themes.Semi/Controls/UrsaWindow.axaml b/src/Ursa.Themes.Semi/Controls/UrsaWindow.axaml index ebe33e1e..3487f478 100644 --- a/src/Ursa.Themes.Semi/Controls/UrsaWindow.axaml +++ b/src/Ursa.Themes.Semi/Controls/UrsaWindow.axaml @@ -60,6 +60,7 @@ + diff --git a/src/Ursa.Themes.Semi/Styles/UrsaView.axaml b/src/Ursa.Themes.Semi/Styles/UrsaView.axaml new file mode 100644 index 00000000..b2430456 --- /dev/null +++ b/src/Ursa.Themes.Semi/Styles/UrsaView.axaml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/src/Ursa.Themes.Semi/Styles/_index.axaml b/src/Ursa.Themes.Semi/Styles/_index.axaml index 8de34d29..e17a4a31 100644 --- a/src/Ursa.Themes.Semi/Styles/_index.axaml +++ b/src/Ursa.Themes.Semi/Styles/_index.axaml @@ -10,5 +10,6 @@ + diff --git a/src/Ursa/Controls/TitleBar/TitleBar.cs b/src/Ursa/Controls/TitleBar/TitleBar.cs index d0dd7dff..24b6674f 100644 --- a/src/Ursa/Controls/TitleBar/TitleBar.cs +++ b/src/Ursa/Controls/TitleBar/TitleBar.cs @@ -29,6 +29,15 @@ public object? RightContent get => GetValue(RightContentProperty); set => SetValue(RightContentProperty, value); } + + public static readonly StyledProperty IsTitleVisibleProperty = AvaloniaProperty.Register( + nameof(IsTitleVisible)); + + public bool IsTitleVisible + { + get => GetValue(IsTitleVisibleProperty); + set => SetValue(IsTitleVisibleProperty, value); + } protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { diff --git a/src/Ursa/Windows/UrsaView.cs b/src/Ursa/Windows/UrsaView.cs new file mode 100644 index 00000000..36e48284 --- /dev/null +++ b/src/Ursa/Windows/UrsaView.cs @@ -0,0 +1,55 @@ +using Avalonia; +using Avalonia.Controls; + +namespace Ursa.Controls; + +/// +/// Ursa window is designed to +/// +public class UrsaView: ContentControl +{ + public static readonly StyledProperty IsTitleBarVisibleProperty = + UrsaWindow.IsTitleBarVisibleProperty.AddOwner(); + + public bool IsTitleBarVisible + { + get => GetValue(IsTitleBarVisibleProperty); + set => SetValue(IsTitleBarVisibleProperty, value); + } + + public static readonly StyledProperty LeftContentProperty = + UrsaWindow.LeftContentProperty.AddOwner(); + + public object? LeftContent + { + get => GetValue(LeftContentProperty); + set => SetValue(LeftContentProperty, value); + } + + public static readonly StyledProperty RightContentProperty = + UrsaWindow.RightContentProperty.AddOwner(); + + public object? RightContent + { + get => GetValue(RightContentProperty); + set => SetValue(RightContentProperty, value); + } + + public static readonly StyledProperty TitleBarContentProperty = + UrsaWindow.TitleBarContentProperty.AddOwner(); + + public object? TitleBarContent + { + get => GetValue(TitleBarContentProperty); + set => SetValue(TitleBarContentProperty, value); + } + + public static readonly StyledProperty TitleBarMarginProperty = + UrsaWindow.TitleBarMarginProperty.AddOwner(); + + public Thickness TitleBarMargin + { + get => GetValue(TitleBarMarginProperty); + set => SetValue(TitleBarMarginProperty, value); + } +} \ No newline at end of file diff --git a/src/Ursa/Windows/UrsaWindow.cs b/src/Ursa/Windows/UrsaWindow.cs index a23ea2bc..73ebd676 100644 --- a/src/Ursa/Windows/UrsaWindow.cs +++ b/src/Ursa/Windows/UrsaWindow.cs @@ -47,7 +47,7 @@ public bool IsCloseButtonVisible } public static readonly StyledProperty IsTitleBarVisibleProperty = AvaloniaProperty.Register( - nameof(IsTitleBarVisible)); + nameof(IsTitleBarVisible), true); public bool IsTitleBarVisible {