Window Framework for UI Toolkit v2.0.x
GWG.WindowFramework.ContextMenuConfig Class Reference

Configuration class for a runtime context menu. More...

Data Fields

List< ContextMenuItem > Items = new List<ContextMenuItem>()
 Ordered mutable menu entries; keep the list and every entry nonnull.
string Title
 Optional title displayed above the menu items; empty/null omits the title.

Detailed Description

Configuration class for a runtime context menu.

This mutable configuration supplies the optional title and ordered item list to WindowFrameContextMenu.Show. It is not a ScriptableObject and does not render itself. Populate Items directly; this class has no AddItem, AddSeparator or submenu builder API. State predicates are evaluated when Show builds the menu, not continuously while open. For nonseparator visible entries provide nonnull IsDisabled and IsChecked delegates: the renderer invokes those directly. Null IsVisible means visible. Application callbacks remain application-owned; opening a menu does not validate the underlying operation.

var config = new ContextMenuConfig { Title = "Options" };
config.Items.Add(new ContextMenuItem("Copy", () => UnityEngine.Debug.Log("Copy")));
config.Items.Add(new ContextMenuItem()); // separator
config.Items.Add(new ContextMenuItem("Paste", () => UnityEngine.Debug.Log("Paste")) {
IsVisible = () => true, IsDisabled = () => false, IsChecked = () => false
});
Configuration class for a runtime context menu.
Definition ContextMenuConfig.cs:26
List< ContextMenuItem > Items
Ordered mutable menu entries; keep the list and every entry nonnull.
Definition ContextMenuConfig.cs:32
string Title
Optional title displayed above the menu items; empty/null omits the title.
Definition ContextMenuConfig.cs:28
ContextMenuItem()
Create a menu seperator in the menu.
Definition ContextMenuItem.cs:127

Field Documentation

◆ Items

List<ContextMenuItem> GWG.WindowFramework.ContextMenuConfig.Items = new List<ContextMenuItem>()

Ordered mutable menu entries; keep the list and every entry nonnull.

Show enumerates this list directly. Separators participate in the visible count; a separator-only configuration does not produce the no-options fallback message.

◆ Title

string GWG.WindowFramework.ContextMenuConfig.Title

Optional title displayed above the menu items; empty/null omits the title.