当前位置: 首页>>代码示例>>C++>>正文


C++ CButton::setOnClickListener方法代码示例

本文整理汇总了C++中CButton::setOnClickListener方法的典型用法代码示例。如果您正苦于以下问题:C++ CButton::setOnClickListener方法的具体用法?C++ CButton::setOnClickListener怎么用?C++ CButton::setOnClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CButton的用法示例。


在下文中一共展示了CButton::setOnClickListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tableviewDataSource

CCObject* CTableViewBindingDataAndVertical::tableviewDataSource(CCObject* pConvertView, unsigned int idx)
{
	CTableViewCell* pCell = (CTableViewCell*)pConvertView;
	CButton* pButton = NULL;

	if(!pCell)
	{
		pCell = new CTableViewCell();
		pCell->autorelease();

		pButton = CButton::createWith9Sprite(CCSizeMake(150, 50), "sprite9_btn1.png", "sprite9_btn2.png");
		pButton->setOnClickListener(this, ccw_click_selector(CTableViewBindingDataAndVertical::onClick));
		pButton->setPosition(CCPoint(150.0f / 2, 54.0f / 2));
		pButton->getLabel()->setFontSize(25.0f);
		pButton->setTag(1);
		pCell->addChild(pButton);
	}
	else
	{
		pButton = (CButton*) pCell->getChildByTag(1);
	}

	pButton->getLabel()->setString(m_vDatas[idx].c_str());
	pButton->setUserTag(idx);

	return pCell;
}
开发者ID:cl0uddajka,项目名称:cocoswidget,代码行数:27,代码来源:TableViewTest.cpp

示例2: onEnter

void CSharpTollgate::onEnter()
{
	BaseLayer::onEnter();

	CButton* pClose = CButton::create("common/back.png", "common/back.png");
	pClose->getSelectedImage()->setScale(1.1f);
	pClose->setPosition(VLEFT+50, VTOP-50);
	pClose->setOnClickListener(this,ccw_click_selector(CSharpTollgate::onClose));
	this->addChild(pClose, 999);


	m_cell = (CLayout*)(m_ui->findWidgetById("Cell"));
// 	m_cell->retain();
// 	m_ui->removeChild(m_cell);

	
	CCAnimation *bgAnim = AnimationManager::sharedAction()->getAnimation("8055");
	bgAnim->setDelayPerUnit(0.05f);
	CCSprite *bg = createAnimationSprite("skill/8055.png",VCENTER,bgAnim,true);
	bg->setScale(3.0f);
	m_ui->addChild(bg);

	m_tableView = (CTableView *)(m_ui->findWidgetById("scroll"));
	m_tableView->setDirection(eScrollViewDirectionHorizontal);
	m_tableView->setSizeOfCell(m_cell->getContentSize());
	//m_tableView->setSizeOfCell(CCSizeMake(790,115));
	m_tableView->setCountOfCell(0);
	m_tableView->setBounceable(false);
	m_tableView->setDataSourceAdapter(this,ccw_datasource_adapter_selector(CSharpTollgate::tableviewDataSource));	
	m_tableView->reloadData();

}
开发者ID:54993306,项目名称:Classes,代码行数:32,代码来源:SharpTollgate.cpp

示例3: init

bool CButtonChangeSizeTest::init()
{
	CButtonTestSceneBase::init();
	setTitle("CButtonChangeSizeTest");
	setDescription("click the button for change anothor one");

	m_lData.push_back("a");
	m_lData.push_back("ab");
	m_lData.push_back("abc");
	m_lData.push_back("abcd");
	m_lData.push_back("abcde");
	m_lData.push_back("abcdef");
	m_lData.push_back("abcdefg");
	m_lData.push_back("abcdefgi");
	m_lData.push_back("abcdefgj");
	m_lData.push_back("hahahahaha\nhehehehehe");
	m_lData.push_back("hahahahaha\nhehehehehe\nkukukukukukukuku");

	m_pButton = CButton::create();
	m_pButton->setScale9Enabled(true);
	m_pButton->setNormalImage("sprite9_btn1.png");
	m_pButton->setSelectedImage("sprite9_btn2.png");
	m_pButton->initText("none", "", 30.0f);
	m_pButton->setCascadeTextSizeEnabled(true, CCSize(50, 30));
	m_pButton->setPosition(CCPoint(480, 320));
	m_pWindow->addChild(m_pButton);

	CButton* pBtn = CButton::createWith9Sprite(CCSizeMake(150, 50), "sprite9_btn1.png", "sprite9_btn2.png");
	pBtn->setPosition(CCPoint(250, 320));
	pBtn->initText("click me", "", 27.0f);
	pBtn->setOnClickListener(this, ccw_click_selector(CButtonChangeSizeTest::onClick));
	m_pWindow->addChild(pBtn);

	return true;
}
开发者ID:Coolxiaoo,项目名称:CocosWidget,代码行数:35,代码来源:ButtonTest.cpp

