本文整理汇总了C++中CCTableView类的典型用法代码示例。如果您正苦于以下问题:C++ CCTableView类的具体用法?C++ CCTableView怎么用?C++ CCTableView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCTableView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTitle
bool ItemListScene::init()
{
bool result = GradientLayer::init();
if (result) {
setTitle(MessageItemBookTitle);
_items = GameEngine::sharedEngine()->getItems();
CCSize windowSize = CCDirector::sharedDirector()->getWinSize();
CCTableView *tableView = CCTableView::create(this, CCSize(windowSize.width, windowSize.height - TitleBarHeight));
tableView->setDirection(kCCScrollViewDirectionVertical);
tableView->setDelegate(this);
tableView->setBounceable(false);
tableView->reloadData();
this->addChild(tableView);
_scrollViewIndicator = CCDrawNode::create();
_scrollViewIndicator->drawSegment(ccp(windowSize.width - kScrollViewIndicatorMarginRight, windowSize.height),
ccp(windowSize.width - kScrollViewIndicatorMarginRight, windowSize.height - kScrollViewIndicatorHeight),
kScrollViewIndicatorRadius, ccc4f(1.0, 1.0, 1.0, 0.3));
_scrollViewIndicator->setPosition(ccp(0, -TitleBarHeight - kScrollViewIndicatorMarginVertical));
this->addChild(_scrollViewIndicator);
setTitleBarLeftButton(MessageBackButtonTitle, GameEngine::sharedEngine(), menu_selector(GameEngine::showTitle));
}
return result;
}
示例2: CCSizeMake
// on "init" you need to initialize your instance
bool TableViewTestLayer::init()
{
if ( !CCLayer::init() )
{
return false;
}
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCTableView* tableView = CCTableView::create(this, CCSizeMake(250, 60));
tableView->setDirection(kCCScrollViewDirectionHorizontal);
tableView->setPosition(ccp(20,winSize.height/2-30));
tableView->setDelegate(this);
this->addChild(tableView);
tableView->reloadData();
tableView = CCTableView::create(this, CCSizeMake(60, 280));
tableView->setDirection(kCCScrollViewDirectionVertical);
tableView->setPosition(ccp(winSize.width-150,winSize.height/2-120));
tableView->setDelegate(this);
tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
this->addChild(tableView);
tableView->reloadData();
// Back Menu
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(TableViewTestLayer::toExtensionsMainLayer));
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
menuBack->setPosition(CCPointZero);
addChild(menuBack);
return true;
}
示例3: setDelegate
void FightInfoLayer::creatMyTableView() {
CCTableView *tableView = CCTableView::create(this, myTableView->getContentSize());
tableView -> setDelegate(this);
tableView->setDirection(kCCScrollViewDirectionVertical);
tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
myTableView -> addCCNode(tableView);
}
示例4: while
//private
void RPGMapItemsMenuLayer::loadItemsData()
{
//道具数据
this->m_itemsList->removeAllObjects();
CppSQLite3Query query = this->m_db->execQuery(ITEMS_EXISTING_QUERY);
while(!query.eof())
{
RPGExistingItems *itemsData = RPGExistingItems::create();
itemsData->m_dataId = query.getIntField("id");
itemsData->m_name = query.getStringField("name_cns");
itemsData->m_buy = query.getIntField("buy");
itemsData->m_sell = query.getIntField("sell");
itemsData->m_type = query.getIntField("type");
itemsData->m_attack = query.getFloatField("attack");
itemsData->m_defense = query.getFloatField("defense");
itemsData->m_speed = query.getFloatField("speed");
itemsData->m_skillAttack = query.getFloatField("skill_attack");
itemsData->m_skillDefense = query.getFloatField("skill_defense");
itemsData->m_total = query.getIntField("total");
this->m_itemsList->addObject(itemsData);
query.nextRow();
}
query.finalize();
CCTableView *tableView = (CCTableView*)this->getChildByTag(kRPGMapItemsMenuLayerTagItemListTable);
tableView->reloadData();
}
示例5: CCTableView
//add by ivan
CCTableView* CCTableView::create()
{
CCTableView *table = new CCTableView();
table->initWithViewSize(CCSizeMake(312, 250),NULL);
table->autorelease();
return table;
}
示例6: endNode
void CCTableViewCreator::endNode(CCNode* pNode)
{
CCTableView* pTableView = (CCTableView*)pNode;
pTableView->initWithViewSize(ccXmlAttrParse::toSize(mAttrMap["view_size"].c_str()), NULL);
pTableView->setDataSource(dynamic_cast<CCTableViewDataSource*>(mRootDelegate));
pTableView->setDelegate(dynamic_cast<CCTableViewDelegate*>(mRootDelegate));
CCNodeCreator::setAttribute(pNode);
}
示例7: if
void CCLobbyView::update( float delta )
{
CCLayer::update( delta );
CocosNetworkLogic* network = CocosNetworkLogic::getInstance();
const CCString& output = network->getOutput();
this->getConsole()->setString( output.getCString() );
State state = network->getState();
CCMenuItemLabel* connectButton = this->getConnectMenu();
CCMenuItemLabel* gameButton = this->getJoinRandomRoomMenu();
CCMenuItemLabel* createGameButton = this->getCreateRoomMenu();
CCTableView* roomTable = (CCTableView*) this->getChildByTag( Child::CCTableView_roomTable );
if( connectButton )
{
if( state == STATE_INITIALIZED )
{
this->removeRoomTable();
connectButton->setString( "Connect" );
gameButton->setVisible(true);
gameButton->setString( "Exit Lobby" );
createGameButton->setVisible( false );
}
else
{
if( !roomTable )
{
this->initRoomTable();
}
connectButton->setString( "Disconnect" );
gameButton->setVisible(true);
if( state == STATE_JOINED )
{
gameButton->setString( "Leave Room" );
createGameButton->setVisible(false);
}
else if (network->getDidCreateGame())
{
}
else
{
gameButton->setString( "Random Room" );
createGameButton->setVisible(true);
}
}
}
roomTable = (CCTableView*) this->getChildByTag( Child::CCTableView_roomTable );
if( roomTable )
{
roomTable->reloadData();
}
}
示例8: switch
int CCLuaEngine::executeTableViewEvent(int nEventType,void* tb,void* pValue, CCArray* pResultArray)
{
CCTableView* pTableView = (CCTableView*)tb;
if (NULL == pTableView)
return 0;
int nHanlder = pTableView->getScriptHandler(nEventType);
if (0 == nHanlder)
return 0;
int nRet = 0;
switch (nEventType)
{
case CCTableView::kTableViewScroll:
case CCTableView::kTableViewZoom:
{
m_stack->pushCCObject(pTableView, "CCTableView");
nRet = m_stack->executeFunctionByHandler(nHanlder, 1);
}
break;
case CCTableView::kTableCellTouched:
case CCTableView::kTableCellHighLight:
case CCTableView::kTableCellUnhighLight:
case CCTableView::kTableCellWillRecycle:
{
m_stack->pushCCObject(pTableView, "CCTableView");
m_stack->pushCCObject(static_cast<CCTableViewCell*>(pValue), "CCTableViewCell");
nRet = m_stack->executeFunctionByHandler(nHanlder, 2);
}
break;
case CCTableView::kTableCellSizeForIndex:
{
m_stack->pushCCObject(pTableView, "CCTableView");
m_stack->pushInt(*((int*)pValue));
nRet = m_stack->executeFunctionReturnArray(nHanlder, 2, 2, pResultArray);
}
break;
case CCTableView::kTableCellSizeAtIndex:
{
m_stack->pushCCObject(pTableView, "CCTableView");
m_stack->pushInt(*((int*)pValue));
nRet = m_stack->executeFunctionReturnArray(nHanlder, 2, 1, pResultArray);
}
break;
case CCTableView::kNumberOfCellsInTableView:
{
m_stack->pushCCObject(pTableView, "CCTableView");
nRet = m_stack->executeFunctionReturnArray(nHanlder, 1, 1, pResultArray);
}
break;
default:
break;
}
return nRet;
}
示例9: CCTableView
CCTableView* CCTableViewCreator::createNode()
{
CCTableView* pTableView = new CCTableView();
if(pTableView)
{
pTableView->autorelease();
return pTableView;
}
CC_SAFE_DELETE(pTableView);
return NULL;
}
示例10: while
void CCLobbyView::removeRoomTable()
{
CCNode *roomTable = NULL;
while ( (roomTable = this->getChildByTag( Child::CCTableView_roomTable)) ) {
CCTableView* table = dynamic_cast<CCTableView*>(roomTable);
table->removeAllChildren();
this->removeChild(roomTable, true);
}
CC_SAFE_DELETE( this->_lobbyViewDataSource );
}
示例11: setKaiBaoxiangBtnVisiable
void IOSStoreLayer::setKaiBaoxiangBtnVisiable()
{
if (!m_pKaibaoxiangNode)
{
return;
}
CCTableView* pTableViwe = (CCTableView*)m_pKaibaoxiangNode->getChildByTag(kaibaoxiang_node_tableview_tag);
if (pTableViwe)
{
pTableViwe->reloadData();
}
}
示例12: CCLog
//메뉴 콜백 함수
void MenuScene::addDataFive( CCObject* sender )
{
CCLog("데이터 5개 추가");
CCTableView* tb = (CCTableView*) this->getChildByTag(tagTableView);
for(int i=0; i < 5; i++){
addDatalist(count);
count++;
}
//테이블 뷰의 크기를 다시 정의 한다. 원하는 퍼퍼먼스는 얻기 힘들었다;
tb->_updateContentSize();
}
示例13: ccc4
KDbool TestList::init ( KDvoid )
{
if ( !CCLayer::initWithVisibleViewport ( ) )
{
return KD_FALSE;
}
const CCSize& tLyrSize = this->getContentSize ( );
CCLayerGradient* pBG = CCLayerGradient::create ( ccc4 ( 52, 84, 236, 200 ), ccc4 ( 149, 0, 202, 200 ) );
pBG->setContentSize ( tLyrSize );
this->addChild ( pBG, -10 );
CCSprite* pBottomLeft = CCSprite::create ( "ccb/jungle-left.png" );
this->addChild ( pBottomLeft, 10 );
pBottomLeft->setScale ( 1.5f );
pBottomLeft->setOpacity ( 210 );
pBottomLeft->setPositionWithParent ( kCCAlignmentBottomLeft );
CCSprite* pBottomRight = CCSprite::create ( "ccb/jungle-right.png" );
this->addChild ( pBottomRight, 10 );
pBottomRight->setScale ( 1.5f );
pBottomRight->setOpacity ( 210 );
pBottomRight->setPositionWithParent ( kCCAlignmentBottomRight );
CCMenuItemImage* pQuit = CCMenuItemImage::create
(
"xm_supports/CloseNormal.png", "xm_supports/CloseSelected.png", this, menu_selector ( TestList::onQuit )
);
pQuit->setScale ( 1.2f );
pQuit->setPosition ( this, kCCAlignmentTopRight, ccp ( 10, 10 ) );
this->addChild ( CCMenu::createWithItem ( pQuit ), 10 );
CCTableView* pTableView = CCTableView::create ( this, ccs ( tLyrSize.cx, tLyrSize.cy - 20.f ) );
this->addChild ( pTableView );
pTableView->setDelegate ( this );
pTableView->setDataSource ( this );
pTableView->setPosition ( ccp ( 0, 10 ) );
if ( s_tPrevPosition.x != -1 )
{
pTableView->setContentOffset ( s_tPrevPosition );
}
CCMenuItemFont::setFontSize ( 30 );
CCMenuItemFont::setFontName ( "fonts/ThonburiBold.ttf" );
return KD_TRUE;
}
示例14: setAttribute
void CCTableViewCreator::setAttribute(CCNode* pNode, const char* strName, const char* strValue, bool bCache)
{
CCTableView* pTableView = (CCTableView*)pNode;
if(bCache)
mAttrMap[strName] = strValue;
else
{
if(strcmp(strName, "fill_order") == 0)
pTableView->setVerticalFillOrder((CCTableViewVerticalFillOrder)ccXmlAttrParse::toInt(strValue));
else
CCScrollViewCreator::setAttribute(pNode, strName, strValue, bCache);
}
}
示例15: tolua_Cocos2dx_CCTableView_setDataSource
static int tolua_Cocos2dx_CCTableView_setDataSource(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"CCTableView",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
CCTableView* self = (CCTableView*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setDataSource'", NULL);
#endif
LUA_TableViewDataSource* dataSource = new LUA_TableViewDataSource();
if (NULL == dataSource)
return 0;
CCDictionary* userDict = static_cast<CCDictionary*>(self->getUserObject());
if (NULL == userDict)
{
userDict = new CCDictionary();
if (NULL == userDict)
return 0;
self->setUserObject(userDict);
userDict->release();
}
userDict->setObject(dataSource, KEY_TABLEVIEW_DATA_SOURCE);
self->setDataSource(dataSource);
dataSource->release();
return 0;
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'setDataSource'.",&tolua_err);
return 0;
#endif
}