| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/controls/button/image_button.h" | 5 #include "ui/views/controls/button/image_button.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "ui/base/animation/throb_animation.h" | 8 #include "ui/base/animation/throb_animation.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "ui/gfx/image/image_skia_operations.h" | 10 #include "ui/gfx/image/image_skia_operations.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (v_alignment_ == ALIGN_MIDDLE) | 90 if (v_alignment_ == ALIGN_MIDDLE) |
| 91 y = (height() - img.height()) / 2; | 91 y = (height() - img.height()) / 2; |
| 92 else if (v_alignment_ == ALIGN_BOTTOM) | 92 else if (v_alignment_ == ALIGN_BOTTOM) |
| 93 y = height() - img.height(); | 93 y = height() - img.height(); |
| 94 | 94 |
| 95 if (!background_image_.isNull()) | 95 if (!background_image_.isNull()) |
| 96 canvas->DrawImageInt(background_image_, x, y); | 96 canvas->DrawImageInt(background_image_, x, y); |
| 97 | 97 |
| 98 canvas->DrawImageInt(img, x, y); | 98 canvas->DrawImageInt(img, x, y); |
| 99 | 99 |
| 100 if (!overlay_image_.empty()) | 100 if (!overlay_image_.isNull()) |
| 101 canvas->DrawImageInt(overlay_image_, x, y); | 101 canvas->DrawImageInt(overlay_image_, x, y); |
| 102 } | 102 } |
| 103 OnPaintFocusBorder(canvas); | 103 OnPaintFocusBorder(canvas); |
| 104 } | 104 } |
| 105 | 105 |
| 106 //////////////////////////////////////////////////////////////////////////////// | 106 //////////////////////////////////////////////////////////////////////////////// |
| 107 // ImageButton, protected: | 107 // ImageButton, protected: |
| 108 | 108 |
| 109 gfx::ImageSkia ImageButton::GetImageToPaint() { | 109 gfx::ImageSkia ImageButton::GetImageToPaint() { |
| 110 gfx::ImageSkia img; | 110 gfx::ImageSkia img; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 bool ToggleImageButton::GetTooltipText(const gfx::Point& p, | 179 bool ToggleImageButton::GetTooltipText(const gfx::Point& p, |
| 180 string16* tooltip) const { | 180 string16* tooltip) const { |
| 181 if (!toggled_ || toggled_tooltip_text_.empty()) | 181 if (!toggled_ || toggled_tooltip_text_.empty()) |
| 182 return Button::GetTooltipText(p, tooltip); | 182 return Button::GetTooltipText(p, tooltip); |
| 183 | 183 |
| 184 *tooltip = toggled_tooltip_text_; | 184 *tooltip = toggled_tooltip_text_; |
| 185 return true; | 185 return true; |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace views | 188 } // namespace views |
| OLD | NEW |