Class ccui.Layout
- Defined in: UILayout.js
- Extends ccui.Widget
Constructor Attributes | Constructor Name and Description |
---|---|
ccui.Layout is the base class of ccui.PageView and ccui.ScrollView, it does layout by layout manager
and clips area by its _clippingStencil when clippingEnabled is true.
|
Method Summary
Class Detail
ccui.Layout()
ccui.Layout is the base class of ccui.PageView and ccui.ScrollView, it does layout by layout manager
and clips area by its _clippingStencil when clippingEnabled is true.
Field Detail
<static> <constant>
ccui.Layout.ABSOLUTE
The absolute of ccui.Layout's layout type.
<static> <constant>
ccui.Layout.BACKGROUND_IMAGE_ZORDER
The zOrder value of ccui.Layout's image background.
<static> <constant>
ccui.Layout.BACKGROUND_RENDERER_ZORDER
The zOrder value of ccui.Layout's color background.
<static> <constant>
ccui.Layout.BG_COLOR_GRADIENT
The gradient of ccui.Layout's background color type, it will use a LayerGradient to draw the background.
<static> <constant>
ccui.Layout.BG_COLOR_NONE
The None of ccui.Layout's background color type
<static> <constant>
ccui.Layout.BG_COLOR_SOLID
The solid of ccui.Layout's background color type, it will use a LayerColor to draw the background.
<static> <constant>
ccui.Layout.CLIPPING_SCISSOR
The scissor of ccui.Layout's clipping type.
<static> <constant>
ccui.Layout.CLIPPING_STENCIL
The stencil of ccui.Layout's clipping type.
{Boolean}
clippingEnabled
- Indicate whether clipping is enabled
{ccui.Layout.CLIPPING_STENCIL|ccui.Layout.CLIPPING_SCISSOR}
clippingType
{ccui.Layout.ABSOLUTE|ccui.Layout.LINEAR_VERTICAL|ccui.Layout.LINEAR_HORIZONTAL|ccui.Layout.RELATIVE}
layoutType
<static> <constant>
ccui.Layout.LINEAR_HORIZONTAL
The horizontal of ccui.Layout's layout type.
<static> <constant>
ccui.Layout.LINEAR_VERTICAL
The vertical of ccui.Layout's layout type.
<static> <constant>
ccui.Layout.RELATIVE
The relative of ccui.Layout's layout type.
Method Detail
-
addChild(widget, zOrder, tag)Adds a widget to the container.
- Parameters:
- {ccui.Widget} widget
- {Number} zOrder Optional
- {Number|string} tag Optional
- tag or name
-
allocates and initializes a UILayout.
- Deprecated:
- since v3.0, please use new ccui.Layout() instead.
- Returns:
- {ccui.Layout}
-
ctor()Allocates and initializes an UILayout. Constructor of ccui.Layout
// example var uiLayout = new ccui.Layout();
-
{ccui.Widget} findNextFocusedWidget(direction, current)When a widget is in a layout, you could call this method to get the next focused widget within a specified direction. If the widget is not in a layout, it will return itself
- Parameters:
- {Number} direction
- the direction to look for the next focused widget in a layout
- {ccui.Widget} current
- the current focused widget
- Returns:
- {ccui.Widget} return the index of widget in the layout
-
forceDoLayout()force refresh widget layout
-
{cc.Color} getBackGroundColor()Gets background color of ccui.Layout, if color type is Layout.COLOR_SOLID.
- Returns:
- {cc.Color}
-
{Number} getBackGroundColorOpacity()Get background opacity value of ccui.Layout.
- Returns:
- {Number}
-
{ccui.Layout.BG_COLOR_NONE|ccui.Layout.BG_COLOR_SOLID|ccui.Layout.BG_COLOR_GRADIENT} getBackGroundColorType()Get background color type of ccui.Layout.
-
{cc.Point} getBackGroundColorVector()Gets background color vector of ccui.Layout, if color type is Layout.COLOR_GRADIENT
- Returns:
- {cc.Point}
-
{cc.Color} getBackGroundEndColor()Gets background end color of ccui.Layout
- Returns:
- {cc.Color}
-
{cc.Rect} getBackGroundImageCapInsets()Gets background image capinsets of ccui.Layout.
- Returns:
- {cc.Rect}
-
{cc.Color} getBackGroundImageColor()Gets backGround image color
- Returns:
- {cc.Color}
-
{Number} getBackGroundImageOpacity()Gets backGround image opacity
- Returns:
- {Number}
-
{cc.Size} getBackGroundImageTextureSize()Gets background image texture size.
- Returns:
- {cc.Size}
-
{cc.Color} getBackGroundStartColor()Gets background start color of ccui.Layout
- Returns:
- {cc.Color}
-
{ccui.Layout.CLIPPING_STENCIL|ccui.Layout.CLIPPING_SCISSOR} getClippingType()Gets clipping type of ccui.Layout
-
{string} getDescription()Returns the "class name" of widget.
- Returns:
- {string}
-
{null} getLayoutType()Gets LayoutType of ccui.Layout.
- Returns:
- {null}
-
{boolean} init()override "init" method of widget. please do not call this function by yourself, you should pass the parameters to constructor to initialize it.
- Returns:
- {boolean}
-
{Boolean} isBackGroundImageScale9Enabled()Get whether background image is use scale9 renderer.
- Returns:
- {Boolean}
-
{Boolean} isClippingEnabled()Gets if layout is clipping enabled.
- Returns:
- {Boolean} if layout is clipping enabled.
-
{boolean} isLoopFocus()Gets whether enable focus loop
- Returns:
- {boolean} If focus loop is enabled, then it will return true, otherwise it returns false. The default value is false.
-
{boolean} isPassFocusToChild()Returns whether the layout will pass the focus to its children or not. The default value is true
- Returns:
- {boolean} To query whether the layout will pass the focus to its children or not. The default value is true
-
onEnter()Calls its parent's onEnter, and calls its clippingStencil's onEnter if clippingStencil isn't null.
-
onExit()Calls its parent's onExit, and calls its clippingStencil's onExit if clippingStencil isn't null.
-
onPassFocusToChild(direction, current)To specify a user-defined functor to decide which child widget of the layout should get focused
- Parameters:
- {Number} direction
- {ccui.Widget} current
-
removeAllChildren(cleanup)Removes all children from the container with a cleanup, and sets the layout dirty flag to true.
- Parameters:
- {Boolean} cleanup
-
removeAllChildrenWithCleanup(cleanup)Removes all children from the container, do a cleanup to all running actions depending on the cleanup parameter, and sets the layout dirty flag to true.
- Parameters:
- {Boolean} cleanup
- true if all running actions on all children nodes should be cleanup, false otherwise.
-
removeBackGroundImage()Remove the background image of ccui.Layout.
-
removeChild(widget, cleanup)Removes child widget from ccui.Layout, and sets the layout dirty flag to true.
- Parameters:
- {ccui.Widget} widget
- {Boolean} cleanup Optional, Default: true
-
requestDoLayout()request to refresh widget layout, it will do layout at visit calls
-
setBackGroundColor(color, endColor)Sets background color for layout, if color type is Layout.COLOR_SOLID
-
setBackGroundColorOpacity(opacity)Sets background opacity to ccui.Layout.
- Parameters:
- {number} opacity
-
setBackGroundColorType(type)Sets Color Type for ccui.Layout.
- Parameters:
- {ccui.Layout.BG_COLOR_NONE|ccui.Layout.BG_COLOR_SOLID|ccui.Layout.BG_COLOR_GRADIENT} type
-
setBackGroundColorVector(vector)Sets background color vector for layout, if color type is Layout.COLOR_GRADIENT
- Parameters:
- {cc.Point} vector
-
setBackGroundImage(fileName, texType)Sets a background image for layout
- Parameters:
- {String} fileName
- {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
-
setBackGroundImageCapInsets(capInsets)Sets a background image CapInsets for layout, if the background image is a scale9 render.
- Parameters:
- {cc.Rect} capInsets
- capinsets of background image.
-
setBackGroundImageColor(color)Sets backGround image color
- Parameters:
- {cc.Color} color
-
setBackGroundImageOpacity(opacity)Sets backGround image Opacity
- Parameters:
- {Number} opacity
-
setBackGroundImageScale9Enabled(able)Sets background image use scale9 renderer.
- Parameters:
- {Boolean} able
- true that use scale9 renderer, false otherwise.
-
setClippingEnabled(able)Changes if layout can clip it's content and locChild. If you really need this, please enable it. But it would reduce the rendering efficiency.
- Parameters:
- {Boolean} able
- clipping enabled.
-
setClippingType(type)Sets clipping type to ccui.Layout
- Parameters:
- {ccui.Layout.CLIPPING_STENCIL|ccui.Layout.CLIPPING_SCISSOR} type
-
setLayoutType(type)Sets LayoutType to ccui.Layout, LayoutManager will do layout by layout type..
-
setLoopFocus(loop)If a layout is loop focused which means that the focus movement will be inside the layout
- Parameters:
- {Boolean} loop
- pass true to let the focus movement loop inside the layout
-
setPassFocusToChild(pass)Specifies whether the layout pass its focus to its child
- Parameters:
- pass
- To specify whether the layout pass its focus to its child
-
visit(parentCmd)
Calls adaptRenderers (its subclass will override it.) and do layout. If clippingEnabled is true, it will clip/scissor area.
- Parameters:
- {cc.Node.RenderCmd} parentCmd Optional