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


C++ CAImageView::getFrame方法代码示例

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


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

示例1: initWithCell

void FSBookReadTimesCell::initWithCell()
{
    
    CADipSize _size = this->getBounds().size;
//    CAView *view = CAView::createWithFrame(this->getBounds());
//    view->setTag(99);
//    this->addSubview(view);
    
    CAImageView* itemImage = CAImageView::createWithFrame(CADipRect(LEFTSPACE, TOPSPACE, (_size.height-TOPSPACE-BOTTOMSPACE)*3/4, _size.height-TOPSPACE-BOTTOMSPACE));
    itemImage->setTag(99);
    this->addSubview(itemImage);
    
//    CADipSize itemSize = itemImage->getBounds().size;
//    CALabel* itemText = CALabel::createWithCenter(CADipRect(itemSize.width*0.5, itemSize.height+20, 150, 40));
//    itemText->setTag(100);
//    itemText->setFontSize(_px(29));
//    itemText->setTextAlignment(CATextAlignmentCenter);
//    itemText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
//    itemImage->addSubview(itemText);
    
    
    CALabel *textTitle = CALabel::createWithFrame(CADipRect(itemImage->getFrame().size.width+LEFTSPACE*2, TOPSPACE, _size.width-itemImage->getFrame().size.width-LEFTSPACE*2, (_size.height-TOPSPACE-BOTTOMSPACE)/2));
    
    textTitle->setTag(100);
        textTitle->setFontSize(_px(29));
        textTitle->setTextAlignment(CATextAlignmentLeft);
        textTitle->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
//        textTitle->setColor(ccc4(100,100,100,1));
    this->addSubview(textTitle);
    
    
    CALabel *authorTitle = CALabel::createWithFrame(CADipRect(itemImage->getFrame().size.width+LEFTSPACE*2, TOPSPACE+(_size.height-TOPSPACE-BOTTOMSPACE)/2, _size.width-itemImage->getFrame().size.width-LEFTSPACE-LEFTSPACE, (_size.height-TOPSPACE-BOTTOMSPACE)/2));
    authorTitle->setTag(101);
    authorTitle->setFontSize(_px(29));
    authorTitle->setTextAlignment(CATextAlignmentLeft);
    authorTitle->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
    this->addSubview(authorTitle);
    
//    CADipSize m_size = this->getFrame().size;
//    CALabel* cellText = CALabel::createWithCenter(CADipRect(m_size.width*0.1, m_size.height*0.5, m_size.width*0.3, m_size.height*0.8));
//    cellText->setTag(100);
//    cellText->setFontSize(_px(30));
//    cellText->setTextAlignment(CATextAlignmentCenter);
//    cellText->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
//    this->addSubview(cellText);
    
//    CAButton* btnOnCell = CAButton::createWithCenter(CADipRect(m_size.width*0.85, m_size.height*0.5, m_size.width*0.2, m_size.height*0.7), CAButtonTypeRoundedRect);
//    btnOnCell->setTag(102);
//    btnOnCell->setTitleForState(CAControlStateAll, "Touch");
//    btnOnCell->addTarget(this, CAControl_selector(FSBookReadTimesCell::cellBtnCallback), CAControlEventTouchUpInSide);
//    this->addSubview(btnOnCell);
}
开发者ID:fx0883,项目名称:HighMessage,代码行数:52,代码来源:FSBookReadTimesCell.cpp

示例2: buildCtrlViews

