| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 canvas->DrawImageInt(img, position.x(), position.y()); | 129 canvas->DrawImageInt(img, position.x(), position.y()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 Painter::PaintFocusPainter(this, canvas, focus_painter()); | 132 Painter::PaintFocusPainter(this, canvas, focus_painter()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 //////////////////////////////////////////////////////////////////////////////// | 135 //////////////////////////////////////////////////////////////////////////////// |
| 136 // ImageButton, protected: | 136 // ImageButton, protected: |
| 137 | 137 |
| 138 void ImageButton::OnFocus() { | 138 void ImageButton::OnFocus() { |
| 139 View::OnFocus(); | 139 CustomButton::OnFocus(); |
| 140 if (focus_painter_.get()) | 140 if (focus_painter_.get()) |
| 141 SchedulePaint(); | 141 SchedulePaint(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void ImageButton::OnBlur() { | 144 void ImageButton::OnBlur() { |
| 145 View::OnBlur(); | 145 CustomButton::OnBlur(); |
| 146 if (focus_painter_.get()) | 146 if (focus_painter_.get()) |
| 147 SchedulePaint(); | 147 SchedulePaint(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 gfx::ImageSkia ImageButton::GetImageToPaint() { | 150 gfx::ImageSkia ImageButton::GetImageToPaint() { |
| 151 gfx::ImageSkia img; | 151 gfx::ImageSkia img; |
| 152 | 152 |
| 153 if (!images_[STATE_HOVERED].isNull() && hover_animation().is_animating()) { | 153 if (!images_[STATE_HOVERED].isNull() && hover_animation().is_animating()) { |
| 154 img = gfx::ImageSkiaOperations::CreateBlendedImage( | 154 img = gfx::ImageSkiaOperations::CreateBlendedImage( |
| 155 images_[STATE_NORMAL], images_[STATE_HOVERED], | 155 images_[STATE_NORMAL], images_[STATE_HOVERED], |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 *tooltip = toggled_tooltip_text_; | 266 *tooltip = toggled_tooltip_text_; |
| 267 return true; | 267 return true; |
| 268 } | 268 } |
| 269 | 269 |
| 270 void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) { | 270 void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) { |
| 271 ImageButton::GetAccessibleState(state); | 271 ImageButton::GetAccessibleState(state); |
| 272 GetTooltipText(gfx::Point(), &state->name); | 272 GetTooltipText(gfx::Point(), &state->name); |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace views | 275 } // namespace views |
| OLD | NEW |