Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: ui/views/controls/button/text_button.cc

Issue 284033002: Allow TextButton derivatives to override drawing of certain parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/button/text_button.cc
diff --git a/ui/views/controls/button/text_button.cc b/ui/views/controls/button/text_button.cc
index 99ac86b51dccfe1155ce09e8e82836a87b3081e9..75dfd1b6e396d3fb52e51170f87a3075b2a4d4cd 100644
--- a/ui/views/controls/button/text_button.cc
+++ b/ui/views/controls/button/text_button.cc
@@ -445,6 +445,10 @@ void TextButtonBase::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
Painter::PaintFocusPainter(this, canvas, focus_painter_.get());
}
+ OnPaintText(canvas, mode);
+}
+
+void TextButtonBase::OnPaintText(gfx::Canvas* canvas, PaintButtonMode mode) {
gfx::Rect text_bounds(GetTextBounds());
if (text_bounds.width() > 0) {
// Because the text button can (at times) draw multiple elements on the
@@ -630,7 +634,10 @@ void TextButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
set_alignment(ALIGN_RIGHT);
TextButtonBase::PaintButton(canvas, mode);
+ OnPaintIcon(canvas, mode);
+}
+void TextButton::OnPaintIcon(gfx::Canvas* canvas, PaintButtonMode mode) {
const gfx::ImageSkia& icon = GetImageToPaint();
if (icon.width() > 0) {
« ui/views/controls/button/text_button.h ('K') | « ui/views/controls/button/text_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698