void UICheckBox::loadTextures(const char *backGround, const char *backGroundSelected, const char *cross,const char* backGroundDisabled,const char* frontCrossDisabled,TextureResType texType) { loadTextureBackGround(backGround,texType); loadTextureBackGroundSelected(backGroundSelected,texType); loadTextureFrontCross(cross,texType); loadTextureBackGroundDisabled(backGroundDisabled,texType); loadTextureFrontCrossDisabled(frontCrossDisabled,texType); }
//复选框 void UI:: initCheckBox(){ auto visibleSize=Director::getInstance()->getVisibleSize(); auto cb=CheckBox::create(); cb->loadTextureBackGround("switch-mask.png"); cb->loadTextureBackGroundSelected("switch-on.png");//点击时候 cb->loadTextureFrontCross("switch-off.png"); cb->addEventListener(CC_CALLBACK_2(UI::checkBoxClick, this)); cb->setPosition(visibleSize/2); addChild(cb); }
void CheckBox::loadTextures(const std::string& backGround, const std::string& backGroundSelected, const std::string& cross, const std::string& backGroundDisabled, const std::string& frontCrossDisabled, TextureResType texType) { loadTextureBackGround(backGround,texType); loadTextureBackGroundSelected(backGroundSelected,texType); loadTextureFrontCross(cross,texType); loadTextureBackGroundDisabled(backGroundDisabled,texType); loadTextureFrontCrossDisabled(frontCrossDisabled,texType); }
void CheckBox::copySpecialProperties(Widget *widget) { CheckBox* checkBox = dynamic_cast<CheckBox*>(widget); if (checkBox) { loadTextureBackGround(checkBox->_backGroundFileName.c_str(), checkBox->_backGroundTexType); loadTextureBackGroundSelected(checkBox->_backGroundSelectedFileName.c_str(), checkBox->_backGroundSelectedTexType); loadTextureFrontCross(checkBox->_frontCrossFileName.c_str(), checkBox->_frontCrossTexType); loadTextureBackGroundDisabled(checkBox->_backGroundDisabledFileName.c_str(), checkBox->_backGroundDisabledTexType); loadTextureFrontCrossDisabled(checkBox->_frontCrossDisabledFileName.c_str(), checkBox->_frontCrossDisabledTexType); setSelectedState(checkBox->_isSelected); } }
void CheckBox::copySpecialProperties(Widget *widget) { CheckBox* checkBox = dynamic_cast<CheckBox*>(widget); if (checkBox) { loadTextureBackGround(checkBox->_backGroundFileName, checkBox->_backGroundTexType); loadTextureBackGroundSelected(checkBox->_backGroundSelectedFileName, checkBox->_backGroundSelectedTexType); loadTextureFrontCross(checkBox->_frontCrossFileName, checkBox->_frontCrossTexType); loadTextureBackGroundDisabled(checkBox->_backGroundDisabledFileName, checkBox->_backGroundDisabledTexType); loadTextureFrontCrossDisabled(checkBox->_frontCrossDisabledFileName, checkBox->_frontCrossDisabledTexType); setSelected(checkBox->_isSelected); _checkBoxEventListener = checkBox->_checkBoxEventListener; _checkBoxEventSelector = checkBox->_checkBoxEventSelector; _checkBoxEventCallback = checkBox->_checkBoxEventCallback; } }
void AbstractCheckButton::copySpecialProperties(Widget *widget) { AbstractCheckButton* abstractCheckButton = dynamic_cast<AbstractCheckButton*>(widget); if (abstractCheckButton) { loadTextureBackGround(abstractCheckButton->_backGroundBoxRenderer->getSpriteFrame()); loadTextureBackGroundSelected(abstractCheckButton->_backGroundSelectedBoxRenderer->getSpriteFrame()); loadTextureFrontCross(abstractCheckButton->_frontCrossRenderer->getSpriteFrame()); loadTextureBackGroundDisabled(abstractCheckButton->_backGroundBoxDisabledRenderer->getSpriteFrame()); loadTextureFrontCrossDisabled(abstractCheckButton->_frontCrossDisabledRenderer->getSpriteFrame()); setSelected(abstractCheckButton->_isSelected); _zoomScale = abstractCheckButton->_zoomScale; _backgroundTextureScaleX = abstractCheckButton->_backgroundTextureScaleX; _backgroundTextureScaleY = abstractCheckButton->_backgroundTextureScaleY; _isBackgroundSelectedTextureLoaded = abstractCheckButton->_isBackgroundSelectedTextureLoaded; _isBackgroundDisabledTextureLoaded = abstractCheckButton->_isBackgroundDisabledTextureLoaded; _isFrontCrossDisabledTextureLoaded = abstractCheckButton->_isFrontCrossDisabledTextureLoaded; } }
void CheckBox::copySpecialProperties(Widget *widget) { CheckBox* checkBox = dynamic_cast<CheckBox*>(widget); if (checkBox) { loadTextureBackGround(checkBox->_backGroundBoxRenderer->getSpriteFrame()); loadTextureBackGroundSelected(checkBox->_backGroundSelectedBoxRenderer->getSpriteFrame()); loadTextureFrontCross(checkBox->_frontCrossRenderer->getSpriteFrame()); loadTextureBackGroundDisabled(checkBox->_backGroundBoxDisabledRenderer->getSpriteFrame()); loadTextureFrontCrossDisabled(checkBox->_frontCrossDisabledRenderer->getSpriteFrame()); setSelected(checkBox->_isSelected); _checkBoxEventListener = checkBox->_checkBoxEventListener; _checkBoxEventSelector = checkBox->_checkBoxEventSelector; _checkBoxEventCallback = checkBox->_checkBoxEventCallback; _ccEventCallback = checkBox->_ccEventCallback; _zoomScale = checkBox->_zoomScale; _backgroundTextureScaleX = checkBox->_backgroundTextureScaleX; _backgroundTextureScaleY = checkBox->_backgroundTextureScaleY; _isBackgroundSelectedTextureLoaded = checkBox->_isBackgroundSelectedTextureLoaded; _isBackgroundDisabledTextureLoaded = checkBox->_isBackgroundDisabledTextureLoaded; _isFrontCrossDisabledTextureLoaded = checkBox->_isFrontCrossDisabledTextureLoaded; } }