C# Class Nez.UI.ScrollPane

A group that scrolls a child widget using scrollbars and/or mouse or touch dragging. The widget is sized to its preferred size.If the widget'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 widget is larger than the scroll pane. The scroll pane's preferred size is that of the child widget. At this size, the child widget will not need to scroll, so scroll pane is typically sized by ignoring the preferred size in one or both directions.
Inheritance: Group, IInputListener
Exibir arquivo Open project: prime31/Nez Class Usage Examples

Protected Properties

Property Type Description
_disableX bool

Public Methods

Method Description
ScrollPane ( Element widget ) : System
ScrollPane ( Element widget, ScrollPaneStyle style ) : System
ScrollPane ( Element widget, Skin skin ) : System
ScrollPane ( Element widget, Skin skin, string styleName ) : System
cancel ( ) : void

If currently scrolling by tracking a touch down, stop scrolling.

debugRender ( Graphics graphics ) : void
draw ( Graphics graphics, float parentAlpha ) : void
fling ( float flingTime, float velocityX, float velocityY ) : void

Generate fling gesture

getMaxX ( ) : float

Returns the maximum scroll value in the x direction.

getMaxY ( ) : float

Returns the maximum scroll value in the y direction.

getScrollBarHeight ( ) : float
getScrollBarWidth ( ) : float
getScrollHeight ( ) : float

Returns the height of the scrolled viewport.

getScrollPercentX ( ) : float
getScrollPercentY ( ) : float
getScrollSpeed ( ) : float

Returns the x scroll speed

getScrollWidth ( ) : float

Returns the width of the scrolled viewport.

getScrollX ( ) : float

Returns the x scroll position in pixels, where 0 is the left of the scroll pane.

getScrollY ( ) : float

Returns the y scroll position in pixels, where 0 is the top of the scroll pane.

getStyle ( ) : ScrollPaneStyle

Returns the scroll pane's style. Modifying the returned style may not have an effect until {@link #setStyle(ScrollPaneStyle)} is called.

getUseNaturalScrolling ( ) : bool
getVariableSizeKnobs ( ) : bool
getVelocityX ( ) : float

Gets the flick scroll x velocity

getVelocityY ( ) : float

Gets the flick scroll y velocity

getVisualScrollPercentX ( ) : float
getVisualScrollPercentY ( ) : float
getVisualScrollX ( ) : float
getVisualScrollY ( ) : float
getWidget ( ) : Element

Returns the Element embedded in this scroll pane, or null

hit ( Vector2 point ) : Element
isBottomEdge ( ) : bool
isFlinging ( ) : bool
isForceScrollX ( ) : bool
isForceScrollY ( ) : bool
isLeftEdge ( ) : bool
isRightEdge ( ) : bool
isScrollX ( ) : bool

Returns true if the widget is larger than the scroll pane horizontally.

isScrollY ( ) : bool

Returns true if the widget is larger than the scroll pane vertically.

isScrollingDisabledX ( ) : bool
isScrollingDisabledY ( ) : bool
isTopEdge ( ) : bool
layout ( ) : void
scrollTo ( float x, float y, float width, float height ) : void

Sets the scroll offset so the specified rectangle is fully in view, if possible. Coordinates are in the scroll pane widget's coordinate system.

scrollTo ( float x, float y, float width, float height, bool centerHorizontal, bool centerVertical ) : void

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 widget's coordinate system.

setClamp ( bool clamp ) : ScrollPane

For flick scroll, prevents scrolling out of the widget's bounds. Default is true.

setFadeScrollBars ( bool fadeScrollBars ) : ScrollPane

When true the scrollbars don't reduce the scrollable size and fade out after some time of not being used.

setFlingTime ( float flingTime ) : ScrollPane

For flick scroll, sets the amount of time in seconds that a fling will continue to scroll. Default is 1.

setForceScroll ( bool x, bool y ) : ScrollPane

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.

setOverscroll ( bool overscrollX, bool overscrollY ) : ScrollPane

For flick scroll, if true the widget can be scrolled slightly past its bounds and will animate back to its bounds when scrolling is stopped. Default is true.

setScrollBarPositions ( bool bottom, bool right ) : ScrollPane

Set the position of the vertical and horizontal scroll bars.

setScrollPercentX ( float percentX ) : void
setScrollPercentY ( float percentY ) : void
setScrollSpeed ( float scrollSpeed ) : ScrollPane

