using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Notifications; using Avalonia.Controls.Primitives; using Avalonia.Media; using SukiUI.ColorTheme; using SukiUI.Content; namespace SukiUI.Controls; public class InfoBar : ContentControl { public static readonly StyledProperty SeverityProperty = AvaloniaProperty.Register(nameof(Severity), NotificationType.Information); public NotificationType Severity { get => GetValue(SeverityProperty); set { Icon = value switch { NotificationType.Information => Icons.InformationOutline, NotificationType.Success => Icons.Check, NotificationType.Warning => Icons.AlertOutline, NotificationType.Error => Icons.AlertOutline, _ => Icons.InformationOutline }; IconForeground = value switch { NotificationType.Information => NotificationColor.InfoIconForeground, NotificationType.Success => NotificationColor.SuccessIconForeground, NotificationType.Warning => NotificationColor.WarningIconForeground, NotificationType.Error => NotificationColor.ErrorIconForeground, _ => NotificationColor.InfoIconForeground }; SetValue(SeverityProperty, value); } } public static readonly StyledProperty IconProperty = AvaloniaProperty.Register(nameof(Icon), Icons.InformationOutline); public object? Icon { get => GetValue(IconProperty); private set => SetValue(IconProperty, value); } public static readonly StyledProperty IconForegroundProperty = AvaloniaProperty.Register(nameof(IconForeground), NotificationColor.InfoIconForeground); public IBrush? IconForeground { get => GetValue(IconForegroundProperty); private set => SetValue(IconForegroundProperty, value); } public static readonly StyledProperty IsOpenProperty = AvaloniaProperty.Register(nameof(IsOpen), true); public bool IsOpen { get => GetValue(IsOpenProperty); set => SetValue(IsOpenProperty, value); } public static readonly StyledProperty IsClosableProperty = AvaloniaProperty.Register(nameof(IsClosable), true); public bool IsClosable { get => GetValue(IsClosableProperty); set => SetValue(IsClosableProperty, value); } public static readonly StyledProperty IsOpaqueProperty = AvaloniaProperty.Register(nameof(IsOpaque), false); public bool IsOpaque { get => GetValue(IsOpaqueProperty); set => SetValue(IsOpaqueProperty, value); } public static readonly StyledProperty TitleProperty = AvaloniaProperty.Register(nameof(Title), string.Empty); public string Title { get => GetValue(TitleProperty); set => SetValue(TitleProperty, value); } public static readonly StyledProperty MessageProperty = AvaloniaProperty.Register(nameof(Message), string.Empty); public string Message { get => GetValue(MessageProperty); set => SetValue(MessageProperty, value); } protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); e.NameScope.Get