This commit is contained in:
Soreepeong 2024-02-26 02:50:30 +09:00
parent eaf447164a
commit cf54a02812
5 changed files with 28 additions and 31 deletions

View file

@ -17,7 +17,7 @@ public interface IActiveNotification : INotification
/// <summary>Invoked upon clicking on the notification.</summary>
/// <remarks>
/// This event is not applicable when <see cref="INotification.Interactible"/> is set to <c>false</c>.
/// 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 +25,7 @@ public interface IActiveNotification : INotification
/// <summary>Invoked when the mouse enters the notification window.</summary>
/// <remarks>
/// This event is applicable regardless of <see cref="INotification.Interactible"/>.
/// 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 +33,7 @@ public interface IActiveNotification : INotification
/// <summary>Invoked when the mouse leaves the notification window.</summary>
/// <remarks>
/// This event is applicable regardless of <see cref="INotification.Interactible"/>.
/// 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,7 +41,7 @@ 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.Interactible"/>.
/// 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>
@ -64,8 +64,8 @@ public interface IActiveNotification : INotification
/// <inheritdoc cref="INotification.Expiry"/>
new DateTime Expiry { get; set; }
/// <inheritdoc cref="INotification.Interactible"/>
new bool Interactible { get; set; }
/// <inheritdoc cref="INotification.Interactable"/>
new bool Interactable { get; set; }
/// <inheritdoc cref="INotification.UserDismissable"/>
new bool UserDismissable { get; set; }

View file

@ -36,12 +36,12 @@ public interface INotification
/// <remarks>
/// Set this value to <c>true</c> if you want to respond to user inputs from
/// <see cref="IActiveNotification.DrawActions"/>.
/// Note that the close buttons for notifications are always provided and interactible.
/// Note that the close buttons for notifications are always provided and interactable.
/// If set to <c>true</c>, then clicking on the notification itself will be interpreted as user-initiated dismissal,
/// unless <see cref="IActiveNotification.Click"/> is set or <see cref="UserDismissable"/> is unset.
/// </remarks>
bool Interactible { get; }
bool Interactable { get; }
/// <summary>Gets a value indicating whether the user can dismiss the notification by themselves.</summary>
/// <remarks>Consider adding a cancel button to <see cref="IActiveNotification.DrawActions"/>.</remarks>
bool UserDismissable { get; }
@ -49,7 +49,7 @@ public interface INotification
/// <summary>Gets the new duration for this notification if mouse cursor is on the notification window.</summary>
/// <remarks>
/// If set to <see cref="TimeSpan.Zero"/> or less, then this feature is turned off.
/// This property is applicable regardless of <see cref="Interactible"/>.
/// This property is applicable regardless of <see cref="Interactable"/>.
/// </remarks>
TimeSpan HoverExtendDuration { get; }

View file

@ -139,15 +139,15 @@ internal sealed class ActiveNotification : IActiveNotification, IDisposable
}
}
/// <inheritdoc cref="IActiveNotification.Interactible"/>
public bool Interactible
/// <inheritdoc cref="IActiveNotification.Interactable"/>
public bool Interactable
{
get => this.underlyingNotification.Interactible;
get => this.underlyingNotification.Interactable;
set
{
if (this.IsDismissed)
return;
this.underlyingNotification.Interactible = value;
this.underlyingNotification.Interactable = value;
}
}
@ -407,7 +407,7 @@ internal sealed class ActiveNotification : IActiveNotification, IDisposable
$"##NotifyMainWindow{this.Id}",
ImGuiWindowFlags.AlwaysAutoResize |
ImGuiWindowFlags.NoDecoration |
(this.Interactible
(this.Interactable
? ImGuiWindowFlags.None
: ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoBringToFrontOnFocus) |
ImGuiWindowFlags.NoNav |
@ -514,7 +514,7 @@ internal sealed class ActiveNotification : IActiveNotification, IDisposable
this.Type = newNotification.Type;
this.IconSource = newNotification.IconSource;
this.Expiry = newNotification.Expiry;
this.Interactible = newNotification.Interactible;
this.Interactable = newNotification.Interactable;
this.HoverExtendDuration = newNotification.HoverExtendDuration;
this.newProgress = newNotification.Progress;
}
@ -538,16 +538,14 @@ internal sealed class ActiveNotification : IActiveNotification, IDisposable
this.MouseEnter = RemoveNonDalamudInvocationsCore(this.MouseEnter);
this.MouseLeave = RemoveNonDalamudInvocationsCore(this.MouseLeave);
this.underlyingNotification.Interactible = false;
this.Interactable = true;
this.IsInitiatorUnloaded = true;
this.UserDismissable = true;
this.HoverExtendDuration = NotificationConstants.DefaultHoverExtendDuration;
var now = DateTime.Now;
var newMaxExpiry = now + NotificationConstants.DefaultDisplayDuration;
if (this.underlyingNotification.Expiry > newMaxExpiry)
{
this.underlyingNotification.Expiry = newMaxExpiry;
this.ExpiryRelativeToTime = now;
}
var newMaxExpiry = DateTime.Now + NotificationConstants.DefaultDisplayDuration;
if (this.Expiry > newMaxExpiry)
this.Expiry = newMaxExpiry;
return;

View file

@ -1,4 +1,3 @@
using Dalamud.Interface.ImGuiNotification.Internal;
using Dalamud.Interface.Internal.Notifications;
namespace Dalamud.Interface.ImGuiNotification;
@ -22,10 +21,10 @@ public sealed record Notification : INotification
public DateTime Expiry { get; set; } = DateTime.Now + NotificationConstants.DefaultDisplayDuration;
/// <inheritdoc/>
public bool Interactible { get; set; }
public bool Interactable { get; set; } = true;
/// <inheritdoc/>
public bool UserDismissable { get; set; }
public bool UserDismissable { get; set; } = true;
/// <inheritdoc/>
public TimeSpan HoverExtendDuration { get; set; } = NotificationConstants.DefaultHoverExtendDuration;

View file

@ -119,7 +119,7 @@ internal class ImGuiWidget : IDataWindowWidget
NotificationTemplate.ProgressModeTitles,
NotificationTemplate.ProgressModeTitles.Length);
ImGui.Checkbox("Interactible", ref this.notificationTemplate.Interactible);
ImGui.Checkbox("Interactable", ref this.notificationTemplate.Interactable);
ImGui.Checkbox("User Dismissable", ref this.notificationTemplate.UserDismissable);
@ -148,7 +148,7 @@ internal class ImGuiWidget : IDataWindowWidget
Content = text,
Title = title,
Type = type,
Interactible = this.notificationTemplate.Interactible,
Interactable = this.notificationTemplate.Interactable,
UserDismissable = this.notificationTemplate.UserDismissable,
Expiry = duration == TimeSpan.MaxValue ? DateTime.MaxValue : DateTime.Now + duration,
Progress = this.notificationTemplate.ProgressMode switch
@ -331,7 +331,7 @@ internal class ImGuiWidget : IDataWindowWidget
public bool ManualType;
public int TypeInt;
public int DurationInt;
public bool Interactible;
public bool Interactable;
public bool UserDismissable;
public bool ActionBar;
public int ProgressMode;
@ -348,7 +348,7 @@ internal class ImGuiWidget : IDataWindowWidget
this.ManualType = false;
this.TypeInt = (int)NotificationType.None;
this.DurationInt = 2;
this.Interactible = true;
this.Interactable = true;
this.UserDismissable = true;
this.ActionBar = true;
this.ProgressMode = 0;