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); }