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/custom_button.h" | 5 #include "ui/views/controls/button/custom_button.h" |
6 | 6 |
7 #include "ui/base/accessibility/accessible_view_state.h" | 7 #include "ui/base/accessibility/accessible_view_state.h" |
8 #include "ui/base/animation/throb_animation.h" | 8 #include "ui/base/animation/throb_animation.h" |
9 #include "ui/base/events/event.h" | 9 #include "ui/base/events/event.h" |
10 #include "ui/base/keycodes/keyboard_codes.h" | 10 #include "ui/base/keycodes/keyboard_codes.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Button is returning to a normal state from hover, start hover | 40 // Button is returning to a normal state from hover, start hover |
41 // fade animation. | 41 // fade animation. |
42 hover_animation_->Hide(); | 42 hover_animation_->Hide(); |
43 } else { | 43 } else { |
44 hover_animation_->Stop(); | 44 hover_animation_->Stop(); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 state_ = state; | 48 state_ = state; |
49 StateChanged(); | 49 StateChanged(); |
| 50 if (state_changed_delegate_.get()) |
| 51 state_changed_delegate_->StateChanged(state_); |
50 SchedulePaint(); | 52 SchedulePaint(); |
51 } | 53 } |
52 | 54 |
53 void CustomButton::StartThrobbing(int cycles_til_stop) { | 55 void CustomButton::StartThrobbing(int cycles_til_stop) { |
54 is_throbbing_ = true; | 56 is_throbbing_ = true; |
55 hover_animation_->StartThrobbing(cycles_til_stop); | 57 hover_animation_->StartThrobbing(cycles_til_stop); |
56 } | 58 } |
57 | 59 |
58 void CustomButton::StopThrobbing() { | 60 void CustomButton::StopThrobbing() { |
59 if (hover_animation_->is_animating()) { | 61 if (hover_animation_->is_animating()) { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 if (!is_add && state_ != BS_DISABLED) | 322 if (!is_add && state_ != BS_DISABLED) |
321 SetState(BS_NORMAL); | 323 SetState(BS_NORMAL); |
322 } | 324 } |
323 | 325 |
324 void CustomButton::OnBlur() { | 326 void CustomButton::OnBlur() { |
325 if (IsHotTracked()) | 327 if (IsHotTracked()) |
326 SetState(BS_NORMAL); | 328 SetState(BS_NORMAL); |
327 } | 329 } |
328 | 330 |
329 } // namespace views | 331 } // namespace views |
OLD | NEW |