mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-29 20:03:41 +01:00
* Add IconTexture/Wrap to INotification (#1738) Notification record and IActiveNotification interface now supports setting or updating the texture wraps being used, and SetIconTexture has gotten more overloads to support leaveOpen mechanism that can commonly be found with Stream wrappers. ImGui widget is updated to support testing setting "leaveOpen" and updating "IconTexture" property via setter, making it possible to check whether IDTW.Dispose is being called under given conditions. Some changes to doccomments are made. * typo
This commit is contained in:
parent
12d70f0749
commit
55bd845a63
7 changed files with 231 additions and 40 deletions
|
|
@ -56,7 +56,7 @@ public interface IActiveNotification : INotification
|
|||
/// from <see cref="INotification.Icon"/>.</param>
|
||||
/// <remarks>
|
||||
/// <para>The texture passed will be disposed when the notification is dismissed or a new different texture is set
|
||||
/// via another call to this function. You do not have to dispose it yourself.</para>
|
||||
/// via another call to this function or overwriting the property. You do not have to dispose it yourself.</para>
|
||||
/// <para>If <see cref="DismissReason"/> is not <c>null</c>, then calling this function will simply dispose the
|
||||
/// passed <paramref name="textureWrap"/> without actually updating the icon.</para>
|
||||
/// </remarks>
|
||||
|
|
@ -68,8 +68,8 @@ public interface IActiveNotification : INotification
|
|||
/// revert back to the icon specified from <see cref="INotification.Icon"/>.</param>
|
||||
/// <remarks>
|
||||
/// <para>The texture resulted from the passed <see cref="Task{TResult}"/> will be disposed when the notification
|
||||
/// is dismissed or a new different texture is set via another call to this function. You do not have to dispose the
|
||||
/// resulted instance of <see cref="IDalamudTextureWrap"/> yourself.</para>
|
||||
/// is dismissed or a new different texture is set via another call to this function over overwriting the property.
|
||||
/// You do not have to dispose the resulted instance of <see cref="IDalamudTextureWrap"/> yourself.</para>
|
||||
/// <para>If the task fails for any reason, the exception will be silently ignored and the icon specified from
|
||||
/// <see cref="INotification.Icon"/> will be used instead.</para>
|
||||
/// <para>If <see cref="DismissReason"/> is not <c>null</c>, then calling this function will simply dispose the
|
||||
|
|
@ -77,6 +77,38 @@ public interface IActiveNotification : INotification
|
|||
/// </remarks>
|
||||
void SetIconTexture(Task<IDalamudTextureWrap?>? textureWrapTask);
|
||||
|
||||
/// <summary>Sets the icon from <see cref="IDalamudTextureWrap"/>, overriding the icon.</summary>
|
||||
/// <param name="textureWrap">The new texture wrap to use, or null to clear and revert back to the icon specified
|
||||
/// from <see cref="INotification.Icon"/>.</param>
|
||||
/// <param name="leaveOpen">Whether to keep the passed <paramref name="textureWrap"/> not disposed.</param>
|
||||
/// <remarks>
|
||||
/// <para>If <paramref name="leaveOpen"/> is <c>false</c>, the texture passed will be disposed when the
|
||||
/// notification is dismissed or a new different texture is set via another call to this function. You do not have
|
||||
/// to dispose it yourself.</para>
|
||||
/// <para>If <see cref="DismissReason"/> is not <c>null</c> and <paramref name="leaveOpen"/> is <c>false</c>, then
|
||||
/// calling this function will simply dispose the passed <paramref name="textureWrap"/> without actually updating
|
||||
/// the icon.</para>
|
||||
/// </remarks>
|
||||
void SetIconTexture(IDalamudTextureWrap? textureWrap, bool leaveOpen);
|
||||
|
||||
/// <summary>Sets the icon from <see cref="IDalamudTextureWrap"/>, overriding the icon, once the given task
|
||||
/// completes.</summary>
|
||||
/// <param name="textureWrapTask">The task that will result in a new texture wrap to use, or null to clear and
|
||||
/// revert back to the icon specified from <see cref="INotification.Icon"/>.</param>
|
||||
/// <param name="leaveOpen">Whether to keep the result from the passed <paramref name="textureWrapTask"/> not
|
||||
/// disposed.</param>
|
||||
/// <remarks>
|
||||
/// <para>If <paramref name="leaveOpen"/> is <c>false</c>, the texture resulted from the passed
|
||||
/// <see cref="Task{TResult}"/> will be disposed when the notification is dismissed or a new different texture is
|
||||
/// set via another call to this function. You do not have to dispose the resulted instance of
|
||||
/// <see cref="IDalamudTextureWrap"/> yourself.</para>
|
||||
/// <para>If the task fails for any reason, the exception will be silently ignored and the icon specified from
|
||||
/// <see cref="INotification.Icon"/> will be used instead.</para>
|
||||
/// <para>If <see cref="DismissReason"/> is not <c>null</c>, then calling this function will simply dispose the
|
||||
/// result of the passed <paramref name="textureWrapTask"/> without actually updating the icon.</para>
|
||||
/// </remarks>
|
||||
void SetIconTexture(Task<IDalamudTextureWrap?>? textureWrapTask, bool leaveOpen);
|
||||
|
||||
/// <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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue