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


C++ CCTableView类代码示例

本文整理汇总了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;
}
开发者ID:ichiko,项目名称:yamiHikariGame,代码行数:30,代码来源:ItemListScene.cpp

示例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;
}
开发者ID:BradB132,项目名称:cocos2d-x,代码行数:34,代码来源:TableViewTestScene.cpp

示例3: setDelegate

void FightInfoLayer::creatMyTableView() {
    CCTableView *tableView = CCTableView::create(this, myTableView->getContentSize());
    tableView -> setDelegate(this);
    tableView->setDirection(kCCScrollViewDirectionVertical);
    tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
    myTableView -> addCCNode(tableView);
}
开发者ID:anzhongliu,项目名称:SmallGame_Cocos2dx,代码行数:7,代码来源:FightInfoLayer.cpp

示例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();
}
开发者ID:ChinaiOS,项目名称:OzgGameRPG,代码行数:30,代码来源:RPGMapItemsMenuLayer.cpp

示例5: CCTableView

//add by ivan
CCTableView* CCTableView::create()
{
    CCTableView *table = new CCTableView();
    table->initWithViewSize(CCSizeMake(312, 250),NULL);
    table->autorelease();
    
    return table;
}
开发者ID:webhunter,项目名称:iGame,代码行数:9,代码来源:CCTableView.cpp

示例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);
}
开发者ID:zhaxun,项目名称:cocos2d,代码行数:9,代码来源:ccScrollViewCreator.cpp

示例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();
    }
}
开发者ID:kaznog,项目名称:t09,代码行数:56,代码来源:CCLobbyView.cpp

示例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;
}
开发者ID:fordream,项目名称:quick,代码行数:55,代码来源:CCLuaEngine.cpp

示例9: CCTableView

CCTableView* CCTableViewCreator::createNode()
{
    CCTableView* pTableView = new CCTableView();
    if(pTableView)
    {
        pTableView->autorelease();
        return pTableView;
    }
    CC_SAFE_DELETE(pTableView);
    return NULL;
}
开发者ID:zhaxun,项目名称:cocos2d,代码行数:11,代码来源:ccScrollViewCreator.cpp

示例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 );
}
开发者ID:kaznog,项目名称:t09,代码行数:11,代码来源:CCLobbyView.cpp

示例11: setKaiBaoxiangBtnVisiable

void IOSStoreLayer::setKaiBaoxiangBtnVisiable()
{
	if (!m_pKaibaoxiangNode)
	{
		return;
	}
	CCTableView* pTableViwe = (CCTableView*)m_pKaibaoxiangNode->getChildByTag(kaibaoxiang_node_tableview_tag);
	if (pTableViwe)
	{
		pTableViwe->reloadData();
	}
}
开发者ID:SongCF,项目名称:game-LostStar,代码行数:12,代码来源:IOSStoreLayer.cpp

示例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();
}
开发者ID:Tingtingyu,项目名称:cocos2dx-scrollbar,代码行数:14,代码来源:MenuScene.cpp

示例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;
}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:49,代码来源:TestList.cpp

示例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);
    }
}
开发者ID:zhaxun,项目名称:cocos2d,代码行数:15,代码来源:ccScrollViewCreator.cpp

示例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    
}
开发者ID:13609594236,项目名称:quick-cocos2d-x,代码行数:46,代码来源:lua_cocos2dx_extensions_manual.cpp


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