OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/button/text_button.h" | 5 #include "views/controls/button/text_button.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 } | 553 } |
554 } | 554 } |
555 | 555 |
556 //////////////////////////////////////////////////////////////////////////////// | 556 //////////////////////////////////////////////////////////////////////////////// |
557 // TextButtonBase, View overrides: | 557 // TextButtonBase, View overrides: |
558 | 558 |
559 gfx::Size TextButtonBase::GetMinimumSize() { | 559 gfx::Size TextButtonBase::GetMinimumSize() { |
560 return max_text_size_; | 560 return max_text_size_; |
561 } | 561 } |
562 | 562 |
563 void TextButtonBase::SetEnabled(bool enabled) { | 563 void TextButtonBase::OnEnabledChanged() { |
564 if (enabled != IsEnabled()) { | |
565 CustomButton::SetEnabled(enabled); | |
566 } | |
567 // We should always call UpdateColor() since the state of the button might be | 564 // We should always call UpdateColor() since the state of the button might be |
568 // changed by other functions like CustomButton::SetState(). | 565 // changed by other functions like CustomButton::SetState(). |
569 UpdateColor(); | 566 UpdateColor(); |
570 SchedulePaint(); | 567 CustomButton::OnEnabledChanged(); |
571 } | 568 } |
572 | 569 |
573 std::string TextButtonBase::GetClassName() const { | 570 std::string TextButtonBase::GetClassName() const { |
574 return kViewClassName; | 571 return kViewClassName; |
575 } | 572 } |
576 | 573 |
577 //////////////////////////////////////////////////////////////////////////////// | 574 //////////////////////////////////////////////////////////////////////////////// |
578 // TextButtonBase, NativeThemeDelegate overrides: | 575 // TextButtonBase, NativeThemeDelegate overrides: |
579 | 576 |
580 gfx::Rect TextButtonBase::GetThemePaintRect() const { | 577 gfx::Rect TextButtonBase::GetThemePaintRect() const { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 bounds.Inset(0, 0, extra_width, 0); | 733 bounds.Inset(0, 0, extra_width, 0); |
737 } | 734 } |
738 } | 735 } |
739 | 736 |
740 return bounds; | 737 return bounds; |
741 } | 738 } |
742 | 739 |
743 } // namespace views | 740 } // namespace views |
744 | 741 |
745 | 742 |
OLD | NEW |