本文整理汇总了C++中CLayout类的典型用法代码示例。如果您正苦于以下问题:C++ CLayout类的具体用法?C++ CLayout怎么用?C++ CLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LSTRACE
LSERR WINAPI CEmbeddedDobj::QueryPointPcp(
PDOBJ pdobj, // IN
PCPOINTUV pptuvQuery, // IN
PCLSQIN plsqIn, // IN
PLSQOUT plsqOut) // OUT
{
LSTRACE(EmbeddedQueryPointPcp);
CLineServices* pLS = pdobj->GetPLS();
CFlowLayout* pFlowLayout = pLS->_pFlowLayout;
PLSRUN plsrun = PLSRUN(plsqIn->plsrun);
CLayout* pLayout = plsrun->GetLayout(pFlowLayout);
long xWidth;
ZeroMemory(plsqOut, sizeof(LSQOUT));
pFlowLayout->GetSiteWidth( pLayout, pLS->_pci, FALSE, 0, &xWidth);
plsqOut->dupObj = xWidth;
plsqOut->plssubl = NULL;
plsqOut->lstextcell.cpStartCell = pLayout->GetContentFirstCp();
plsqOut->lstextcell.cpEndCell = pLayout->GetContentLastCp();
plsqOut->lstextcell.dupCell = xWidth;
plsqOut->lstextcell.pCellDetails = NULL;
return lserrNone;
}
示例2:
CLayout *TuiManager::createLayout(float tag,float x,float y,float w,float h,float rotation){
CLayout *pLayout = CLayout::create(Size(w,h));
pLayout->setPosition(Point(x,-y));
pLayout->setRotation(rotation);
pLayout->setTag(tag);
return pLayout;
}
示例3: addTableCell
void CHeroExpItem::addTableCell(unsigned int uIdx, CTableViewCell * pCell)
{
CLayout *lay = UICloneMgr::cloneLayout(m_cell);
const CEvolQuest &evol = m_evolInfo.questsList.at(uIdx);
const TaskData *task = DataCenter::sharedData()->getTask(Evole_Task)->getCfg(evol.id);
for (int i = 1; i <=4; i++)
{
CCNode *child = lay->getChildByTag(i);
lay->removeChild(child);
pCell->addChild(child);
if (i==1)
{
CImageView *bgView= (CImageView*)child;
bgView->setTouchEnabled(true);
bgView->setUserData(&m_evolInfo.questsList.at(uIdx));
bgView->setOnClickListener(this, ccw_click_selector(CHeroExpItem::onRecvTask));
}
else if (i==2)
{
CLabel *taskName = (CLabel*)child;
taskName->setString(task->taskName.c_str());
}
else if (i==3)
{
CLabel *taskDesc = (CLabel*)child;
taskDesc->setString(task->taskDesc.c_str());
}
else if (i==4)
{
child->setVisible(evol.pass);
}
}
}
示例4: updateData
void CHeroEvolveEffectLayer::updateData( )
{
//面板数据
int iValue[][2] = {
{m_pBaseHero->combat, m_pAimHero->combat},
{m_pBaseHero->hp, m_pAimHero->hp},
{m_pBaseHero->atk, m_pAimHero->atk},
{m_pBaseHero->def, m_pAimHero->def},
{m_pBaseHero->dex, m_pAimHero->dex},
{m_pBaseHero->hit, m_pAimHero->hit},
{m_pBaseHero->crit, m_pAimHero->crit},
{m_pBaseHero->dodge, m_pAimHero->dodge},
{m_pBaseHero->renew, m_pAimHero->renew}
};
//更新数据
for(int i=0; i<9; i++)
{
CLayout *pLay = (CLayout *)m_pUI->findWidgetById(CCString::createWithFormat("data%d", i+1)->getCString());
pLay->setVisible(false);
CLabel *pBaseValue = (CLabel *)pLay->findWidgetById(CCString::createWithFormat("base_value%d", i+1)->getCString());
pBaseValue->setString(ToString(iValue[i][0]));
CLabel *pAimValue = (CLabel *)pLay->findWidgetById(CCString::createWithFormat("aim_value%d", i+1)->getCString());
pAimValue->setString(ToString(iValue[i][1]));
}
}
示例5: setTitle
bool CExpandableListViewBasicTest::init()
{
CExpandableListViewTestSceneBase::init();
setTitle("CExpandableListViewBasicTest");
setDescription("click item to expand");
pListView = CExpandableListView::create(CCSize(320, 390));
pListView->setBackgroundImage("background2.png");
pListView->setPosition(CCPoint(480, 320));
m_pWindow->addChild(pListView);
for( int i = 0; i < 10; i++ )
{
CExpandableNode* pExpandableNode = CExpandableNode::create();
pExpandableNode->setContentSize(CCSize(320, 50));
pListView->insertExpandableNodeAtLast(pExpandableNode);
CImageViewScale9* pExpandableNodeBg = CImageViewScale9::create(CCSize(320, 45), "expandnodebg.png");
pExpandableNodeBg->setPosition(CCPoint(320/2, 50/2));
pExpandableNode->addChild(pExpandableNodeBg);
CButton* pColBtn = CButton::createWith9Sprite(CCSize(35, 35), "sprite9_btn1.png", "sprite9_btn2.png");
pColBtn->setPosition(ccp(320 - 30, 50 / 2));
pColBtn->setText("-");
pColBtn->setUserTag(i);
pColBtn->setOnClickListener(this, ccw_click_selector(CExpandableListViewBasicTest::onClick));
pExpandableNode->addChild(pColBtn);
char buff[64] = {0};
sprintf(buff, "ExpandableNode : %d", i);
CLabel* pTitleLabel = CLabel::create(buff, "", 28);
pTitleLabel->setPosition(CCPoint(10, 50/2));
pTitleLabel->setAnchorPoint(CCPoint(0, 0.5));
pExpandableNode->addChild(pTitleLabel);
sprintf(buff, "Label %d - 1", i);
pExpandableNode->insertItemNodeAtLast(CLabel::create(buff, "", 30));
sprintf(buff, "Label %d - 2", i);
pExpandableNode->insertItemNodeAtLast(CLabel::create(buff, "", 30));
sprintf(buff, "Label %d - 3", i);
pExpandableNode->insertItemNodeAtLast(CLabel::create(buff, "", 30));
CButton* pButton = CButton::createWith9Sprite(CCSize(150, 38), "sprite9_btn1.png", "sprite9_btn2.png");
pButton->setOnClickListener(this, ccw_click_selector(CExpandableListViewBasicTest::onClick));
pButton->initText("collapse", "", 28);
pButton->setUserTag(i);
pButton->setPosition(CCPoint(100, 40/2));
CLayout* pBtnLayout = CLayout::create(CCSize(320, 40));
pBtnLayout->addChild(pButton);
pExpandableNode->insertItemNodeAtLast(pBtnLayout);
}
pListView->reloadData();
return true;
}
示例6: if
void CStrengthenItem::onSetFilter(const TMessage& tMsg)
{
m_itemList.clear();
vector<int> *filt = (vector<int> *)tMsg.lParam;
m_filterVec = *filt;
for (int i=0; i<m_itemData.itemList.size(); ++i)
{
CItem *item =(CItem*)(&m_itemData.itemList.at(i));
bool isAdd = false;
for (int j = 0; j < filt->size(); j++)
{
if (item->armor.armorType == filt->at(j))
{
if (tMsg.nMsg == 2)
{
isAdd = true;
}
else if (tMsg.nMsg == 0&&tMsg.nMsg==item->armor.hero)
{
isAdd = true;
}
else if (tMsg.nMsg == 1&& item->armor.hero>0)
{
isAdd = true;
}
else
{
isAdd = false;
}
break;
}
}
if (isAdd)
{
m_itemList.push_back(&m_itemData.itemList.at(i));
}
}
//排序
std::sort(m_itemList.begin(), m_itemList.end(), SortItem);
m_tableView->setCountOfCell(m_itemList.size());
m_tableView->reloadData();
CLayout *attribute = (CLayout*)(m_ui->findWidgetById("attr"));
attribute->setVisible(false);
if (m_itemList.size()>0)
{
CTableViewCell *cell = (CTableViewCell*)m_tableView->getCells()->objectAtIndex(0);
onTouchItem(cell->getChildByTag(1));
}
}
示例7: CLayout
CLayout* CLayout::create()
{
CLayout* pRet = new CLayout();
if( pRet && pRet->init() )
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
示例8: initItemInfo
void CSmeltArmor::initItemInfo( CCPoint posStart, CLayout* pLayout[], int iCount )
{
for(int i=0; i<iCount; i++)
{
CLayout* pCopyLayout = UICloneMgr::cloneLayout(m_pCellInfo);
pCopyLayout->setPosition(posStart+ccp(0, -i*50));
m_attr->addChild(pCopyLayout, 911);
pLayout[i] = pCopyLayout;
pLayout[i]->setVisible(false);
}
}
示例9: PlayEffectSound
void CStrengthenItem::onTouchItem(CCObject* pSender)
{
if(isVisible())
{
PlayEffectSound(SFX_Button);
}
CImageView * img = (CImageView*)pSender;
m_item = (CItem*)img->getUserData();
m_pItemTip->showItemProperty(m_item);
CLayout *attribute = (CLayout*)(m_ui->findWidgetById("attr"));
attribute->setVisible(true);
m_selectCellImg->removeFromParent();
img->addChild(m_selectCellImg);
m_selectCellImg->setVisible(true);
m_selectCellImg->setPosition(ccp(img->getContentSize().width/2,0/*img->getContentSize().height/2*/));
CButton *select = (CButton*)(m_ui->findWidgetById("select")); //sel_font
CLabel *selfont = (CLabel*)(m_ui->findWidgetById("sel_font"));
if (m_toHero==m_item->armor.hero&&m_toHero>0)
{
select->setVisible(true);
selfont->setVisible(false);
}
else if (m_toHero>0&&!m_item->canUse)
{
select->setVisible(false);
selfont->setVisible(false);
}
else
{
select->setVisible(true);
selfont->setVisible(true);
}
if (m_type==2)
{
if (m_toHero>0)
{
CImageView *uninstall = (CImageView*)(m_ui->findWidgetById("uninstall"));
CImageView *change = (CImageView*)(m_ui->findWidgetById("change"));
CImageView *selfont = (CImageView*)(m_ui->findWidgetById("sel_font"));
uninstall->setVisible(m_toHero==m_item->armor.hero);
change->setVisible(m_toHero!=m_item->armor.hero&&m_item->armor.hero>0&&m_item->canUse);
selfont->setVisible(m_item->armor.hero==0&&m_item->canUse);
}
}
}
示例10: CCTexture2D
void CMainCityUI::imageLoadSuccessCallBack(string sTag, vector<char>* pBuffer)
{
CCImage* img = new CCImage;
img->initWithImageData((unsigned char*)pBuffer->data(), pBuffer->size());
CCTexture2D* texture = new CCTexture2D();
texture->initWithImage(img);
CLayout* headPart = (CLayout*)m_ui->findWidgetById("head_part");
CCSprite* head = (CCSprite*)headPart->getChildByTag(15);
// head->removeFromParent();
//head->setTexture(texture);
string path = HttpLoadImage::getInstance()->getStoragePath("download/fbImg",sTag.c_str())+".jpg";
string buff(pBuffer->begin(), pBuffer->end());
CCLOG("path: %s", path.c_str());
FILE *fp = fopen(path.c_str(), "wb+");
fwrite(buff.c_str(), 1, pBuffer->size(), fp);
fclose(fp);
// CCSprite *headbg = (CCSprite*)(m_ui->findWidgetById("headbg"));
// CCClippingNode *clip = CCClippingNode::create();
// CCSprite *fbimg = CCSprite::createWithTexture(texture);
// clip->addChild(fbimg);
//
// clip->setPosition(headbg->getPosition());
// clip->setContentSize(CCSizeMake(110,110));
//
// static ccColor4F red ={1,0,1};
// float radius = 106;
// const int nCount = 200;
// const float angle = 2.0f* (float)M_PI/nCount;
// CCPoint circle[nCount];
// for(int i=0; i<nCount; i++)
// {
// float radian = i*angle;
// circle[i].x = radius * cosf(radian);
// circle[i].y = radius * sinf(radian);
// }
// CCDrawNode *stencil= CCDrawNode::create();
// stencil->drawPolygon(circle,nCount,red,0,red);
// clip->setStencil(stencil);
// m_ui->addChild(clip);
CCSprite *headBg = (CCSprite *)(headPart->findWidgetById("headbg"));
CCSprite *headSpr = MakeFaceBookHeadToCircle(CCSprite::createWithTexture(texture));
headSpr->setTag(15);
headSpr->setPosition(headBg->getPosition());
headPart->addChild(headSpr);
head->removeFromParent();
img->release();
}
示例11: initListCellIcon
void CHandBookHeroLayer::initListCellIcon( AtlasIns *pAtlasIns, CCPoint startPos, int iGapX, CTableViewCell *pCell )
{
int iSize = pAtlasIns->data_list_size();
for(int i=0; i<iSize; i++)
{
//克隆元素
CLayout *pIconCell = UICloneMgr::cloneLayout(m_pCell);
pIconCell->setPosition(ccp(startPos.x+iGapX*i, startPos.y));
pCell->addChild(pIconCell, 10);
initCellIconByData( pAtlasIns->mutable_data_list()->Mutable(i), pIconCell );
}
}
示例12: catch
bool Arguments::handleCommandLine() const
{
if (!(mSaveLayout && haveFile() && haveOutputDir()))
return false;
CCopasiRootContainer::init(0, NULL, false);
CCopasiDataModel& model = *CCopasiRootContainer::addDatamodel();
try
{
if (!model.importSBML(mFilename, NULL))
model.loadModel(mFilename, NULL);
}
catch (CCopasiException &ex)
{
std::cerr << ex.getMessage().getAllMessageText() << std::endl;
return true;
}
for (size_t i = 0; i < model.getListOfLayouts()->size(); ++i)
{
CLayout* layout = (*model.getListOfLayouts())[i];
CQLayoutScene scene(layout, &model);
scene.recreate();
scene.saveToFile(mOutputDir + "/" + QFileInfo(mFilename.c_str()).baseName().toStdString() + "_" + layout->getObjectName() + "." + mFileType, mFileType);
}
return true;
}
示例13: insertLayout
bool Circuit::insertLayout(CLayout& tmp){
// map<string, CLayout>::iterator cells_it=layouts.find(tmp.getName());
// if(cells_it!=layouts.end())
// cout << "-> Cell layout " << tmp.getName() << " already exists. Overwriting..." << endl;
layouts[tmp.getName()]=tmp;
return true;
}
示例14: addGridCell
void CChangeHeadImg::addGridCell(unsigned int uIdx, CGridViewCell* pCell)
{
CLayout *lay = UICloneMgr::cloneLayout(m_cell);
for (int i=1; i<=2; i++)
{
CCNode *child = lay->getChildByTag(i);
lay->removeChild(child);
pCell->addChild(child);
if (i==1)
{
if (m_headIconList.at(uIdx)>0)
{
CImageView* pHead = CImageView::create(CCString::createWithFormat("headImg/%d.png", m_headIconList.at(uIdx))->getCString());
if(!pHead)
{
pHead = CImageView::create("headImg/null.png");
CCLOG("ERROR_____CChangeHeadImg::addGridCell");
}
child->addChild(pHead);
NodeFillParent(pHead);
}
else
{
UserData *data = DataCenter::sharedData()->getUser()->getUserData();
string fbName = data->getFbId() +".jpg";
string fullName = CCFileUtils::sharedFileUtils()->fullPathForFilename(fbName.c_str());
bool isFileExist = CCFileUtils::sharedFileUtils()->isFileExist(fullName);
if(isFileExist)
{
CCSprite* spr =CCSprite::create(fullName.c_str());
child->addChild(spr);
NodeFillParent(spr);
}
}
}
else if(i==2)
{
CImageView* pBtn = (CImageView*)child;
pBtn->setTouchEnabled(true);
pBtn->setUserData(&m_headIconList.at(uIdx));
pBtn->setOnClickListener(this,ccw_click_selector(CChangeHeadImg::onChangHeadImg));
}
}
}
示例15: showDataFlyOutByType
void CHeroEvolveEffectLayer::showDataFlyOutByType( int iType )
{
for(int i=0; i<9; i++)
{
if( (iType==1 && i<4) || (iType==2 && i>=4))
{
CLayout *pLay = (CLayout *)m_pUI->findWidgetById(CCString::createWithFormat("data%d", i+1)->getCString());
pLay->runAction(CCSequence::create(
CCDelayTime::create(0.05f*i),
CCMoveBy::create(0.15f, ccp(-600, 0)),
CCHide::create(),
CCMoveBy::create(0.0f, ccp(600, 0)),
nullptr
));
}
}
}