Example #1
0
bool CTableViewBindingDataAndVertical::init()
{
	CTableViewTestSceneBase::init();
	setTitle("CTableViewBindingDataAndVertical");
	setDescription("binding data with vector<string>");

	m_vDatas.push_back("A");
	m_vDatas.push_back("B");
	m_vDatas.push_back("C");
	m_vDatas.push_back("D");
	m_vDatas.push_back("E");
	m_vDatas.push_back("F");
	m_vDatas.push_back("G");
	m_vDatas.push_back("H");
	m_vDatas.push_back("I");
	m_vDatas.push_back("J");
	m_vDatas.push_back("K");
	m_vDatas.push_back("L");
	m_vDatas.push_back("M");
	m_vDatas.push_back("N");
	m_vDatas.push_back("O");
	m_vDatas.push_back("P");
	m_vDatas.push_back("Q");
	m_vDatas.push_back("R");
	m_vDatas.push_back("S");
	m_vDatas.push_back("T");
	m_vDatas.push_back("U");
	m_vDatas.push_back("V");
	m_vDatas.push_back("W");
	m_vDatas.push_back("X");
	m_vDatas.push_back("Y");
	m_vDatas.push_back("Z");

	CTableView* pTable = CTableView::create(
		CCSize(150.0f, 54.0f * 5),
		CCSize(150.0f, 54.0f),
		m_vDatas.size(), this, 
		ccw_datasource_adapter_selector(CTableViewBindingDataAndVertical::tableviewDataSource));
	pTable->setDirection(eScrollViewDirectionVertical);
	pTable->setPosition(CCPoint(480, 320));
	m_pWindow->addChild(pTable);
	pTable->reloadData();

	pText = CLabel::create();
	pText->setAnchorPoint(CCPoint(0, 0.5));
	pText->setPosition(CCPoint(200, 320));
	pText->setFontSize(35.0f);
	pText->setString("click button");
	m_pWindow->addChild(pText);

	return true;
}
Example #2
0
CTableView* TuiManager::createTableView(float tag, const char* img, int dir, int num, int cellWidth, int cellHeight, float x, float y, float w, float h, float rotation){
	CTableView *pView = CTableView::create(Size(w, h));
	m_isUseSpriteFrame ? pView->setBackgroundSpriteFrameName(img) : pView->setBackgroundImage(img);
	pView->setAutoRelocate(true);
	pView->setRotation(rotation);
	pView->setDirection((CScrollViewDirection)dir);
	pView->setCountOfCell(num);
	pView->setSizeOfCell(Size(cellWidth, cellHeight));
	pView->setRotation(rotation);
	pView->setPosition(x, -y);
	pView->setTag(tag);
	return pView;
}
Example #3
0
CTableView* TuiManager::createTableView(float tag, Color4B color, int dir, int num, int cellWidth, int cellHeight, float x, float y, float w, float h, float rotation){
	CTableView *pView = CTableView::create(Size(w,h));
	if (color.a != 0) pView->setBackgroundColor(color);
	pView->setAutoRelocate(true);
	pView->setRotation(rotation);
	pView->setDirection((CScrollViewDirection)dir);
	pView->setCountOfCell(num);
	pView->setSizeOfCell(Size(cellWidth, cellHeight));
	pView->setRotation(rotation);
	pView->setPosition(x,-y);
	pView->setTag(tag);
	return pView;
}
Example #4
0
bool CTableViewBasicTest::init()
{
	CTableViewTestSceneBase::init();
	setTitle("CTableViewBasicTest");
	setDescription("TableView basic test");

	CTableView* pTable = CTableView::create(
		Size(74.0f * 5, 70.0f),
		Size(74.0f, 70.0f),
		50, this, 
		ccw_datasource_adapter_selector(CTableViewBasicTest::tableviewDataSource));
	pTable->setPosition(Vec2(480, 320));
	pTable->setBackgroundColor(Color4B::GRAY);
	m_pWindow->addChild(pTable);
	pTable->reloadData();
	return true;
}