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 "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
737 } | 737 } |
738 | 738 |
739 void TextButton::set_ignore_minimum_size(bool ignore_minimum_size) { | 739 void TextButton::set_ignore_minimum_size(bool ignore_minimum_size) { |
740 ignore_minimum_size_ = ignore_minimum_size; | 740 ignore_minimum_size_ = ignore_minimum_size; |
741 } | 741 } |
742 | 742 |
743 std::string TextButton::GetClassName() const { | 743 std::string TextButton::GetClassName() const { |
744 return kViewClassName; | 744 return kViewClassName; |
745 } | 745 } |
746 | 746 |
747 void TextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { | |
748 if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) { | |
749 gfx::Rect rect(GetLocalBounds()); | |
750 rect.Inset(3, 3); | |
Peter Kasting
2011/11/01 21:46:04
Please, no context-free magic numbers.
dmazzoni
2011/11/01 21:49:07
Updated to use a constant instead.
| |
751 canvas->DrawFocusRect(rect); | |
752 } | |
753 } | |
754 | |
747 gfx::NativeTheme::Part TextButton::GetThemePart() const { | 755 gfx::NativeTheme::Part TextButton::GetThemePart() const { |
748 return gfx::NativeTheme::kPushButton; | 756 return gfx::NativeTheme::kPushButton; |
749 } | 757 } |
750 | 758 |
751 void TextButton::GetExtraParams(gfx::NativeTheme::ExtraParams* params) const { | 759 void TextButton::GetExtraParams(gfx::NativeTheme::ExtraParams* params) const { |
752 TextButtonBase::GetExtraParams(params); | 760 TextButtonBase::GetExtraParams(params); |
753 params->button.is_default = is_default_; | 761 params->button.is_default = is_default_; |
754 } | 762 } |
755 | 763 |
756 gfx::Rect TextButton::GetTextBounds() const { | 764 gfx::Rect TextButton::GetTextBounds() const { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
837 #endif | 845 #endif |
838 } | 846 } |
839 | 847 |
840 void NativeTextButton::GetExtraParams( | 848 void NativeTextButton::GetExtraParams( |
841 gfx::NativeTheme::ExtraParams* params) const { | 849 gfx::NativeTheme::ExtraParams* params) const { |
842 TextButton::GetExtraParams(params); | 850 TextButton::GetExtraParams(params); |
843 params->button.has_border = true; | 851 params->button.has_border = true; |
844 } | 852 } |
845 | 853 |
846 } // namespace views | 854 } // namespace views |
OLD | NEW |