| 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 "ui/views/controls/button/text_button.h" | 5 #include "ui/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 "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 | 746 |
| 747 void TextButton::set_ignore_minimum_size(bool ignore_minimum_size) { | 747 void TextButton::set_ignore_minimum_size(bool ignore_minimum_size) { |
| 748 ignore_minimum_size_ = ignore_minimum_size; | 748 ignore_minimum_size_ = ignore_minimum_size; |
| 749 } | 749 } |
| 750 | 750 |
| 751 std::string TextButton::GetClassName() const { | 751 std::string TextButton::GetClassName() const { |
| 752 return kViewClassName; | 752 return kViewClassName; |
| 753 } | 753 } |
| 754 | 754 |
| 755 void TextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { | 755 void TextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { |
| 756 if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) { | 756 if ((focusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) { |
| 757 gfx::Rect rect(GetLocalBounds()); | 757 gfx::Rect rect(GetLocalBounds()); |
| 758 rect.Inset(kFocusRectInset, kFocusRectInset); | 758 rect.Inset(kFocusRectInset, kFocusRectInset); |
| 759 canvas->DrawFocusRect(rect); | 759 canvas->DrawFocusRect(rect); |
| 760 } | 760 } |
| 761 } | 761 } |
| 762 | 762 |
| 763 gfx::NativeTheme::Part TextButton::GetThemePart() const { | 763 gfx::NativeTheme::Part TextButton::GetThemePart() const { |
| 764 return gfx::NativeTheme::kPushButton; | 764 return gfx::NativeTheme::kPushButton; |
| 765 } | 765 } |
| 766 | 766 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 gfx::Size NativeTextButton::GetMinimumSize() { | 834 gfx::Size NativeTextButton::GetMinimumSize() { |
| 835 return GetPreferredSize(); | 835 return GetPreferredSize(); |
| 836 } | 836 } |
| 837 | 837 |
| 838 std::string NativeTextButton::GetClassName() const { | 838 std::string NativeTextButton::GetClassName() const { |
| 839 return kViewClassName; | 839 return kViewClassName; |
| 840 } | 840 } |
| 841 | 841 |
| 842 void NativeTextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { | 842 void NativeTextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { |
| 843 #if defined(OS_WIN) | 843 #if defined(OS_WIN) |
| 844 if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) { | 844 if ((focusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) { |
| 845 gfx::Rect rect(GetLocalBounds()); | 845 gfx::Rect rect(GetLocalBounds()); |
| 846 rect.Inset(kFocusRectInset, kFocusRectInset); | 846 rect.Inset(kFocusRectInset, kFocusRectInset); |
| 847 canvas->DrawFocusRect(rect); | 847 canvas->DrawFocusRect(rect); |
| 848 } | 848 } |
| 849 #else | 849 #else |
| 850 TextButton::OnPaintFocusBorder(canvas); | 850 TextButton::OnPaintFocusBorder(canvas); |
| 851 #endif | 851 #endif |
| 852 } | 852 } |
| 853 | 853 |
| 854 void NativeTextButton::GetExtraParams( | 854 void NativeTextButton::GetExtraParams( |
| 855 gfx::NativeTheme::ExtraParams* params) const { | 855 gfx::NativeTheme::ExtraParams* params) const { |
| 856 TextButton::GetExtraParams(params); | 856 TextButton::GetExtraParams(params); |
| 857 params->button.has_border = true; | 857 params->button.has_border = true; |
| 858 } | 858 } |
| 859 | 859 |
| 860 } // namespace views | 860 } // namespace views |
| OLD | NEW |