Package com.prineside.tdi2.scene2d.ui
Class ScrollPane
java.lang.Object
com.prineside.tdi2.scene2d.Actor
com.prineside.tdi2.scene2d.Group
com.prineside.tdi2.scene2d.ui.WidgetGroup
com.prineside.tdi2.scene2d.ui.ScrollPane
- Direct Known Subclasses:
 SelectBox.SelectBoxScrollPane
A group that scrolls a child actor using scrollbars and/or mouse or touch dragging.
 
The actor is sized to its preferred size. If the actor's preferred width or height is less than the size of this scroll pane, it is set to the size of this scroll pane. Scrollbars appear when the actor is larger than the scroll pane.
The scroll pane's preferred size is that of the child actor. At this size, the child actor will not need to scroll, so the scroll pane is typically sized by ignoring the preferred size in one or both directions.
- Author:
 - mzechner, Nathan Sweet
 
- 
Nested Class Summary
Nested Classes - 
Constructor Summary
ConstructorsConstructorDescriptionScrollPane(Actor actor) ScrollPane(Actor actor, ScrollPane.ScrollPaneStyle style)  - 
Method Summary
Modifier and TypeMethodDescriptionvoidact(float delta) Updates the actor based on time.voidDeprecated.ScrollPane may have only a single child.voidaddActorAfter(Actor actorAfter, Actor actor) Deprecated.ScrollPane may have only a single child.voidaddActorAt(int index, Actor actor) Deprecated.ScrollPane may have only a single child.voidaddActorBefore(Actor actorBefore, Actor actor) Deprecated.ScrollPane may have only a single child.voidcancel()If currently scrolling by tracking a touch down, stop scrolling.voidCancels the stage's touch focus for all listeners except this scroll pane's flick scroll listener.voidIf this method is overridden, the super method orWidgetGroup.validate()should be called to ensure the widget group is laid out.voiddrawDebug(ShapeRenderer shapes) Draws this actor's debug lines ifActor.getDebug()is true and, regardless ofActor.getDebug(), callsActor.drawDebug(ShapeRenderer)on each child.voidfling(float flingTime, float velocityX, float velocityY) Generate fling gesture.getActor()Returns the actor embedded in this scroll pane, or null.booleanfloatgetMaxX()Returns the maximum scroll value in the x direction.floatgetMaxY()Returns the maximum scroll value in the y direction.floatfloatfloatfloatfloatfloatfloatfloatReturns the height of the scrolled viewport.floatfloatfloatReturns the width of the scrolled viewport.floatReturns the x scroll position in pixels, where 0 is the left of the scroll pane.floatReturns the y scroll position in pixels, where 0 is the top of the scroll pane.getStyle()Returns the scroll pane's style.booleanfloatGets the flick scroll x velocity.floatGets the flick scroll y velocity.floatfloatfloatfloatDeprecated.UsegetActor().hit(float x, float y, boolean touchable) If this method is overridden, the super method orWidgetGroup.validate()should be called to ensure the widget group is laid out.booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanReturns true if the actor is larger than the scroll pane horizontally.booleanReturns true if the actor is larger than the scroll pane vertically.booleanvoidlayout()Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, callsLayout.invalidate()on any each child whose width or height has changed, and callsLayout.validate()on each child.booleanremoveActor(Actor actor) Removes an actor from this group and unfocuses it.booleanremoveActor(Actor actor, boolean unfocus) Removes an actor from this group.removeActorAt(int index, boolean unfocus) Removes an actor from this group.voidscrollTo(float x, float y, float width, float height) Sets the scroll offset so the specified rectangle is fully in view, if possible.voidscrollTo(float x, float y, float width, float height, boolean centerHorizontal, boolean centerVertical) Sets the scroll offset so the specified rectangle is fully in view, and optionally centered vertically and/or horizontally, if possible.voidSets theActorembedded in this scroll pane.voidsetCancelTouchFocus(boolean cancelTouchFocus) When true (default) and flick scrolling begins,cancelTouchFocus()is called.voidsetClamp(boolean clamp) For flick scroll, prevents scrolling out of the actor's bounds.voidsetFadeScrollBars(boolean fadeScrollBars) When true the scrollbars don't reduce the scrollable size and fade out after some time of not being used.voidsetFlickScroll(boolean flickScroll) voidsetFlickScrollTapSquareSize(float halfTapSquareSize) voidsetFlingTime(float flingTime) For flick scroll, sets the amount of time in seconds that a fling will continue to scroll.voidsetForceScroll(boolean x, boolean y) Forces enabling scrollbars (for non-flick scroll) and overscrolling (for flick scroll) in a direction, even if the contents do not exceed the bounds in that direction.voidsetOverscroll(boolean overscrollX, boolean overscrollY) For flick scroll, if true the actor can be scrolled slightly past its bounds and will animate back to its bounds when scrolling is stopped.voidsetScrollBarPositions(boolean bottom, boolean right) Set the position of the vertical and horizontal scroll bars.voidsetScrollbarsOnTop(boolean scrollbarsOnTop) When false (the default), the actor is clipped so it is not drawn under the scrollbars.voidsetScrollbarsVisible(boolean visible) Shows or hides the scrollbars for when usingsetFadeScrollBars(boolean).voidsetScrollBarTouch(boolean scrollBarTouch) When false, the scroll bars don't respond to touch or mouse events.voidsetScrollingDisabled(boolean x, boolean y) Disables scrolling in a direction.voidsetScrollPercentX(float percentX) voidsetScrollPercentY(float percentY) voidsetScrollX(float pixels) voidsetScrollY(float pixels) voidsetSmoothScrolling(boolean smoothScrolling) voidvoidsetupFadeScrollBars(float fadeAlphaSeconds, float fadeDelaySeconds) voidsetupOverscroll(float distance, float speedMin, float speedMax) For flick scroll, sets the overscroll distance in pixels and the speed it returns to the actor's bounds in seconds.voidsetVariableSizeKnobs(boolean variableSizeKnobs) voidsetVelocityX(float velocityX) voidsetVelocityY(float velocityY) voidDeprecated.UsesetActor(Actor).voidSets the visual scroll amount equal to the scroll amount.Methods inherited from class com.prineside.tdi2.scene2d.ui.WidgetGroup
getMaxHeight, getMaxHeightValue, getMaxWidth, getMaxWidthValue, getMinHeightValue, getMinWidthValue, getPrefHeightValue, getPrefWidthValue, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setPrefHeight, setPrefHeight, setPrefWidth, setPrefWidth, setWidth, validateMethods inherited from class com.prineside.tdi2.scene2d.Group
clear, clear, clearChildren, clearChildren, debugAll, findActor, getChild, getChildren, getCullingArea, hasChildren, isTransform, localToDescendantCoordinates, setCullingArea, setDebug, setTransform, swapActor, swapActor, toStringMethods inherited from class com.prineside.tdi2.scene2d.Actor
addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, remove, removeAction, removeCaptureListener, removeListener, rotateBy, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront 
- 
Constructor Details
- 
ScrollPane
- Parameters:
 actor- May be null.
 - 
