Class SizedBox
A dimension is a finite number of points, zero or more, or UNSET, which leaves it
free. Any other negative leaves it free as well, and UNSET is the way to say so. A
NaN or an infinite dimension is refused where the box is made: measure asked only whether
a dimension was at least zero, so a NaN left its axis free without a word and positive
infinity was clamped to whatever the parent allowed, which is a different box under every
parent and an infinite one under an unbounded axis. A box meant to take all the room it is given
leaves that to its parent: UNSET across a Flex that stretches its children, or an
Expanded along one.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidonLayout()Containers position children here (measure +Widget.layoutBox(float, float, float, float)per child).protected SizeonMeasure(Constraints constraints) Reports the size this widget wants withinconstraints.protected floatWhatpaintOverflow(float)declared; else nothing for a spacer, which has no child to paint past it; else the reach of the focus ring in the theme in effect for this box: the child is laid out over the whole box, so a ring at its edge is a ring at this box's edge.paintOverflow(float points) Declares how far the child may paint past this box, in logical points, in place of the reach of the theme's focus ring, which is the default.Goes back to declaring the reach of the theme's focus ring for the child, which is the default; seepaintOverflow(float).Methods inherited from class limn.scene.Widget
acceptsTextInput, accessibleLabelAccessKey, accessibleLabelTarget, accessibleLabelText, add, add, announceChange, backdropReach, baselineOffset, baselineOffsetOf, caretRect, children, clipboard, clipHeight, clipsChildren, clipWidth, clipX, clipY, controlSize, cursor, declaredControlSize, declaredLayoutDirection, declaredLocale, focusArrivedBackward, focusArrivedByTraversal, handleUserChange, height, hitTest, hitTestChild, id, imageCursor, inheritanceHost, invalidate, invalidate, invalidateAccessible, isEnabled, isFocusable, isFocused, isRightToLeft, isSelfEnabled, isShowing, isVisible, isVisibleByItsOwnFlag, layoutBox, layoutDirection, locale, localToScene, localToSceneBounds, markNeedsContainedLayout, markNeedsLayout, markNeedsLayoutInPlace, maxHeight, maxWidth, measure, minHeight, minWidth, moveChild, moveChild, moveChild, neutralBase, notifyChange, notifyTextEdit, observeChanges, onAccessibility, onAccessibilityAction, onAccessibilityChild, onAccessibilityChildAction, onAccessibilityChildIdentity, onAttached, onCanEdit, onCharTyped, onDetached, onDragExit, onDragOver, onDragStart, onDrop, onEdit, onFocusGained, onFocusLost, onHitTest, onKeyEvent, onMouseEvent, onPaint, onPaintOverlay, onPreedit, onSyntheticAction, overlayPassesPointer, paintChildren, paintsDecoration, paintsFromBackdrop, paintWidget, parent, remove, remove, requestFocus, requestFocus, revealInView, revealInView, runHandler, scene, sceneNanos, sceneToLocal, self, setAccessibleDescribedBy, setAccessibleDescription, setAccessibleDescription, setAccessibleIgnored, setAccessibleLabelledBy, setAccessibleName, setAccessibleName, setAccessibleRole, setControlSize, setCursor, setEnabled, setFocusable, setId, setImageCursor, setInheritanceHost, setLayoutDirection, setLocale, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setPresentedElsewhere, setTooltip, setTooltip, setVisible, shapeText, textRuler, tooltip, tooltipSource, width, x, y
-
Field Details
-
UNSET
public static final float UNSETMarks a dimension as "not fixed".- See Also:
-
-
Constructor Details
-
SizedBox
Forceschildto an exact size;UNSETon an axis leaves it free.- Parameters:
width- the width in points, orUNSETheight- the height in points, orUNSETchild- what the box holds, ornullfor a spacer- Throws:
IllegalArgumentException- when a dimension isNaNor infinite
-
SizedBox
public SizedBox(float width, float height) An empty box of a fixed size: a spacer.- Parameters:
width- the width in points, orUNSETheight- the height in points, orUNSET- Throws:
IllegalArgumentException- when a dimension isNaNor infinite
-
-
Method Details
-
paintOverflow
Declares how far the child may paint past this box, in logical points, in place of the reach of the theme's focus ring, which is the default. It is whatContainer.paintOverflow(float)is to a container, for the one child here: the public setter ofpaintOutset(), and a new declaration repaints this box and its band while one already in force repaints nothing. UI thread only.- Parameters:
points- how far the child may paint past each side of this box, in logical points- Returns:
- this box
- Throws:
IllegalArgumentException- when negative,NaNor infinite
-
paintOverflowFromTheme
Goes back to declaring the reach of the theme's focus ring for the child, which is the default; seepaintOverflow(float). UI thread only.- Returns:
- this box
-
paintOutset
protected float paintOutset()WhatpaintOverflow(float)declared; else nothing for a spacer, which has no child to paint past it; else the reach of the focus ring in the theme in effect for this box: the child is laid out over the whole box, so a ring at its edge is a ring at this box's edge. O(1) and allocation-free.- Overrides:
paintOutsetin classWidget<SizedBox>
-
onMeasure
Description copied from class:WidgetReports the size this widget wants withinconstraints. 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
ControlSizeand theLayoutDirectiononce each here and thread them down; never read either in a constructor. The locale needs no threading: it is in scope, andI18n.locale()answers it wherever text is resolved. -
onLayout
protected void onLayout()Description copied from class:WidgetContainers position children here (measure +Widget.layoutBox(float, float, float, float)per child).
-