Class ccs.Widget

Class Summary
Constructor Attributes Constructor Name and Description
 
Base class for ccs.Widget

Method Summary

Class Detail

ccs.Widget()
Base class for ccs.Widget

Method Detail

  • addChild(child, zOrder, tag)
    Adds a child to the container.
    Parameters:
    {ccs.Widget} child
    zOrder
    tag
  • addNode(node, zOrder, tag)
    add node for widget
    Parameters:
    {cc.Node} node
    {Number} zOrder
    {Number} tag
  • 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.Widget} sender
    {cc.Point} touchPoint
  • {Boolean} clippingParentAreaContainPoint(pt)
    Checks a point if in parent's area.
    Parameters:
    {cc.Point} pt
    Returns:
    {Boolean}
  • <static> {ccs.Widget} ccs.Widget.create()
    allocates and initializes a UIWidget.
    // example
    var uiWidget = ccs.Widget.create();
    Returns:
    {ccs.Widget}
  • didNotSelectSelf()
    A call back function when widget lost of focus.
  • {number} getBottomInParent()
    Gets the bottom boundary position of this widget.
    Returns:
    {number}
  • {ccs.Widget} getChildByName(name)
    Gets a child from the container with its name
    Parameters:
    {string} name
    Returns:
    {ccs.Widget}
  • {Array} getChildren()
    Return an array of children
    Returns:
    {Array}
  • {Number} getChildrenCount()
    get the count of children
    Returns:
    {Number}
  • {cc.Size} getContentSize()
    Gets the content size of widget.
    Returns:
    {cc.Size}
  • {string} getDescription()
    Returns the "class name" of widget.
    Returns:
    {string}
  • {ccs.LayoutParameter} getLayoutParameter(type)
    Gets layout parameter
    Parameters:
    {ccs.LayoutParameterType} type
    Returns:
    {ccs.LayoutParameter}
  • {number} getLeftInParent()
    Gets the left boundary position of this widget.
    Returns:
    {number}
  • {string} getName()
    Gets the name of widget
    Returns:
    {string}
  • {cc.Node} getNodeByTag(tag)
    get node by tag
    Parameters:
    {Number} tag
    Returns:
    {cc.Node}
  • {Array} getNodes()
    get all node
    Returns:
    {Array}
  • {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}
  • {number} getRightInParent()
    Gets the right boundary position 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} 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}
  • {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} isEnabled()
    Determines if the widget is enabled
    Returns:
    {boolean}
  • {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}
  • 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.
  • onTouchCancelled(touchPoint)
    A call back function called when widget is selected, and on touch canceled.
    Parameters:
    {cc.Point} touchPoint
  • onTouchLongClicked(touchPoint)
    A call back function called when widget is selected, and on touch long clicked.
    Parameters:
    {cc.Point} touchPoint
  • removeAllChildren(cleanup)
    Removes all children from the container, and do a cleanup to all running actions depending on the cleanup parameter.
    Parameters:
    cleanup
  • removeAllNodes()
    remove all node
  • removeChild(child, cleanup)
    remove child
    Parameters:
    {ccs.Widget} child
    {Boolean} cleanup
  • removeNode(node)
    remove node
    Parameters:
    {cc.Node} node
  • removeNodeByTag(tag)
    remove node by tag
    Parameters:
    tag
  • setBrightStyle(style)
    To set the bright style of widget.
    Parameters:
    {ccs.BrightStyle} style
  • setEnabled(enabled)
    Set enabled renderer
    Parameters:
    {Boolean} enabled
  • 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.LayoutParameter} parameter
  • setName(name)
    Sets the name of widget
    Parameters:
    {String} name
  • setPosition(pos, posY)
    Changes the position (x,y) of the widget .
    Parameters:
    {cc.Point||Number} pos
    {Number} posY
  • 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
  • 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
  • setTouchEnabled(enable)
    Sets whether the widget is touch enabled
    Parameters:
    enable
  • setUpdateEnabled(enable)
    Schedules the "update" method.
    Parameters:
    enable
  • updateSizeAndPosition()
    update size and position