ScrollPane
- Parameters:
 actor- May be null.
 
 - 
 - 
Method Details
- 
setScrollbarsVisible
public void setScrollbarsVisible(boolean visible) Shows or hides the scrollbars for when usingsetFadeScrollBars(boolean). - 
cancelTouchFocus
public void cancelTouchFocus()Cancels the stage's touch focus for all listeners except this scroll pane's flick scroll listener. This causes any actors inside the scrollpane that have received touchDown to receive touchUp.- See Also:
 
 - 
cancel
public void cancel()If currently scrolling by tracking a touch down, stop scrolling. - 
setStyle
 - 
getStyle
Returns the scroll pane's style. Modifying the returned style may not have an effect untilsetStyle(ScrollPaneStyle)is called. - 
act
public void act(float delta) Description copied from class:ActorUpdates the actor based on time. Typically this is called each frame byStage.act(float).The default implementation calls
Action.act(float)on each action and removes actions that are complete. - 
layout
public void layout()Description copied from interface:LayoutComputes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, callsLayout.invalidate()on any each child whose width or height has changed, and callsLayout.validate()on each child. This method should almost never be called directly, insteadLayout.validate()should be used.- Specified by:
 layoutin interfaceLayout- Overrides:
 layoutin classWidgetGroup
 - 
draw
Description copied from class:WidgetGroupIf this method is overridden, the super method orWidgetGroup.validate()should be called to ensure the widget group is laid out.- Overrides:
 drawin classWidgetGroupparentAlpha- The parent alpha, to be multiplied with this actor's alpha, allowing the parent's alpha to affect all children.
 - 
fling
public void fling(float flingTime, float velocityX, float velocityY) Generate fling gesture.- Parameters:
 flingTime- Time in seconds for which you want to fling last.velocityX- Velocity for horizontal direction.velocityY- Velocity for vertical direction.
 - 
getPrefWidth
public float getPrefWidth()- Specified by:
 getPrefWidthin interfaceLayout- Overrides:
 getPrefWidthin classWidgetGroup
 - 
getPrefHeight
public float getPrefHeight()- Specified by:
 getPrefHeightin interfaceLayout- Overrides:
 getPrefHeightin classWidgetGroup
 - 
