Class ccs.UIWidget
- Defined in: UIWidget.js
- Extends ccs.Class
Constructor Attributes | Constructor Name and Description |
---|---|
Base class for ccs.UIWidget
|
Method Summary
Class Detail
ccs.UIWidget()
Base class for ccs.UIWidget
Method Detail
-
{boolean} addChild(child)Adds a child to the container.
- Parameters:
- {ccs.UIWidget} child
- Returns:
- {boolean}
-
addRenderer(renderer, zOrder)Add a CCNode for rendering. renderer is a CCNode, it's for drawing
- Parameters:
- {cc.Node} renderer
- {number} zOrder
-
addTouchEventListener(selector, target)Sets the touch event target/selector of the menu item
- Parameters:
- {Function} selector
- {Object} target
-
checkChildInfo(handleState, sender, touchPoint)Sends the touch event to widget's parent
- Parameters:
- {number} handleState
- {ccs.UIWidget} sender
- {cc.Point} touchPoint
-
{Boolean} clippingParentAreaContainPoint(pt)Checks a point if in parent's area.
- Parameters:
- {cc.Point} pt
- Returns:
- {Boolean}
-
{cc.Point} convertToWorldSpace(pt)Converts a Point to world space coordinates. The result is in Points.
- Parameters:
- {cc.Point} pt
- Returns:
- {cc.Point}
-
allocates and initializes a UIWidget.
// example var uiWidget = ccs.UIWidget.create();
- Returns:
- {ccs.UIWidget}
-
didNotSelectSelf()A call back function when widget lost of focus.
-
{cc.Action} getActionByTag(tag)Removes an action from the running action list by its tag.
- Parameters:
- {number} tag
- Returns:
- {cc.Action}
-
{cc.ActionManager} getActionManager()Gets the CCActionManager object that is used by all actions.
- Returns:
- {cc.ActionManager}
-
{cc.Point} getAnchorPoint()Returns the anchor point in percent.
- Returns:
- {cc.Point}
-
{number} getBottomInParent()Gets the bottom boundary position of this widget.
- Returns:
- {number}
-
{ccs.UIWidget} getChildByName(name)Gets a child from the container with its name
- Parameters:
- {string} name
- Returns:
- {ccs.UIWidget}
-
{ccs.UIWidget} getChildByTag(tag)Gets a child from the container with its tag
- Parameters:
- {number} tag
- Returns:
- {ccs.UIWidget}
-
{Array} getChildren()Return an array of children
- Returns:
- {Array}
-
{cc.c3b} getColor()Gets color of widget
- Returns:
- {cc.c3b}
-
{cc.Size} getContentSize()Gets the content size of widget.
- Returns:
- {cc.Size}
-
{string} getDescription()Returns the "class name" of widget.
- Returns:
- {string}
-
{ccs.UILayoutParameter} getLayoutParameter(type)Gets layout parameter
- Parameters:
- {ccs.LayoutParameterType} type
- Returns:
- {ccs.UILayoutParameter}
-
{number} getLeftInParent()Gets the left boundary position of this widget.
- Returns:
- {number}
-
{string} getName()Gets the name of widget
- Returns:
- {string}
-
{number} getOpacity()Gets opacity of widget
- Returns:
- {number}
-
{ccs.UIWidget} getParent()Returns a pointer to the parent widget
- Returns:
- {ccs.UIWidget}
-
{cc.Point} getPosition()Gets the position (x,y) of the widget
- Returns:
- {cc.Point}
-
{cc.Point} getPositionPercent()Gets the percent (x,y) of the widget
- Returns:
- {cc.Point}
-
{cc.pPositionType} getPositionType()Gets the position type of the widget
- Returns:
- {cc.pPositionType}
-
{cc.Node} getRenderer()Gets the renderer of widget
- Returns:
- {cc.Node}
-
{number} getRightInParent()Gets the right boundary position of this widget.
- Returns:
- {number}
-
{number} getRotation()Returns the rotation of the widget in degrees.
- Returns:
- {number}
-
{number} getRotationX()Gets the X rotation (angle) of the widget in degrees which performs a horizontal rotation skew.
- Returns:
- {number}
-
{number} getRotationY()Gets the Y rotation (angle) of the widget in degrees which performs a vertical rotational skew.
- Returns:
- {number}
-
{number} getScale()Gets the scale factor of the widget, when X and Y have the same scale factor.
- Returns:
- {number}
-
{number} getScaleX()Returns the scale factor on X axis of this widget
- Returns:
- {number}
-
{number} getScaleY()Returns the scale factor on Y axis of this widget
- Returns:
- {number}
-
{cc.Size} getSize()Returns size of widget
- Returns:
- {cc.Size}
-
{cc.Point} getSizePercent()Returns size percent of widget
- Returns:
- {cc.Point}
-
{ccs.SizeType} getSizeType()Gets the size type of widget.
- Returns:
- {ccs.SizeType}
-
{Number} getTag()Gets widget tag
- Returns:
- {Number}
-
{number} getTopInParent()Gets the top boundary position of this widget.
- Returns:
- {number}
-
{cc.Point} getTouchEndPos()Gets touch end position
- Returns:
- {cc.Point}
-
{cc.Point} getTouchMovePos()Gets touch move position
- Returns:
- {cc.Point}
-
{cc.Point} getTouchStartPos()Gets touch start position
- Returns:
- {cc.Point}
-
{cc.Node} getVirtualRenderer()Gets the Virtual Renderer of widget.
- Returns:
- {cc.Node}
-
{ccs.WidgetType} getWidgetType()get widget type
- Returns:
- {ccs.WidgetType}
-
{cc.Point} getWorldPosition()Gets world position of widget.
- Returns:
- {cc.Point}
-
{number} getZOrder()get zOrder of widget
- Returns:
- {number}
-
{boolean} hitTest(pt)Checks a point if is in widget's space
- Parameters:
- {cc.Point} pt
- Returns:
- {boolean}
-
ignoreContentAdaptWithSize(ignore)Ignore the widget size
- Parameters:
- {Boolean} ignore
-
{boolean} init()initializes state of widget.
- Returns:
- {boolean}
-
initRenderer()initializes renderer of widget.
-
{boolean} isBright()Determines if the widget is bright
- Returns:
- {boolean}
-
{Boolean} isCascadeColorEnabled()Gets whether cascadeColor is enabled
- Returns:
- {Boolean}
-
{Boolean} isCascadeOpacityEnabled()Gets whether cascadeOpacity is enabled
- Returns:
- {Boolean}
-
{boolean} isEnabled()Determines if the widget is enabled
- Returns:
- {boolean}
-
{Boolean} isFlippedX()Returns the flag which indicates whether the widget is flipped horizontally or not. It only flips the texture of the widget, and not the texture of the widget's children. Also, flipping the texture doesn't alter the anchorPoint. If you want to flip the anchorPoint too, and/or to flip the children too use: widget.setScaleX(sprite.getScaleX() * -1);
- Returns:
- {Boolean} true if the widget is flipped horizaontally, false otherwise.
-
{Boolean} isFlippedY()Return the flag which indicates whether the widget is flipped vertically or not. It only flips the texture of the widget, and not the texture of the widget's children. Also, flipping the texture doesn't alter the anchorPoint. If you want to flip the anchorPoint too, and/or to flip the children too use: widget.setScaleY(widget.getScaleY() * -1);
- Returns:
- {Boolean} true if the widget is flipped vertically, flase otherwise.
-
{boolean} isFocused()Determines if the widget is on focused
- Returns:
- {boolean}
-
{boolean} isIgnoreContentAdaptWithSize()Gets the widget if is ignore it's size.
- Returns:
- {boolean}
-
{boolean} isTouchEnabled()To set the bright style of widget.
- Returns:
- {boolean}
-
{boolean} isUpdateEnabled()is the "update" method scheduled.
- Returns:
- {boolean}
-
{boolean} isVisible()Determines if the widget is visible
- Returns:
- {boolean}
-
onPressStateChangedToDisabled()call back function called widget's state changed to dark.
-
onPressStateChangedToNormal()call back function called widget's state changed to normal.
-
onPressStateChangedToPressed()call back function called widget's state changed to selected.
-
onSizeChanged()call back function called when size changed.
-
{boolean} onTouchBegan(touchPoint)A call back function called when widget is selected, and on touch began.
- Parameters:
- {cc.Ponit} touchPoint
- Returns:
- {boolean}
-
onTouchCancelled(touchPoint)A call back function called when widget is selected, and on touch canceled.
- Parameters:
- {cc.Point} touchPoint
-
onTouchEnded(touchPoint)A call back function called when widget is selected, and on touch ended.
- Parameters:
- {cc.Point} touchPoint
-
onTouchLongClicked(touchPoint)A call back function called when widget is selected, and on touch long clicked.
- Parameters:
- {cc.Point} touchPoint
-
onTouchMoved(touchPoint)A call back function called when widget is selected, and on touch moved.
- Parameters:
- {cc.Point} touchPoint
-
releaseResoures()Release texture resoures of widget. Release renderer. If you override releaseResoures, you shall call its parent's one, e.g. UIWidget::releaseResoures().
-
removeAllChildren()Removes all children from the container, and do a cleanup to all running actions depending on the cleanup parameter.
-
{boolean} removeChild(child)Adds a child to the container.
- Parameters:
- {ccs.UIWidget} child
- Returns:
- {boolean}
-
removeFromParent()Removes this widget itself from its parent widget. If the widget orphan, then it will destroy itself.
-
removeRenderer(renderer, cleanup)Remove a CCNode from widget.
- Parameters:
- {cc.Node} renderer
- {Boolean} cleanup
-
reorderChild(child)Reorders a child according to a new z value.
- Parameters:
- {ccs.UIWidget} child
-
{*} runAction(action)run action
- Parameters:
- {cc.Action} action
- Returns:
- {*}
-
setActionManager(actionManager)Sets the CCActionManager object that is used by all actions.
- Parameters:
- {cc.ActionManager} actionManager
-
setAnchorPoint(pt)Sets the anchor point in percent.
- Parameters:
- {cc.Point} pt
-
setBlendFunc(blendFunc)Sets blendFunc
- Parameters:
- {cc.BlendFunc} blendFunc
-
setBrightStyle(style)To set the bright style of widget.
- Parameters:
- {ccs.BrightStyle} style
-
setCascadeColorEnabled(cascadeColorEnabled)Sets cascade color enabled
- Parameters:
- {Boolean} cascadeColorEnabled
-
setCascadeOpacityEnabled(cascadeOpacityEnabled)Sets cascade opacity enabled
- Parameters:
- {Boolean} cascadeOpacityEnabled
-
setColor(color)Sets color to widget
- Parameters:
- {cc.c3b} color
-
setEnabled(enabled)Set enabled renderer
- Parameters:
- {Boolean} enabled
-
setFlippedX(flipX)Sets whether the widget should be flipped horizontally or not.
- Parameters:
- {Boolean} flipX
-
setFlippedY(flipY)Sets whether the widget should be flipped vertically or not.
- Parameters:
- {Boolean} flipY
-
setFocused(fucos)Sets whether the widget is on focused The default value is false, a widget is default to not on focused
- Parameters:
- {boolean} fucos
-
setLayoutParameter(parameter)Sets layout parameter
- Parameters:
- {ccs.UILayoutParameter} parameter
-
setName(name)Sets the name of widget
- Parameters:
- {String} name
-
setOpacity(opacity)Sets opacity to widget
- Parameters:
- {number} opacity
-
setParent(parent)Sets the parent widget
- Parameters:
- {ccs.UIWidget} parent
-
setPosition(pos)Changes the position (x,y) of the widget .
- Parameters:
- {cc.Point} pos
-
setPositionPercent(percent)Changes the position (x,y) of the widget
- Parameters:
- {cc.Point} percent
-
setPositionType(type)Changes the position type of the widget
- Parameters:
- {ccs.PositionType} type
-
setRotation(rotation)Sets the rotation (angle) of the widget in degrees.
- Parameters:
- {number} rotation
-
setRotationX(rotationX)Sets the X rotation (angle) of the widget in degrees which performs a horizontal rotational skew.
- Parameters:
- {number} rotationX
-
setRotationY(rotationY)Sets the Y rotation (angle) of the widget in degrees which performs a vertical rotational skew.
- Parameters:
- {number} rotationY
-
setScale(scale)Changes both X and Y scale factor of the widget. 1.0 is the default scale factor. It modifies the X and Y scale at the same time.
- Parameters:
- {number} scale
-
setScaleX(scaleX)Changes the scale factor on X axis of this widget
- Parameters:
- {number} scaleX
-
setScaleY(scaleY)Changes the scale factor on Y axis of this widget
- Parameters:
- {number} scaleY
-
setSize(size)Changes the size that is widget's size
- Parameters:
- {cc.Size} size
-
setSizePercent(percent)Changes the percent that is widget's percent size
- Parameters:
- {cc.Point} percent
-
setSizeType(type)Changes the size type of widget.
- Parameters:
- {ccs.SizeType} type
-
setTag(tag)Sets widget tag
- Parameters:
- {Number} tag
-
setTouchEnabled(enable)Sets whether the widget is touch enabled
- Parameters:
- enable
-
setUpdateEnabled(enable)Schedules the "update" method.
- Parameters:
- enable
-
setVisible(visible)Sets whether the widget is visible The default value is true, a widget is default to visible
- Parameters:
- {Boolean} visible
-
setZOrder(z)set zOrder of widget
- Parameters:
- {number} z
-
stopAction(action)Stops and removes an action from the running action list.
- Parameters:
- {cc.Action} action
-
stopActionByTag(tag)Removes an action from the running action list by its tag.
- Parameters:
- {number} tag
-
stopAllActions()Stops and removes all actions from the running action list .
-
updateSizeAndPosition()update size and position