sets the scroll speed when the mouse wheel is used to scroll the ScrollPane

setScrollX ( float pixelsX ) : ScrollPane

sets x scroll amount

setScrollY ( float pixelsY ) : ScrollPane

Called whenever the y scroll amount is changed

setScrollbarsOnTop ( bool scrollbarsOnTop ) : ScrollPane

When false (the default), the widget is clipped so it is not drawn under the scrollbars. When true, the widget is clipped to the entire scroll pane bounds and the scrollbars are drawn on top of the widget. If {@link #setFadeScrollBars(boolean)} is true, the scroll bars are always drawn on top.

setScrollingDisabled ( bool x, bool y ) : ScrollPane

Disables scrolling in a direction. The widget will be sized to the FlickScrollPane in the disabled direction.

setSmoothScrolling ( bool smoothScrolling ) : ScrollPane
setStyle ( ScrollPaneStyle style ) : ScrollPane
setUseNaturalScrolling ( bool useNaturalScrolling ) : ScrollPane

sets how the mouse wheel/trackpad operates. Natural scrolling moves the contents of a window the same direction as your fingers.

setVariableSizeKnobs ( bool variableSizeKnobs ) : ScrollPane

If true, the scroll knobs are sized based on getMaxX() or getMaxY(). If false, the scroll knobs are sized based on Drawable#getMinWidth() or Drawable#getMinHeight(). Default is true.

setVelocityX ( float velocityX ) : void
setVelocityY ( float velocityY ) : ScrollPane
setWidget ( Element widget ) : ScrollPane

Sets the {@link Element} embedded in this scroll pane

setupFadeScrollBars ( float fadeAlphaSeconds, float fadeDelaySeconds ) : ScrollPane
setupOverscroll ( float distance, float speedMin, float speedMax ) : ScrollPane

For flick scroll, sets the overscroll distance in pixels and the speed it returns to the widget's bounds in seconds. Default is 50, 30, 200.

updateVisualScroll ( ) : ScrollPane

Sets the visual scroll amount equal to the scroll amount. This can be used when setting the scroll amount without animating.

Protected Methods

Method Description
setVisualScrollX ( float pixelsX ) : void

Called whenever the visual x scroll amount is changed

setVisualScrollY ( float pixelsY ) : void

Called whenever the visual y scroll amount is changed

update ( ) : void

Private Methods

Method Description
IInputListener ( Vector2 mousePos ) : bool
IInputListener ( int mouseWheelDelta ) : bool
IInputListener ( ) : void
IInputListener ( Vector2 mousePos ) : void
clamp ( ) : void
resetFade ( ) : void

Method Details

ScrollPane() public method

public ScrollPane ( Element widget ) : System
widget Element
return System

ScrollPane() public method

public ScrollPane ( Element widget, ScrollPaneStyle style ) : System
widget Element
style ScrollPaneStyle
return System

ScrollPane() public method

public ScrollPane ( Element widget, Skin skin ) : System
widget Element
skin Skin
return System

ScrollPane() public method

public ScrollPane ( Element widget, Skin skin, string styleName ) : System
widget Element
skin Skin
styleName string
return System

cancel() public method

If currently scrolling by tracking a touch down, stop scrolling.
public cancel ( ) : void
return void

debugRender() public method

public debugRender ( Graphics graphics ) : void
graphics Graphics
return void

draw() public method

public draw ( Graphics graphics, float parentAlpha ) : void
graphics Graphics
parentAlpha float
return void

fling() public method

Generate fling gesture
public fling ( float flingTime, float velocityX, float velocityY ) : void
flingTime float Fling time.
velocityX float Velocity x.
velocityY float Velocity y.
return void

getMaxX() public method

Returns the maximum scroll value in the x direction.
public getMaxX ( ) : float
return float

getMaxY() public method

Returns the maximum scroll value in the y direction.
public getMaxY ( ) : float
return float

getScrollBarHeight() public method

public getScrollBarHeight ( ) : float
return float

getScrollBarWidth() public method

public getScrollBarWidth ( ) : float
return float

getScrollHeight() public method

Returns the height of the scrolled viewport.
public getScrollHeight ( ) : float
return float

getScrollPercentX() public method

public getScrollPercentX ( ) : float
return float

getScrollPercentY() public method

public getScrollPercentY ( ) : float
return float

getScrollSpeed() public method

Returns the x scroll speed
public getScrollSpeed ( ) : float
return float

getScrollWidth() public method

Returns the width of the scrolled viewport.
public getScrollWidth ( ) : float
return float

getScrollX() public method

Returns the x scroll position in pixels, where 0 is the left of the scroll pane.
public getScrollX ( ) : float
return float

getScrollY() public method

Returns the y scroll position in pixels, where 0 is the top of the scroll pane.
public getScrollY ( ) : float
return float

getStyle() public method

Returns the scroll pane's style. Modifying the returned style may not have an effect until {@link #setStyle(ScrollPaneStyle)} is called.
public getStyle ( ) : ScrollPaneStyle
return ScrollPaneStyle

getUseNaturalScrolling() public method

public getUseNaturalScrolling ( ) : bool
return bool

getVariableSizeKnobs() public method

public getVariableSizeKnobs ( ) : bool
return bool

getVelocityX() public method

Gets the flick scroll x velocity
public getVelocityX ( ) : float
return float

getVelocityY() public method

Gets the flick scroll y velocity
public getVelocityY ( ) : float
return float

getVisualScrollPercentX() public method

public getVisualScrollPercentX ( ) : float
return float

getVisualScrollPercentY() public method

public getVisualScrollPercentY ( ) : float
return float

getVisualScrollX() public method

public getVisualScrollX ( ) : float
return float

getVisualScrollY() public method

public getVisualScrollY ( ) : float
return float

getWidget() public method

Returns the Element embedded in this scroll pane, or null
public getWidget ( ) : Element
return Element

hit() public method

public hit ( Vector2 point ) : Element
point Vector2
return Element

isBottomEdge() public method

public isBottomEdge ( ) : bool
return bool

isFlinging() public method

public isFlinging ( ) : bool
return bool

isForceScrollX() public method

public isForceScrollX ( ) : bool
return bool

isForceScrollY() public method

public isForceScrollY ( ) : bool
return bool

isLeftEdge() public method

public isLeftEdge ( ) : bool
return bool

isRightEdge() public method

public isRightEdge ( ) : bool
return bool

isScrollX() public method

Returns true if the widget is larger than the scroll pane horizontally.
public isScrollX ( ) : bool
return bool

isScrollY() public method

Returns true if the widget is larger than the scroll pane vertically.
public isScrollY ( ) : bool
return bool

isScrollingDisabledX() public method

public isScrollingDisabledX ( ) : bool
return bool

isScrollingDisabledY() public method

public isScrollingDisabledY ( ) : bool
return bool

isTopEdge() public method

public isTopEdge ( ) : bool
return bool

layout() public method

public layout ( ) : void
return void

scrollTo() public method

Sets the scroll offset so the specified rectangle is fully in view, if possible. Coordinates are in the scroll pane widget's coordinate system.
public scrollTo ( float x, float y, float width, float height ) : void
x float The x coordinate.
y float The y coordinate.
width float Width.
height float Height.
return void

scrollTo() public method

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 widget's coordinate system.
public scrollTo ( float x, float y, float width, float height, bool centerHorizontal, bool centerVertical ) : void
x float The x coordinate.
y float The y coordinate.
width float Width.
height float Height.
centerHorizontal bool Center horizontal.
centerVertical bool Center vertical.
return void

setClamp() public method

For flick scroll, prevents scrolling out of the widget's bounds. Default is true.
public setClamp ( bool clamp ) : ScrollPane
clamp bool Clamp.
return ScrollPane

setFadeScrollBars() public method

When true the scrollbars don't reduce the scrollable size and fade out after some time of not being used.
public setFadeScrollBars ( bool fadeScrollBars ) : ScrollPane
fadeScrollBars bool Fade scroll bars.
return ScrollPane

setFlingTime() public method

For flick scroll, sets the amount of time in seconds that a fling will continue to scroll. Default is 1.
public setFlingTime ( float flingTime ) : ScrollPane
flingTime float Fling time.
return ScrollPane

setForceScroll() public method

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.
public setForceScroll ( bool x, bool y ) : ScrollPane
x bool The x coordinate.
y bool The y coordinate.
return ScrollPane

setOverscroll() public method

For flick scroll, if true the widget can be scrolled slightly past its bounds and will animate back to its bounds when scrolling is stopped. Default is true.
public setOverscroll ( bool overscrollX, bool overscrollY ) : ScrollPane
overscrollX bool Overscroll x.
overscrollY bool Overscroll y.
return ScrollPane

setScrollBarPositions() public method

Set the position of the vertical and horizontal scroll bars.
public setScrollBarPositions ( bool bottom, bool right ) : ScrollPane
bottom bool Bottom.
right bool Right.
return ScrollPane

setScrollPercentX() public method

public setScrollPercentX ( float percentX ) : void
percentX float
return void

setScrollPercentY() public method

public setScrollPercentY ( float percentY ) : void
percentY float
return void

setScrollSpeed() public method

sets the scroll speed when the mouse wheel is used to scroll the ScrollPane
public setScrollSpeed ( float scrollSpeed ) : ScrollPane
scrollSpeed float Scroll speed.
return ScrollPane

setScrollX() public method

sets x scroll amount
public setScrollX ( float pixelsX ) : ScrollPane
pixelsX float Pixels x.
return ScrollPane

setScrollY() public method

Called whenever the y scroll amount is changed
public setScrollY ( float pixelsY ) : ScrollPane
pixelsY float Pixels y.
return ScrollPane

setScrollbarsOnTop() public method

When false (the default), the widget is clipped so it is not drawn under the scrollbars. When true, the widget is clipped to the entire scroll pane bounds and the scrollbars are drawn on top of the widget. If {@link #setFadeScrollBars(boolean)} is true, the scroll bars are always drawn on top.
public setScrollbarsOnTop ( bool scrollbarsOnTop ) : ScrollPane
scrollbarsOnTop bool Scrollbars on top.
return ScrollPane

setScrollingDisabled() public method

Disables scrolling in a direction. The widget will be sized to the FlickScrollPane in the disabled direction.
public setScrollingDisabled ( bool x, bool y ) : ScrollPane
x bool The x coordinate.
y bool The y coordinate.
return ScrollPane

setSmoothScrolling() public method

public setSmoothScrolling ( bool smoothScrolling ) : ScrollPane
smoothScrolling bool
return ScrollPane

setStyle() public method

public setStyle ( ScrollPaneStyle style ) : ScrollPane
style ScrollPaneStyle
return ScrollPane

setUseNaturalScrolling() public method

sets how the mouse wheel/trackpad operates. Natural scrolling moves the contents of a window the same direction as your fingers.
public setUseNaturalScrolling ( bool useNaturalScrolling ) : ScrollPane
useNaturalScrolling bool Use natural scrolling.
return ScrollPane

setVariableSizeKnobs() public method

If true, the scroll knobs are sized based on getMaxX() or getMaxY(). If false, the scroll knobs are sized based on Drawable#getMinWidth() or Drawable#getMinHeight(). Default is true.
public setVariableSizeKnobs ( bool variableSizeKnobs ) : ScrollPane
variableSizeKnobs bool Variable size knobs.
return ScrollPane

setVelocityX() public method

public setVelocityX ( float velocityX ) : void
velocityX float
return void

setVelocityY() public method

public setVelocityY ( float velocityY ) : ScrollPane
velocityY float
return ScrollPane

setVisualScrollX() protected method

Called whenever the visual x scroll amount is changed
protected setVisualScrollX ( float pixelsX ) : void
pixelsX float Pixels x.
return void

setVisualScrollY() protected method

Called whenever the visual y scroll amount is changed
protected setVisualScrollY ( float pixelsY ) : void
pixelsY float Pixels y.
return void

setWidget() public method

Sets the {@link Element} embedded in this scroll pane
public setWidget ( Element widget ) : ScrollPane
widget Element Widget.
return ScrollPane

setupFadeScrollBars() public method

public setupFadeScrollBars ( float fadeAlphaSeconds, float fadeDelaySeconds ) : ScrollPane
fadeAlphaSeconds float
fadeDelaySeconds float
return ScrollPane

setupOverscroll() public method

For flick scroll, sets the overscroll distance in pixels and the speed it returns to the widget's bounds in seconds. Default is 50, 30, 200.
public setupOverscroll ( float distance, float speedMin, float speedMax ) : ScrollPane
distance float Distance.
speedMin float Speed minimum.
speedMax float Speed max.
return ScrollPane

update() protected method

protected update ( ) : void
return void

updateVisualScroll() public method

Sets the visual scroll amount equal to the scroll amount. This can be used when setting the scroll amount without animating.
public updateVisualScroll ( ) : ScrollPane
return ScrollPane

Property Details

_disableX protected_oe property

protected bool _disableX
return bool