Class WidgetGroup
- All Implemented Interfaces:
Cullable
- Direct Known Subclasses:
Collapser
,FxWidgetGroup
,LCanvas.DragLayout
,MapObjectivesCanvas
,MapObjectivesCanvas.ObjectiveTilemap
,ScrollPane
,Stack
,Table
,TreeElement
Group
that participates in layout and provides a minimum, preferred, and maximum size.
The default preferred size of a widget group is 0 and this is almost always overridden by a subclass. The default minimum size returns the preferred size, so a subclass may choose to return 0 for minimum size if it wants to allow itself to be sized smaller than the preferred size. The default maximum size is 0, which means no maximum size.
See Layout
for details on how a widget group should participate in layout. A widget group's mutator methods should call
invalidate()
or invalidateHierarchy()
as needed. By default, invalidateHierarchy is called when child widgets
are added and removed.
-
Field Summary
Fields inherited from class arc.scene.Group
children, cullingArea, transform
Fields inherited from class arc.scene.Element
color, cullable, fillParent, height, name, originX, originY, parent, parentAlpha, rotation, scaleX, scaleY, touchable, touchablility, translation, userObject, visibility, visible, width, x, y
-
Constructor Summary
ConstructorDescriptionWidgetGroup
(Element... actors) Creates a new widget group containing the specified actors. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Called when actors are added to or removed from the group.void
draw()
If this method is overridden, the super method orvalidate()
should be called to ensure the widget group is laid out.float
float
float
float
void
Invalidates this actor's layout, causingElement.layout()
to happen the next timeElement.validate()
is called.void
Invalidates this actor and its ascendants, callingElement.invalidate()
on each.void
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, callsElement.invalidate()
on any each child whose width or height has changed, and callsElement.validate()
on each child.boolean
Returns true if the widget's layout has beeninvalidated
.void
pack()
Sizes this actor to its preferred width and height, then callsElement.validate()
.void
setFillParent
(boolean fillParent) If true, this actor will be sized to the parent inElement.validate()
.void
setLayoutEnabled
(boolean enabled) protected void
Called when the actor's size has been changed.void
validate()
Ensures the actor has been laid out.Methods inherited from class arc.scene.Group
act, addChild, addChildAfter, addChildAt, addChildBefore, applyTransform, clear, clearChildren, computeTransform, drawChildren, fill, fill, fill, find, find, findVisible, forEach, getChildren, getCullingArea, hasChildren, hit, isTransform, localToDescendantCoordinates, removeChild, removeChild, resetTransform, setCullingArea, setScene, setTransform, swapActor, swapActor, toString
Methods inherited from class arc.scene.Element
actions, addAction, addCaptureListener, addListener, change, changed, clearActions, clearListeners, clicked, clicked, clicked, clicked, clipBegin, clipBegin, clipEnd, dragged, exited, fire, fireClick, getActions, getCaptureListeners, getHeight, getListeners, getMaxHeight, getMaxWidth, getRight, getRotation, getScene, getTop, getWidth, getX, getY, getZIndex, hasActions, hasKeyboard, hasMouse, hasParent, hasScroll, hovered, isAscendantOf, isDescendantOf, isDescendantOf, isTouchable, keepInStage, keyDown, keyDown, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, released, remove, removeAction, removeCaptureListener, removeListener, requestKeyboard, requestScroll, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, scrolled, setBounds, setColor, setColor, setHeight, setOrigin, setOrigin, setPosition, setPosition, setRotation, setRotationOrigin, setScale, setScale, setSize, setSize, setTranslation, setWidth, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, tapped, toBack, toFront, touchable, update, updateVisibility, visible
-
Constructor Details
-
WidgetGroup
public WidgetGroup() -
WidgetGroup
Creates a new widget group containing the specified actors.
-
-
Method Details
-
getMinWidth
public float getMinWidth()- Overrides:
getMinWidth
in classElement
-
getMinHeight
public float getMinHeight()- Overrides:
getMinHeight
in classElement
-
getPrefWidth
public float getPrefWidth()- Overrides:
getPrefWidth
in classElement
-
getPrefHeight
public float getPrefHeight()- Overrides:
getPrefHeight
in classElement
-
setLayoutEnabled
public void setLayoutEnabled(boolean enabled) - Overrides:
setLayoutEnabled
in classElement
-
validate
public void validate()Description copied from class:Element
Ensures the actor has been laid out. CallsElement.layout()
ifElement.invalidate()
has been called since the last timeElement.validate()
was called, or if the actor otherwise needs to be laid out. This method is usually called inElement.draw()
by the actor itself before drawing is performed. -
needsLayout
public boolean needsLayout()Returns true if the widget's layout has beeninvalidated
.- Overrides:
needsLayout
in classElement
-
invalidate
public void invalidate()Description copied from class:Element
Invalidates this actor's layout, causingElement.layout()
to happen the next timeElement.validate()
is called. This method should be called when state changes in the actor that requires a layout but does not change the minimum, preferred, maximum, or actual size of the actor (meaning it does not affect the parent actor's layout).- Overrides:
invalidate
in classElement
-
invalidateHierarchy
public void invalidateHierarchy()Description copied from class:Element
Invalidates this actor and its ascendants, callingElement.invalidate()
on each. This method should be called when state changes in the actor that affects the minimum, preferred, maximum, or actual size of the actor (meaning it potentially affects the parent actor's layout).- Overrides:
invalidateHierarchy
in classElement
-
childrenChanged
protected void childrenChanged()Description copied from class:Group
Called when actors are added to or removed from the group.- Overrides:
childrenChanged
in classGroup
-
sizeChanged
protected void sizeChanged()Description copied from class:Element
Called when the actor's size has been changed.- Overrides:
sizeChanged
in classElement
-
pack
public void pack()Description copied from class:Element
Sizes this actor to its preferred width and height, then callsElement.validate()
.Generally this method should not be called in an actor's constructor because it calls
Element.layout()
, which means a subclass would have layout() called before the subclass' constructor. Instead, in constructors simply set the actor's size toElement.getPrefWidth()
andElement.getPrefHeight()
. This allows the actor to have a size at construction time for more convenient use with groups that do not layout their children. -
setFillParent
public void setFillParent(boolean fillParent) Description copied from class:Element
If true, this actor will be sized to the parent inElement.validate()
. If the parent is the stage, the actor will be sized to the stage. This method is for convenience only when the widget's parent does not set the size of its children (such as the stage).- Overrides:
setFillParent
in classElement
-
layout
public void layout()Description copied from class:Element
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, callsElement.invalidate()
on any each child whose width or height has changed, and callsElement.validate()
on each child. This method should almost never be called directly, insteadElement.validate()
should be used. -
draw
public void draw()If this method is overridden, the super method orvalidate()
should be called to ensure the widget group is laid out.
-