Class WidgetInstance<W extends Widget>
- All Implemented Interfaces:
IElement
- Direct Known Subclasses:
LeafWidget.AbstractState
,SingleChildWidgetInstance
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final WidgetInstance[]
final BooleanSignal
final BooleanSignal
final BooleanSignal
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal float
final float
final float
final float
void
applyBuiltinSelector
(BuiltinSelector selector, Consumer<WidgetInstance> consumer) final float
final float
final float
clippedX()
final float
clippedY()
final float
final float
protected static void
computeFillLayout
(WidgetInstance element) protected abstract void
computeMount
(MountContext context) protected abstract void
protected abstract void
computeStencilLayout
(StateContext context) protected abstract void
abstract void
configure
(StateContext stateContext, W widget, boolean init) Configures the instance's state according to the inputs in the specifiedwidget
.final void
Copies the available size from the givenother
widget (usually the parent).final void
Copies the clipped rect from the givenother
widget (usually the parent).protected final void
final void
copyPositionFrom
(WidgetInstance other) Copies the position from the givenother
widget (usually the parent).final void
dispose()
Disposes of the element.final boolean
protected final void
Sets the computed size to fill the entire allocated rect.final GuiContext
final int
hashCode()
final boolean
isInside
(double checkX, double checkY) Checks if the given coordinates are inside the element's clipped rectangle.final boolean
isInside
(float checkX, float checkY) Checks if the given coordinates are inside the element's clipped rectangle.final long
key()
protected final void
Deprecated.protected final void
protected final void
protected final void
protected final void
protected final void
protected final void
final void
mount
(MountContext context) protected void
onMount()
Called when the element is mounted to a new parent.protected void
Called when the element is unmounted from the current parent.final @Nullable IElement
parent()
protected void
This will need to be overridden for any aligned positioning to includemarkNeedsTraceLayout()
.protected final void
protected final void
final void
Clips element content and children.final void
setAvailableSize
(float width, float height) Called by the parent element to communicate the amount of space available to its children.final void
setClippedRect
(float x, float y, float width, float height) Widgets may be clipped by parents.protected final void
setComputedSize
(float width, float height) final void
setPosition
(float x, float y) Called by the parent element to set the position of its children.final void
stencilLayout
(StateContext context) Computes sizes of element content and children.protected final boolean
protected final boolean
protected final boolean
final String
toString()
final String
final void
Sets positions of element content and children.final void
updateMount
(WidgetInstance<?> parent) void
uSpecMount
(MountContext context)
-
Field Details
-
EMPTY_ARRAY
-
needsStencilLayout
-
needsTraceLayout
-
needsScissorLayout
-
-
Constructor Details
-
WidgetInstance
-
-
Method Details
-
configure
Configures the instance's state according to the inputs in the specifiedwidget
.Other initialization might be done if
init
is true. -
onMount
protected void onMount()Called when the element is mounted to a new parent. -
onUnmount
@MustBeInvokedByOverriders protected void onUnmount()Called when the element is unmounted from the current parent. -
updateMount
-
dispose
public final void dispose()Disposes of the element. The element may be reused. -
stencilLayout
Computes sizes of element content and children.This will usually call
StencilLayoutContext.updateMountAndLayout(StateContext, WidgetInstance, WidgetInstance, BiConsumer)
with each child and go through a layout procedure whereinsetAvailableSize(float, float)
and thenstencilLayout(StateContext)
are called (in that order) on each child. -
traceLayout
public final void traceLayout()Sets positions of element content and children.This will usually call
StencilLayoutContext.updateMountAndLayout(StateContext, WidgetInstance, WidgetInstance, BiConsumer)
with each child and go through a layout procedure whereinsetAvailableSize(float, float)
and thentraceLayout()
are called (in that order) on each child. -
scissorLayout
public final void scissorLayout()Clips element content and children.This will usually call
StencilLayoutContext.updateMountAndLayout(StateContext, WidgetInstance, WidgetInstance, BiConsumer)
with each child and go through a layout procedure whereinsetClippedRect(float, float, float, float)
and thenscissorLayout()
are called (in that order) on each child. -
mount
-
uSpecMount
-
computeFillLayout
-
computeStencilLayout
-
computeTraceLayout
protected abstract void computeTraceLayout() -
computeScissorLayout
protected abstract void computeScissorLayout() -
computeMount
-
markNeedsStencilLayout
protected final void markNeedsStencilLayout() -
markNeedsTraceLayout
protected final void markNeedsTraceLayout() -
markNeedsScissorLayout
protected final void markNeedsScissorLayout() -
markNeedsLayout
Deprecated.usemarkNeedsStencilLayout()
and/ormarkNeedsTraceLayout()
as appropriate instead. -
propagateNeedsStencilLayoutFromChild
protected void propagateNeedsStencilLayoutFromChild()This will need to be overridden for any aligned positioning to includemarkNeedsTraceLayout()
. -
takeNeedsStencilLayout
protected final boolean takeNeedsStencilLayout() -
takeNeedsTraceLayout
protected final boolean takeNeedsTraceLayout() -
takeNeedsScissorLayout
protected final boolean takeNeedsScissorLayout() -
allocatedX
public final float allocatedX() -
allocatedY
public final float allocatedY() -
allocatedWidth
public final float allocatedWidth() -
allocatedHeight
public final float allocatedHeight() -
markNeedsStencilLayoutOnAllocationChange
protected final void markNeedsStencilLayoutOnAllocationChange() -
markNeedsTraceLayoutOnAllocationChange
protected final void markNeedsTraceLayoutOnAllocationChange() -
markNeedsScissorLayoutOnAllocationChange
protected final void markNeedsScissorLayoutOnAllocationChange() -
setPosition
public final void setPosition(float x, float y) Called by the parent element to set the position of its children. -
setAvailableSize
public final void setAvailableSize(float width, float height) Called by the parent element to communicate the amount of space available to its children. -
copyPositionFrom
Copies the position from the givenother
widget (usually the parent). -
copyAvailableSizeFrom
Copies the available size from the givenother
widget (usually the parent). -
copyClippedRectFrom
Copies the clipped rect from the givenother
widget (usually the parent). -
requireFiniteAllocatedWidth
protected final void requireFiniteAllocatedWidth() -
requireFiniteAllocatedHeight
protected final void requireFiniteAllocatedHeight() -
computedWidth
public final float computedWidth() -
computedHeight
public final float computedHeight() -
clippedX
public final float clippedX() -
clippedY
public final float clippedY() -
clippedWidth
public final float clippedWidth() -
clippedHeight
public final float clippedHeight() -
setComputedSize
protected final void setComputedSize(float width, float height) -
setClippedRect
public final void setClippedRect(float x, float y, float width, float height) Widgets may be clipped by parents. To support this, parents must propagate a clipped rect to their children. The clip is enforced by parents when rendering, but must be enforced by each element when implementing input event handlers.
- See Also:
-
copyComputedSizeFrom
-
fillAllocated
protected final void fillAllocated()Sets the computed size to fill the entire allocated rect. -
isInside
public final boolean isInside(double checkX, double checkY) Checks if the given coordinates are inside the element's clipped rectangle. -
isInside
public final boolean isInside(float checkX, float checkY) Checks if the given coordinates are inside the element's clipped rectangle. -
applyBuiltinSelector
-
toStringShort
- Specified by:
toStringShort
in interfaceIElement
-
toString
-
guiContext
-
key
-
equals
-
hashCode
-
parent
-
markNeedsStencilLayout()
and/ormarkNeedsTraceLayout()
as appropriate instead.