本文整理汇总了C++中CAButton::getFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ CAButton::getFrame方法的具体用法?C++ CAButton::getFrame怎么用?C++ CAButton::getFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAButton
的用法示例。
在下文中一共展示了CAButton::getFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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) );
}
示例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;
//.........这里部分代码省略.........