void CAVideoPlayerControlView::buildCtrlViews()
{
	m_glView = CAVideoPlayerView::createWithFrame(getFrame());
	m_glView->setFrameOrigin(DPointZero);
	m_glView->setColor(ccc4(0, 0, 0, 0));
	this->insertSubview(m_glView, 1);

	// Bottom Panel Back
	CAImageView* bottomPanel = NULL;
	do {
		DRect frame = m_glView->getFrame();
		CAImage* image = CAImage::create("source_material/vdo_panel_bottom_bg.png");
		float width = m_glView->getFrame().size.width;
		float height = image->getContentSize().height;
		bottomPanel = CAImageView::createWithFrame(DRect(0, frame.size.height - height, width, height));
		bottomPanel->setImage(image);
		m_glView->addSubview(bottomPanel);
	} while (0);

	// Slider 
	do {
		DRect frame = bottomPanel->getFrame();
		CAImage* backImage = CAImage::create("source_material/vdo_progress_back.png");
		CAImage* barImage = CAImage::create("source_material/vdo_progress_bar.png");
		m_playSlider = CASlider::createWithCenter(DRect(frame.size.width / 2, frame.size.height*0.3, frame.size.width * 0.9, barImage->getContentSize().height));
		m_playSlider->setMaxTrackTintImage(backImage);
		m_playSlider->setThumbTintImage(barImage);
		m_playSlider->setTrackHeight(backImage->getContentSize().height);
		m_playSlider->addTargetForTouchUpSide(this, CAControl_selector(CAVideoPlayerControlView::onSlideChanged));
		m_playSlider->addTarget(this, CAControl_selector(CAVideoPlayerControlView::onSlideTouched));
		bottomPanel->addSubview(m_playSlider);
	} while (0);

	// Play Pause Button
	do {
		DRect frame = bottomPanel->getFrame();
		CAImage* backImage = CAImage::create("source_material/vdo_pause.png");
		CAImage* backImage_h = CAImage::create("source_material/vdo_pause_down.png");
		frame.origin.y = frame.size.height * 2 / 3;
		frame.origin.x = backImage->getContentSize().width;
		frame.size.height = backImage->getContentSize().height;
		frame.size.width = backImage->getContentSize().width;
		m_playButton = CAButton::createWithCenter(frame, CAButtonTypeCustom);
		m_playButton->setImageForState(CAControlStateAll, backImage);
		m_playButton->setImageForState(CAControlStateHighlighted, backImage_h);
		m_playButton->addTarget(this, CAControl_selector(CAVideoPlayerControlView::onButtonPause), CAControlEventTouchUpInSide);
		bottomPanel->addSubview(m_playButton);
	} while (0);

	// play time
	do {
		DRect frame = m_playButton->getFrame();
		DRect newFrame = DRectZero;
		m_playTimeLabel = CALabel::createWithFrame(DRectZero);
		m_playTimeLabel->setFontSize(32);
		m_playTimeLabel->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
		m_playTimeLabel->setColor(ccc4(255, 255, 255, 255));
		newFrame.origin.x = frame.origin.x * 2 + frame.size.width;
		newFrame.origin.y = frame.origin.y;
		newFrame.size.width = m_playTimeLabel->getFontSize() * 20;
		newFrame.size.height = frame.size.height;
		m_playTimeLabel->setFrame(newFrame);
		m_playTimeLabel->setText("00:00 / 00:00");
		bottomPanel->addSubview(m_playTimeLabel);
	} while (0);

	// Top Panel Back
	CAImageView* topPanel = NULL;
	do {
		CAImage* image = CAImage::create("source_material/vdo_panel_top_bg.png");
		topPanel = CAImageView::createWithFrame(DRect(0, 0, m_glView->getFrame().size.width, image->getContentSize().height));
		topPanel->setImage(image);
		m_glView->addSubview(topPanel);
	} while (0);

	// Back Button
	CAButton* buttonBack = NULL;
	do {
		DRect frame = topPanel->getFrame();
		//        CAImage* backImage = CAImage::create("source_material/vdo_btn_back.png");
		//        CAImage* backImage_h = CAImage::create("source_material/vdo_btn_back_h.png");
		CAImage* backImage = CAImage::create("source_material/btn_left_blue.png");
		CAImage* backImage_h = CAImage::create("source_material/btn_left_white.png");
		frame.origin.y = frame.size.height / 3;
		frame.origin.x = frame.origin.y;
		frame.size.height = backImage->getContentSize().height;
		frame.size.width = backImage->getContentSize().width;
		buttonBack = CAButton::createWithCenter(frame, CAButtonTypeCustom);
		buttonBack->setImageForState(CAControlStateAll, backImage);
		buttonBack->setImageForState(CAControlStateHighlighted, backImage_h);
		buttonBack->addTarget(this, CAControl_selector(CAVideoPlayerControlView::onButtonBack), CAControlEventTouchUpInSide);
		topPanel->addSubview(buttonBack);
	} while (0);

	// Title
	do {
		DRect frame = buttonBack->getFrame();
		DRect r = DRectZero;
		r.origin.x = buttonBack->getFrame().origin.x * 2 + buttonBack->getFrame().size.width;
		r.origin.y = buttonBack->getFrame().origin.y;
//.........这里部分代码省略.........
开发者ID:CornerZhang,项目名称:CrossApp,代码行数:101,代码来源:CAVideoPlayerControlViewMac.cpp


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