void Layout::setBackGroundImageScale9Enabled(bool able) { if (_backGroundScale9Enabled == able) { return; } _backGroundScale9Enabled = able; if (nullptr == _backGroundImage) { addBackGroundImage(); setBackGroundImage(_backGroundImageFileName,_bgImageTexType); } _backGroundImage->setScale9Enabled(_backGroundScale9Enabled); setBackGroundImageCapInsets(_backGroundImageCapInsets); }
void UILayout::copySpecialProperties(UIWidget *widget) { UILayout* layout = dynamic_cast<UILayout*>(widget); if (layout) { setBackGroundImageScale9Enabled(layout->m_bBackGroundScale9Enabled); setBackGroundImage(layout->m_strBackGroundImageFileName.c_str(),layout->m_eBGImageTexType); setBackGroundImageCapInsets(layout->m_backGroundImageCapInsets); setBackGroundColorType(layout->m_colorType); setBackGroundColor(layout->m_cColor); setBackGroundColor(layout->m_gStartColor, layout->m_gEndColor); setBackGroundColorOpacity(layout->m_nCOpacity); setBackGroundColorVector(layout->m_AlongVector); setLayoutType(layout->m_eLayoutType); setClippingEnabled(layout->m_bClippingEnabled); } }
void Layout::copySpecialProperties(Widget *widget) { Layout* layout = dynamic_cast<Layout*>(widget); if (layout) { setBackGroundImageScale9Enabled(layout->_backGroundScale9Enabled); setBackGroundImage(layout->_backGroundImageFileName,layout->_bgImageTexType); setBackGroundImageCapInsets(layout->_backGroundImageCapInsets); setBackGroundColorType(layout->_colorType); setBackGroundColor(layout->_cColor); setBackGroundColor(layout->_gStartColor, layout->_gEndColor); setBackGroundColorOpacity(layout->_cOpacity); setBackGroundColorVector(layout->_alongVector); setLayoutType(layout->_layoutType); setClippingEnabled(layout->_clippingEnabled); setClippingType(layout->_clippingType); _loopFocus = layout->_loopFocus; _passFocusToChild = layout->_passFocusToChild; _isInterceptTouch = layout->_isInterceptTouch; } }
void Layout::setBackGroundImageScale9Enabled(bool able) { if (_backGroundScale9Enabled == able) { return; } CCNode::removeChild(_backGroundImage, true); _backGroundImage = NULL; _backGroundScale9Enabled = able; if (_backGroundScale9Enabled) { _backGroundImage = extension::CCScale9Sprite::create(); CCNode::addChild(_backGroundImage, BACKGROUNDIMAGE_Z, -1); } else { _backGroundImage = CCSprite::create(); CCNode::addChild(_backGroundImage, BACKGROUNDIMAGE_Z, -1); } setBackGroundImage(_backGroundImageFileName.c_str(),_bgImageTexType); setBackGroundImageCapInsets(_backGroundImageCapInsets); }
void Layout::setBackGroundImageScale9Enabled(bool able) { if (_backGroundScale9Enabled == able) { return; } _backGroundScale9Enabled = able; if (nullptr == _backGroundImage) { addBackGroundImage(); setBackGroundImage(_backGroundImageFileName,_bgImageTexType); } if(_backGroundScale9Enabled){ _backGroundImage->setRenderingType(Scale9Sprite::RenderingType::SLICE); _backGroundImage->setPreferredSize(_contentSize); }else{ _backGroundImage->setRenderingType(Scale9Sprite::RenderingType::SIMPLE); _backGroundImage->setPreferredSize(_backGroundImageTextureSize); } setBackGroundImageCapInsets(_backGroundImageCapInsets); }
void UILayout::setBackGroundImageScale9Enabled(bool able) { if (m_bBackGroundScale9Enabled == able) { return; } m_pRenderer->removeChild(m_pBackGroundImage, true); m_pBackGroundImage = NULL; m_bBackGroundScale9Enabled = able; if (m_bBackGroundScale9Enabled) { m_pBackGroundImage = CCScale9Sprite::create(); m_pRenderer->addChild(m_pBackGroundImage); } else { m_pBackGroundImage = CCSprite::create(); m_pRenderer->addChild(m_pBackGroundImage); } m_pBackGroundImage->setZOrder(-1); setBackGroundImage(m_strBackGroundImageFileName.c_str(),m_eBGImageTexType); setBackGroundImageCapInsets(m_backGroundImageCapInsets); }