Vixen
dd8b0a81
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 (14)

  • 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 Show(bool open, UiElement? target = null)

    Makes it whichever of the two the caller says, from wherever it is now.

  • 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 (59, showing 40)

  • GalleryHelloUi
  • AccessibilityNotificationTestsVixen.Ui.Controls.Tests
  • BoundOverlaySheetVixen.Ui.Controls.Tests
  • ColorInputVixen.Ui.Controls.Advanced
  • ComboBoxVixen.Ui.Controls
  • ComboEditorVixen.Ui.Controls
  • CommandBindingTestsVixen.Ui.Controls.Tests
  • ContextMenuVixen.Ui.Controls
  • ContextMenuMarkupTestsVixen.Ui.Controls.Tests
  • ControlVisualTestsVixen.Ui.Controls.Tests
  • DialogVixen.Ui.Controls
  • DialogServiceVixen.Ui.Controls
  • DialogSessionVixen.Ui.Controls
  • DialogTestsVixen.Ui.Controls.Tests
  • DocumentClosePromptTestsVixen.Ui.Controls.Tests
  • DrawerVixen.Ui.Controls
  • ElementStateBitTestsVixen.Ui.Controls.Tests
  • MenuVixen.Ui.Controls
  • MenuBarVixen.Ui.Controls
  • MenuBarItemVixen.Ui.Controls
  • MenuItemVixen.Ui.Controls
  • NestedTagTestsVixen.Ui.Controls.Advanced.Tests
  • OverlayInteractionTestsVixen.Ui.Controls.Tests
  • OverlayLifetimeTestsVixen.Ui.Controls.Tests
  • OverlayMarkupTestsVixen.Ui.Controls.Tests
  • PopoverVixen.Ui.Controls
  • RadialMenuVixen.Ui.Controls
  • SelectBaseVixen.Ui.Controls
  • SelectionTestsVixen.Ui.Controls.Tests
  • StateDialogTestsVixen.Ui.Controls.Tests
  • SurfaceTestsVixen.Ui.Controls.Tests
  • TooltipVixen.Ui.Controls
  • AddComponentMenuVixen.Editor.App
  • AddComponentMenuDumpTestsVixen.Editor.App.Tests
  • AddComponentMenuTestsVixen.Editor.App.Tests
  • BehaviorAuthoringTestsVixen.Editor.App.Tests
  • BrowserSavedFilterTestsVixen.Editor.App.Tests
  • CommandPaletteVixen.Editor.Ui
  • ComponentTestsVixen.Editor.App.Tests
  • ComponentsViewVixen.Editor.App