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


C++ CAButton::setBackGroundViewForState方法代码示例

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


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

示例1: buttonBackground

void ButtonTest::buttonBackground()
{
	CALabel* buttonImage = CALabel::createWithCenter(CCRect(size.width*0.5, size.height*0.3, size.width*0.4, 50));
	buttonImage->setText("ButtonImage");
	buttonImage->setFontSize(30 * CROSSAPP_ADPTATION_RATIO);
	buttonImage->setTextAlignment(CATextAlignmentCenter);
	buttonImage->setColor(ccc4(51, 204, 255, 255));
	this->getView()->addSubview(buttonImage);

	CAButton* defaultBtn = CAButton::create(CAButtonTypeCustom);
	defaultBtn->setCenter(CCRect(size.width*0.25 - 50, size.height*0.4, size.width*0.2, size.height*0.05));
	defaultBtn->setTitleForState(CAControlStateNormal, "Normal");
	defaultBtn->setTitleForState(CAControlStateSelected,"Selected");
	defaultBtn->setTitleForState(CAControlStateHighlighted, "Highlighted");
	defaultBtn->setBackGroundViewForState(CAControlStateNormal,CAView::createWithColor(CAColor_green));
	defaultBtn->setBackGroundViewForState(CAControlStateHighlighted, CAView::createWithColor(CAColor_yellow));
	defaultBtn->setTitleColorForState(CAControlStateAll, ccc4(51, 204, 255, 255));
	this->getView()->addSubview(defaultBtn);

	CALabel* custom = CALabel::createWithCenter(CCRect(size.width*0.25 - 50, size.height*0.4 + 80, size.width*0.2, 50));
	custom->setText("(BackgroundView)");
	custom->setFontSize(20 * CROSSAPP_ADPTATION_RATIO);
	custom->setTextAlignment(CATextAlignmentCenter);
	custom->setColor(ccc4(51, 204, 255, 255));
	this->getView()->addSubview(custom);


	CAButton* squareRectBtn = CAButton::create(CAButtonTypeSquareRect);
	squareRectBtn->setCenter(CCRect(size.width*0.5, size.height*0.4, size.width*0.2, size.height*0.05));
	squareRectBtn->setImageForState(CAControlStateNormal,CAImage::create("square_nor.png"));
	squareRectBtn->setImageForState(CAControlStateHighlighted, CAImage::create("square_sel.png"));
	this->getView()->addSubview(squareRectBtn);

	CALabel* square = CALabel::createWithCenter(CCRect(size.width*0.5, size.height*0.4 + 80, size.width*0.2, 50));
	square->setText("(StateImage)");
	square->setFontSize(20 * CROSSAPP_ADPTATION_RATIO);
	square->setTextAlignment(CATextAlignmentCenter);
	square->setColor(ccc4(51, 204, 255, 255));
	this->getView()->addSubview(square);

	CAButton* roundedRectBtn = CAButton::create(CAButtonTypeRoundedRect);
	roundedRectBtn->setCenter(CCRect(size.width*0.75 + 50, size.height*0.4, size.width*0.2, size.height*0.05));
	roundedRectBtn->setControlState(CAControlStateDisabled);
	this->getView()->addSubview(roundedRectBtn);

	CALabel* rounded = CALabel::createWithCenter(CCRect(size.width*0.75 + 50, size.height*0.4 + 80, size.width*0.2, 50));
	rounded->setText("(Disabled)");
	rounded->setFontSize(20 * CROSSAPP_ADPTATION_RATIO);
	rounded->setTextAlignment(CATextAlignmentCenter);
	rounded->setColor(ccc4(51, 204, 255, 255));
	this->getView()->addSubview(rounded);
}
开发者ID:AojiaoZero,项目名称:CrossApp,代码行数:52,代码来源:ButtonTest.cpp

示例2: viewDidLoad

