| 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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
| 9 #include "ui/gfx/animation/throb_animation.h" | 9 #include "ui/gfx/animation/throb_animation.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 SchedulePaint(); | 67 SchedulePaint(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void ImageButton::SetFocusPainter(scoped_ptr<Painter> focus_painter) { | 70 void ImageButton::SetFocusPainter(scoped_ptr<Painter> focus_painter) { |
| 71 focus_painter_ = focus_painter.Pass(); | 71 focus_painter_ = focus_painter.Pass(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 //////////////////////////////////////////////////////////////////////////////// | 74 //////////////////////////////////////////////////////////////////////////////// |
| 75 // ImageButton, View overrides: | 75 // ImageButton, View overrides: |
| 76 | 76 |
| 77 gfx::Size ImageButton::GetPreferredSize() { | 77 gfx::Size ImageButton::GetPreferredSize() const { |
| 78 gfx::Size size = preferred_size_; | 78 gfx::Size size = preferred_size_; |
| 79 if (!images_[STATE_NORMAL].isNull()) { | 79 if (!images_[STATE_NORMAL].isNull()) { |
| 80 size = gfx::Size(images_[STATE_NORMAL].width(), | 80 size = gfx::Size(images_[STATE_NORMAL].width(), |
| 81 images_[STATE_NORMAL].height()); | 81 images_[STATE_NORMAL].height()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 gfx::Insets insets = GetInsets(); | 84 gfx::Insets insets = GetInsets(); |
| 85 size.Enlarge(insets.width(), insets.height()); | 85 size.Enlarge(insets.width(), insets.height()); |
| 86 return size; | 86 return size; |
| 87 } | 87 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 *tooltip = toggled_tooltip_text_; | 245 *tooltip = toggled_tooltip_text_; |
| 246 return true; | 246 return true; |
| 247 } | 247 } |
| 248 | 248 |
| 249 void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) { | 249 void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) { |
| 250 ImageButton::GetAccessibleState(state); | 250 ImageButton::GetAccessibleState(state); |
| 251 GetTooltipText(gfx::Point(), &state->name); | 251 GetTooltipText(gfx::Point(), &state->name); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace views | 254 } // namespace views |
| OLD | NEW |