// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> void FrameWindowDesc::draw(const Core::Rectangle& area) const { Renderer::setCurrentColor(Color(1, 1, 1, 1)); // *********************************************************************** // draw the background // *********************************************************************** const Core::Vector2 topLeft = frameWindow_->position(); const Core::Vector2 bottomRight = frameWindow_->position() + frameWindow_->size(); const Core::Vector2 topRight(bottomRight.x(), topLeft.y()); const Core::Vector2 bottomLeft(topLeft.x(), bottomRight.y()); // *********************************************************************** // draw the border // *********************************************************************** // get the centers of the four rounded corners const Core::Vector2 topLeftCenter = topLeft + Core::Vector2(leftBorderWidth_, topBorderWidth_); const Core::Vector2 bottomRightCenter = bottomRight + Core::Vector2(-rightBorderWidth_, -bottomBorderWidth_); const Core::Vector2 bottomLeftCenter = Core::Vector2(topLeft.x() + leftBorderWidth_, bottomRight.y() - bottomBorderWidth_); const Core::Vector2 topRightCenter = Core::Vector2(bottomRight.x() - rightBorderWidth_, topLeft.y() + topBorderWidth_); topLeftDesc_->draw(Core::Rectangle(topLeft, topLeftCenter)); topRightDesc_->draw(Core::Rectangle(topRight, topRightCenter)); rightDesc_->draw(Core::Rectangle(topRightCenter, Core::Vector2(bottomRight.x(), bottomRightCenter.y()))); bottomRightDesc_->draw(Core::Rectangle(bottomRightCenter, bottomRight)); bottomDesc_->draw(Core::Rectangle(bottomLeftCenter, Core::Vector2(bottomRightCenter.x(), bottomRight.y()))); bottomLeftDesc_->draw(Core::Rectangle(bottomLeftCenter, bottomLeft)); leftDesc_->draw(Core::Rectangle(Core::Vector2(topLeft.x(), topLeftCenter.y()), bottomLeftCenter)); textDesc_->setText(frameWindow_->text()); Core::Vector2 textSize = textDesc_->textSize(); Core::Vector2 barSize(textSize.x()+10.0f, topBorderWidth_); const float clientWidth = bottomRightCenter.x() - topLeftCenter.x(); if(barSize.x() > clientWidth) barSize.setX(clientWidth); Core::Vector2 barMini = topLeft + Core::Vector2(leftBorderWidth_, 0.0f); titleDesc_->draw(Core::Rectangle(Core::Vector2(topLeftCenter.x(), topLeft.y()), Core::Vector2(topLeftCenter.x() + barSize.x(), topLeftCenter.y()))); topDesc_->draw(Core::Rectangle(Core::Vector2(topLeftCenter.x() + barSize.x(), topLeft.y()), topRightCenter)); // *********************************************************************** // draw the title // *********************************************************************** textDesc_->draw(Core::Rectangle(Core::Vector2(topLeftCenter.x(), topLeft.y()), Core::Vector2(topLeftCenter.x() + barSize.x(), topLeftCenter.y()))); Renderer::setCurrentColor(Color(1, 1, 1, 1)); }
void ProgressOverlay::resizeEvent(QResizeEvent *e) { QSize barSize(e->size() * 0.5); barSize.setHeight(bar->sizeHint().height()); QPoint topLeft((e->size().width() - barSize.width()) / 2, (e->size().height() - barSize.height()) / 2); QRect barRect(topLeft, barSize); bar->setGeometry(barRect); QWidget::resizeEvent(e); }
BAR_FUNC::BAR_FUNC() : FOO_BAR_FUNC(bar, barSize()) {}