void SessionsViewController::viewDidLoad()
{
    // Do any additional setup after loading the view from its nib.
    m_winSize = this->getView()->getBounds().size;
    
    CAScale9ImageView* sView = CAScale9ImageView::createWithImage(CAImage::create("common/sky_bg.png"));
    sView->setFrame(DRect(_px(0), _px(0), m_winSize.width, _px(120)));
    this->getView()->addSubview(sView);
    
    CAButton* button = CAButton::createWithFrame(DRect(_px(20), _px(20), _px(100), _px(100)), CAButtonTypeCustom);
    CAImageView* imageView = CAImageView::createWithImage(CAImage::create("main/nav_notification.png"));
    imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
    button->setBackGroundViewForState(CAControlStateAll, imageView);
    button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
    button->setTag(20);
    this->getView()->addSubview(button);
    
    m_timeNoticeImageView = CAImageView::createWithFrame(DRect(_px(60), _px(30), _px(10), _px(10)));
    m_timeNoticeImageView->setImage(CAImage::create("common/reddot.png"));
    button->addSubview(m_timeNoticeImageView);
    
    button = CAButton::createWithFrame(DRect(m_winSize.width - _px(120), _px(20), _px(100), _px(100)), CAButtonTypeCustom);
    imageView = CAImageView::createWithImage(CAImage::create("main/nav_prize.png"));
    imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
    button->setBackGroundViewForState(CAControlStateAll, imageView);
    button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
    button->setTag(30);
    this->getView()->addSubview(button);
    
    CALabel* label = CALabel::createWithCenter(DRect(m_winSize.width / 2, _px(70), m_winSize.width, _px(40)));
    label->setTextAlignment(CATextAlignmentCenter);
    label->setColor(CAColor_white);
    label->setFontSize(_px(40));
    label->setText("Agenda");
    label->setFontName("fonts/arial.ttf");
    sView->addSubview(label);

    if (m_msg.empty())
    {
        requestMsg();
    }
    else
    {
        this->initMsgTableView();
    }
    
    CCLog("%f", CAApplication::getApplication()->getWinSize().width);
}
开发者ID:DreamCastleShanghai,项目名称:client_new,代码行数:48,代码来源:VoteViewController.cpp

示例3: show

void CATextToolBarView::show(CAView* pView)
{
	CCSize winSize = CAApplication::getApplication()->getWinSize();

	float alertViewButtonHeight = 88;
	float alertViewWidth = winSize.width * 2 / 3;

	CCRect rect = CCRect(winSize.width / 2, winSize.height / 2 - alertViewButtonHeight, alertViewWidth, alertViewButtonHeight);

	m_pBackView = CAClippingView::create();
	m_pBackView->setCenter(rect);
	this->addSubview(m_pBackView);
	this->setTextTag("CATextToolBarView");
	m_pBackView->setAlphaThreshold(0.5f);

	CAScale9ImageView *backgroundImageView = CAScale9ImageView::createWithFrame(m_pBackView->getBounds());
	backgroundImageView->setImage(CAImage::create("source_material/alert_back.png"));
	m_pBackView->addSubview(backgroundImageView);
	m_pBackView->setStencil(backgroundImageView->copy());

	size_t btnCount = m_CallbackTargets.size();

	for (int i = 0; i < btnCount; i++) 
	{
		CAButton* btn = CAButton::create(CAButtonTypeSquareRect);
		btn->setTitleForState(CAControlStateAll, m_CallbackTargets[i].cszButtonText.c_str());
		btn->setTitleColorForState(CAControlStateAll, ccc4(3, 100, 255, 255));
		btn->setBackGroundViewForState(CAControlStateNormal, CAView::createWithColor(CAColor_clear));
		btn->setBackGroundViewForState(CAControlStateHighlighted, CAView::createWithColor(ccc4(226, 226, 226, 225)));
		btn->setTag(i);
		btn->addTarget(this, CAControl_selector(CATextToolBarView::alertViewCallback), CAControlEventTouchUpInSide);
		btn->setFrame(CCRect(i*alertViewWidth / btnCount, 0, alertViewWidth / btnCount, alertViewButtonHeight));
		m_pBackView->addSubview(btn);

		if (i>0)
		{
            addGrayLine(alertViewWidth/btnCount * i);
		}
	}

	if (CAWindow *rootWindow = CAApplication::getApplication()->getRootWindow())
	{
		rootWindow->insertSubview(this, CAWindowZOderTop);
	}
	becomeFirstResponder();
    m_pControlView = pView;
}
开发者ID:garyyyy,项目名称:CrossApp,代码行数:47,代码来源:CATextEditHelper.cpp

示例4: createDefaultSegment

CAButton* CASegmentedControl::createDefaultSegment()
{
    CCRect elemFrame = CCRectMake(0, 0, m_itemSize.width, m_itemSize.height);
    
    CAButton *newBtn = CAButton::createWithFrame(elemFrame, CAButtonTypeCustom);
    if (newBtn)
    {
        CAView* normalBG = this->getDefaultNormalBackgroundView();
        CAView* selectedBG = this->getDefaultSelectedBackgroundView();
        CAView* highlightedBG = this->getDefaultHighlightedBackgroundView();
        newBtn->setBackGroundViewForState(CAControlStateNormal, normalBG);
        newBtn->setBackGroundViewForState(CAControlStateSelected, selectedBG);
        newBtn->setBackGroundViewForState(CAControlStateHighlighted, highlightedBG);
        newBtn->setAllowsSelected(true);
        newBtn->setTouchEnabled(false);
    }
    return newBtn;
}
开发者ID:13609594236,项目名称:CrossApp,代码行数:18,代码来源:CASegmentedControl.cpp

