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


C++ CAVector类代码示例

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


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

示例1: loadTabBarView

CAView* HeroInfoController::loadTabBarView(){


	CAVector<CATabBarItem*> items;
	if (m_pTabBar == NULL){
		CATabBarItem* tabBarItem1 = CATabBarItem::create(UTF8("英雄综合"), NULL, NULL);
		CATabBarItem* tabBarItem2 = CATabBarItem::create(UTF8("技能加点"), NULL, NULL);
		CATabBarItem* tabBarItem3 = CATabBarItem::create(UTF8("物品出装"), NULL, NULL);
		CATabBarItem* tabBarItem4 = CATabBarItem::create(UTF8("克制关系"), NULL, NULL);
		items.pushBack(tabBarItem1);
		items.pushBack(tabBarItem2);
		items.pushBack(tabBarItem3);
		items.pushBack(tabBarItem4);
	}
	m_pTabBar = CATabBar::create(items, CCSize(640, 30));
	m_pTabBar->setTitleColorForNormal(CAColor_gray);
	m_pTabBar->setTitleColorForSelected(CAColor_white);

	m_pTabBar->setSelectedAtIndex(0);
	m_pTabBar->setBackGroundColor(CAColor_black);
	m_pTabBar->setSelectedBackGroundColor(CAColor_black);
	m_pTabBar->setSelectedIndicatorImage(CAImage::create("image/Indicator.png"));
	m_pTabBar->showSelectedIndicator();
	m_pTabBar->setDelegate(this);
	m_pTabBar->setCenterOrigin(CCPoint(320, _size.height / 4 - _px(15)));

	this->getView()->insertSubview(m_pTabBar, 2);
	return m_pTabBar;
}
开发者ID:a752602882,项目名称:DotaMax,代码行数:29,代码来源:HeroInfoController.cpp

示例2: loadTableView

void HeroInfoController::loadTableView(){
	CCRect tableViewRect = this->getView()->getBounds();
	tableViewRect.origin.y = tableViewRect.size.height / 4;
	tableViewRect.size.height = tableViewRect.size.height / 4 * 3;

	m_pPageView = CAPageView::createWithFrame(tableViewRect, CAPageViewDirection::CAPageViewDirectionHorizontal);
	m_pPageView->setPageViewDelegate(this);
	//m_pPageView->setZoomScale(0.2);
	this->getView()->addSubview(m_pPageView);




	m_pTableView1 = CATableView::createWithFrame(tableViewRect);
	m_pTableView1->setTableViewDelegate(this);
	m_pTableView1->setTableViewDataSource(this);
	m_pTableView1->setTableHeaderView(CAView::createWithColor(CAColor_red));
	m_pTableView1->setTableHeaderHeight(_px(20));
	m_pTableView1->setZoomScale(1);

	m_pTableView1->setBackGroundColor(COLOR_GRAY);
	m_pTableView1->setSeparatorColor(COLOR_GRAY1);
	m_pTableView1->setAlwaysTopSectionHeader(false);


	tableViewRect.origin.x += tableViewRect.size.width;
	m_pTableView2 = CATableView::createWithFrame(tableViewRect);
	m_pTableView2->setTableViewDelegate(this);
	m_pTableView2->setTableViewDataSource(this);
	m_pTableView2->setBackGroundColor(COLOR_GRAY);
	m_pTableView2->setSeparatorColor(COLOR_GRAY1);
	m_pTableView2->setAlwaysTopSectionHeader(false);


	tableViewRect.origin.x += tableViewRect.size.width;
	m_pTableView3 = CATableView::createWithFrame(tableViewRect);
	m_pTableView3->setTableViewDelegate(this);
	m_pTableView3->setTableViewDataSource(this);
	m_pTableView3->setBackGroundColor(COLOR_GRAY);
	m_pTableView3->setSeparatorColor(COLOR_GRAY1);
	m_pTableView3->setAlwaysTopSectionHeader(false);

	tableViewRect.origin.x += tableViewRect.size.width;
	m_pTableView4 = CATableView::createWithFrame(tableViewRect);
	m_pTableView4->setTableViewDelegate(this);
	m_pTableView4->setTableViewDataSource(this);
	m_pTableView4->setBackGroundColor(COLOR_GRAY);
	m_pTableView4->setSeparatorColor(COLOR_GRAY1);
	m_pTableView4->setAlwaysTopSectionHeader(false);

	//把CAView中的tableView设置到view中
	CAVector<CAView*> views;
	views.pushBack(m_pTableView1);
	views.pushBack(m_pTableView2);
	views.pushBack(m_pTableView3);
	views.pushBack(m_pTableView4);
	m_pPageView->setViews(views);

}
开发者ID:a752602882,项目名称:DotaMax,代码行数:59,代码来源:HeroInfoController.cpp

