当前位置: 首页>>代码示例>>C++>>正文


C++ CATableViewCell类代码示例

本文整理汇总了C++中CATableViewCell的典型用法代码示例。如果您正苦于以下问题:C++ CATableViewCell类的具体用法?C++ CATableViewCell怎么用?C++ CATableViewCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CATableViewCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getContentOffset

void CATableView::recoveryTableCell()
{
    CCRect rect = this->getBounds();
	rect.origin = getContentOffset();
    rect.origin.y -= rect.size.height * 0.1f;
    rect.size.height *= 1.2f;
    
    std::map<CAIndexPath2E, CATableViewCell*>::iterator itr;
    for (itr=m_pUsedTableCells.begin();
         itr!=m_pUsedTableCells.end();
         itr++)
    {
        CATableViewCell* cell = itr->second;
        CC_CONTINUE_IF(cell == NULL);
        CCRect cellRect = cell->getFrame();

        CC_CONTINUE_IF(rect.intersectsRect(cellRect));
        m_pFreedTableCells[cell->getReuseIdentifier()].pushBack(cell);
        cell->removeFromSuperview();
        cell->resetTableViewCell();
        itr->second = NULL;
        
        CAView* line = m_pUsedLines[itr->first];
        CC_CONTINUE_IF(line == NULL);
        m_pFreedLines.pushBack(line);
        line->removeFromSuperview();
        m_pUsedLines[itr->first] = NULL;
    }
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:29,代码来源:CATableView.cpp

示例2: update

void CATableView::update(float fDelta)
{
    CAScrollView::update(fDelta);
    
    CCRect rect = this->getBounds();
    rect.origin.y -= rect.size.height/2;
    rect.size.height *= 2;
    
    std::deque<CATableViewCell*>::iterator itr;
    for (itr=m_pTableCells.begin(); itr!=m_pTableCells.end(); itr++)
    {
        CATableViewCell* cell = *itr;
        CCPoint point = cell->getCenterOrigin();
        point = m_pContainer->convertToWorldSpace(point);
        point = this->convertToNodeSpace(point);
        
        if (rect.containsPoint(point))
        {
            cell->setVisible(true);
        }
        else
        {
            cell->setVisible(false);
        }
    }
}
开发者ID:Jimlan,项目名称:CrossApp,代码行数:26,代码来源:CATableView.cpp

示例3: clearData

void CATableView::clearData()
{
    m_nRowsInSections.clear();
    m_nSectionHeaderHeights.clear();
    m_nSectionFooterHeights.clear();
    std::vector<std::vector<unsigned int> >::iterator itr;
    for (itr=m_nRowHeightss.begin(); itr!=m_nRowHeightss.end(); itr++)
    {
        itr->clear();
    }
    m_nRowHeightss.clear();
    
    m_rSectionRectss.clear();
    m_rTableCellRectss.clear();
    
    std::set<CATableViewCell*>::iterator itr2;
    for (itr2=m_pSelectedTableCells.begin(); itr2!=m_pSelectedTableCells.end(); itr2++)
    {
        CATableViewCell* cell = *itr2;
        cell->setControlStateNormal();
    }
    m_pSelectedTableCells.clear();
    
    m_pTableCells.clear();
}
开发者ID:Jimlan,项目名称:CrossApp,代码行数:25,代码来源:CATableView.cpp

示例4: tableCellAtIndex

CATableViewCell* RootViewController::tableCellAtIndex(CATableView *table, unsigned int section, unsigned int row)
{
    
    
    CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("aaa");
    if (cell == NULL)
    {
        cell = CATableViewCell::create("aaa");
        //cell->setBackGroundView(NULL);
    }
    
    CCString* str = CCString::createWithFormat("CELL - %u", row);
    CCLabelTTF* ttf = CCLabelTTF::create(str->getCString(), "Arial", 40);
    ttf->setColor(ccBLACK);
    ttf->setFrame(CCRect(10, 60, 0, 0));
    cell->addSubview(ttf);
    
//    CALabel* label = CALabel::create(CCRect(0, 0, 600, 100));
//    label->setOpacity(128);
//    label->setVerticalTextAlignmet(kCCVerticalTextAlignmentCenter);
//    label->setCenterOrigin(CCPoint(300, 60));
//    label->setText(str->getCString());
//    cell->addSubview(label);
    

    return cell;
}
开发者ID:tangyijie,项目名称:CrossApp,代码行数:27,代码来源:RootViewController.cpp

示例5: update

void CATableView::update(float fDelta)
{
    CAScrollView::update(fDelta);
    
    CCRect rect = this->getBounds();
    rect.origin.y -= rect.size.height * 0.1f;
    rect.size.height *= 1.2f;
    
    std::deque<CATableViewCell*>::iterator itr;
    for (itr=m_pTableCells.begin(); itr!=m_pTableCells.end(); itr++)
    {
        CATableViewCell* cell = *itr;
        CCRect cellRect = cell->getFrame();
        cellRect.origin = m_pContainer->convertToWorldSpace(cellRect.origin);
        cellRect.origin = this->convertToNodeSpace(cellRect.origin);
        
        if (rect.intersectsRect(cellRect))
        {
            cell->setVisible(true);
        }
        else
        {
            cell->setVisible(false);
        }
    }
}
开发者ID:DeltaYang,项目名称:CrossApp,代码行数:26,代码来源:CATableView.cpp

示例6: tableCellAtIndex

CATableViewCell* CAPickerView::tableCellAtIndex(CATableView* table, const CCSize& cellSize, unsigned int section, unsigned int row)
{
    if (m_dataSource && !m_tableViews.empty())
    {
        
        CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("CrossApp");
        if (cell == NULL)
        {
            cell = CATableViewCell::create("CrossApp");
            cell->setBackgroundView(NULL);
        }
        else
        {
            cell->removeSubviewByTag(100);            
        }
        
		size_t component = m_tableViews.getIndex(table);
        
        CAView* view = viewForRowInComponent((unsigned int)component, row, cellSize);
        if (view)
        {
            view->setTag(100);
            cell->addSubview(view);
        }
        
        return cell;
    }
    
    return NULL;
}
开发者ID:lmxing1987,项目名称:CrossApp,代码行数:30,代码来源:CAPickerView.cpp

示例7: CATableViewCell

CATableViewCell* CATableViewCell::create(const std::string& reuseIdentifier)
{
    CATableViewCell* cell = new CATableViewCell();
    if (cell && cell->initWithReuseIdentifier(reuseIdentifier))
    {
        cell->autorelease();
        return cell;
    }
    CC_SAFE_DELETE(cell);
    return NULL;
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:11,代码来源:CATableView.cpp

示例8: tableCellAtIndex

CATableViewCell* CAAlertView::tableCellAtIndex(CATableView* table, unsigned int section, unsigned int row)
{
	CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("cellID");
	if (cell == NULL)
	{
		cell = CATableViewCell::create("cellID");

		cell->addSubview(m_vAllBtn[row]);
		m_vAllBtn[row]->setCenterOrigin(m_vAllBtn[row]->getBounds().size / 2);
	}
	return cell;
}
开发者ID:13609594236,项目名称:CrossApp,代码行数:12,代码来源:CAAlertView.cpp

示例9: dequeueReusableCellWithIdentifier

CATableViewCell* CATableView::dequeueReusableCellWithIdentifier(const char* reuseIdentifier)
{
    CATableViewCell* cell = NULL;
    
    if (!m_pFreedTableCells[reuseIdentifier].empty())
    {
        cell = m_pFreedTableCells[reuseIdentifier].back();
        cell->retain()->autorelease();
        m_pFreedTableCells[reuseIdentifier].eraseObject(cell);
    }
    return cell;
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:12,代码来源:CATableView.cpp

示例10: tableCellAtIndex

CATableViewCell* ExtensionsTest::tableCellAtIndex(CATableView* table, const CCSize& cellSize, unsigned int section, unsigned int row)
{
	CADipSize _size = cellSize;
	Info* p_List = (Info*)personList.getValue(row);
	CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("CrossApp");
	if (cell == NULL)
	{
		cell = CATableViewCell::create("CrossApp");
		CALabel* p_Name = CALabel::createWithCenter(CADipRect(_size.width*0.1, _size.height*0.5, _size.width*0.2, _size.height));
		p_Name->setTag(NAME);
		p_Name->setText(p_List->name.c_str());
		p_Name->setFontSize(_px(30));
		p_Name->setColor(CAColor_blueStyle);
		p_Name->setTextAlignment(CATextAlignmentCenter);
		p_Name->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
		cell->addSubview(p_Name);

		CALabel* p_Num = CALabel::createWithCenter(CADipRect(_size.width*0.3, _size.height*0.5, _size.width*0.2, _size.height));
		p_Num->setTag(NUM);
		p_Num->setText(p_List->num.c_str());
		p_Num->setFontSize(_px(30));
		p_Num->setColor(CAColor_blueStyle);
		p_Num->setTextAlignment(CATextAlignmentCenter);
		p_Num->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
		cell->addSubview(p_Num);

		CALabel* p_Gender = CALabel::createWithCenter(CADipRect(_size.width*0.5, _size.height*0.5, _size.width*0.2, _size.height));
		p_Gender->setTag(GENDER);
		p_Gender->setText(p_List->gender.c_str());
		p_Gender->setFontSize(_px(30));
		p_Gender->setColor(CAColor_blueStyle);
		p_Gender->setTextAlignment(CATextAlignmentCenter);
		p_Gender->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
		cell->addSubview(p_Gender);

		CALabel* p_Occupation = CALabel::createWithCenter(CADipRect(_size.width*0.8, _size.height*0.5, _size.width*0.3, _size.height));
		p_Occupation->setTag(OCCUPATION);
		p_Occupation->setText(p_List->occupation.c_str());
		p_Occupation->setFontSize(_px(30));
		p_Occupation->setColor(CAColor_blueStyle);
		p_Occupation->setTextAlignment(CATextAlignmentCenter);
		p_Occupation->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
		cell->addSubview(p_Occupation);
	}
	CALabel* p_Name = (CALabel*)cell->getSubviewByTag(NAME);
	p_Name->setText(p_List->name.c_str());
	CALabel* p_Num = (CALabel*)cell->getSubviewByTag(NUM);
	p_Num->setText(p_List->num.c_str());
	CALabel* p_Gender = (CALabel*)cell->getSubviewByTag(GENDER);
	p_Gender->setText(p_List->gender.c_str());
	CALabel* p_Occupation = (CALabel*)cell->getSubviewByTag(OCCUPATION);
	p_Occupation->setText(p_List->occupation.c_str());

	return cell;

}
开发者ID:domzhaosh,项目名称:CrossApp,代码行数:56,代码来源:ExtensionsTest.cpp

示例11: clearData

void CATableView::clearData()
{
    m_nSections = 0;
    m_nRowsInSections.clear();
    m_nSectionHeaderHeights.clear();
    m_nSectionFooterHeights.clear();
    std::vector<std::vector<unsigned int> >::iterator itr;
    for (itr=m_nRowHeightss.begin(); itr!=m_nRowHeightss.end(); itr++)
    {
        itr->clear();
    }
    m_nRowHeightss.clear();
    
    std::vector<std::vector<CCRect> >::iterator itr2;
    for (itr2=m_rTableCellRectss.begin(); itr2!=m_rTableCellRectss.end(); itr2++)
    {
        itr2->clear();
    }
    m_rTableCellRectss.clear();
    
    m_rSectionRects.clear();
    
    std::vector<std::vector<CCRect> >::iterator itr3;
    for (itr3=m_rLineRectss.begin(); itr3!=m_rLineRectss.end(); itr3++)
    {
        itr3->clear();
    }
    m_rLineRectss.clear();
    
    m_pSelectedTableCells.clear();
    m_pUsedLines.clear();
    
    std::map<CAIndexPath2E, CATableViewCell*>::iterator itr4;
    for (itr4=m_pUsedTableCells.begin(); itr4!=m_pUsedTableCells.end(); itr4++)
    {
        CATableViewCell* cell = itr4->second;
        CC_CONTINUE_IF(cell == NULL);
        m_pFreedTableCells[cell->getReuseIdentifier()].pushBack(cell);
        itr4->second = NULL;
        cell->removeFromSuperview();
        cell->resetTableViewCell();
    }
    m_pUsedTableCells.clear();
    m_pSectionHeaderViews.clear();
    m_pSectionHeaderViews.clear();
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:46,代码来源:CATableView.cpp

示例12: CC_CONTINUE_IF

bool CATableView::ccTouchBegan(CATouch *pTouch, CAEvent *pEvent)
{
    if (!m_vTouches.empty())
    {
        m_vTouches.replace(0, pTouch);
        return true;
    }
    bool isInertia = m_tInertia.getLength() < 1.0f;
    if (!CAScrollView::ccTouchBegan(pTouch, pEvent))
        return false;
    
    if (m_bAllowsSelection && this->isScrollWindowNotOutSide() == false && isInertia)
    {
        CCPoint point = m_pContainer->convertTouchToNodeSpace(pTouch);
        
        std::map<CAIndexPath2E, CATableViewCell*>::iterator itr;
        for (itr=m_pUsedTableCells.begin(); itr!=m_pUsedTableCells.end(); itr++)
        {
            CATableViewCell* cell = itr->second;
            CC_CONTINUE_IF(cell == NULL);
            if (cell->getFrame().containsPoint(point) && cell->isVisible())
            {
                CC_BREAK_IF(cell->getControlState() == CAControlStateDisabled);
                
                if (m_pHighlightedTableCells)
                {
                    m_pHighlightedTableCells->setControlStateNormal();
                }
                
                m_pHighlightedTableCells = cell;

                CC_BREAK_IF(cell->getControlState() == CAControlStateSelected);
                
                CCDelayTime* delayTime = CCDelayTime::create(0.05f);
                CCCallFunc* func = CCCallFunc::create(cell, callfunc_selector(CATableViewCell::setControlStateHighlighted));
                CCSequence* actions = CCSequence::create(delayTime, func, NULL);
                m_pContainer->runAction(actions);
                break;
            }
        }
    }
    return true;
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:43,代码来源:CATableView.cpp

示例13: tableCellAtIndex

CATableViewCell* PageMenu::tableCellAtIndex(CATableView *table, unsigned int section, unsigned int row)
{
	CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("aaa");
    if (cell == NULL)
    {
        cell = CATableViewCell::create("aaa");

		cell->setBackGroundViewForState(CAControlStateSelected, CAView::createWithColor(ccc4(89, 104, 109, 255)));
		cell->setBackGroundViewForState(CAControlStateHighlighted, CAView::createWithColor(ccc4(89, 104, 109, 255)));
		cell->setBackGroundViewForState(CAControlStateNormal, CAView::createWithColor(ccc4(0, 0, 0, 0)));
    }
    cell->removeAllSubviews();

	
	if ( row < m_bookData.m_vecMenu.size() )
	{
		MenuCell *pIcon = new MenuCell( this );
		pIcon->LoadFromBookMenuData( &m_bookData.m_vecMenu[row] );
		pIcon->UpdateStatus( BookDB::Instance()->GetBookMenuDownloadStatus( &m_bookData , row ) , BookDB::Instance()->GetBookMenuReadStatus( &m_bookData , row ) );
		cell->addSubview(pIcon);
		pIcon->release();
		m_vecMenuCell[row] = pIcon;
	}
	return cell;
}
开发者ID:anarki1234,项目名称:9miao,代码行数:25,代码来源:PageMenu.cpp

示例14: tableCellAtIndex

CATableViewCell* MenuViewController::tableCellAtIndex(CATableView* table, const DSize& cellSize, unsigned int section, unsigned int row)
{
    DSize _size = cellSize;
    CATableViewCell* cell = table->dequeueReusableCellWithIdentifier("CrossApp");
    if (cell == NULL)
    {
        cell = CATableViewCell::create("CrossApp");
        cell->setBackgroundView(NULL);
        CALabel* test = CALabel::createWithCenter(DRect(_size.width/2+30,
                                                            _size.height/2,
                                                            _size.width,
                                                            _size.height));
        test->setTextAlignment(CATextAlignmentLeft);
        test->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
        test->setFontSize(_px(32));
		test->setColor(CAColor_white);
        test->setTag(100);
        cell->addSubview(test);
        
        CAImageView* arrow = CAImageView::createWithCenter(DRect(_size.width-64,_size.height/2,64,64));
        arrow->setTag(101);
        cell->addSubview(arrow);
    }
	CALabel* test = (CALabel*)cell->getSubviewByTag(100);
	test->setText(unicode_to_utf8(menuList[row]));// menuList[row]);
    CAImageView* arrow = (CAImageView*)cell->getSubviewByTag(101);
    arrow->setImage(CAImage::create("source_material/cell_btn_right.png"));

    return cell;
}
开发者ID:bazhi,项目名称:CrossApp,代码行数:30,代码来源:MenuViewController.cpp

示例15: ccTouchEnded

void CATableView::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent)
{
    CAScrollView::ccTouchEnded(pTouch, pEvent);
    
    if (m_pHighlightedTableCells)
    {
        this->stopActionByTag(0xffff);
        
        CATableViewCell* deselectedCell = NULL;
        CATableViewCell* selectedCell = m_pHighlightedTableCells;
        m_pHighlightedTableCells = NULL;
        
        if (m_pSelectedTableCells.count(selectedCell) > 0 && m_bAllowsMultipleSelection)
        {
            deselectedCell = selectedCell;
            selectedCell = NULL;
            m_pSelectedTableCells.erase(deselectedCell);
        }
        else
        {
            if (m_pSelectedTableCells.size() > 0 && m_bAllowsMultipleSelection == false)
            {
                deselectedCell = *m_pSelectedTableCells.begin();
                m_pSelectedTableCells.clear();
            }
            m_pSelectedTableCells.insert(selectedCell);
        }
        
        if (deselectedCell)
        {
            deselectedCell->setControlStateNormal();
            if (m_pTableViewDelegate)
            {
                m_pTableViewDelegate->tableViewDidDeselectRowAtIndexPath(this, deselectedCell->getSection(), deselectedCell->getRow());
            }
        }
        
        if (selectedCell)
        {
            selectedCell->setControlStateSelected();
            if (m_pTableViewDelegate)
            {
                m_pTableViewDelegate->tableViewDidSelectRowAtIndexPath(this, selectedCell->getSection(), selectedCell->getRow());
            }
        }
    }
    
    if (m_pTableViewDelegate)
    {
        if (m_pTablePullDownView && m_pContainer->getFrame().origin.y > m_nTablePullViewHeight)
        {
            m_pTableViewDelegate->tableViewDidShowPullDownView(this);
        }
        
        if (m_pTablePullUpView && this->getBounds().size.height - (m_pContainer->getFrame().origin.y + m_pContainer->getFrame().size.height) > m_nTablePullViewHeight)
        {
            m_pTableViewDelegate->tableViewDidShowPullUpView(this);
        }
    }
}
开发者ID:DeltaYang,项目名称:CrossApp,代码行数:60,代码来源:CATableView.cpp


注:本文中的CATableViewCell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。