示例5: changeButtonView

void registerViewController::changeButtonView(CAControl*control, CCPoint){
	                    
	CAView* _view2 = CAScale9ImageView::createWithImage(CAImage::create("image/bg1.png"));
	CAView* _view3 = CAScale9ImageView::createWithImage(CAImage::create("image/bg1R.png"));
	   CAButton*  btn = dynamic_cast<CAButton*>(control);
	   if (btn->getTag() ==99)
	   {
		   btn->setBackGroundViewForState(CAControlStateAll, _view2);
		  // authCodeButton->setBackGroundViewForState(CAControlStateDisabled, CAView::createWithColor(CAColor_gray));
		   btn->setTag(100);
	   }
	   else if (btn->getTag() == 100)
	   {
		   btn->setBackGroundViewForState(CAControlStateAll, _view3);
		 //  authCodeButton->setBackGroundViewForState(CAControlStateNormal, CAView::createWithColor(CAColor_blue));
		   btn->setTag(99);
	   }
	   
}
开发者ID:a752602882,项目名称:DotaMax,代码行数:19,代码来源:registerViewController.cpp

示例6: initWithCollectionView

void DMCatalogController::initWithCollectionView()
{
    CADipRect rect = this->getView()->getBounds();
    m_uiItems = (unsigned int)(rect.size.width / 300);
    m_uiItems = MIN(m_uiItems, 5);
    m_uiItems = MAX(m_uiItems, 3);
    
    m_pCollectionView = CACollectionView::createWithFrame(rect);
    m_pCollectionView->setCollectionViewDataSource(this);
    m_pCollectionView->setCollectionViewDelegate(this);
    m_pCollectionView->setScrollViewDelegate(this);
    CAPullToRefreshView* view = CAPullToRefreshView::create(CAPullToRefreshView::CAPullToRefreshTypeHeader);
    m_pCollectionView->setHeaderRefreshView(view);
    m_pCollectionView->setBackGroundColor(CAColor_clear);
    this->getView()->addSubview(m_pCollectionView);
    m_pCollectionView->setAllowsSelection(true);
    m_pCollectionView->setHoriInterval(_px(30));
    m_pCollectionView->setVertInterval(_px(10));
    
    float width = this->getView()->getBounds().size.width;
    m_pCollectionView->setCollectionHeaderHeight(width * 15/32.0f);
    
    CAButton* bg = CAButton::createWithFrame(CADipRect(0, 0, rect.size.width, _dip(m_pCollectionView->getCollectionHeaderHeight())), CAButtonTypeCustom);
    m_pHeaderImageView = CommonUrlImageView::createWithImage(NULL);
    bg->setBackGroundViewForState(CAControlStateNormal, m_pHeaderImageView);
    bg->addTarget(this, CAControl_selector(DMCatalogController::onButton), CAControlEventTouchUpInSide);
    m_pCollectionView->setCollectionHeaderView(bg);
    
    CADipRect headerRect = CADipRectZero;
    headerRect.size = rect.size;
    headerRect.size.height = 76;
    headerRect.origin.y = _dip(m_pCollectionView->getCollectionHeaderHeight()) - 76;
    CAImageView* imageView = CAImageView::createWithFrame(headerRect);
    imageView->setImage(CAImage::create(title_bg_first));
    bg->insertSubview(imageView,1);
    
    headerRect.origin.x = 25;
    headerRect.size.height -= 20;
    headerRect.size.width -= headerRect.origin.x;
    headerRect.origin.y = _dip(m_pCollectionView->getCollectionHeaderHeight()) - headerRect.size.height;
    m_pHeaderLabel = CALabel::createWithFrame(headerRect);
    m_pHeaderLabel->setFontSize(_px(28));
    m_pHeaderLabel->setColor(CAColor_white);
    m_pHeaderLabel->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
    bg->insertSubview(m_pHeaderLabel,1);
    
    if (!m_mvData[m_sTitle].empty())
    {
        const DMBriefInfo& info = m_mvData[m_sTitle].front();
        m_pHeaderLabel->setText("《" + info.title + "》" + info.subtitle);
        m_pHeaderImageView->setUrl(info.cover);
    }
}
开发者ID:9miao,项目名称:CartoonHouse,代码行数:53,代码来源:DMCatalogController.cpp

