Vixen
02b45cc4
csharp
public class Menu

A list of commands, floating over everything.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ Arrows move the focus and do not activate — the opposite of a tab strip and a radio group, and for the opposite reason. Those are one tab stop whose members are alternatives, so moving has to choose; a menu is a list of commands, and a menu that ran each one as the highlight passed over it would be unusable. Enter runs the highlighted one.

Activating an item closes the whole chain. A submenu three levels deep whose item is chosen must not leave two menus standing, so the close walks up through ParentMenu rather than closing only itself.

Fields and properties (3)

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • public IReadOnlyList<MenuItem> Items

    The items, in order, not counting separators.

  • public Menu? ParentMenu

    The menu this one opened out of, if it is a submenu.

Methods (10)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • public void Clear()

    Removes every item and separator.

  • public MenuItem AddItem(string? label = null)

    Adds a command.

  • public Separator AddSeparator()

    Adds a rule between two groups of commands.

  • public Menu AddSubmenu(string? label = null)

    Adds a command that opens a menu of its own.

  • protected override void OnRemoved()
  • protected override void OnOpened()
  • protected override void OnClosed(CloseReason reason)

    Called after it closes.

  • protected override bool IsOutside(UiElement? hit)
  • public void CloseChain(CloseReason reason)

    Closes this menu and every one it opened out of.

Used by (21)

  • ShellHelloUi
  • ContextMenuVixen.Ui.Controls
  • ControlVisualTestsVixen.Ui.Controls.Tests
  • MenuBarVixen.Ui.Controls
  • MenuBarItemVixen.Ui.Controls
  • MenuItemVixen.Ui.Controls
  • OverlayInteractionTestsVixen.Ui.Controls.Tests
  • OverlayLifetimeTestsVixen.Ui.Controls.Tests
  • SurfaceTestsVixen.Ui.Controls.Tests
  • CreateMenuTestsVixen.Editor.App.Tests
  • EditorApplicationVixen.Editor.App
  • EditorSessionVixen.Editor.Testing
  • EditorShellTestsVixen.Editor.Ui.Tests
  • GridViewTestsVixen.Editor.App.Tests
  • InspectorViewVixen.Editor.Inspector
  • MenuBarTestsVixen.Editor.App.Tests
  • MenuPresenterVixen.Editor.Ui
  • MenuTestsVixen.Editor.Ui.Tests
  • PanelTestsVixen.Editor.Inspector.Tests
  • SceneMenuTestsVixen.Editor.App.Tests
  • ToolbarSectionTestsVixen.Editor.Ui.Tests