//设置按钮状态 void CStar97UILayer::setBtnEnable(enGameBtnTag eBtnTag, bool bEnabled) { CCMenuItem * pItem = dynamic_cast<CCMenuItem *>(m_pMenuLayer->getChildByTag(eBtnTag)); CCAssert(pItem != NULL, "this tag button don't have"); if (eBtnTag == GBTag_BetScore && bEnabled) { //判断是否为明星局 if (m_pGameLayer->isBetStarUseful()) pItem->setEnabled(bEnabled); else return; } else if (pItem->isEnabled() != bEnabled) pItem->setEnabled(bEnabled); }
void CCMenuItemToggle::setEnabled(bool enabled) { if (m_bEnabled != enabled) { CCMenuItem::setEnabled(enabled); if(m_pSubItems && m_pSubItems->count() > 0) { CCObject* pObj = NULL; CCARRAY_FOREACH(m_pSubItems, pObj) { CCMenuItem* pItem = (CCMenuItem*)pObj; pItem->setEnabled(enabled); }
void CCMenuItemToggle::setEnabled(bool enabled) { CCMenuItem::setEnabled(enabled); if(m_pSubItems && m_pSubItems->count() > 0) { //CCArray::CCMutableArrayIterator it; //for( it = m_pSubItems->begin(); it != m_pSubItems->end(); ++it) //{ // (*it)->setEnabled(enabled); //} CCObject* pObj = NULL; CCARRAY_FOREACH(m_pSubItems, pObj) { CCMenuItem* pItem = (CCMenuItem*)pObj; pItem->setEnabled(enabled); }