本文整理汇总了C++中SkinTheme::calcSizeHint方法的典型用法代码示例。如果您正苦于以下问题:C++ SkinTheme::calcSizeHint方法的具体用法?C++ SkinTheme::calcSizeHint怎么用?C++ SkinTheme::calcSizeHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkinTheme
的用法示例。
在下文中一共展示了SkinTheme::calcSizeHint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onSetDecorativeWidgetBounds
void onSetDecorativeWidgetBounds() override {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
Widget* window = parent();
gfx::Rect rect(0, 0, 0, 0);
gfx::Size centerSize = this->sizeHint();
gfx::Size playSize = theme->calcSizeHint(this, theme->styles.windowPlayButton());
gfx::Size closeSize = theme->calcSizeHint(this, theme->styles.windowCloseButton());
rect.w = centerSize.w;
rect.h = centerSize.h;
rect.offset(window->bounds().x2()
- theme->styles.windowCloseButton()->margin().width() - closeSize.w
- theme->styles.windowPlayButton()->margin().width() - playSize.w
- style()->margin().right() - centerSize.w,
window->bounds().y + style()->margin().top());
setBounds(rect);
}
示例2: onSizeHint
void onSizeHint(SizeHintEvent& ev) override {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
ui::Style* style = theme->styles.newsItem();
setText(m_title);
gfx::Size sz = theme->calcSizeHint(this, style);
if (!m_desc.empty())
sz.h *= 5;
ev.setSizeHint(gfx::Size(0, sz.h));
}
示例3: onPaint
void onPaint(PaintEvent& ev) override {
SkinTheme* theme = static_cast<SkinTheme*>(this->theme());
Graphics* g = ev.graphics();
gfx::Rect bounds = clientBounds();
ui::Style* style = theme->styles.newsItem();
ui::Style* styleDetail = theme->styles.newsItemDetail();
setText(m_title);
gfx::Size textSize = theme->calcSizeHint(this, style);
gfx::Rect textBounds(bounds.x, bounds.y, bounds.w, textSize.h);
gfx::Rect detailsBounds(
bounds.x, bounds.y+textSize.h,
bounds.w, bounds.h-textSize.h);
theme->paintWidget(g, this, style, textBounds);
setText(m_desc);
theme->paintWidget(g, this, styleDetail, detailsBounds);
}