示例4: onEnter

void CVipCard::onEnter()
{
	BaseLayer::onEnter();
	//确定
	CButton* pConfirm = (CButton*)m_ui->findWidgetById("confirm");
	pConfirm->setOnClickListener(this, ccw_click_selector(CVipCard::onConfirm));

	CButton* cancel = (CButton*)m_ui->findWidgetById("cancel");
	cancel->setOnClickListener(this, ccw_click_selector(CVipCard::onCancel));

	CButton* pClose = CButton::create("common/back.png", "common/back.png");
	pClose->getSelectedImage()->setScale(1.1f);
	pClose->setPosition(VLEFT+50, VTOP-50);
	pClose->setOnClickListener(this,ccw_click_selector(CVipCard::onClose));
	this->addChild(pClose, 999);
	
	CImageViewScale9* pRect1 = (CImageViewScale9*)m_ui->findWidgetById("rect1");
	m_cardText = CursorTextField::textFieldWithPlaceHolder("", FONT_NAME, 29, CCSize(690, 110), ccBLACK);
	m_cardText->setPriority(this->getTouchPriority());
	m_cardText->setLimitNum(17);
	m_cardText->setAnchorPoint(ccp(0, 0.5f));
	m_cardText->setPosition( ccp(pRect1->getPositionX()-440, pRect1->getPositionY()));
	m_ui->addChild(m_cardText, 999);

	//展示区图片
	CLayout *pShowInfo = CLayout::create();

	CScrollView *pScroll = (CScrollView*)m_ui->findWidgetById("scroll_info");
	pScroll->setDirection(eScrollViewDirectionVertical);
	pScroll->setBounceable(false);
	pScroll->getContainer()->addChild(pShowInfo);

	CCSize size = CCSize(957, 471);
	pShowInfo->setContentSize(size);
	pScroll->setContainerSize(size);
	pShowInfo->setPosition(ccp(pScroll->getContainerSize().width*0.5f, pScroll->getContainerSize().height*0.5f));
	pScroll->setContentOffsetToTop();

	//嫁接内容
	CLayout* pLayout = (CLayout*)findWidgetById("layer_info");
	pLayout->retain();
	pLayout->removeFromParent();
	pShowInfo->addChild(pLayout);
	pLayout->release();
	pLayout->setPosition(ccp(size.width/2, size.height/2+10));

}
开发者ID:54993306,项目名称:Classes,代码行数:47,代码来源:CVipCard.cpp

示例5: onEnter

void CSignLayer::onEnter()
{
	BaseLayer::onEnter();

	//签到grid的cell
	m_cell = (CLayout*)(m_ui->findWidgetById("Cell"));
	m_cell->retain();
    m_ui->removeChild(m_cell);

	m_gridView = (CGridView*)m_ui->findWidgetById("scroll");
	m_gridView->setDirection(eScrollViewDirectionVertical);	
	m_gridView->setCountOfCell(0);
	m_gridView->setSizeOfCell(m_cell->getContentSize());
	m_gridView->setAnchorPoint(ccp(0,0));
	m_gridView->setColumns(5);
	m_gridView->setAutoRelocate(false);
	m_gridView->setDeaccelerateable(true);
	m_gridView->setDataSourceAdapter(this,ccw_datasource_adapter_selector(CSignLayer::gridviewDataSource));
	m_gridView->reloadData();


	m_signLay = (CLayout*)(m_ui->findWidgetById("Sign"));


	//退出
	CButton* pClose = CButton::create("common/back.png", "common/back.png");
	pClose->getSelectedImage()->setScale(1.1f);
	pClose->setPosition(VLEFT+50, VTOP-50);
	pClose->setOnClickListener(this,ccw_click_selector(CSignLayer::onClose));
	this->addChild(pClose, 999);

	//book
	CCheckBox* pBook = (CCheckBox*)(m_ui->findWidgetById("book"));
	pBook->setOnCheckListener(this,ccw_check_selector(CSignLayer::showHeroBook));

	//按钮补签
	CButton* pResign = (CButton*)m_ui->findWidgetById("buqian_btn");
	pResign->setOnClickListener(this, ccw_click_selector(CSignLayer::onBtnResignDay));

	//按钮签到
	CButton* pSign = (CButton*)m_ui->findWidgetById("qiandao_btn");
	pSign->setOnClickListener(this, ccw_click_selector(CSignLayer::onBtnSignDay));

	GetTcpNet->registerMsgHandler(SignDataMsg,this, CMsgHandler_selector(CSignLayer::ProcessMsg));
	GetTcpNet->registerMsgHandler(SignReqMsg,this, CMsgHandler_selector(CSignLayer::ProcessMsg));
}
开发者ID:54993306,项目名称:Classes,代码行数:46,代码来源:SignLayer.cpp

