Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: views/controls/button/text_button.cc

Issue 6976048: views: Add OnEnabledChanged() method to View class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win, move OnEnabledChanged to protected section, add comment Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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()) { 564 CustomButton::OnEnabledChanged();
565 CustomButton::SetEnabled(enabled);
566 }
567 // We should always call UpdateColor() since the state of the button might be 565 // We should always call UpdateColor() since the state of the button might be
568 // changed by other functions like CustomButton::SetState(). 566 // changed by other functions like CustomButton::SetState().
569 UpdateColor(); 567 UpdateColor();
570 SchedulePaint(); 568 SchedulePaint();
571 } 569 }
572 570
573 std::string TextButtonBase::GetClassName() const { 571 std::string TextButtonBase::GetClassName() const {
574 return kViewClassName; 572 return kViewClassName;
575 } 573 }
576 574
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 bounds.Inset(0, 0, extra_width, 0); 734 bounds.Inset(0, 0, extra_width, 0);
737 } 735 }
738 } 736 }
739 737
740 return bounds; 738 return bounds;
741 } 739 }
742 740
743 } // namespace views 741 } // namespace views
744 742
745 743
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698