Ref* CTableViewBasicTest::tableviewDataSource(Ref* pConvertView, unsigned int idx) { CTableViewCell* pCell = (CTableViewCell*)pConvertView; CButton* pButton = NULL; if(!pCell) { pCell = new CTableViewCell(); pCell->autorelease(); pButton = CButton::createWith9Sprite(Size(70, 70), "sprite9_btn1.png", "sprite9_btn2.png"); pButton->setPosition(Vec2(74.0f / 2, 70.0f / 2)); //pButton->getLabel()->setFontSize(25.0f); pButton->setTag(1); pCell->addChild(pButton); } else { pButton = (CButton*) pCell->getChildByTag(1); } char buff[64]; sprintf(buff, "%u", idx); pButton->getLabel()->setString(buff); pButton->setUserTag(idx); return pCell; }
Ref* CTableViewReloadTest::tableviewDataSource(Ref* pConvertView, unsigned int idx) { CTableViewCell* pCell = (CTableViewCell*) pConvertView; CButton* pButton = NULL; if(!pCell) { pCell = new CTableViewCell(); pCell->autorelease(); pButton = CButton::createWith9Sprite(Size(150, 50), "sprite9_btn1.png", "sprite9_btn2.png"); pButton->setPosition(Vec2(150.0f / 2, 54.0f / 2)); // pButton->getLabel()->setFontSize(25.0f); pButton->setTag(1); pCell->addChild(pButton); } else { pButton = (CButton*) pCell->getChildByTag(1); } pButton->getLabel()->setString(m_vDatas[idx].c_str()); pButton->setUserTag(idx); return pCell; }
CCObject* CTableViewBindingDataAndVertical::tableviewDataSource(CCObject* pConvertView, unsigned int idx) { CTableViewCell* pCell = (CTableViewCell*)pConvertView; CButton* pButton = NULL; if(!pCell) { pCell = new CTableViewCell(); pCell->autorelease(); pButton = CButton::createWith9Sprite(CCSizeMake(150, 50), "sprite9_btn1.png", "sprite9_btn2.png"); pButton->setOnClickListener(this, ccw_click_selector(CTableViewBindingDataAndVertical::onClick)); pButton->setPosition(CCPoint(150.0f / 2, 54.0f / 2)); pButton->getLabel()->setFontSize(25.0f); pButton->setTag(1); pCell->addChild(pButton); } else { pButton = (CButton*) pCell->getChildByTag(1); } pButton->getLabel()->setString(m_vDatas[idx].c_str()); pButton->setUserTag(idx); return pCell; }
Ref* Bagui::event_adapt_tblBag(Ref* pConvertCell, unsigned int uIdx) { CTableViewCell* pCell = (CTableViewCell*)pConvertCell; if (!pCell) { pCell = new CTableViewCell(); pCell->autorelease(); TuiManager::getInstance()->parseCell(pCell, "cell_grid", PATH_BAG); }else{ } return pCell; }
CTableViewCell* CTableView::dequeueCell() { CTableViewCell* pCell = NULL; if( m_vCellsFreed.empty() ) { return NULL; } else { pCell = m_vCellsFreed.back(); m_vCellsFreed.popBack(); pCell->autorelease(); } return pCell; }
CCObject* CHandBookHeroLayer::tableviewDataSource( CCObject* pConvertCell, unsigned int uIdx ) { CTableViewCell *pCell = (CTableViewCell*)(pConvertCell); if (!pCell) { pCell = new CTableViewCell; pCell->autorelease(); addTableCell(uIdx, pCell); } else { pCell->removeAllChildren(); addTableCell(uIdx, pCell); } return pCell; }