//-------------------------------------------------------------------------
void FKCW_UI_Table::arrangeItems()
{
	unsigned int nItemCount = m_tNodes.count();
	int nColumnCount = (m_bLayerDirectionHorizontal ? nItemCount / m_nWindowRowCount + (int)(nItemCount % m_nWindowRowCount > 0) : m_nWindowColumnCount);
	int nRowCount = (m_bLayerDirectionHorizontal ? m_nWindowRowCount : nItemCount / m_nWindowColumnCount + (int)(nItemCount % m_nWindowColumnCount > 0));
	m_tLayerSize = cczDenormalizeTo(ccz((float)nColumnCount, (float)nRowCount), m_tCellSize);

	int nItemNum = 0;
	if (CCArray* __pArray = (&m_tNodes))
	{
		for (unsigned int __idx = 0; __idx < __pArray->data->num; ++__idx) 
		{
			if ( CCNode* pNode = ( CCNode* )*(__pArray->data->arr + __idx))
			{
				pNode->setPosition(ccpShift(m_tWindowRect.origin,
					cczDenormalizeTo(
					ccz(
					m_bFillDirectionHorizontal ? nItemNum % nColumnCount : nItemNum / nRowCount,
					nRowCount - 1 - (m_bFillDirectionHorizontal ? nItemNum / nColumnCount : nItemNum % nRowCount)),
					m_tCellSize)));
				++nItemNum;
			}
		}
	}
}
void CCTableWorker::arrangeItems()
{
	unsigned int nItemCount = m_tNodes.count();
	int nColumnCount = (m_bLayerDirectionHorizontal ?
			nItemCount / m_nWindowRowCount + (int)(nItemCount % m_nWindowRowCount > 0) :
			m_nWindowColumnCount);
	int nRowCount = (m_bLayerDirectionHorizontal ?
			m_nWindowRowCount :
			nItemCount / m_nWindowColumnCount + (int)(nItemCount % m_nWindowColumnCount > 0));
	m_tLayerSize = cczDenormalizeTo(ccz((float)nColumnCount, (float)nRowCount), m_tCellSize);

	int nItemNum = 0;
	CCARRAY_FOREACH_OBJECT(&m_tNodes, CCNode*, pNode)
	{
		pNode->setPosition(ccpShift(m_tWindowRect.origin,
				cczDenormalizeTo(
						ccz(
								m_bFillDirectionHorizontal ? nItemNum % nColumnCount : nItemNum / nRowCount,
										nRowCount - 1 - (m_bFillDirectionHorizontal ? nItemNum / nColumnCount : nItemNum % nRowCount)),
						m_tCellSize)));
		++nItemNum;
	}
}