void MediaPlayer::layout(){ if(mVideoPlayer){ mVideoPlayer->setSize(getWidth(), getHeight()); } if(mStreamPlayer){ mStreamPlayer->setSize(getWidth(), getHeight()); } if(mPDFPlayer){ mPDFPlayer->setSize(getWidth(), getHeight()); } if(mThumbnailImage){ fitInside(mThumbnailImage, ci::Rectf(0.0f, 0.0f, getWidth(), getHeight()), true); } if(mPrimaryImage){ fitInside(mPrimaryImage, ci::Rectf(0.0f, 0.0f, getWidth(), getHeight()), true); } if(mWebPlayer){ mWebPlayer->setSize(getWidth(), getHeight()); } onLayout(); }
// Layout is called when the size is changed, so don't change the size in the layout void MediaInterface::layout(){ const float w = getWidth(); const float h = getHeight(); if(mBackground){ mBackground->setSize(w, h); } onLayout(); }
TitaniumLayout::TitaniumLayout(TiView* tiView) : QObject(tiView), _layout(""), _left(""), _right(""), _top(""), _bottom(""), _width(""), _height(""), _nLayout(-1), _nLeft(-1), _nRight(-1), _nTop(-1), _nBottom(-1), _nWidth(-1), _nHeight(-1), lastWidth_(0), lastHeight_(0), displayWidth_(0), displayHeight_(0), ignoreHeight_(false), ignoreWidth_(false), deferWidth_(false), deferHeight_(false), deferWidthType_((enum Ti::Layout::ValueType)-1), deferHeightType_((enum Ti::Layout::ValueType)-1), _tiView(tiView), _control(NULL) { ignoreHeight_ = _tiView->ingoreHeight(); ignoreWidth_ = _tiView->ingoreWidth(); Ti::Layout::TiNode::nodeInitialize(&layoutNode_); layoutNode_.onLayout = onPostLayout; layoutNode_.data = this; // ================================ if(_tiView->defaultHeight() == Ti::TiConstants::SizeSIZE) { layoutNode_.properties.defaultHeightType = Ti::Layout::Size; deferHeight_ = true; if(ignoreHeight_) layoutNode_.properties.height.valueType = Ti::Layout::Size; } else if(_tiView->defaultHeight() == Ti::TiConstants::SizeFILL) { layoutNode_.properties.defaultHeightType = Ti::Layout::Fill; if(ignoreHeight_) layoutNode_.properties.height.valueType = Ti::Layout::Fill; } // ================================ if(_tiView->defaultWidth() == Ti::TiConstants::SizeSIZE) { deferWidth_ = true; layoutNode_.properties.defaultWidthType = Ti::Layout::Size; if(ignoreWidth_) layoutNode_.properties.width.valueType = Ti::Layout::Size; } else if(_tiView->defaultWidth() == Ti::TiConstants::SizeFILL) { layoutNode_.properties.defaultWidthType = Ti::Layout::Fill; if(ignoreWidth_) layoutNode_.properties.width.valueType = Ti::Layout::Fill; } _control = _tiView->childControl != NULL ? _tiView->childControl : _tiView; bb::cascades::LayoutUpdateHandler::create(_control).onLayoutFrameChanged(this,SLOT(onLayout(QRectF))); }