本文整理汇总了C++中CAListViewCell::setControlState方法的典型用法代码示例。如果您正苦于以下问题:C++ CAListViewCell::setControlState方法的具体用法?C++ CAListViewCell::setControlState怎么用?C++ CAListViewCell::setControlState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAListViewCell
的用法示例。
在下文中一共展示了CAListViewCell::setControlState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadCell
void CAListView::loadCell()
{
DRect rect = this->getBounds();
rect.origin = getContentOffset();
rect.origin.y -= rect.size.height * 0.1f;
rect.origin.x -= rect.size.width * 0.1f;
rect.size.width *= 1.2f;
rect.size.height *= 1.2f;
std::map<unsigned int, CAListViewCell*>::iterator itr;
for (itr = m_mpUsedListCells.begin(); itr != m_mpUsedListCells.end(); itr++)
{
CC_CONTINUE_IF(itr->second != NULL);
unsigned int index = itr->first;
DRect cellRect = m_rIndexRects[index];
CC_CONTINUE_IF(!rect.intersectsRect(cellRect));
CAListViewCell* cell = m_pListViewDataSource->listViewCellAtIndex(this, cellRect.size, index);
if (cell)
{
cell->m_nIndex = index;
cell->updateDisplayedAlpha(this->getAlpha());
addSubview(cell);
cell->setFrame(cellRect);
m_mpUsedListCells[index] = cell;
m_vpUsedListCells.pushBack(cell);
}
if (m_pSelectedListCells.count(index))
{
cell->setControlState(CAControlStateSelected);
}
if (m_pListViewDataSource)
{
m_pListViewDataSource->listViewWillDisplayCellAtIndex(this, cell, index);
}
CAView* view = this->dequeueReusableLine();
DRect lineRect = m_rLineRects[index];
if (view == NULL)
{
view = CAView::createWithFrame(lineRect, m_obSeparatorColor);
}
m_pUsedLines[index] = view;
this->insertSubview(view, 1);
view->setFrame(lineRect);
}
}
示例2: mouseMoved
void CAListView::mouseMoved(CATouch* pTouch, CAEvent* pEvent)
{
if (m_bAllowsSelection)
{
DPoint point = m_pContainer->convertTouchToNodeSpace(pTouch);
std::map<unsigned int, CAListViewCell*>::iterator itr;
for (itr = m_mpUsedListCells.begin(); itr != m_mpUsedListCells.end(); ++itr)
{
CAListViewCell* pCell = itr->second;
CC_CONTINUE_IF(pCell == NULL);
if (pCell->getFrame().containsPoint(point) && pCell->isVisible())
{
CC_BREAK_IF(pCell->getControlState() == CAControlStateDisabled);
if (m_pHighlightedListCells)
{
unsigned int index = m_pHighlightedListCells->getIndex();
if (m_pSelectedListCells.count(index))
{
m_pHighlightedListCells->setControlState(CAControlStateHighlighted);
}
else
{
m_pHighlightedListCells->setControlState(CAControlStateNormal);
}
}
m_pHighlightedListCells = pCell;
pCell->setControlState(CAControlStateHighlighted);
break;
}
}
}
}