示例6: addTableCell

void CSharpTollgate::addTableCell(unsigned int uIdx, CTableViewCell * pCell)
{
	const vector<StageWidget> *data = DataCenter::sharedData()->getStageData()
		->getStageWidgets(m_chapter);
	CStage &stage = m_stageList.at(uIdx);

	for (int i = 0; i < 2; i++)
	{
		CCNode * node = (CCNode*)m_cell->getChildren()->objectAtIndex(i);

		if (node->getTag()==1)
		{
			const StageWidget *widget = nullptr;			
			CCString *strId = CCString::createWithFormat("hero%d",uIdx+1);
			for (int j=0; j<data->size();++j)
			{
				widget = &data->at(j);
				if (widget->widgetId!=""&&widget->widgetId.compare(strId->getCString())==0)
				{				
					CButton *btn =  CButton::create(widget->normalImage.c_str());
					btn->setScaleX(widget->scaleX);
					btn->setScaleY(widget->scaleY);
					btn->setPosition(ccp(100, 80/*btn->boundingBox().size.height*/));  
					btn->setAnchorPoint(ccp(0.5, 0.0));
					btn->setUserData(&m_stageList.at(uIdx));
					btn->setOnClickListener(this,ccw_click_selector(CSharpTollgate::onBattle));
					btn->setTag(1);
					pCell->addChild(btn);
					if (!stage.isOpen)
					{
						btn->getNormalImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
// 						btn->getSelectedImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
					}
					break;
				}
			}
		}
		else if (node->getTag()==2)
		{
			CImageView *image = UICloneMgr::cloneImageView((CImageView*)node);
			if (stage.star>0)
			{		
				image->setTexture(CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("tollgate/star_%d.png",stage.star)->getCString()));
			}
			else
			{
				image->setTexture(CCTextureCache::sharedTextureCache()->addImage("tollgate/star_3.png"));
				image->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
			}
			image->setAnchorPoint(ccp(0.5f,0));

			pCell->addChild(image);
		}
	}
	pCell->setVisible(false);
	pCell->setScale(1.15f);
	pCell->runAction(CCSequence::create(CCDelayTime::create(0.1f+0.15f*uIdx),CCShow::create(),CCScaleTo::create(0.05f,1.0f),CCCallFuncN::create(this,callfuncN_selector(CSharpTollgate::heroCall)),nullptr));
}
开发者ID:54993306,项目名称:Classes,代码行数:58,代码来源:SharpTollgate.cpp

示例7: onLoadScene

void Mapui::onLoadScene()
{
	TuiManager::getInstance()->parseScene(this,"panel_map",PATH_MAP);

    CMapView* pMapView = (CMapView*)this->getControl(PANEL_MAP,MAP_TEST);
	pMapView->setRole(Sprite::create("map/img_icon.png"),Vec2(0,0),5);
    
    CButton* pBtnBack = (CButton*)this->getControl(PANEL_MAP,BTN_BACK);
    pBtnBack->setOnClickListener(this, ccw_click_selector(Mapui::event_btn_back));
}
开发者ID:602147629,项目名称:Tui-x,代码行数:10,代码来源:Mapui.cpp

示例8: init

