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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 class ScrollBarButton : public BaseScrollBarButton { | 23 class ScrollBarButton : public BaseScrollBarButton { |
24 public: | 24 public: |
25 enum Type { | 25 enum Type { |
26 UP, | 26 UP, |
27 DOWN, | 27 DOWN, |
28 LEFT, | 28 LEFT, |
29 RIGHT, | 29 RIGHT, |
30 }; | 30 }; |
31 | 31 |
32 ScrollBarButton(ButtonListener* listener, Type type); | 32 ScrollBarButton(ButtonListener* listener, Type type); |
33 virtual ~ScrollBarButton(); | 33 ~ScrollBarButton() override; |
34 | 34 |
35 virtual gfx::Size GetPreferredSize() const override; | 35 gfx::Size GetPreferredSize() const override; |
36 virtual const char* GetClassName() const override { | 36 const char* GetClassName() const override { return "ScrollBarButton"; } |
37 return "ScrollBarButton"; | |
38 } | |
39 | 37 |
40 protected: | 38 protected: |
41 virtual void OnPaint(gfx::Canvas* canvas) override; | 39 void OnPaint(gfx::Canvas* canvas) override; |
42 | 40 |
43 private: | 41 private: |
44 ui::NativeTheme::ExtraParams GetNativeThemeParams() const; | 42 ui::NativeTheme::ExtraParams GetNativeThemeParams() const; |
45 ui::NativeTheme::Part GetNativeThemePart() const; | 43 ui::NativeTheme::Part GetNativeThemePart() const; |
46 ui::NativeTheme::State GetNativeThemeState() const; | 44 ui::NativeTheme::State GetNativeThemeState() const; |
47 | 45 |
48 Type type_; | 46 Type type_; |
49 }; | 47 }; |
50 | 48 |
51 // Wrapper for the scroll thumb | 49 // Wrapper for the scroll thumb |
52 class ScrollBarThumb : public BaseScrollBarThumb { | 50 class ScrollBarThumb : public BaseScrollBarThumb { |
53 public: | 51 public: |
54 explicit ScrollBarThumb(BaseScrollBar* scroll_bar); | 52 explicit ScrollBarThumb(BaseScrollBar* scroll_bar); |
55 virtual ~ScrollBarThumb(); | 53 ~ScrollBarThumb() override; |
56 | 54 |
57 virtual gfx::Size GetPreferredSize() const override; | 55 gfx::Size GetPreferredSize() const override; |
58 virtual const char* GetClassName() const override { | 56 const char* GetClassName() const override { return "ScrollBarThumb"; } |
59 return "ScrollBarThumb"; | |
60 } | |
61 | 57 |
62 protected: | 58 protected: |
63 virtual void OnPaint(gfx::Canvas* canvas) override; | 59 void OnPaint(gfx::Canvas* canvas) override; |
64 | 60 |
65 private: | 61 private: |
66 ui::NativeTheme::ExtraParams GetNativeThemeParams() const; | 62 ui::NativeTheme::ExtraParams GetNativeThemeParams() const; |
67 ui::NativeTheme::Part GetNativeThemePart() const; | 63 ui::NativeTheme::Part GetNativeThemePart() const; |
68 ui::NativeTheme::State GetNativeThemeState() const; | 64 ui::NativeTheme::State GetNativeThemeState() const; |
69 | 65 |
70 ScrollBar* scroll_bar_; | 66 ScrollBar* scroll_bar_; |
71 }; | 67 }; |
72 | 68 |
73 ///////////////////////////////////////////////////////////////////////////// | 69 ///////////////////////////////////////////////////////////////////////////// |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 thumb_params.scrollbar_thumb.is_hovering = false; | 411 thumb_params.scrollbar_thumb.is_hovering = false; |
416 gfx::Size track_size = theme->GetPartSize( | 412 gfx::Size track_size = theme->GetPartSize( |
417 ui::NativeTheme::kScrollbarVerticalThumb, | 413 ui::NativeTheme::kScrollbarVerticalThumb, |
418 ui::NativeTheme::kNormal, | 414 ui::NativeTheme::kNormal, |
419 thumb_params); | 415 thumb_params); |
420 | 416 |
421 return std::max(track_size.width(), button_size.width()); | 417 return std::max(track_size.width(), button_size.width()); |
422 } | 418 } |
423 | 419 |
424 } // namespace views | 420 } // namespace views |
OLD | NEW |