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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 return kViewClassName; | 823 return kViewClassName; |
824 } | 824 } |
825 | 825 |
826 void NativeTextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { | 826 void NativeTextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { |
827 #if defined(OS_WIN) | 827 #if defined(OS_WIN) |
828 // On windows, make sure the focus border is inset wrt the entire button so | 828 // On windows, make sure the focus border is inset wrt the entire button so |
829 // that the native text button appears more like a windows button. | 829 // that the native text button appears more like a windows button. |
830 if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) { | 830 if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) { |
831 gfx::Rect rect(GetLocalBounds()); | 831 gfx::Rect rect(GetLocalBounds()); |
832 rect.Inset(3, 3); | 832 rect.Inset(3, 3); |
833 canvas->DrawFocusRect(rect.x(), rect.y(), rect.width(), rect.height()); | 833 canvas->DrawFocusRect(rect); |
834 } | 834 } |
835 #else | 835 #else |
836 TextButton::OnPaintFocusBorder(canvas); | 836 TextButton::OnPaintFocusBorder(canvas); |
837 #endif | 837 #endif |
838 } | 838 } |
839 | 839 |
840 void NativeTextButton::GetExtraParams( | 840 void NativeTextButton::GetExtraParams( |
841 gfx::NativeTheme::ExtraParams* params) const { | 841 gfx::NativeTheme::ExtraParams* params) const { |
842 TextButton::GetExtraParams(params); | 842 TextButton::GetExtraParams(params); |
843 params->button.has_border = true; | 843 params->button.has_border = true; |
844 } | 844 } |
845 | 845 |
846 } // namespace views | 846 } // namespace views |
OLD | NEW |