bool CTableViewReloadTest::init()
{
	CTableViewTestSceneBase::init();
	setTitle("CTableViewReloadTest");
	setDescription("click button will pop a string into vector and reload\n table with auto relocate");

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

	m_vDatas.push_back("A");

	pTable = CTableView::create(
		Size(150.0f, 54.0f * 5),
		Size(150.0f, 54.0f),
		m_vDatas.size(), this, 
		ccw_datasource_adapter_selector(CTableViewReloadTest::tableviewDataSource));
	pTable->setDirection(eScrollViewDirectionVertical);
	pTable->setAutoRelocate(true);
	pTable->setPosition(Vec2(480, 320));
	m_pWindow->addChild(pTable);
	pTable->reloadData();

	CButton* pButton = CButton::createWith9Sprite(Size(150, 50), "sprite9_btn1.png", "sprite9_btn2.png");
	pButton->setOnClickListener(this, ccw_click_selector(CTableViewReloadTest::onClick));
	pButton->setPosition(Vec2(200, 320));
	//pButton->getLabel()->setFontSize(25.0f);
	pButton->getLabel()->setString("reloadData");
	m_pWindow->addChild(pButton);

	return true;
}
开发者ID:Kudoo,项目名称:Tui-x,代码行数:54,代码来源:TableViewTest.cpp

示例9: onLoadScene

NS_MAIN_BEGIN

void Mainui::onLoadScene()
{
	SpriteFrameCache::getInstance()->addSpriteFramesWithFile("main/mainui.plist");
	TuiManager::getInstance()->parseScene(this,"panel_main",PATH_MAIN);

	//注册事件
	CControlView *ctlv = (CControlView*)this->getControl(PANEL_MAIN,CTLV_LEFT);
	ctlv->setOnControlListener(this,ccw_control_selector(Mainui::event_ctlv_left));

	CButton *pBtnOk = (CButton*)this->getControl(PANEL_MAIN,BTN_OK);
	pBtnOk->setOnClickListener(this,ccw_click_selector(Mainui::event_btn_ok));

	CButton *pBtnGo = (CButton*)this->getControl(PANEL_MAIN,BTN_GO);
	pBtnGo->setOnClickListener(this,ccw_click_selector(Mainui::event_btn_go));

	CButton *pBtnPhone = (CButton*)this->getControl(PANEL_MAIN, BTN_SHOWPHONE);
	pBtnPhone->setOnClickListener(this, ccw_click_selector(Mainui::event_btn_showphone));

	CButton *pBtnBag = (CButton*)this->getControl(PANEL_MAIN, BTN_BAG);
	pBtnBag->setOnClickListener(this, ccw_click_selector(Mainui::event_btn_bag));

	CButton *pBtnRecombine = (CButton*)this->getControl(PANEL_MAIN, BTN_RECOMBINE);
	pBtnRecombine->setOnClickListener(this, ccw_click_selector(Mainui::event_btn_recombine));

	CToggleView *pTgvA = (CToggleView*)this->getControl(PANEL_MAIN, TGV_A);
	pTgvA->setOnCheckListener(this, ccw_check_selector(Mainui::event_tgvA_check));

	CToggleView *pTgvB = (CToggleView*)this->getControl(PANEL_MAIN, TGV_B);
	pTgvB->setOnCheckListener(this, ccw_check_selector(Mainui::event_tgvB_check));

	MovieView *pMovie = (MovieView*)this->getControl(PANEL_MAIN, MOVIE_TEST);
	map<string, function<void()>> m;
	m["finish"] = bind(&Mainui::event_movie_finish, this);
	pMovie->setCallBack(m);

	//播放骨骼动画(默认不播放)
	Armature *armature = (Armature*)this->getControl(PANEL_MAIN,ARMATURE_BOSS1);
	armature->getAnimation()->play("live",-1,1);	
}
开发者ID:h7ing,项目名称:Tui-x,代码行数:41,代码来源:Mainui.cpp

示例10: onLoadScene

void Recomebineui::onLoadScene()
{
	SpriteFrameCache::getInstance()->addSpriteFramesWithFile("recombine/recombineui.plist");
	TuiManager::getInstance()->parseScene(this, "panel_recombine", PATH_RECOMBINEUI);

	CGridPageView *pGpvBag = (CGridPageView*)this->getControl(PANEL_RECOMBINE, GPV_BAG);
	pGpvBag->setDataSourceAdapter(this,ccw_datasource_adapter_selector(Recomebineui::adapt_gpv_bag));
	pGpvBag->reloadData();

	CButton *pBtnBack = (CButton*)this->getControl(PANEL_RECOMBINE, BTN_BACK);
	pBtnBack->setOnClickListener(this, ccw_click_selector(Recomebineui::event_btn_back));
}
开发者ID:110440,项目名称:Tui-x,代码行数:12,代码来源:Recombineui.cpp

