本文整理汇总了C++中CButton::setOnLongClickListener方法的典型用法代码示例。如果您正苦于以下问题:C++ CButton::setOnLongClickListener方法的具体用法?C++ CButton::setOnLongClickListener怎么用?C++ CButton::setOnLongClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CButton
的用法示例。
在下文中一共展示了CButton::setOnLongClickListener方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gridviewDataSource
CCObject* MainScene::gridviewDataSource(CCObject* pConvertView, unsigned int idx){
CGridViewCell* pCell = (CGridViewCell*) pConvertView;
CButton* pButton = NULL;
CCLog("idx %d",idx);
if(!pCell)
{
pCell = new CGridViewCell();
pCell->autorelease();
pButton = CButton::create("strangedesign/main_clincher.png","strangedesign/main_clincher_down.png");
pButton->setPosition(CCPoint(360/2, 350-pButton->getContentSize().height/2));
pButton->getLabel()->setFontSize(40.0f);
pButton->setTag(1);
pCell->addChild(pButton,10);
CCSprite* sprite = CCSprite::create("strangedesign/table4mul4.png");
sprite->setContentSize(CCSize(320,320));
sprite->setPosition(CCPoint(360/2,350/2));
pCell->addChild(sprite,1);
CCLog("idx %d",idx);
vector<vector<string> > groupCharacter = SQLiteData::getUnit(unit_ids.at(idx));
CCPoint positions[16] = {ccp(40,280),ccp(120,280),ccp(200,280),ccp(280,280),
ccp(40,200),ccp(120,200),ccp(200,200),ccp(280,200),
ccp(40,120),ccp(120,120),ccp(200,120),ccp(280,120),
ccp(40,40),ccp(120,40),ccp(200,40),ccp(280,40)
};
for (unsigned int i = 0; i < groupCharacter.size(); i++)
{
string hanzi = groupCharacter.at(i).at(0);
CCLabelTTF* clabel = CCLabelTTF::create(hanzi.c_str(),"Arial",40);
clabel->setPosition(positions[i]);
clabel->setColor(ccc3(0,0,0));
sprite->addChild(clabel);
}
}
else
{
pButton = CButton::create("strangedesign/main_clincher.png","strangedesign/main_clincher_down.png");
pButton->setPosition(CCPoint(360/2, 350-pButton->getContentSize().height/2));
pButton->getLabel()->setFontSize(40.0f);
pButton->setTag(1);
pCell->addChild(pButton,10);
CCSprite* sprite = CCSprite::create("strangedesign/table4mul4.png");
sprite->setContentSize(CCSize(320,320));
sprite->setPosition(CCPoint(360/2,350/2));
pCell->addChild(sprite,1);
CCLog("idx %d",idx);
vector<vector<string> > groupCharacter = SQLiteData::getUnit(unit_ids.at(idx));
CCPoint positions[16] = {ccp(40,280),ccp(120,280),ccp(200,280),ccp(280,280),
ccp(40,200),ccp(120,200),ccp(200,200),ccp(280,200),
ccp(40,120),ccp(120,120),ccp(200,120),ccp(280,120),
ccp(40,40),ccp(120,40),ccp(200,40),ccp(280,40)
};
for (unsigned int i = 0; i < groupCharacter.size(); i++)
{
string hanzi = groupCharacter.at(i).at(0);
CCLabelTTF* clabel = CCLabelTTF::create(hanzi.c_str(),"Arial",40);
clabel->setPosition(positions[i]);
clabel->setColor(ccc3(0,0,0));
sprite->addChild(clabel);
}
}
char buff[64];
unsigned int labelidx = idx+1;
sprintf(buff, "%u", labelidx);
pButton->getLabel()->setString(buff);
pButton->setUserTag(idx);
pButton->setOnClickListener(this,ccw_click_selector(MainScene::buttonClick));
pButton->setOnLongClickListener(this,ccw_longclick_selector(MainScene::buttonLongClick));
return pCell;
}