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/scrollbar/native_scroll_bar_views.h" | 5 #include "ui/views/controls/scrollbar/native_scroll_bar_views.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/events/keycodes/keyboard_codes.h" | 8 #include "ui/events/keycodes/keyboard_codes.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/gfx/path.h" | 10 #include "ui/gfx/path.h" |
11 #include "ui/views/controls/button/custom_button.h" | 11 #include "ui/views/controls/button/custom_button.h" |
12 #include "ui/views/controls/focusable_border.h" | 12 #include "ui/views/controls/focusable_border.h" |
13 #include "ui/views/controls/scrollbar/base_scroll_bar_button.h" | 13 #include "ui/views/controls/scrollbar/base_scroll_bar_button.h" |
14 #include "ui/views/controls/scrollbar/base_scroll_bar_thumb.h" | 14 #include "ui/views/controls/scrollbar/base_scroll_bar_thumb.h" |
15 #include "ui/views/controls/scrollbar/native_scroll_bar.h" | 15 #include "ui/views/controls/scrollbar/native_scroll_bar.h" |
16 #include "ui/views/controls/scrollbar/scroll_bar.h" | 16 #include "ui/views/controls/scrollbar/scroll_bar.h" |
| 17 #include "ui/views/style/platform_style.h" |
17 | 18 |
18 namespace views { | 19 namespace views { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 // Wrapper for the scroll buttons. | 23 // Wrapper for the scroll buttons. |
23 class ScrollBarButton : public BaseScrollBarButton { | 24 class ScrollBarButton : public BaseScrollBarButton { |
24 public: | 25 public: |
25 enum Type { | 26 enum Type { |
26 UP, | 27 UP, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 66 |
66 ScrollBar* scroll_bar_; | 67 ScrollBar* scroll_bar_; |
67 }; | 68 }; |
68 | 69 |
69 ///////////////////////////////////////////////////////////////////////////// | 70 ///////////////////////////////////////////////////////////////////////////// |
70 // ScrollBarButton | 71 // ScrollBarButton |
71 | 72 |
72 ScrollBarButton::ScrollBarButton(ButtonListener* listener, Type type) | 73 ScrollBarButton::ScrollBarButton(ButtonListener* listener, Type type) |
73 : BaseScrollBarButton(listener), | 74 : BaseScrollBarButton(listener), |
74 type_(type) { | 75 type_(type) { |
75 SetFocusable(false); | 76 PlatformStyle::ConfigureFocus(PlatformStyle::CONTROL::SCROLLBAR_VIEW, this); |
76 SetAccessibilityFocusable(false); | |
77 } | 77 } |
78 | 78 |
79 ScrollBarButton::~ScrollBarButton() { | 79 ScrollBarButton::~ScrollBarButton() { |
80 } | 80 } |
81 | 81 |
82 gfx::Size ScrollBarButton::GetPreferredSize() const { | 82 gfx::Size ScrollBarButton::GetPreferredSize() const { |
83 return GetNativeTheme()->GetPartSize(GetNativeThemePart(), | 83 return GetNativeTheme()->GetPartSize(GetNativeThemePart(), |
84 GetNativeThemeState(), | 84 GetNativeThemeState(), |
85 GetNativeThemeParams()); | 85 GetNativeThemeParams()); |
86 } | 86 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 NOTREACHED(); | 143 NOTREACHED(); |
144 return ui::NativeTheme::kNormal; | 144 return ui::NativeTheme::kNormal; |
145 } | 145 } |
146 | 146 |
147 ///////////////////////////////////////////////////////////////////////////// | 147 ///////////////////////////////////////////////////////////////////////////// |
148 // ScrollBarThumb | 148 // ScrollBarThumb |
149 | 149 |
150 ScrollBarThumb::ScrollBarThumb(BaseScrollBar* scroll_bar) | 150 ScrollBarThumb::ScrollBarThumb(BaseScrollBar* scroll_bar) |
151 : BaseScrollBarThumb(scroll_bar), | 151 : BaseScrollBarThumb(scroll_bar), |
152 scroll_bar_(scroll_bar) { | 152 scroll_bar_(scroll_bar) { |
153 SetFocusable(false); | 153 PlatformStyle::ConfigureFocus(PlatformStyle::CONTROL::SCROLLBAR_VIEW, this); |
154 SetAccessibilityFocusable(false); | |
155 } | 154 } |
156 | 155 |
157 ScrollBarThumb::~ScrollBarThumb() { | 156 ScrollBarThumb::~ScrollBarThumb() { |
158 } | 157 } |
159 | 158 |
160 gfx::Size ScrollBarThumb::GetPreferredSize() const { | 159 gfx::Size ScrollBarThumb::GetPreferredSize() const { |
161 return GetNativeTheme()->GetPartSize(GetNativeThemePart(), | 160 return GetNativeTheme()->GetPartSize(GetNativeThemePart(), |
162 GetNativeThemeState(), | 161 GetNativeThemeState(), |
163 GetNativeThemeParams()); | 162 GetNativeThemeParams()); |
164 } | 163 } |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 thumb_params.scrollbar_thumb.is_hovering = false; | 399 thumb_params.scrollbar_thumb.is_hovering = false; |
401 gfx::Size track_size = theme->GetPartSize( | 400 gfx::Size track_size = theme->GetPartSize( |
402 ui::NativeTheme::kScrollbarVerticalThumb, | 401 ui::NativeTheme::kScrollbarVerticalThumb, |
403 ui::NativeTheme::kNormal, | 402 ui::NativeTheme::kNormal, |
404 thumb_params); | 403 thumb_params); |
405 | 404 |
406 return std::max(track_size.width(), button_size.width()); | 405 return std::max(track_size.width(), button_size.width()); |
407 } | 406 } |
408 | 407 |
409 } // namespace views | 408 } // namespace views |
OLD | NEW |