本文整理汇总了C++中CATableViewCell::getFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ CATableViewCell::getFrame方法的具体用法?C++ CATableViewCell::getFrame怎么用?C++ CATableViewCell::getFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CATableViewCell
的用法示例。
在下文中一共展示了CATableViewCell::getFrame方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recoveryTableCell
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;
}
}
示例2: 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);
}
}
}
示例3: ccTouchBegan
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;
}
示例4: ccTouchBegan
bool CATableView::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
if (m_pTouches->count() > 0)
return false;
if (!CAScrollView::ccTouchBegan(pTouch, pEvent))
return false;
if (m_bAllowsSelection && this->isScrollWindowNotOutSide() == false)
{
CCPoint point = m_pContainer->convertTouchToNodeSpace(pTouch);
std::deque<CATableViewCell*>::iterator itr;
for (itr=m_pTableCells.begin(); itr!=m_pTableCells.end(); itr++)
{
CATableViewCell* cell = *itr;
if (cell->getFrame().containsPoint(point))
{
CC_BREAK_IF(cell->isDisabled());
m_pHighlightedTableCells = cell;
CC_BREAK_IF(cell->isSelected());
CCDelayTime* delayTime = CCDelayTime::create(0.1f);
CCCallFunc* func = CCCallFunc::create(cell, callfunc_selector(CATableViewCell::setControlStateHighlighted));
CCSequence* actions = CCSequence::create(delayTime, func, NULL);
actions->setTag(0xffff);
this->runAction(actions);
break;
}
}
}
m_tBeginPoint = pTouch->getLocation();
return true;
}
示例5: visit
void CAPickerView::visit()
{
if (m_dataSource)
{
for (int i = 0; i < m_tableViews.size(); i++)
{
// cycle data
CATableView* tableView = (CATableView*)m_tableViews.at(i);
CCPoint offset = tableView->getContentOffset();
unsigned int component = (unsigned int)m_tableViews.getIndex(tableView);
int row = m_dataSource->numberOfRowsInComponent(this, component);
int row_height = m_dataSource->rowHeightForComponent(this, component);
if (row > m_displayRow[component])
{
if (offset.y < 0)
{
offset.y += row * 2 * row_height;
tableView->setContentOffset(offset, false);
}
else if (offset.y > row_height * m_componentsIndex[component].size() - tableView->getFrame().size.height)
{
offset.y -= row * 2 * row_height;
tableView->setContentOffset(offset, false);
}
}
// set opacity
int offset_y = abs((int)offset.y);
int remainder = offset_y % row_height;
int index = offset_y / row_height;
if (remainder >= row_height * 0.5)
{
index++;
}
for (int i=index-1; i<index + m_displayRow[component] + 2; i++)
{
CATableViewCell* cell = tableView->cellForRowAtIndexPath(0, i);
if (cell)
{
float y = cell->getFrameOrigin().y - offset_y + cell->getFrame().size.height/2;
float mid = tableView->getFrame().size.height/2;
float length = fabs(mid - y);
float op = (fabs(length - mid))/mid;
op = powf(op, 2);
op = MAX(op, 0.1f);
cell->setAlpha(op);
}
}
// fixed position in the middle
if (!tableView->isDecelerating() && !tableView->isTracking())
{
if (remainder > row_height/2)
{
index++;
offset.y = index * row_height;
tableView->setContentOffset(offset, true);
}
else if (remainder > 0)
{
offset.y = index * row_height;
tableView->setContentOffset(offset, true);
}
else
{
// set selected when stop scrolling.
int selected = index + m_displayRow[component]/2;
if (m_selected[component] != selected)
{
m_selected[component] = selected;
if (m_delegate)
{
m_delegate->didSelectRow(this, m_componentsIndex[component][m_selected[component]], component);
}
}
}
}
}
}
CAView::visit();
}