Class Stack


public class Stack extends Container<Stack>
Overlays children on top of each other (later children on top; the base for overlays and modal dialogs). Sizes to the biggest child; each child is placed by this stack's Stack.Alignment.

A layer stacked over another does not block it. The layers are siblings, and covering one with an opaque panel changes nothing about it: it keeps taking the keyboard, and an assistive technology is still offered every control underneath the glass, because nothing here says which rectangle hides which. A panel meant to be modal goes through Scene.pushOverlay(limn.scene.Widget<?>) or is mounted in the scene by Dialog, both of which confine input and publish the fact to a screen reader.

  • Constructor Details

    • Stack

      public Stack()
  • Method Details

    • alignment

      public Stack alignment(Stack.Alignment alignment)
      Where children sit within the stack's box; they all get the full box to measure against. The default is Stack.Alignment.TOP_LEFT. UI thread only.
      Parameters:
      alignment - where each child sits
      Returns:
      this stack
    • onMeasure

      protected Size onMeasure(Constraints constraints)
      Description copied from class: Widget
      Reports the size this widget wants within constraints. Called once per layout pass, and the result is cached against the constraints and the resolved axes (size step, layout direction, locale), so it must be a pure function of them and of this widget's own state.

      Resolve the ControlSize and the LayoutDirection once each here and thread them down; never read either in a constructor. The locale needs no threading: it is in scope, and I18n.locale() answers it wherever text is resolved.

      Specified by:
      onMeasure in class Widget<Stack>
    • onLayout

      protected void onLayout()
      Description copied from class: Widget
      Containers position children here (measure + Widget.layoutBox(float, float, float, float) per child).
      Overrides:
      onLayout in class Widget<Stack>