示例3: initNewsPageView

void CDNewsViewController::initNewsPageView()
{
    //初始化pageView
    CAView* tempview = CAView::create();
    
    p_PageView = CAPageView::createWithFrame(DRect(0,0,winSize.width,winSize.width/2), CAPageViewDirectionHorizontal);
    p_PageView->setPageViewDelegate(this);
    p_PageView->setTouchEnabled(true);
    CAVector<CAView* > viewList;
    CommonUrlImageView* temImage0 = CommonUrlImageView::createWithFrame(DRect(winSize.width/2,100,winSize.width,winSize.width/2));
    temImage0->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
    temImage0->setImage(CAImage::create("image/HelloWorld.png"));
    temImage0->setUrl(m_page[m_page.size()-1].m_pic);
    
    viewList.pushBack(temImage0);
    for (int i=0; i<m_page.size(); i++) {
        //初始化viewList
        CommonUrlImageView* temImage = CommonUrlImageView::createWithFrame(DRect(winSize.width/2,100,winSize.width,winSize.width/2));
        temImage->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
        temImage->setImage(CAImage::create("image/HelloWorld.png"));
        temImage->setUrl(m_page[i].m_pic);
        viewList.pushBack(temImage);
    }
    CommonUrlImageView* temImage1 = CommonUrlImageView::createWithFrame(DRect(winSize.width/2,100,winSize.width,winSize.width/2));
    temImage1->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
    temImage1->setImage(CAImage::create("image/HelloWorld.png"));
    temImage1->setUrl(m_page[0].m_pic);
    viewList.pushBack(temImage1);
    
    p_PageView->setViews(viewList);
    tempview->addSubview(p_PageView);
    p_PageView->setCurrPage(1, false);
    pageControl = CAPageControl::createWithCenter(DRect(winSize.width-80, winSize.width/2-25, 100, 50));
    pageControl->setNumberOfPages((int)m_page.size());
    pageControl->setPageIndicatorImage(CAImage::create("image/pagecontrol_selected.png"));
    pageControl->setCurrIndicatorImage(CAImage::create("image/pagecontrol_bg.png"));
    pageControl->setPageIndicatorTintColor(CAColor_gray);
    //pageControl->setCurrentPageIndicatorTintColor(CAColor_clear);
    pageControl->addTarget(this, CAControl_selector(CDNewsViewController::pageControlCallBack));
    tempview->addSubview(pageControl);
    
    CAView* bg = CAView::createWithColor(ccc4(0, 0, 0, 128));
    bg->setFrame(DRect(0,winSize.width/2-50,winSize.width,50));
    tempview->addSubview(bg);
    
    if (m_page.size()>0) {
        pageViewTitle = CALabel::createWithFrame(DRect(10, winSize.width/2-40, winSize.width-50, 50));
        pageViewTitle->setText(m_page[0].m_title);
		pageViewTitle->setColor(CAColor_white);
        pageViewTitle->setFontSize(_px(28));
        tempview->addSubview(pageViewTitle);
    }
    
    p_TableView->setTableHeaderView(tempview);
    p_TableView->setTableHeaderHeight(_px(winSize.width/2));
}
开发者ID:bazhi,项目名称:CrossApp,代码行数:56,代码来源:CDNewsViewController.cpp

