RunicHostedMenuRequest record

Namespace Runic.Application.Views.Desktop in Runic.Application.Views.Desktop 0.23.0

public sealed record RunicHostedMenuRequest : IEquatable<RunicHostedMenuRequest>

Inherits or implements IEquatable.

Menus a guest application shows in one of its windows: its menu bar or a context menu.

Remarks

RunicHostedMenuRequest.Entries are the menus as the host shows them. A guest's item runs the guest's command: its DesktopMenuItem.CommandId is RunicHostedMenuRequest.GuestCommandId and RunicHostedMenuRequest.GuestItemId reads the guest's id from it. An item a policy adds with a command id of its own runs the host application's command, as an item of DesktopHost.MenuBar does (DesktopHost.MenuCommands).

Experimental; see docs/experimental.md.

Fields

GuestCommandId

public const string GuestCommandId = "runic-hosted-item"

The command id of the guest's items in RunicHostedMenuRequest.Entries.

Properties

Entries

public ImmutableArray<DesktopMenuEntry> Entries { get; init; }

The entries: for RunicHostedMenuKind.MenuBar the bar's DesktopMenus, in the guest's order, empty for none; for RunicHostedMenuKind.ContextMenu the menu's entries. Disabled items, check marks and titles are the guest's current ones.

Kind

public RunicHostedMenuKind Kind { get; }

Whether these are the window's menu bar or a context menu.

Position

public DesktopContextMenuOptions? Position { get; init; }

Where a context menu opens, in CSS pixels of the page's viewport; null at the pointer and for a menu bar.

Window

public RunicHostedWindow Window { get; }

The window.

Methods

GuestItemId

public static string? GuestItemId(DesktopMenuItem item)

Gets the guest's id of an item of RunicHostedMenuRequest.Entries, or null for an item that is not the guest's.

Parameters

item

The item.

Returns

The id.