OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/checkbox.h" | 5 #include "ui/views/controls/button/checkbox.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/base/accessibility/accessible_view_state.h" | 8 #include "ui/base/accessibility/accessible_view_state.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/views/controls/label.h" | 10 #include "ui/views/controls/label.h" |
11 | 11 |
12 namespace views { | 12 namespace views { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 const int kCheckboxLabelSpacing = 4; | 16 const int kCheckboxLabelSpacing = 4; |
17 | 17 |
18 const int kFocusBorderWidth = 1; | 18 const int kFocusBorderWidth = 1; |
19 | 19 |
20 } // namespace | 20 } // namespace |
21 | 21 |
22 // static | 22 // static |
23 const char Checkbox::kViewClassName[] = "views/Checkbox"; | 23 const char Checkbox::kViewClassName[] = "Checkbox"; |
24 | 24 |
25 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
26 // CheckboxNativeThemeBorder, public: | 26 // CheckboxNativeThemeBorder, public: |
27 | 27 |
28 gfx::Insets CheckboxNativeThemeBorder::GetInsets() const { | 28 gfx::Insets CheckboxNativeThemeBorder::GetInsets() const { |
29 if (use_custom_insets_) | 29 if (use_custom_insets_) |
30 return custom_insets_; | 30 return custom_insets_; |
31 | 31 |
32 const gfx::Insets& insets = TextButtonNativeThemeBorder::GetInsets(); | 32 const gfx::Insets& insets = TextButtonNativeThemeBorder::GetInsets(); |
33 return gfx::Insets(insets.top(), 0, insets.bottom(), 0); | 33 return gfx::Insets(insets.top(), 0, insets.bottom(), 0); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 gfx::Rect Checkbox::GetTextBounds() const { | 127 gfx::Rect Checkbox::GetTextBounds() const { |
128 gfx::Rect bounds(TextButtonBase::GetTextBounds()); | 128 gfx::Rect bounds(TextButtonBase::GetTextBounds()); |
129 ui::NativeTheme::ExtraParams extra; | 129 ui::NativeTheme::ExtraParams extra; |
130 ui::NativeTheme::State state = GetThemeState(&extra); | 130 ui::NativeTheme::State state = GetThemeState(&extra); |
131 gfx::Size size(GetNativeTheme()->GetPartSize(GetThemePart(), state, extra)); | 131 gfx::Size size(GetNativeTheme()->GetPartSize(GetThemePart(), state, extra)); |
132 bounds.Offset(size.width() + kCheckboxLabelSpacing, 0); | 132 bounds.Offset(size.width() + kCheckboxLabelSpacing, 0); |
133 return bounds; | 133 return bounds; |
134 } | 134 } |
135 | 135 |
136 } // namespace views | 136 } // namespace views |
OLD | NEW |