Class ccui.CheckBox

Class Summary
Constructor Attributes Constructor Name and Description
 
The CheckBox control of Cocos UI.

Method Summary

Class Detail

ccui.CheckBox()
The CheckBox control of Cocos UI.

Field Detail

<static> <constant> ccui.CheckBox.BOX_DISABLED_RENDERER_ZORDER
The disabled Background renderer's zOrder
<static> <constant> ccui.CheckBox.BOX_RENDERER_ZORDER
The normal background renderer's zOrder
<static> <constant> ccui.CheckBox.BOX_SELECTED_RENDERER_ZORDER
The selected Background renderer's zOrder
<static> <constant> ccui.CheckBox.EVENT_SELECTED
The selected state of ccui.CheckBox's event.
<static> <constant> ccui.CheckBox.EVENT_UNSELECTED
The unselected state of ccui.CheckBox's event.
<static> <constant> ccui.CheckBox.FRONT_CROSS_DISABLED_RENDERER_ZORDER
The disabled front renderer's zOrder
<static> <constant> ccui.CheckBox.FRONT_CROSS_RENDERER_ZORDER
The normal front renderer's zOrder
{Boolean} selected
- Indicate whether the check box has been selected

Method Detail

  • addEventListener(selector, target)
    add a call back function would called when checkbox is selected or unselected.
    Parameters:
    {Function} selector
    {Object} target Optional
  • addEventListenerCheckBox(selector, target)
    add event listener to ccui.CheckBox. it would called when checkbox is selected or unselected.
    Parameters:
    {Function} selector
    {Object} target Optional
    Deprecated:
    since v3.0, please use addEventListener instead.
  • <static> {ccui.CheckBox} ccui.CheckBox.create(backGround, backGroundSeleted, cross, backGroundDisabled, frontCrossDisabled, texType)
    allocates and initializes a UICheckBox.
    // example
    var uiCheckBox = new ccui.CheckBox();
    Parameters:
    {string} backGround Optional
    backGround texture.
    {string} backGroundSeleted Optional
    backGround selected state texture.
    {string} cross Optional
    cross texture.
    {string} backGroundDisabled Optional
    cross dark state texture.
    {string} frontCrossDisabled Optional
    cross dark state texture.
    {Number} texType Optional
    Deprecated:
    since v3.0, please use new ccui.CheckBox() instead.
    Returns:
    {ccui.CheckBox}
  • ctor(backGround, backGroundSelected, cross, backGroundDisabled, frontCrossDisabled, texType)
    allocates and initializes a UICheckBox. Constructor of ccui.CheckBox, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
    // example
    var uiCheckBox = new ccui.CheckBox();
    Parameters:
    {String} backGround
    {String} backGroundSelected
    {String} cross
    {String} backGroundDisabled
    {String} frontCrossDisabled
    {Number} texType Optional, Default: ccui.Widget.LOCAL_TEXTURE
  • {string} getDescription()
    Returns the "class name" of widget.
    Returns:
    {string}
  • getSelectedState()
    Deprecated:
    since v3.1, please use isSelected.
  • {cc.Node} getVirtualRenderer()
    override "getVirtualRenderer" method of widget.
    Returns:
    {cc.Node} the renderer of ccui.CheckBox.
  • {cc.Size} getVirtualRendererSize()
    Returns the content size of Renderer.
    Returns:
    {cc.Size}
  • {boolean} isSelected()
    Returns the selected state of ccui.CheckBox.
    Returns:
    {boolean}
  • loadTextureBackGround(backGround, texType)
    Loads background texture for checkbox.
    Parameters:
    {String} backGround
    background filename
    {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
  • loadTextureBackGroundDisabled(backGroundDisabled, texType)
    Loads disabled state of backGround texture for checkbox.
    Parameters:
    {String} backGroundDisabled
    {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
  • loadTextureBackGroundSelected(backGroundSelected, texType)
    Loads selected state of background texture for checkbox.
    Parameters:
    {String} backGroundSelected
    {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
  • loadTextureFrontCross(cross, texType)
    Loads cross texture for checkbox.
    Parameters:
    {String} cross
    {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
  • loadTextureFrontCrossDisabled(frontCrossDisabled, texType)
    Loads frontCrossDisabled texture for checkbox.
    Parameters:
    {String} frontCrossDisabled
    {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
  • loadTextures(backGround, backGroundSelected, cross, backGroundDisabled, frontCrossDisabled, texType)
    Loads textures for checkbox.
    Parameters:
    {String} backGround
    {String} backGroundSelected
    {String} cross
    {String} backGroundDisabled
    {String} frontCrossDisabled
    {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
  • setSelected(selected)
    Sets the selected state to ccui.CheckBox
    Parameters:
    {Boolean} selected
  • setSelectedState(selected)
    Parameters:
    selected
    Deprecated:
    since v3.1, please use setSelected.