Vixen
02b45cc4
csharp
public abstract class Overlay

Anything that appears over the rest of the interface.

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

Remarks

An overlay is a child of the root, not of whatever opened it, and that is forced by painting order: the draw list is document order, so an element can only be drawn over something by coming after it. A popup that lived inside the button that opened it would be painted inside that button's stacking position and clipped by every overflow: hidden between the two. Being a root child costs a reference back to the anchor and buys an overlay that is always on top and never clipped.

⚠ Placement runs a layout pass of its own. Where a popup goes depends on how big it is, and how big it is depends on a layout that has not happened when it opens. So Open updates the document, reads the sizes, and then positions — one extra pass, on a user action, rather than a popup that is in the wrong place for the first frame anybody sees it.

Position is OffsetX, not layout. Moving a popup does not disturb anything: no sibling reflows, no ancestor grows, and dragging one costs a walk rather than a cascade.

Fields and properties (11)

  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • public bool IsOpen

    Whether it is showing.

  • public Placement Placement
  • public float Gap
  • public bool LightDismiss
  • public bool CloseOnEscape
  • public UiElement? Anchor

    What it is attached to, if anything.

  • public static readonly UiPropertyKey PlacementProperty

    Identity for Placement.

  • public static readonly UiPropertyKey GapProperty

    Identity for Gap.

  • public static readonly UiPropertyKey LightDismissProperty

    Identity for LightDismiss.

  • public static readonly UiPropertyKey CloseOnEscapeProperty

    Identity for CloseOnEscape.

Events (1)

  • public Action<Overlay, bool>? OpenChanged

    Raised when it opens or closes.

Methods (13)

  • protected override void OnCreated()

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

  • protected override void OnRemoved()
  • public void Open(UiElement? target = null)

    Shows it, beside an anchor.

  • public void Close(CloseReason reason = Code)

    Hides it.

  • public void Reposition()

    Puts it where its placement asks, flipping if there is no room.

  • public void MoveTo(float x, float y)

    Puts its top-left corner at a point in document space.

  • protected virtual void OnOpened()

    Called after it opens.

  • protected virtual void OnClosed(CloseReason reason)

    Called after it closes.

  • protected virtual bool IsOutside(UiElement? hit)

    Whether a press at a point should close it.

  • public void ClearPlacement()

    Unsets Placement, so it takes its default or its ancestor's value again.

  • public void ClearGap()

    Unsets Gap, so it takes its default or its ancestor's value again.

  • public void ClearLightDismiss()

    Unsets LightDismiss, so it takes its default or its ancestor's value again.

  • public void ClearCloseOnEscape()

    Unsets CloseOnEscape, so it takes its default or its ancestor's value again.

Used by (37)

  • ColorInputVixen.Ui.Controls.Advanced
  • ComboBoxVixen.Ui.Controls
  • ContextMenuVixen.Ui.Controls
  • ControlVisualTestsVixen.Ui.Controls.Tests
  • DialogVixen.Ui.Controls
  • DrawerVixen.Ui.Controls
  • MenuVixen.Ui.Controls
  • MenuBarVixen.Ui.Controls
  • OverlayInteractionTestsVixen.Ui.Controls.Tests
  • OverlayLifetimeTestsVixen.Ui.Controls.Tests
  • PopoverVixen.Ui.Controls
  • RadialMenuVixen.Ui.Controls
  • SelectBaseVixen.Ui.Controls
  • SelectionTestsVixen.Ui.Controls.Tests
  • SurfaceTestsVixen.Ui.Controls.Tests
  • TooltipVixen.Ui.Controls
  • AddComponentMenuVixen.Editor.App
  • AddComponentMenuTestsVixen.Editor.App.Tests
  • BehaviorAuthoringTestsVixen.Editor.App.Tests
  • CommandPaletteVixen.Editor.Ui
  • ComponentTestsVixen.Editor.App.Tests
  • DialogServiceVixen.Editor.Ui
  • DialogSessionVixen.Editor.Ui
  • DialogTestsVixen.Editor.Ui.Tests
  • EditorShellVixen.Editor.Ui
  • EditorShellTestsVixen.Editor.Ui.Tests
  • GridViewTestsVixen.Editor.App.Tests
  • InspectorViewVixen.Editor.Inspector
  • MenuPresenterVixen.Editor.Ui
  • MenuTestsVixen.Editor.Ui.Tests
  • MilestoneE3TestsVixen.Editor.App.Tests
  • NodeSearchPopupVixen.Editor.NodeGraph
  • PaletteTestsVixen.Editor.Ui.Tests
  • PanelTestsVixen.Editor.Inspector.Tests
  • SceneMenuTestsVixen.Editor.App.Tests
  • ToolbarPresenterVixen.Editor.Ui
  • ViewTestsVixen.Editor.NodeGraph.Tests