示例4: initPageView

void MainViewController::initPageView()
{
    int pageViewHeight = m_winSize.height * 0.3;
    int headerHeight = (120);
    // Page view
    if (m_pageView == NULL)
    {
        m_pageView = CAPageView::createWithFrame(DRect(0, headerHeight, m_winSize.width, pageViewHeight), CAPageViewDirectionHorizontal);
        m_pageView->setPageViewDelegate(this);
        m_pageView->setTouchEnabled(true);
        m_pageView->setSpacing(0);
        this->getView()->addSubview(m_pageView);
    }
    
    if (m_pageView) {
        CAVector<CAView* > viewList;
        for (int i = 0; i<m_page.size(); i++)
        {
            CommonUrlImageView* temImage = CommonUrlImageView::createWithFrame(DRect(0, (0), m_winSize.width, pageViewHeight - headerHeight));
            temImage->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
            temImage->setImage(CAImage::create("common/bg.png"));
            temImage->setUrl(m_page[i].m_imageUrl);
            temImage->setTouchEnabled(true);
            temImage->setTag(500 + i);
            viewList.pushBack(temImage);
        }
        m_pageView->setViews(viewList);
        m_pageView->setCurrPage(0, false);
    }
    
    // picture dots bg in page view
    if (m_pageControlBG == NULL) {
        m_pageControlBG = CAView::createWithColor(ccc4(0, 0, 0, 20));
        m_pageControlBG->setFrame(DRect(0, pageViewHeight + headerHeight - (50), m_winSize.width, (50)));
        m_pageControlBG->setTouchEnabled(false);
        this->getView()->addSubview(m_pageControlBG);
    }
    
    // picture dots
    if (m_pageControl != NULL) {
        this->getView()->removeSubview(m_pageControl);
        m_pageControl = NULL;
    }
    m_pageControl = CAPageControl::createWithCenter(DRect(m_winSize.width / 2, pageViewHeight + headerHeight - (25), (200), (50)));
    m_pageControl->setTag(200);
    m_pageControl->setTouchEnabled(false);
    m_pageControl->addTarget(this, CAControl_selector(MainViewController::buttonCallBack));
    m_pageControl->setNumberOfPages((int)m_page.size());
    this->getView()->addSubview(m_pageControl);
    
    // to : animate the page view
    CAScheduler::schedule(schedule_selector(MainViewController::updatePageView), this, 5);//, true, 3000);
}
开发者ID:DreamCastleShanghai,项目名称:client_new,代码行数:53,代码来源:MainViewController.cpp

示例5: Segmentation

CAVector CToolCervicales::SegmentationGlob(CDib * m_Dib, CRxDoc * i_Document, CList<CPoint, CPoint&>& i_List) {
	CList<CPoint, CPoint&> Result;
	
	Result.AddTail(i_List.GetHead());
	Segmentation(m_Dib, i_Document, i_List.GetHeadPosition(), i_List.GetTailPosition(), i_List, 0, Result);
	Result.AddTail(i_List.GetTail());

	CAVector Vector; CPoint l_Point;
	POSITION c_Pos = Result.GetHeadPosition();
	while (c_Pos != NULL) {
		l_Point = Result.GetNext(c_Pos);
		Vector.Add(CPoint(l_Point.x, m_Dib->GetHeight()-l_Point.y));
	}
	/* replace very close points by an intermediate value */	
	for (int i=2;i<(int)((double)(m_Dib->GetWidth() + m_Dib->GetHeight())/2 * 0.03);i++) RemoveClosePoints(Vector, i);
	/* remove pattern points */
	RemovePatternPoints(Vector);
	//i_Document->Add(Vector);
	return Vector;
}
开发者ID:dblock,项目名称:rxcervicales,代码行数:20,代码来源:ToolCervicales.cpp

示例6: scrollViewStopMoved

