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

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

Issue 10174014: views: Add optional overlay image to ImageButton (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove debugging tweak Created 8 years, 8 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
« no previous file with comments | « ui/views/controls/button/image_button.h ('k') | ui/views/controls/button/image_button_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/image_button.cc
diff --git a/ui/views/controls/button/image_button.cc b/ui/views/controls/button/image_button.cc
index 129ca260119f87075bfbc168eda6e653234141bb..85c705d790794b15a8a409515a657eccd77d6ed0 100644
--- a/ui/views/controls/button/image_button.cc
+++ b/ui/views/controls/button/image_button.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -48,6 +48,14 @@ void ImageButton::SetBackground(SkColor color,
SkBitmapOperations::CreateButtonBackground(color, *image, *mask);
}
+void ImageButton::SetOverlayImage(const SkBitmap* image) {
+ if (!image) {
+ overlay_image_.reset();
+ return;
+ }
+ overlay_image_ = *image;
+}
+
void ImageButton::SetImageAlignment(HorizontalAlignment h_align,
VerticalAlignment v_align) {
h_alignment_ = h_align;
@@ -85,7 +93,11 @@ void ImageButton::OnPaint(gfx::Canvas* canvas) {
if (!background_image_.empty())
canvas->DrawBitmapInt(background_image_, x, y);
+
canvas->DrawBitmapInt(img, x, y);
+
+ if (!overlay_image_.empty())
+ canvas->DrawBitmapInt(overlay_image_, x, y);
}
OnPaintFocusBorder(canvas);
}
« no previous file with comments | « ui/views/controls/button/image_button.h ('k') | ui/views/controls/button/image_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698