getMinWidth
public float getMinWidth()- Specified by:
 getMinWidthin interfaceLayout- Overrides:
 getMinWidthin classWidgetGroup
 - 
getMinHeight
public float getMinHeight()- Specified by:
 getMinHeightin interfaceLayout- Overrides:
 getMinHeightin classWidgetGroup
 - 
setActor
Sets theActorembedded in this scroll pane.- Parameters:
 actor- May be null to remove any current actor.
 - 
getActor
Returns the actor embedded in this scroll pane, or null. - 
setWidget
Deprecated.UsesetActor(Actor). - 
getWidget
Deprecated.UsegetActor(). - 
addActor
Deprecated.ScrollPane may have only a single child.Description copied from class:GroupAdds an actor as a child of this group, removing it from its previous parent. If the actor is already a child of this group, no changes are made. - 
addActorAt
Deprecated.ScrollPane may have only a single child.Description copied from class:GroupAdds an actor as a child of this group at a specific index, removing it from its previous parent. If the actor is already a child of this group, no changes are made.- Overrides:
 addActorAtin classGroup- Parameters:
 index- May be greater than the number of children.- See Also:
 
 - 
addActorBefore
Deprecated.ScrollPane may have only a single child.Description copied from class:GroupAdds an actor as a child of this group immediately before another child actor, removing it from its previous parent. If the actor is already a child of this group, no changes are made.- Overrides:
 addActorBeforein classGroup- See Also:
 
 - 
addActorAfter
Deprecated.ScrollPane may have only a single child.Description copied from class:GroupAdds an actor as a child of this group immediately after another child actor, removing it from its previous parent. If the actor is already a child of this group, no changes are made. IfactorAfteris not in this group, the actor is added as the last child.- Overrides:
 addActorAfterin classGroup- See Also:
 
 - 
removeActor
Description copied from class:GroupRemoves an actor from this group and unfocuses it. CallsGroup.removeActor(Actor, boolean)with true.- Overrides:
 removeActorin classGroup
 - 
removeActor
Description copied from class:GroupRemoves an actor from this group. CallsGroup.removeActorAt(int, boolean)with the actor's child index.- Overrides:
 removeActorin classGroup
 - 
removeActorAt
Description copied from class:GroupRemoves an actor from this group. If the actor will not be used again and has actions, they should beclearedso the actions will be returned to theirpool, if any. This is not done automatically.- Overrides:
 removeActorAtin classGroupunfocus- If true,Stage.unfocus(Actor)is called.- Returns:
 - the actor removed from this group.
 
 - 
hit
Description copied from class:WidgetGroupIf this method is overridden, the super method orWidgetGroup.validate()should be called to ensure the widget group is laid out.- Overrides:
 hitin classWidgetGrouptouchable- If true, hit detection will respect thetouchability.- See Also:
 
 - 
