Make notifications minimizable, remove interactable

This commit is contained in:
Soreepeong 2024-02-26 19:51:00 +09:00
parent e96089f8b2
commit 0040f61125
12 changed files with 688 additions and 424 deletions

View file

@ -1,7 +1,5 @@
using System.Threading;
using Dalamud.Interface.Internal.Notifications;
namespace Dalamud.Interface.ImGuiNotification;
/// <summary>Represents an active notification.</summary>
@ -17,7 +15,6 @@ public interface IActiveNotification : INotification
/// <summary>Invoked upon clicking on the notification.</summary>
/// <remarks>
/// This event is not applicable when <see cref="INotification.Interactable"/> is set to <c>false</c>.
/// Note that this function may be called even after <see cref="Dismiss"/> has been invoked.
/// Refer to <see cref="IsDismissed"/>.
/// </remarks>
@ -25,7 +22,6 @@ public interface IActiveNotification : INotification
/// <summary>Invoked when the mouse enters the notification window.</summary>
/// <remarks>
/// This event is applicable regardless of <see cref="INotification.Interactable"/>.
/// Note that this function may be called even after <see cref="Dismiss"/> has been invoked.
/// Refer to <see cref="IsDismissed"/>.
/// </remarks>
@ -33,7 +29,6 @@ public interface IActiveNotification : INotification
/// <summary>Invoked when the mouse leaves the notification window.</summary>
/// <remarks>
/// This event is applicable regardless of <see cref="INotification.Interactable"/>.
/// Note that this function may be called even after <see cref="Dismiss"/> has been invoked.
/// Refer to <see cref="IsDismissed"/>.
/// </remarks>
@ -41,42 +36,18 @@ public interface IActiveNotification : INotification
/// <summary>Invoked upon drawing the action bar of the notification.</summary>
/// <remarks>
/// This event is applicable regardless of <see cref="INotification.Interactable"/>.
/// Note that this function may be called even after <see cref="Dismiss"/> has been invoked.
/// Refer to <see cref="IsDismissed"/>.
/// </remarks>
event Action<IActiveNotification> DrawActions;
/// <inheritdoc cref="INotification.Content"/>
new string Content { get; set; }
/// <inheritdoc cref="INotification.Title"/>
new string? Title { get; set; }
/// <inheritdoc cref="INotification.Type"/>
new NotificationType Type { get; set; }
/// <inheritdoc cref="INotification.Expiry"/>
new DateTime Expiry { get; set; }
/// <inheritdoc cref="INotification.ShowIndeterminateIfNoExpiry"/>
new bool ShowIndeterminateIfNoExpiry { get; set; }
/// <inheritdoc cref="INotification.Interactable"/>
new bool Interactable { get; set; }
/// <inheritdoc cref="INotification.UserDismissable"/>
new bool UserDismissable { get; set; }
/// <inheritdoc cref="INotification.HoverExtendDuration"/>
new TimeSpan HoverExtendDuration { get; set; }
/// <inheritdoc cref="INotification.Progress"/>
new float Progress { get; set; }
/// <summary>Gets the ID of this notification.</summary>
long Id { get; }
/// <summary>Gets the effective expiry time.</summary>
/// <remarks>Contains <see cref="DateTime.MaxValue"/> if the notification does not expire.</remarks>
DateTime EffectiveExpiry { get; }
/// <summary>Gets a value indicating whether the mouse cursor is on the notification window.</summary>
bool IsMouseHovered { get; }
@ -87,16 +58,15 @@ public interface IActiveNotification : INotification
/// <summary>Dismisses this notification.</summary>
void DismissNow();
/// <summary>Extends this notifiation.</summary>
/// <param name="extension">The extension time.</param>
/// <remarks>This does not override <see cref="INotification.HardExpiry"/>.</remarks>
void ExtendBy(TimeSpan extension);
/// <summary>Loads the icon again using the same <see cref="INotification.IconSource"/>.</summary>
/// <remarks>If <see cref="IsDismissed"/> is <c>true</c>, then this function is a no-op.</remarks>
void UpdateIcon();
/// <summary>Disposes the previous icon source, take ownership of the new icon source,
/// and calls <see cref="UpdateIcon"/>.</summary>
/// <param name="newIconSource">Thew new icon source.</param>
/// <remarks>If <see cref="IsDismissed"/> is <c>true</c>, then this function is a no-op.</remarks>
void UpdateIconSource(INotificationIconSource? newIconSource);
/// <summary>Generates a new value to use for <see cref="Id"/>.</summary>
/// <returns>The new value.</returns>
internal static long CreateNewId() => Interlocked.Increment(ref idCounter);