| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 103 const char* ImageButton::GetClassName() const { | 103 const char* ImageButton::GetClassName() const { |
| 104 return kViewClassName; | 104 return kViewClassName; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ImageButton::OnPaint(gfx::Canvas* canvas) { | 107 void ImageButton::OnPaint(gfx::Canvas* canvas) { |
| 108 // Call the base class first to paint any background/borders. | 108 // Call the base class first to paint any background/borders. |
| 109 View::OnPaint(canvas); | 109 View::OnPaint(canvas); |
| 110 | 110 |
| 111 // TODO(estade|tdanderson|bruthig): The ink drop layer should be positioned |
| 112 // behind the button's image which means the image needs to be painted to its |
| 113 // own layer instead of to the Canvas. |
| 111 gfx::ImageSkia img = GetImageToPaint(); | 114 gfx::ImageSkia img = GetImageToPaint(); |
| 112 | 115 |
| 113 if (!img.isNull()) { | 116 if (!img.isNull()) { |
| 114 gfx::ScopedCanvas scoped(canvas); | 117 gfx::ScopedCanvas scoped(canvas); |
| 115 if (draw_image_mirrored_) { | 118 if (draw_image_mirrored_) { |
| 116 canvas->Translate(gfx::Vector2d(width(), 0)); | 119 canvas->Translate(gfx::Vector2d(width(), 0)); |
| 117 canvas->Scale(-1, 1); | 120 canvas->Scale(-1, 1); |
| 118 } | 121 } |
| 119 | 122 |
| 120 gfx::Point position = ComputeImagePaintPosition(img); | 123 gfx::Point position = ComputeImagePaintPosition(img); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 *tooltip = toggled_tooltip_text_; | 264 *tooltip = toggled_tooltip_text_; |
| 262 return true; | 265 return true; |
| 263 } | 266 } |
| 264 | 267 |
| 265 void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) { | 268 void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) { |
| 266 ImageButton::GetAccessibleState(state); | 269 ImageButton::GetAccessibleState(state); |
| 267 GetTooltipText(gfx::Point(), &state->name); | 270 GetTooltipText(gfx::Point(), &state->name); |
| 268 } | 271 } |
| 269 | 272 |
| 270 } // namespace views | 273 } // namespace views |
| OLD | NEW |