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 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_ | 5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_ |
6 #define UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_ | 6 #define UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "ui/gfx/point.h" | 9 #include "ui/gfx/point.h" |
10 #include "ui/native_theme/native_theme.h" | 10 #include "ui/native_theme/native_theme.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // Views implementation for the scrollbar. | 24 // Views implementation for the scrollbar. |
25 class VIEWS_EXPORT NativeScrollBarViews : public BaseScrollBar, | 25 class VIEWS_EXPORT NativeScrollBarViews : public BaseScrollBar, |
26 public ButtonListener, | 26 public ButtonListener, |
27 public NativeScrollBarWrapper { | 27 public NativeScrollBarWrapper { |
28 public: | 28 public: |
29 static const char kViewClassName[]; | 29 static const char kViewClassName[]; |
30 | 30 |
31 // Creates new scrollbar, either horizontal or vertical. | 31 // Creates new scrollbar, either horizontal or vertical. |
32 explicit NativeScrollBarViews(NativeScrollBar* native_scroll_bar); | 32 explicit NativeScrollBarViews(NativeScrollBar* native_scroll_bar); |
33 virtual ~NativeScrollBarViews(); | 33 ~NativeScrollBarViews() override; |
34 | 34 |
35 private: | 35 private: |
36 // View overrides: | 36 // View overrides: |
37 virtual void Layout() override; | 37 void Layout() override; |
38 virtual void OnPaint(gfx::Canvas* canvas) override; | 38 void OnPaint(gfx::Canvas* canvas) override; |
39 virtual gfx::Size GetPreferredSize() const override; | 39 gfx::Size GetPreferredSize() const override; |
40 virtual const char* GetClassName() const override; | 40 const char* GetClassName() const override; |
41 | 41 |
42 // ScrollBar overrides: | 42 // ScrollBar overrides: |
43 virtual int GetLayoutSize() const override; | 43 int GetLayoutSize() const override; |
44 | 44 |
45 // BaseScrollBar overrides: | 45 // BaseScrollBar overrides: |
46 virtual void ScrollToPosition(int position) override; | 46 void ScrollToPosition(int position) override; |
47 virtual int GetScrollIncrement(bool is_page, bool is_positive) override; | 47 int GetScrollIncrement(bool is_page, bool is_positive) override; |
48 | 48 |
49 // BaseButton::ButtonListener overrides: | 49 // BaseButton::ButtonListener overrides: |
50 virtual void ButtonPressed(Button* sender, | 50 void ButtonPressed(Button* sender, const ui::Event& event) override; |
51 const ui::Event& event) override; | |
52 | 51 |
53 // NativeScrollBarWrapper overrides: | 52 // NativeScrollBarWrapper overrides: |
54 virtual int GetPosition() const override; | 53 int GetPosition() const override; |
55 virtual View* GetView() override; | 54 View* GetView() override; |
56 virtual void Update(int viewport_size, | 55 void Update(int viewport_size, int content_size, int current_pos) override; |
57 int content_size, | |
58 int current_pos) override; | |
59 | 56 |
60 // Returns the area for the track. This is the area of the scrollbar minus | 57 // Returns the area for the track. This is the area of the scrollbar minus |
61 // the size of the arrow buttons. | 58 // the size of the arrow buttons. |
62 virtual gfx::Rect GetTrackBounds() const override; | 59 gfx::Rect GetTrackBounds() const override; |
63 | 60 |
64 // The NativeScrollBar we are bound to. | 61 // The NativeScrollBar we are bound to. |
65 NativeScrollBar* native_scroll_bar_; | 62 NativeScrollBar* native_scroll_bar_; |
66 | 63 |
67 // The scroll bar buttons (Up/Down, Left/Right). | 64 // The scroll bar buttons (Up/Down, Left/Right). |
68 Button* prev_button_; | 65 Button* prev_button_; |
69 Button* next_button_; | 66 Button* next_button_; |
70 | 67 |
71 ui::NativeTheme::ExtraParams params_; | 68 ui::NativeTheme::ExtraParams params_; |
72 ui::NativeTheme::Part part_; | 69 ui::NativeTheme::Part part_; |
73 ui::NativeTheme::State state_; | 70 ui::NativeTheme::State state_; |
74 | 71 |
75 DISALLOW_COPY_AND_ASSIGN(NativeScrollBarViews); | 72 DISALLOW_COPY_AND_ASSIGN(NativeScrollBarViews); |
76 }; | 73 }; |
77 | 74 |
78 } // namespace views | 75 } // namespace views |
79 | 76 |
80 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_ | 77 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_ |
OLD | NEW |