示例11: onLoadScene

NS_MAIN_BEGIN

void MsgBox::onLoadScene()
{
	SpriteFrameCache::getInstance()->addSpriteFramesWithFile("main/mainui.plist");
	TuiManager::getInstance()->parseScene(this,"panel_msgbox",PATH_MAIN);
	//注册事件
	CButton *pBtnClose = (CButton*)getControl(PANEL_MSGBOX, BTN_CLOSE);
	pBtnClose->setOnClickListener(this,ccw_click_selector(MsgBox::event_btn_close));
	
	CSlider *pSlider = (CSlider*)getControl(PANEL_MSGBOX,SLIDER_TEST);
	pSlider->setOnValueChangedListener(this,ccw_valuechanged_selector(MsgBox::event_slider_test));
}
开发者ID:602147629,项目名称:Tui-x,代码行数:13,代码来源:MsgBox.cpp

示例12: onEnter

void CStrengthenItem::onEnter()
{
	BaseLayer::onEnter();

	m_cell = (CLayout*)(m_ui->findWidgetById("Cell"));
	m_cell->retain();
	m_ui->removeChild(m_cell);

	m_tableView = (CTableView *)(m_ui->findWidgetById("scroll"));
	m_tableView->setDirection(eScrollViewDirectionVertical);
	m_tableView->setSizeOfCell(m_cell->getContentSize());
	m_tableView->setCountOfCell(0);
	m_tableView->setBounceable(false);
	m_tableView->setDataSourceAdapter(this,ccw_datasource_adapter_selector(CStrengthenItem::tableviewDataSource));
	m_tableView->reloadData();

	CButton *select = (CButton*)(m_ui->findWidgetById("select"));
	select->setOnClickListener(this,ccw_click_selector(CStrengthenItem::onSelectItem));

	CButton *filter = (CButton*)(m_ui->findWidgetById("filter"));
	filter->setOnClickListener(this,ccw_click_selector(CStrengthenItem::onFilterItem));

	//退出
	CButton* pClose = CButton::create("common/back.png", "common/back.png");
	pClose->getSelectedImage()->setScale(1.1f);
	pClose->setPosition(VLEFT+50, VTOP-50);
	pClose->setOnClickListener(this,ccw_click_selector(CStrengthenItem::onClose));
	this->addChild(pClose, 999);

    m_selectCellImg = (CCSprite*)m_ui->findWidgetById("selimg");
	m_selectCellImg->retain();

	GetTcpNet->registerMsgHandler(RoleBag,this,CMsgHandler_selector(CStrengthenItem::recItemData));
	GetTcpNet->registerMsgHandler(ArmorListMsg,this,CMsgHandler_selector(CStrengthenItem::processNetMessage));

	CSceneManager::sharedSceneManager()->addMsgObserver("updateFilter",this,GameMsghandler_selector(CStrengthenItem::onSetFilter));
}
开发者ID:54993306,项目名称:Classes,代码行数:37,代码来源:StrengthenItem.cpp

示例13: onEnter

