diff --git a/demo/Ursa.Demo/App.axaml b/demo/Ursa.Demo/App.axaml index 9ac19d2..418891c 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 1b2ba8a..980608c 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 45760f5..d548ae6 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 2065973..f447a48 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 5a20b4f..ca15c4c 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 0000000..dd4d12b --- /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 0000000..fe9da4d --- /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 0000000..fb7bb62 --- /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 ebe33e1..3487f47 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 0000000..b243045 --- /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 8de34d2..e17a4a3 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 d0dd7df..24b6674 100644 --- a/src/Ursa/Controls/TitleBar/TitleBar.cs +++ b/src/Ursa/Controls/TitleBar/TitleBar.cs @@ -29,6 +29,15 @@ public class TitleBar: ContentControl 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 0000000..36e4828 --- /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 a23ea2b..73ebd67 100644 --- a/src/Ursa/Windows/UrsaWindow.cs +++ b/src/Ursa/Windows/UrsaWindow.cs @@ -47,7 +47,7 @@ public class UrsaWindow: Window } public static readonly StyledProperty IsTitleBarVisibleProperty = AvaloniaProperty.Register( - nameof(IsTitleBarVisible)); + nameof(IsTitleBarVisible), true); public bool IsTitleBarVisible {