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


C++ CAListViewCell::setColor方法代码示例

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


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

示例1: listViewCellAtIndex

CAListViewCell* SessionsViewController::listViewCellAtIndex(CAListView *listView, const DSize& cellSize, unsigned int index)
{
    CAListViewCell* cell = NULL;
    if (listView->getTag() == 1)
    {
        DSize _size = cellSize;
        cell = (CAListViewCell*)listView->dequeueReusableCellWithIdentifier("ListViewCell");
        if (!cell)
        {
            cell = CAListViewCell::create("ListViewCell");
            cell->setColor(ccc4(0xEB, 0xEB, 0xEB, 0xff));
            CALabel* test = CALabel::createWithCenter(DRect(_size.width/2,
                                                            _size.height/2,
                                                            _size.width,
                                                            _size.height));
            test->setTextAlignment(CATextAlignmentCenter);
            test->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
            test->setFontSize((28));
            test->setTag(100);
            CAScale9ImageView* sView = CAScale9ImageView::createWithImage(CAImage::create("common/gray_bg.png"));
            sView->setFrame(DRect((0), (0), _size.width, _size.height));
            cell->setBackgroundView(sView);
            cell->addSubview(test);
        }
        CALabel* test = (CALabel*)cell->getSubviewByTag(100);
        if (m_timeTblId == index)
            test->setColor(CAColor_white); // ccc4(0x96, 0x96, 0x96, 255)
        else
            test->setColor(SAP_GRAY);
        if (index == 0)
        {
            test->setText("All");
        }
        else
        {
            test->setText(crossapp_format_string("%2d:00", index + 8));
        }
    }
    /*
    else if(listView->getTag() == 2)
    {
        DSize _size = cellSize;
        cell = (CAListViewCell*)listView->dequeueReusableCellWithIdentifier("ListViewCell");
        if (!cell)
        {
            cell = CAListViewCell::create("ListViewCell");
            CAButton* button = CAButton::createWithFrame(DRect((20), (20), (120), (40)), CAButtonTypeCustom);

            CAScale9ImageView* sView = CAScale9ImageView::createWithFrame(DRect((0), (0), (120), (40)));
            sView->setImage(CAImage::create("common/seggreen_bg.png"));
            sView->setTouchEnabled(false);
            button->addSubview(sView);
            //button->setBackgroundViewForState(CAControlStateAll, sView);
            sView = CAScale9ImageView::createWithFrame(DRect((0), (0), (120), (40)));
            sView->setImage(CAImage::create("common/seggreen_bg.png"));
            sView->setColor(ccc4(0x86, 0xBD, 0x45, 0xff));
            button->setBackgroundViewForState(CAControlStateSelected, sView);
            button->setTitleForState(CAControlStateAll, filterItem[index * 2]);
            button->setTitleColorForState(CAControlStateAll, ccc4(0xA0, 0xA0, 0xA0, 0xA0));
            button->setTitleFontSize((20));
            button->setAllowsSelected(true);
            button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
            button->setTag(310 + index * 2);
            //m_listButton[index * 2] = button;
            cell->addSubview(button);
            
            button = CAButton::createWithFrame(DRect((20), (70), (120), (40)), CAButtonTypeCustom);
            sView = CAScale9ImageView::createWithFrame(DRect((0), (0), (120), (40)));
            sView->setImage(CAImage::create("common/seggreen_bg.png"));
            sView->setTouchEnabled(false);
            button->addSubview(sView);
            //button->setBackgroundViewForState(CAControlStateAll, sView);
            //button->addSubview(sView);
            //button->setBackgroundViewForState(CAControlStateAll, sView);
            sView = CAScale9ImageView::createWithFrame(DRect((0), (0), (120), (40)));
            sView->setImage(CAImage::create("common/btn_round.png"));
            sView->setColor(ccc4(0x86, 0xBD, 0x45, 0xff));
            button->setBackgroundViewForState(CAControlStateSelected, sView);
            button->setTitleForState(CAControlStateAll, filterItem[index * 2 + 1]);
            button->setTitleColorForState(CAControlStateAll, CAColor_gray);
            button->setTitleFontSize((20));
            button->setAllowsSelected(true);
            button->addTarget(this, CAControl_selector(SessionsViewController::buttonCallBack), CAControlEventTouchUpInSide);
            button->setTag(310 + index * 2 + 1);
            //m_listButton[index * 2 + 1] = button;
            cell->addSubview(button);
            
            //sView = CAScale9ImageView::createWithImage(CAImage::create("common/gray_bg.png"));
            //sView->setFrame(DRect((0), (0), _size.width, _size.height));
            //sView->setColor(CAColor_clear);
            //cell->setAlpha(0);
            //cell->setBackgroundView(sView);
                            
        }
        
    }*/
    return cell;
}
开发者ID:DreamCastleShanghai,项目名称:client_new,代码行数:98,代码来源:SessionsViewController.cpp


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