void CDNewsImageController::scrollViewStopMoved(CrossApp::CAScrollView *view)
{
    CAVector<CATableViewCell*> temVec =  p_TableView->displayingTableCell();
    for(int i=0;i<temVec.size();i++)
    {
        CDNewsImageTableCell* cell = (CDNewsImageTableCell*)temVec.at(i);
        CCLog("cell-index===%d",cell->getRow());
        int row = cell->getRow();
        int img_num = m_ImageNum[row];
        
        for (int i=0; i<img_num; i++)
        {
            CommonUrlImageView* temImage = dynamic_cast<CommonUrlImageView*>(cell->getSubviewByTag(200 + i));
            if (temImage)
            {
                temImage->setUrl(m_ImageMsg[row].m_imageUrl[1 + i]);
            }
        }
    }
}
开发者ID:jtly1985,项目名称:CrossApp,代码行数:20,代码来源:CDNewsImageController.cpp

示例7: RemovePatternPoints

void CToolCervicales::RemovePatternPoints(CAVector& Vector){
	BOOL Removed;
	for (int k=Vector.GetSize()-1;k>=0;k--) {
		// for each existing point do
		Removed = FALSE;
		if (Vector.GetSize() <= 4) break;
		for (int m=0;m<Vector.GetSize();m++) {								
			for (int l=k+1;l<Vector.GetSize();l++){
				if (Vector.GetSize() <= 4) break;
				if ((k!=m)&&(k!=l)) {
					if ((Vector[k].x >= Vector[m].x)&&(Vector[k].y >= Vector[m].y)&&
						(Vector[k].x <= Vector[l].x)&&(Vector[k].y <= Vector[l].y)) {
						Vector.Remove(k);
						Removed = TRUE;
						break;
					}
					if ((Vector[k].x <= Vector[m].x)&&(Vector[k].y <= Vector[m].y)&&
						(Vector[k].x >= Vector[l].x)&&(Vector[k].y >= Vector[l].y)) {
						Vector.Remove(k);
						Removed = TRUE;
						break;
					}
					if ((Vector[k].x >= Vector[m].x)&&(Vector[k].y <= Vector[m].y)&&
						(Vector[k].x <= Vector[l].x)&&(Vector[k].y >= Vector[l].y)) {
						Vector.Remove(k);
						Removed = TRUE;
						break;
					}
					if ((Vector[k].x <= Vector[m].x)&&(Vector[k].y >= Vector[m].y)&&
						(Vector[k].x >= Vector[l].x)&&(Vector[k].y <= Vector[l].y)) {
						Vector.Remove(k);
						Removed = TRUE;
						break;
					}										
				}		
			}
			if (Removed) break;
		}			
	}
}
开发者ID:dblock,项目名称:rxcervicales,代码行数:40,代码来源:ToolCervicales.cpp

示例8: RemoveClosePoints

void CToolCervicales::RemoveClosePoints(CAVector& Vector, int Tol) {
	CAVector Hector;
	for (int j=0;j<Vector.GetSize();j++) {
		if (Vector.GetSize() <= 4) return;
		BOOL m_Add = TRUE;
		for (int k=0;k<Hector.GetSize();k++) {
			if (CAVector::Distance(Vector[j], Hector[k]) < Tol) {				
				Hector.Add(CPoint((Vector[j].x + Hector[k].x) / 2, (Vector[j].y + Hector[k].y) / 2));
				Hector.Remove(k);
				m_Add = FALSE;
				break;
			}
		}
		if (m_Add) Hector.Add(Vector[j]);
		if (Vector.GetSize() <= 4) break;
	}
	Vector = Hector;		
}
开发者ID:dblock,项目名称:rxcervicales,代码行数:18,代码来源:ToolCervicales.cpp

示例9: initWithViewControllers