setScrollX
public void setScrollX(float pixels)  - 
getScrollX
public float getScrollX()Returns the x scroll position in pixels, where 0 is the left of the scroll pane. - 
setScrollY
public void setScrollY(float pixels)  - 
getScrollY
public float getScrollY()Returns the y scroll position in pixels, where 0 is the top of the scroll pane. - 
updateVisualScroll
public void updateVisualScroll()Sets the visual scroll amount equal to the scroll amount. This can be used when setting the scroll amount without animating. - 
getVisualScrollX
public float getVisualScrollX() - 
getVisualScrollY
public float getVisualScrollY() - 
getVisualScrollPercentX
public float getVisualScrollPercentX() - 
getVisualScrollPercentY
public float getVisualScrollPercentY() - 
getScrollPercentX
public float getScrollPercentX() - 
setScrollPercentX
public void setScrollPercentX(float percentX)  - 
getScrollPercentY
public float getScrollPercentY() - 
setScrollPercentY
public void setScrollPercentY(float percentY)  - 
setFlickScroll
public void setFlickScroll(boolean flickScroll)  - 
setFlickScrollTapSquareSize
public void setFlickScrollTapSquareSize(float halfTapSquareSize)  - 
scrollTo
public void scrollTo(float x, float y, float width, float height) Sets the scroll offset so the specified rectangle is fully in view, if possible. Coordinates are in the scroll pane actor's coordinate system. - 
scrollTo
public void scrollTo(float x, float y, float width, float height, boolean centerHorizontal, boolean centerVertical) Sets the scroll offset so the specified rectangle is fully in view, and optionally centered vertically and/or horizontally, if possible. Coordinates are in the scroll pane actor's coordinate system. - 
getMaxX
public float getMaxX()Returns the maximum scroll value in the x direction. - 
getMaxY
public float getMaxY()Returns the maximum scroll value in the y direction. - 
getScrollBarHeight
public float getScrollBarHeight() - 
getScrollBarWidth
public float getScrollBarWidth() - 
getScrollWidth
public float getScrollWidth()Returns the width of the scrolled viewport. - 
getScrollHeight
public float getScrollHeight()Returns the height of the scrolled viewport. - 
isScrollX
public boolean isScrollX()Returns true if the actor is larger than the scroll pane horizontally. - 
isScrollY
public boolean isScrollY()Returns true if the actor is larger than the scroll pane vertically. - 
setScrollingDisabled
public void setScrollingDisabled(boolean x, boolean y) Disables scrolling in a direction. The actor will be sized to the FlickScrollPane in the disabled direction. - 
isScrollingDisabledX
public boolean isScrollingDisabledX() - 
isScrollingDisabledY
public boolean isScrollingDisabledY() - 
isLeftEdge
public boolean isLeftEdge() - 
isRightEdge
public boolean isRightEdge() - 
isTopEdge
public boolean isTopEdge() - 
isBottomEdge
public boolean isBottomEdge() - 
isDragging
public boolean isDragging() - 
isPanning
public boolean isPanning() - 
isFlinging
public boolean isFlinging() - 
setVelocityX
public void setVelocityX(float velocityX)  - 
getVelocityX
public float getVelocityX()Gets the flick scroll x velocity. - 
setVelocityY
public void setVelocityY(float velocityY)  - 
getVelocityY
public float getVelocityY()Gets the flick scroll y velocity. - 
setOverscroll
public void setOverscroll(boolean overscrollX, boolean overscrollY) For flick scroll, if true the actor can be scrolled slightly past its bounds and will animate back to its bounds when scrolling is stopped. Default is true. - 
setupOverscroll
public void setupOverscroll(float distance, float speedMin, float speedMax) For flick scroll, sets the overscroll distance in pixels and the speed it returns to the actor's bounds in seconds. Default is 50, 30, 200. - 
getOverscrollDistance
public float getOverscrollDistance() - 
setForceScroll
public void setForceScroll(boolean x, boolean y) Forces enabling scrollbars (for non-flick scroll) and overscrolling (for flick scroll) in a direction, even if the contents do not exceed the bounds in that direction. - 
isForceScrollX
public boolean isForceScrollX() - 
isForceScrollY
public boolean isForceScrollY() - 
setFlingTime
public void setFlingTime(float flingTime) For flick scroll, sets the amount of time in seconds that a fling will continue to scroll. Default is 1. - 
setClamp
public void setClamp(boolean clamp) For flick scroll, prevents scrolling out of the actor's bounds. Default is true. - 
setScrollBarPositions
public void setScrollBarPositions(boolean bottom, boolean right) Set the position of the vertical and horizontal scroll bars. - 
setFadeScrollBars
public void setFadeScrollBars(boolean fadeScrollBars) When true the scrollbars don't reduce the scrollable size and fade out after some time of not being used. - 
setupFadeScrollBars
public void setupFadeScrollBars(float fadeAlphaSeconds, float fadeDelaySeconds)  - 
getFadeScrollBars
public boolean getFadeScrollBars() - 
setScrollBarTouch
public void setScrollBarTouch(boolean scrollBarTouch) When false, the scroll bars don't respond to touch or mouse events. Default is true. - 
setSmoothScrolling
public void setSmoothScrolling(boolean smoothScrolling)  - 
setScrollbarsOnTop
public void setScrollbarsOnTop(boolean scrollbarsOnTop) When false (the default), the actor is clipped so it is not drawn under the scrollbars. When true, the actor is clipped to the entire scroll pane bounds and the scrollbars are drawn on top of the actor. IfsetFadeScrollBars(boolean)is true, the scroll bars are always drawn on top. - 
getVariableSizeKnobs
public boolean getVariableSizeKnobs() - 
setVariableSizeKnobs
public void setVariableSizeKnobs(boolean variableSizeKnobs) If true, the scroll knobs are sized based ongetMaxX()orgetMaxY(). If false, the scroll knobs are sized based onDrawable.getMinWidth()orDrawable.getMinHeight(). Default is true. - 
setCancelTouchFocus
public void setCancelTouchFocus(boolean cancelTouchFocus) When true (default) and flick scrolling begins,cancelTouchFocus()is called. This causes any actors inside the scrollpane that have received touchDown to receive touchUp when flick scrolling begins. - 
drawDebug
Description copied from class:GroupDraws this actor's debug lines ifActor.getDebug()is true and, regardless ofActor.getDebug(), callsActor.drawDebug(ShapeRenderer)on each child. 
 -