示例7: showSelectedBackGround

void CATabBar::showSelectedBackGround()
{
    for (size_t i=0; i<m_pButtons.size(); i++)
    {
        CAButton* btn = m_pButtons.at(i);
        btn->setTitleForState(CAControlStateAll, m_pItems.at(i)->getTitle());
        btn->setTitleColorForState(CAControlStateAll, m_sTitleColor);
        btn->setTitleColorForState(CAControlStateHighlighted, m_sSelectedTitleColor);
        btn->setTitleColorForState(CAControlStateSelected, m_sSelectedTitleColor);
        btn->setImageForState(CAControlStateNormal, m_pItems.at(i)->getImage());
        CAImage* selectedImage = m_pItems.at(i)->getSelectedImage()
        ? m_pItems.at(i)->getSelectedImage()
        : m_pItems.at(i)->getImage();
        btn->setImageForState(CAControlStateHighlighted, selectedImage);
        btn->setImageForState(CAControlStateSelected, selectedImage);
        btn->setBackGroundViewForState(CAControlStateNormal, CAView::createWithColor(CAColor_clear));
        if (m_pSelectedBackGroundImage)
        {
            btn->setBackGroundViewForState(CAControlStateHighlighted,
                                           CAScale9ImageView::createWithImage(m_pSelectedBackGroundImage));
            btn->setBackGroundViewForState(CAControlStateSelected,
                                           CAScale9ImageView::createWithImage(m_pSelectedBackGroundImage));
        }
        else
        {
            btn->setBackGroundViewForState(CAControlStateHighlighted,
                                           CAView::createWithColor(m_sSelectedBackGroundColor));
            btn->setBackGroundViewForState(CAControlStateSelected,
                                           CAView::createWithColor(m_sSelectedBackGroundColor));
        }
        btn->setAllowsSelected(true);
        
        CABadgeView* badgeView = m_pBadgeViews.at(i);
        badgeView->setBadgeText(m_pItems.at(i)->getBadgeValue());
    }
}
开发者ID:nightdomain,项目名称:CrossApp,代码行数:36,代码来源:CABar.cpp

示例8: setBackgroundImageAtIndex

bool CASegmentedControl::setBackgroundImageAtIndex(CAImage *image, int index, CAControlState controlState)
{
    if (!this->indexIsValid(index))
    {
        return false;
    }
    
    CAButton *btn = m_segments.at(index);
    if (NULL == btn)
    {
        return false;
    }
    btn->setBackGroundViewForState(controlState, CAScale9ImageView::createWithImage(image));
    
    return true;
}
开发者ID:13609594236,项目名称:CrossApp,代码行数:16,代码来源:CASegmentedControl.cpp

示例9: setBackgroundViewAtIndex

bool CASegmentedControl::setBackgroundViewAtIndex(CAView *view, int index, const CAControlState& controlState)
{
    if (!this->indexIsValid(index))
    {
        return false;
    }
    
    CAButton *btn = m_segments.at(index);
    if (NULL == btn)
    {
        return false;
    }
    btn->setBackGroundViewForState(controlState, view);
    
    return true;
}
开发者ID:dlpc,项目名称:CrossApp,代码行数:16,代码来源:CASegmentedControl.cpp

示例10: buttonTouchEvent