void CSmeltArmor::onEnter()
{
	BaseLayer::onEnter();

	//四个选择框
	for (unsigned int i=0; i<4; ++i)
	{
		CCheckBox *checkBtn = (CCheckBox*)(m_pBaseInfo[i]->findWidgetById("check"));
		checkBtn->setOnCheckListener(this,ccw_check_selector(CSmeltArmor::onCheckAttr));
	}

	//选择武器
	CButton *select = (CButton*)(m_ui->findWidgetById("select"));
	select->setOnClickListener(this, ccw_click_selector(CSmeltArmor::onSelectItem));

	//洗练
	CButton *refine = (CButton*)(m_ui->findWidgetById("refine"));
	refine->setOnClickListener(this, ccw_click_selector(CSmeltArmor::onRefineItem));
	
	//初始化火
	initFire();

	//旋转圈
	CImageView *circleFire = (CImageView*)(m_ui->findWidgetById("fire_circle"));
	circleFire->setScale(1.95f);
	circleFire->runAction(CCRepeatForever::create(CCRotateBy::create(1.0f, 60)));
	circleFire->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCScaleTo::create(1.2f, 2.1f), CCScaleTo::create(1.2f, 1.95f))));


	GetTcpNet->registerMsgHandler(SmeltArmorMsg,this,CMsgHandler_selector(CSmeltArmor::proceesMessage));
	GetTcpNet->registerMsgHandler(SmeltDataRequestMsg,this,CMsgHandler_selector(CSmeltArmor::proceesMessage));

	CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO, this, GameMsghandler_selector(CSmeltArmor::roleUpdate));
	
	CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_ITEM_DATA, this, GameMsghandler_selector(CSmeltArmor::updateStar));
}
开发者ID:54993306,项目名称:Classes,代码行数:36,代码来源:SmeltArmor.cpp

示例14: onLoadScene

NS_MAIN_BEGIN


void MsgBox::onLoadScene()
{
	//setAutoRemoveUnusedTexture(true);
	TuiManager::getInstance()->parseScene(this,"panel_msgbox",PATH_MAIN);
	//注册事件
	CButton *pBtnClose = (CButton*)getControl(PANEL_MSGBOX,BTN_CLOSE);
	pBtnClose->setOnClickListener(this,ccw_click_selector(MsgBox::event_btn_close));
	
	CSlider *pSlider = (CSlider*)getControl(PANEL_MSGBOX,SLIDER_TEST);
	pSlider->setOnValueChangedListener(this,ccw_valuechanged_selector(MsgBox::event_slider_test));

	CProgressBar *pProg = (CProgressBar*)this->getControl(PANEL_MSGBOX,PROG_HP);
	pProg->setShowValueLabel(true);
}
开发者ID:Eason-Xi,项目名称:Tui-x,代码行数:17,代码来源:MsgBox.cpp

示例15: init

bool CListViewOperateTest::init()
{
	CListViewTestSceneBase::init();
	setTitle("CListViewOperateTest");
	setDescription("Add or Remove operate");

	m_pListView = CListView::create(Size(480, 320));
	m_pListView->setBackgroundImage("background.png");
	m_pListView->setPosition(Vec2(480, 320));
	m_pListView->setDirection(eScrollViewDirectionVertical);
	m_pWindow->addChild(m_pListView);

	CButton* pButton = CButton::createWith9Sprite(Size(150, 50),
		"sprite9_btn1.png", "sprite9_btn2.png");
	pButton->setPosition(Vec2(150, 450));
	pButton->setUserTag(1);
	pButton->setOnClickListener(this, ccw_click_selector(CListViewOperateTest::onClick));
	pButton->initText("Add Last", "", 30);
	m_pWindow->addChild(pButton);

	CButton* pButton2 = CButton::createWith9Sprite(Size(150, 50),
		"sprite9_btn1.png", "sprite9_btn2.png");
	pButton2->setPosition(Vec2(150, 380));
	pButton2->setUserTag(2);
	pButton2->setOnClickListener(this, ccw_click_selector(CListViewOperateTest::onClick));
	pButton2->initText("Add Front", "", 30);
	m_pWindow->addChild(pButton2);

	CButton* pButton3 = CButton::createWith9Sprite(Size(150, 50),
		"sprite9_btn1.png", "sprite9_btn2.png");
	pButton3->setPosition(Vec2(150, 310));
	pButton3->setUserTag(3);
	pButton3->setOnClickListener(this, ccw_click_selector(CListViewOperateTest::onClick));
	pButton3->initText("Remove Last", "", 30);
	m_pWindow->addChild(pButton3);

	CButton* pButton4 = CButton::createWith9Sprite(Size(150, 50),
		"sprite9_btn1.png", "sprite9_btn2.png");
	pButton4->setPosition(Vec2(150, 240));
	pButton4->setUserTag(4);
	pButton4->setOnClickListener(this, ccw_click_selector(CListViewOperateTest::onClick));
	pButton4->initText("Remove Front", "", 30);
	m_pWindow->addChild(pButton4);

	return true;
}
开发者ID:Kudoo,项目名称:Tui-x,代码行数:46,代码来源:ListViewTest.cpp


注:本文中的CButton::setOnClickListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。