bool CATabBarController::initWithViewControllers(const CAVector<CAViewController*>& viewControllers, CABarVerticalAlignment var)
{
    CAViewController::init();
    
    do
    {
        CC_BREAK_IF(viewControllers.size() == 0);
        m_pViewControllers = viewControllers;
        
        std::vector<CATabBarItem*> items;
        
        for (unsigned int i=0; i<m_pViewControllers.size(); i++)
        {
            CAViewController* view = m_pViewControllers.at(i);
            if (view->getTabBarItem() == NULL)
            {
                char title[8];
                sprintf(title, "item%d", i);
                CATabBarItem* item = CATabBarItem::create(title, NULL);
                item->setTag(i);
                view->setTabBarItem(item);
            }
            items.push_back(view->getTabBarItem());
            view->m_pTabBarController = this;
        }
        
        m_pTabBar = CATabBar::create(items);
        m_pTabBar->retain();
        m_pTabBar->setDelegate(this);
        
    }
    while (0);
    
    m_eTabBarVerticalAlignment = var;
    
    return true;
    
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:38,代码来源:CAViewController.cpp

示例10: sprintf

void CATabBarController::viewDidLoad()
{
    std::vector<CATabBarItem*> items;
    
    for (unsigned int i=0; i<m_pViewControllers.size(); i++)
    {
        CAViewController* view = m_pViewControllers.at(i);
        if (view->getTabBarItem() == NULL)
        {
            char title[8];
            sprintf(title, "item%d", i);
            CATabBarItem* item = CATabBarItem::create(title, NULL);
            item->setTag(i);
            view->setTabBarItem(item);
        }
        items.push_back(view->getTabBarItem());
        view->m_pTabBarController = this;
    }
    
    m_pTabBar = CATabBar::create(items, DSize(this->getView()->getBounds().size.width, 0), m_eTabBarVerticalAlignment);
    this->getView()->addSubview(m_pTabBar);
    m_pTabBar->setDelegate(this);
    
    DRect container_rect = this->getView()->getBounds();
    
    DPoint tab_bar_rectOrgin = DPointZero;
    if (m_bTabBarHidden)
    {
        tab_bar_rectOrgin = this->getTabBarTakeBackPoint();
    }
    else
    {
        tab_bar_rectOrgin = this->getTabBarOpenPoint();
        
        container_rect.size.height -= m_pTabBar->getFrame().size.height;
        if (m_eTabBarVerticalAlignment == CABarVerticalAlignmentTop)
        {
            container_rect.origin.y = m_pTabBar->getFrame().size.height;
        }
    }
    
    DSize container_view_size = container_rect.size;
    container_view_size.width *= m_pViewControllers.size();
    
    m_pContainer = CAPageView::createWithFrame(container_rect, CAPageViewDirectionHorizontal);
    m_pContainer->setBackgroundColor(CAColor_clear);
    m_pContainer->setPageViewDelegate(this);
    m_pContainer->setScrollViewDelegate(this);
    m_pContainer->setScrollEnabled(m_bScrollEnabled);
    m_pContainer->setDisplayRange(true);
    this->getView()->addSubview(m_pContainer);
    
    CAVector<CAView*> views;
    for (int i=0; i<m_pViewControllers.size(); i++)
    {
        CAView* view = new CAView();
        views.pushBack(view);
        view->release();
    }
    m_pContainer->setViews(views);
    
    if (m_pTabBarBackgroundImage)
    {
        m_pTabBar->setBackgroundImage(m_pTabBarBackgroundImage);
    }
    else
    {
        m_pTabBar->setBackgroundColor(m_sTabBarBackgroundColor);
    }
    
    
    if (m_pTabBarSelectedBackgroundImage)
    {
        m_pTabBar->setSelectedBackgroundImage(m_pTabBarSelectedBackgroundImage);
    }
    else
    {
        m_pTabBar->setSelectedBackgroundColor(m_sTabBarSelectedBackgroundColor);
    }
    
    
    if (m_pTabBarSelectedIndicatorImage)
    {
        m_pTabBar->setSelectedIndicatorImage(m_pTabBarSelectedIndicatorImage);
    }
    else
    {
        m_pTabBar->setSelectedIndicatorColor(m_sTabBarSelectedIndicatorColor);
    }
    
    
    m_pTabBar->setTitleColorForNormal(m_sTabBarTitleColor);
    m_pTabBar->setTitleColorForSelected(m_sTabBarSelectedTitleColor);
    
    if (m_bShowTabBarSelectedIndicator)
    {
        m_pTabBar->showSelectedIndicator();
    }
    
    m_pTabBar->setFrameOrigin(tab_bar_rectOrgin);
//.........这里部分代码省略.........
开发者ID:wjm0729,项目名称:CrossApp,代码行数:101,代码来源:CAViewController.cpp

示例11: init

bool RootWindow::init()
{
    if (!CAWindow::init())
    {
        return false;
    }
    CAApplication::getApplication()->setNotificationView(CAView::createWithFrame(this->getBounds(), CAColor_green));

    CAVector<CAViewController*> controllerVec;
	m_home = new MainViewController();
    if (m_home) {
        m_home->setTabBarItem(CATabBarItem::create(unicode_to_utf8(mainBar[0]), CAImage::create("main/bar_0.png"),CAImage::create("main/bar_pre_0.png")));
        m_home->init();
        m_home->autorelease();
        controllerVec.pushBack(m_home);
    }
    
    m_session = new SessionsViewController();
    if (m_session) {
        m_session->init();
        m_session->autorelease();
        m_session->setTabBarItem(CATabBarItem::create(unicode_to_utf8(mainBar[1]), CAImage::create("main/bar_1.png"),CAImage::create("main/bar_pre_1.png")));
        controllerVec.pushBack(m_session);
    }
    
    m_my = new MyStatusViewController();
    if (m_my) {
        m_my->setTabBarItem(CATabBarItem::create(unicode_to_utf8(mainBar[2]), CAImage::create("main/bar_2.png"),CAImage::create("main/bar_pre_2.png")));
        m_my->init();
        m_my->autorelease();
        controllerVec.pushBack(m_my);
    }    
    
    CATabBarController* tabBarController = new CATabBarController();
    tabBarController->initWithViewControllers(controllerVec);
    tabBarController->setTabBarSelectedBackgroundColor(CAColor_clear);
    tabBarController->setTabBarTitleColorForSelected(CAColor_white);

    tabBarController->setTabBarBackgroundImage(CAImage::create("common/sky_bg.png"));
    /*
    CANavigationBarItem* temp_nav = CANavigationBarItem::create("");
    temp_nav->setNagigationBarHidden(true);
	tabBarController->setScrollEnabled(false);
    tabBarController->setNavigationBarItem(temp_nav);
    tabBarController->setTabBarTitleColorForSelected(CAColor_white);
    tabBarController->autorelease();
*/
	m_pRootNavigationController = new CANavigationController();
	m_pRootNavigationController->initWithRootViewController(tabBarController);
	m_pRootNavigationController->setNavigationBarBackgroundImage(CAImage::create("common/sky_bg.png"));
	m_pRootNavigationController->setNavigationBarHidden(true, false);
    m_pRootNavigationController->setScrollEnabled(false);

    FUser user = FUserManager::sharedFUserManager()->onLineUser();
	if (user.loginname.length() == 0)
	{
		LoginViewController* _viewController = new LoginViewController();
		_viewController->init();
		this->setRootViewController(_viewController);
		_viewController->release();
	}
	else
	{
        FDataManager::getInstance()->setUserId(user.uid);
		this->setRootViewController(m_pRootNavigationController);
	}

	CAApplication::getApplication()->setNotificationView(NULL);
    
    return true;
}
开发者ID:DreamCastleShanghai,项目名称:client_new,代码行数:71,代码来源:RootWindow.cpp

示例12: swap

void CABatchView::updateAtlasIndex(CAView* view, int* curIndex)
{
    const CAVector<CAView*> pVector = view->getSubviews();
    unsigned int count = (unsigned int)pVector.size();

    int oldIndex = 0;

    if( count == 0 )
    {
        oldIndex = view->getAtlasIndex();
        view->setAtlasIndex(*curIndex);
        view->setOrderOfArrival(0);
        if (oldIndex != *curIndex)
        {
            swap(oldIndex, *curIndex);
        }
        (*curIndex)++;
    }
    else
    {
        bool needNewIndex = true;

        if (pVector.front()->getZOrder() >= 0)
        {
            oldIndex = view->getAtlasIndex();
            view->setAtlasIndex(*curIndex);
            view->setOrderOfArrival(0);
            if (oldIndex != *curIndex)
            {
                swap(oldIndex, *curIndex);
            }
            (*curIndex)++;
            
            needNewIndex = false;
        }
        
        CAVector<CAView*>::const_iterator itr;
        for (itr=pVector.begin(); itr!=pVector.end(); itr++)
        {
            CAView* subview = *itr;
            if (needNewIndex && subview->getZOrder() >= 0)
            {
                oldIndex = view->getAtlasIndex();
                view->setAtlasIndex(*curIndex);
                view->setOrderOfArrival(0);
                if (oldIndex != *curIndex)
                {
                    this->swap(oldIndex, *curIndex);
                }
                (*curIndex)++;
                needNewIndex = false;
                
            }
            
            updateAtlasIndex(subview, curIndex);
        }

        if (needNewIndex)
        {
            oldIndex = view->getAtlasIndex();
            view->setAtlasIndex(*curIndex);
            view->setOrderOfArrival(0);
            if (oldIndex!=*curIndex)
            {
                swap(oldIndex, *curIndex);
            }
            (*curIndex)++;
        }
    }
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:70,代码来源:CABatchView.cpp

示例13: initNewsImageView

void CDShowNewsImage::initNewsImageView(newsImage _image)
{
    m_image = _image;
    CAVector<CAView* > viewList;

    for (int i=0; i<m_image.m_imageUrl.size(); i++) {
        //初始化viewList
        CommonUrlImageView* temImage = CommonUrlImageView::createWithFrame(DRect(0,0,winSize.width,winSize.height));
        temImage->setImageViewScaleType(CAImageViewScaleTypeFitImageInside);
        temImage->setImage(CAImage::create("HelloWorld.png"));
        temImage->setUrl(m_image.m_imageUrl[i]);
        
        CAScrollView* p_ScrollView = CAScrollView::createWithFrame(DRect(0,0,winSize.width,winSize.height));
        p_ScrollView->setMinimumZoomScale(1.0f);
        p_ScrollView->setMaximumZoomScale(2.5f);
        p_ScrollView->setMultitouchGesture(CAScrollView::MultitouchGesture::Zoom);
        p_ScrollView->setBackgroundColor(CAColor_clear);
        p_ScrollView->setShowsScrollIndicators(false);
        p_ScrollView->setBounceVertical(false);
        p_ScrollView->setScrollViewDelegate(this);
        p_ScrollView->addSubview(temImage);
        viewList.pushBack(p_ScrollView);
    }
    p_PageView = CAPageView::createWithFrame(DRect(0, 30, winSize.width, winSize.height), CAPageViewDirectionHorizontal);
    p_PageView->setViews(viewList);
    p_PageView->setPageViewDelegate(this);
    p_PageView->setBackgroundColor(CAColor_black);
    p_PageView->setPageViewDelegate(this);
    this->getView()->addSubview(p_PageView);
    
    p_bg = CAView::createWithColor(ccc4(0,0,0,200));
    p_bg->setFrame(DRect(0,winSize.height/3*2,winSize.width,winSize.height/2));
    this->getView()->addSubview(p_bg);

    p_title = CALabel::createWithFrame(DRect(10,10,winSize.width-80,40));
    p_title->setText(m_image.m_title);
	p_title->setColor(CAColor_white);
    p_title->setFontSize(34);
    p_title->setBold(true);
    p_bg->addSubview(p_title);
    
    char temp[10];
    sprintf(temp, "1/%lu",m_image.m_imageUrl.size());
    p_index = CALabel::createWithFrame(DRect(winSize.width-60,10,80,30));
    p_index->setText(temp);
	p_index->setColor(CAColor_white);
    p_index->setFontSize(30);
    p_index->setBold(true);
    p_bg->addSubview(p_index);
    
    p_des = CALabel::createWithFrame(DRect(10,0,winSize.width-20,200));
    p_des->setText(m_image.m_imageDesc[4]);
	p_des->setColor(ccc4(200, 200, 200, 255));
    p_des->setFontSize(26);
    
    CAScrollView* ps = CAScrollView::createWithFrame(DRect(0,70,winSize.width,200));
    ps->setBackgroundColor(CAColor_clear);
    ps->setShowsVerticalScrollIndicator(false);
    ps->setShowsHorizontalScrollIndicator(false);
    ps->setBounceHorizontal(false);
    ps->addSubview(p_des);
    p_bg->addSubview(ps);

}
开发者ID:jtly1985,项目名称:CrossApp,代码行数:64,代码来源:CDShowNewsImage.cpp

示例14: setItems

void CATabBar::setItems(const CAVector<CATabBarItem*>& items)
{
    CC_RETURN_IF(items.empty());
	m_pItems = items;
}
开发者ID:nightdomain,项目名称:CrossApp,代码行数:5,代码来源:CABar.cpp

示例15: viewDidLoad

void CATabBarController::viewDidLoad()
{
    CCPoint tab_bar_rectOrgin = CCPointZero;
    
    CCRect container_rect = this->getView()->getBounds();
    
    CCSize container_view_size = container_rect.size;
    container_view_size.width *= m_pViewControllers.size();
    
    if (m_bTabBarHidden)
    {
        tab_bar_rectOrgin = this->getTabBarTakeBackPoint();
    }
    else
    {
        tab_bar_rectOrgin = this->getTabBarOpenPoint();
        
        container_rect.size.height -= m_pTabBar->getFrame().size.height;
        if (m_eTabBarVerticalAlignment == CABarVerticalAlignmentTop)
        {
            container_rect.origin.y = m_pTabBar->getFrame().size.height;
        }
    }
    
    m_pContainer = CAPageView::createWithFrame(container_rect, CAPageView::CAPageViewDirectionHorizontal);
    m_pContainer->setBackGroundColor(CAColor_clear);
    m_pContainer->setPageViewDelegate(this);
    m_pContainer->setScrollViewDelegate(this);
    m_pContainer->setScrollEnabled(m_bscrollEnabled);
    m_pContainer->setDisplayRange(true);
    this->getView()->addSubview(m_pContainer);
    
    CAVector<CAView*> views;
    for (int i=0; i<m_pViewControllers.size(); i++)
    {
        CAView* view = new CAView();
        views.pushBack(view);
        view->release();
    }
    m_pContainer->setViews(views);
    
    if (m_pTabBarBackGroundImage)
    {
        m_pTabBar->setBackGroundImage(m_pTabBarBackGroundImage);
    }
    else
    {
        m_pTabBar->setBackGroundColor(m_sTabBarBackGroundColor);
    }
    
    
    if (m_pTabBarSelectedBackGroundImage)
    {
        m_pTabBar->setSelectedBackGroundImage(m_pTabBarSelectedBackGroundImage);
    }
    else
    {
        m_pTabBar->setSelectedBackGroundColor(m_sTabBarSelectedBackGroundColor);
    }
    
    
    if (m_pTabBarSelectedIndicatorImage)
    {
        m_pTabBar->setSelectedIndicatorImage(m_pTabBarSelectedIndicatorImage);
    }
    else
    {
        m_pTabBar->setSelectedIndicatorColor(m_sTabBarSelectedBackGroundColor);
    }
    
    
    m_pTabBar->setTitleColorForNormal(m_sTabBarTitleColor);
    m_pTabBar->setTitleColorForSelected(m_sTabBarSelectedTitleColor);
    
    if (m_bShowTabBarSelectedIndicator)
    {
        m_pTabBar->showSelectedIndicator();
    }
    
    m_pTabBar->setFrameOrigin(tab_bar_rectOrgin);
    this->getView()->addSubview(m_pTabBar);
    
    m_pTabBar->setSelectedAtIndex(m_nSelectedIndex);
    this->renderingSelectedViewController();
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:85,代码来源:CAViewController.cpp


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