void ButtonTest::buttonTouchEvent(void)
{
	CADipSize size = eventView->getBounds().size;

	CALabel* buttonTouch = CALabel::createWithCenter(CADipRect(size.width*0.5, size.height*0.2, size.width*0.4, 50));
	buttonTouch->setText("TouchEvent");
	buttonTouch->setFontSize(_px(35));
	buttonTouch->setTextAlignment(CATextAlignmentCenter);
	buttonTouch->setColor(CAColor_blueStyle);
	eventView->addSubview(buttonTouch);

	CAButton* btnOne = CAButton::create(CAButtonTypeCustom);
	btnOne->setCenter(CADipRect(size.width*0.25 - 50, size.height*0.5, size.width*0.25, size.height*0.1));
	btnOne->setTag(BUTTONONE);
	btnOne->setTitleForState(CAControlStateAll, "TouchDown");
	btnOne->setTitleColorForState(CAControlStateNormal, CAColor_blueStyle);
	btnOne->setBackGroundViewForState(CAControlStateNormal, CAScale9ImageView::createWithImage(CAImage::create("source_material/round1.png")));
	btnOne->setBackGroundViewForState(CAControlStateHighlighted, CAScale9ImageView::createWithImage(CAImage::create("source_material/round2.png")));
	btnOne->addTarget(this, CAControl_selector(ButtonTest::buttonCallback), CAControlEventTouchDown);
	eventView->addSubview(btnOne);

	CAButton* btnTwo = CAButton::create(CAButtonTypeSquareRect);
	btnTwo->setCenter(CADipRect(size.width*0.5, size.height*0.5, size.width*0.25, size.height*0.1));
	btnTwo->setTag(BUTTONTWO);
	btnTwo->setTitleForState(CAControlStateAll, "TouchMoved");
	btnTwo->setTitleColorForState(CAControlStateNormal,CAColor_white);
	btnTwo->setBackGroundViewForState(CAControlStateNormal, CAScale9ImageView::createWithImage(CAImage::create("source_material/btn_square_highlighted.png")));
	btnTwo->setBackGroundViewForState(CAControlStateHighlighted, CAScale9ImageView::createWithImage(CAImage::create("source_material/btn_square_selected.png")));
	btnTwo->addTarget(this, CAControl_selector(ButtonTest::buttonCallback), CAControlEventTouchMoved);
	eventView->addSubview(btnTwo);

	CAButton* btnThree = CAButton::create(CAButtonTypeRoundedRect);
	btnThree->setCenter(CADipRect(size.width*0.75 + 50, size.height*0.5, size.width*0.25, size.height*0.1));
	btnThree->setTag(BUTTONTHREE);
	btnThree->setTitleForState(CAControlStateAll, "TouchUpInSide");
	btnThree->setTitleColorForState(CAControlStateNormal, CAColor_white);
	btnThree->setBackGroundViewForState(CAControlStateNormal, CAScale9ImageView::createWithImage(CAImage::create("source_material/btn_rounded3D_highlighted.png")));
	btnThree->setBackGroundViewForState(CAControlStateHighlighted, CAScale9ImageView::createWithImage(CAImage::create("source_material/btn_rounded3D_selected.png")));
	btnThree->addTarget(this, CAControl_selector(ButtonTest::buttonCallback), CAControlEventTouchUpInSide);
	eventView->addSubview(btnThree);

	descTest = CALabel::createWithCenter(CADipRect(size.width*0.5, size.height*0.8, size.width, 50));
	descTest->setText("Display coordinates");
	descTest->setFontSize(_px(30));
	descTest->setColor(CAColor_blueStyle);
	descTest->setTextAlignment(CATextAlignmentCenter);
	eventView->addSubview(descTest);
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:48,代码来源:ButtonTest.cpp

示例11: addButton

CCObject* CAUIHelper::addButton(CSJson::Value jsonValue, cocos2d::CCRect &uiRect)
{
    CAButton *btn = CAButton::createWithFrame(uiRect, CAButtonTypeRoundedRect);
    int tag = jsonValue["tag"].asInt();
//    bool isEffect = jsonValue["isEffect"].asBool();
//    bool isClick = jsonValue["isClick"].asBool();
//    bool isTouchSuspend = jsonValue["isTouchSuspend"].asBool();
    CAControlState  btnState = (CAControlState)jsonValue["btnState"].asInt();

    int alpha = jsonValue["alpha"].asInt();
    std::string imageRes = jsonValue["backgroundImage"].asString();
    mCAButtonType btntype = (mCAButtonType)jsonValue["btnType"].asInt();
    
    btn->setTag(tag);
    btn->setOpacity(alpha);
    btn->setControlState(btnState);
    if (btntype == ButtonColor)
    {
        
    }
    else if (btntype == ButtonGrid9)
    {
        CAScale9ImageView *image = CAScale9ImageView::createWithImage(CAImage::create(imageRes.c_str()));
    
        btn->setBackGroundViewForState(CAControlStateNormal, image);
        
    }
    else if (btntype == ButtonImage)
    {
        
    }
    else if (btntype == ButtonNone)
    {

    }
    return btn;
    
    
}
开发者ID:DeltaYang,项目名称:CrossApp,代码行数:39,代码来源:CAUIHelper.cpp

示例12: insertSegmentWithBackgroundImage

bool CASegmentedControl::insertSegmentWithBackgroundImage(CAImage *image, int index, CAControlState controlState)
{
    const int curItemCount = m_segments.size();
    if (index < 0)
    {
        index = 0;
    }
    else if (index >= curItemCount)
    {
        index = curItemCount;
    }
    
    CAButton *newBtn = this->createDefaultSegment();
    if (NULL == newBtn)
    {
        return false;
    }
    
    newBtn->setBackGroundViewForState(controlState, CAScale9ImageView::createWithImage(image));
    m_segments.insert(m_segments.begin() + index, newBtn);
    this->addSubview(newBtn);
    this->layoutSubviews();
    return true;
}
开发者ID:13609594236,项目名称:CrossApp,代码行数:24,代码来源:CASegmentedControl.cpp

示例13: viewDidLoad

void MainViewController::viewDidLoad()
{
    // Do any additional setup after loading the view from its nib.
    m_winSize = this->getView()->getBounds().size;
    
    // header
    CAScale9ImageView* header = CAScale9ImageView::createWithImage(CAImage::create("common/sky_bg.png"));
    if (header) {
        header->setFrame(DRect((0), (0), m_winSize.width, (120)));
        header->setTouchEnabled(false);
        this->getView()->addSubview(header);
        
        // title lable
        CALabel* label = CALabel::createWithCenter(DRect(m_winSize.width / 2, (80), m_winSize.width, (50)));
        if (label) {
            label->setTextAlignment(CATextAlignmentCenter);
            label->setColor(CAColor_white);
            label->setFontSize(SAP_TITLE_FONT_SIZE);
            label->setText("SAP d-kom");
            label->setFontName(SAP_FONT_ARIAL);
            label->setTouchEnabled(false);
            header->addSubview(label);
        }
    }

    // left notification button
    CAButton* button = CAButton::createWithFrame(DRect((0), (20), (100), (100)), CAButtonTypeCustom);
    if (button) {
        button->addTarget(this, CAControl_selector(MainViewController::buttonCallBack), CAControlEventTouchUpInSide);
        button->setTag(20);
        this->getView()->addSubview(button);
        
        CAImageView* imageView = CAImageView::createWithImage(CAImage::create("main/nav_notification.png"));
        if (imageView) {
            imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
            button->setBackGroundViewForState(CAControlStateAll, imageView);
        }
        
        m_timeNoticeImageView = CAImageView::createWithFrame(DRect((60), (30), (20), (20)));
        if (m_timeNoticeImageView) {
            m_timeNoticeImageView->setImage(CAImage::create("common/reddot.png"));
            button->addSubview(m_timeNoticeImageView);
        }
        //refreshNoticeRedPoint();
    }
    
    // notification alert point

    /*
    // right survey button
	button = CAButton::createWithFrame(DRect(m_winSize.width - (100), (20), (100), (100)), CAButtonTypeCustom);
    if (button) {
        button->addTarget(this, CAControl_selector(MainViewController::buttonCallBack), CAControlEventTouchUpInSide);
        button->setTag(30);
        this->getView()->addSubview(button);
        
        CAImageView* imageView = CAImageView::createWithImage(CAImage::create("main/nav_survey.png"));
        if (imageView) {
            imageView->setImageViewScaleType(CAImageViewScaleTypeFitImageXY);
            button->setBackgroundViewForState(CAControlStateAll, imageView);
        }
    }
    
    // survey lable
    CALabel * surveylable = CALabel::createWithFrame(DRect(m_winSize.width - (75), (100), (100), (25)));
    if (surveylable) {
        surveylable->setTextAlignment(CATextAlignmentLeft);
        surveylable->setColor(CAColor_white);
        surveylable->setFontSize(15);
        surveylable->setText("Survey");
        surveylable->setFontName(SAP_FONT_ARIAL);
        surveylable->setTouchEnabled(false);
        this->getView()->addSubview(surveylable);
    }
     */
	
    int pageViewHeight = m_winSize.height * 0.3;
    int butViewHeight = m_winSize.height * 0.15;
    int headerHeight = (120);
    int buttitleHeight = (40);
    
    /*
    // Page view
    if (!m_pageView)
    {
        m_pageView = CAPageView::createWithFrame(DRect(0, headerHeight, m_winSize.width, pageViewHeight), CAPageViewDirectionHorizontal);
        if (m_pageView) {
            m_pageView->setPageViewDelegate(this);
            m_pageView->setTouchEnabled(true);
            
             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(false);
             viewList.pushBack(temImage);
             }
//.........这里部分代码省略.........
开发者ID:DreamCastleShanghai,项目名称:client_new,代码行数:101,代码来源:MainViewController.cpp

示例14: viewDidLoad

void PageMenu::viewDidLoad()
{
	g_pCurrentPageMenu = this;
	PageBase::viewDidLoad();

	CAImageView *pBk = CAImageView::createWithImage(CAImage::create("Bk.png"));
	pBk->setFrame( getView()->getFrame() );
	getView()->addSubview( pBk );

	m_pMenuList = new CATableView();
	m_pMenuList->initWithFrame( CCRect( 0 , 0 , getView()->getFrame().size.width , getView()->getFrame().size.height - 120 ) );
	m_pMenuList->setTableViewDataSource(this);
    m_pMenuList->setTableViewDelegate(this);
	m_pMenuList->setTablePullViewHeight( 96 );
	//m_pMenuList->setTablePullDownView( CAView::createWithColor( ccc4( 34 , 168 , 109 , 255 ) ) );
	m_pMenuList->setTablePullUpView( CAImageView::createWithImage(CAImage::create("MenuDropList.png") ) );
	m_pMenuList->setTablePullDownView( CAView::createWithColor( ccc4( 34 , 168 , 109 , 255 ) ) );
	getView()->addSubview( m_pMenuList );
	m_pMenuList->release();
	m_pMenuList->setAllowsSelection( true );

	CAImageView *pBk2 = CAImageView::createWithImage(CAImage::create("Bk2.png"));
	pBk2->setFrame( CCRect( 0 , getView()->getFrame().size.height - 120 , getView()->getFrame().size.width , 120 ) );
	getView()->addSubview( pBk2 );

	m_pProgress = CAProgress::create();
	m_pProgress->setFrame( CCRect( 0 , -40 , 720 , 44 ) );
	//m_pProgress->setProgressTintColor( ccc4( 34 , 168 , 109 , 255 ) );
	m_pProgress->setProgressTintColor( ccc4( 255 , 255 , 255 , 255 ) );
	m_pProgress->setProgressTintImage( CAImage::create( "DownloadProgress.png" ) );
	m_pProgress->setProgresstrackColor( ccc4( 74 , 103 , 92 , 255 ) );
	m_pProgress->setVisible( false );
	pBk2->addSubview( m_pProgress );

	m_pProgressLabel = CALabel::createWithFrame( m_pProgress->getFrame() );
	m_pProgressLabel->setColor( ccc4( 255 , 255 , 255 , 255 ) );
	m_pProgressLabel->setFontSize( 28 );
	m_pProgressLabel->setTextAlignment( CATextAlignmentCenter );
	m_pProgressLabel->setVerticalTextAlignmet( CAVerticalTextAlignmentCenter );
	pBk2->addSubview( m_pProgressLabel );

	// 下载全书
	{
		CAButton *pButton = CAButton::createWithFrame( CCRect( 64 , 22 , 260 , 88 ) , CAButtonTypeCustom );
		pButton->setBackGroundViewForState( CAControlStateNormal , CAScale9ImageView::createWithImage( CAImage::create( "ButtonNormal.png" ) ) );
		pButton->setBackGroundViewForState( CAControlStateHighlighted , CAScale9ImageView::createWithImage( CAImage::create( "ButtonLight.png" ) ) );
		pButton->setBackGroundViewForState( CAControlStateDisabled , CAScale9ImageView::createWithImage( CAImage::create( "ButtonDisable.png" ) ) );
		CALabel *pLabel = CALabel::createWithFrame( CCRect( 0 , 0 , pButton->getFrame().size.width , pButton->getFrame().size.height ) );
		pLabel->setText( ("下载全书") );
		pLabel->setColor( ccc4( 255 , 255 , 255 , 255 ) );
		pLabel->setFontSize( 28 );
		pLabel->setTextAlignment( CATextAlignmentCenter );
		pLabel->setVerticalTextAlignmet( CAVerticalTextAlignmentCenter );
		pButton->addSubview( pLabel );
		pBk2->addSubview( pButton );
		pButton->addTarget( this , CAControl_selector(PageMenu::OnDownloadAllButtonDown) , CAControlTouchUpInSide );
	}

	// 章节下载
	{
		CAButton *pButton = CAButton::createWithFrame( CCRect( 400 , 22 , 260 , 88 ) , CAButtonTypeCustom );
		pButton->setBackGroundViewForState( CAControlStateNormal , CAScale9ImageView::createWithImage( CAImage::create( "ButtonNormal.png" ) ) );
		pButton->setBackGroundViewForState( CAControlStateHighlighted , CAScale9ImageView::createWithImage( CAImage::create( "ButtonLight.png" ) ) );
		pButton->setBackGroundViewForState( CAControlStateDisabled , CAScale9ImageView::createWithImage( CAImage::create( "ButtonDisable.png" ) ) );
		CALabel *pLabel = CALabel::createWithFrame( CCRect( 0 , 0 , pButton->getFrame().size.width , pButton->getFrame().size.height ) );
		pLabel->setText( ("下载后续章节") );
		pLabel->setColor( ccc4( 255 , 255 , 255 , 255 ) );
		pLabel->setFontSize( 28 );
		pLabel->setTextAlignment( CATextAlignmentCenter );
		pLabel->setVerticalTextAlignmet( CAVerticalTextAlignmentCenter );
		pButton->addSubview( pLabel );
		pBk2->addSubview( pButton );
		pButton->addTarget( this , CAControl_selector(PageMenu::OnDownloadButtonDown) , CAControlTouchUpInSide );
	}

	ShowWait( true );
	BookDB::Instance()->GetBookMenu( &m_bookData , this , BookDB_selector(PageMenu::OnComplete) );
}
开发者ID:anarki1234,项目名称:9miao,代码行数:78,代码来源:PageMenu.cpp

示例15: initWithReuseIdentifier


//.........这里部分代码省略.........

		CALabel* m_pLabel3_v = CALabel::createWithFrame(CCRect(0, fristRect.origin.y / 2, fristRect.size.width, fristRect.size.height / 2));
		m_pLabel3_v->setColor(CAColor_gray);
		m_pLabel3_v->setFontSize(_px(15));
		m_pLabel3_v->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
		m_pLabel3_v->setTextAlignment(CATextAlignmentCenter);
		m_pLabel3_v->setText(UTF8("本月胜率"));
		_view3->addSubview(m_pLabel3_v);

		fristRect.origin.x += fristRect.size.width + _px(10);
		CAView* _view4 = CAView::createWithCenter(fristRect);
		this->addSubview(_view4);

		CALabel* m_pLabel4 = CALabel::createWithFrame(CCRect(0, 0, fristRect.size.width, fristRect.size.height / 2));
		m_pLabel4->setColor(CAColor_black);
		m_pLabel4->setFontSize(_px(20));
		m_pLabel4->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
		m_pLabel4->setTextAlignment(CATextAlignmentCenter);
		m_pLabel4->setText("3");
		_view4->addSubview(m_pLabel4);

		CALabel* m_pLabel4_v = CALabel::createWithFrame(CCRect(0, fristRect.origin.y / 2, fristRect.size.width, fristRect.size.height / 2));
		m_pLabel4_v->setColor(CAColor_gray);
		m_pLabel4_v->setFontSize(_px(15));
		m_pLabel4_v->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
		m_pLabel4_v->setTextAlignment(CATextAlignmentCenter);
		m_pLabel4_v->setText(UTF8("胜率排名"));
		_view4->addSubview(m_pLabel4_v);

	}
	else if (reuseIdentifier == "slider"){

		CAButton* leftButton = CAButton::createWithCenter(CCRect(_px(30), cellSize.height/2, _px(30), _px(30)), CAButtonTypeCustom);
		leftButton->setBackGroundViewForState(CAControlStateAll, CAImageView::createWithImage(CAImage::create("image/sub.png")));
		
		leftButton->setImageColorForState(CAControlStateHighlighted, CAColor_gray);
    	//leftButton->addTarget(this, CAControl_selector(HeroInfoController::setButton), CAControlEventTouchUpInSide);
		this->addSubview(leftButton);

		CAButton* rightButton = CAButton::createWithCenter(CCRect(_px(cellSize.width - _px(40)), cellSize.height / 2, _px(30), _px(30)), CAButtonTypeCustom);
		rightButton->setBackGroundViewForState(CAControlStateAll, CAImageView::createWithImage(CAImage::create("image/_plus.png")));
			rightButton->setImageColorForState(CAControlStateHighlighted, CAColor_gray);
		//leftButton->addTarget(this, CAControl_selector(HeroInfoController::setButton), CAControlEventTouchUpInSide);
		this->addSubview(rightButton);


		CALabel*  level = CALabel::createWithFrame(CCRect(_px(cellSize.width - _px(90)), 10, _px(20), _px(20)));
		level->setColor(CAColor_black);
		level->setFontSize(_px(20));
		level->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
		level->setTextAlignment(CATextAlignmentCenter);
		level->setText("3");
		this->addSubview(level);


		
		CASlider* slider = CASlider::createWithCenter(CCRect(cellSize.width / 2, cellSize.height / 2, cellSize.width-200, _px(10)));
     	

		slider->setMaxTrackTintImage(CAImage::create("image/bcolor.png"));
		slider->setMinTrackTintImage(CAImage::create("image/fcolor.png"));

		slider->setMaxValue(25);
		slider->setMinValue(0);
	
		//slider->setThumbTintImage(CAImage::create("image/slideBlock.png"));
开发者ID:a752602882,项目名称:DotaMax,代码行数:67,代码来源:HeroInfoController.cpp


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