mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-13 03:17:43 +01:00
feat(ContextMenu): add convenience methods to ContextMenuOpenedArgs
This commit is contained in:
parent
6131c3efa1
commit
d88e0bcf54
3 changed files with 34 additions and 16 deletions
|
|
@ -19,9 +19,9 @@ namespace Dalamud.Game.Gui.ContextMenus
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the item.
|
||||
/// Gets the name of the item.
|
||||
/// </summary>
|
||||
public SeString Name { get; set; }
|
||||
public SeString Name { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether or not the item is enabled. When enabled, an item is selectable.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
|
||||
|
|
@ -59,5 +60,22 @@ namespace Dalamud.Game.Gui.ContextMenus
|
|||
/// Gets the item context associated with the context menu.
|
||||
/// </summary>
|
||||
public InventoryItemContext? InventoryItemContext { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Append a custom context menu item to this context menu.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the item.</param>
|
||||
/// <param name="selected">The action to be executed once selected.</param>
|
||||
public void AddCustomItem(SeString name, CustomContextMenuItemSelectedDelegate selected) =>
|
||||
this.Items.Add(new CustomContextMenuItem(name, selected));
|
||||
|
||||
/// <summary>
|
||||
/// Append a custom submenu to this context menu.
|
||||
/// Note that these cannot be nested, and will be ignored if they are.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the submenu.</param>
|
||||
/// <param name="opened">The action to be executed once opened.</param>
|
||||
public void AddCustomSubMenu(SeString name, ContextMenuOpenedDelegate opened) =>
|
||||
this.Items.Add(new OpenSubContextMenuItem(name, opened));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue