OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_H_ | |
6 #define UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "base/gtest_prod_util.h" | |
12 #include "base/macros.h" | |
13 #include "ui/views/controls/scrollbar/scroll_bar.h" | |
14 #include "ui/views/view.h" | |
15 | |
16 namespace ui { | |
17 class NativeTheme; | |
18 } | |
19 | |
20 namespace views { | |
21 namespace test { | |
22 class ScrollViewTestApi; | |
23 } | |
24 | |
25 class NativeScrollBarWrapper; | |
26 | |
27 // The NativeScrollBar class is a scrollbar that uses platform's | |
28 // native control. | |
29 class VIEWS_EXPORT NativeScrollBar : public ScrollBar { | |
30 public: | |
31 // The scroll-bar's class name. | |
32 static const char kViewClassName[]; | |
33 | |
34 // Create new scrollbar, either horizontal or vertical. | |
35 explicit NativeScrollBar(bool is_horiz); | |
36 ~NativeScrollBar() override; | |
37 | |
38 // Return the system sizes. | |
39 static int GetHorizontalScrollBarHeight(const ui::NativeTheme* theme); | |
40 static int GetVerticalScrollBarWidth(const ui::NativeTheme* theme); | |
41 | |
42 private: | |
43 friend class NativeScrollBarTest; | |
44 friend class test::ScrollViewTestApi; | |
45 FRIEND_TEST_ALL_PREFIXES(NativeScrollBarTest, Scrolling); | |
46 | |
47 // Overridden from View. | |
48 gfx::Size GetPreferredSize() const override; | |
49 void Layout() override; | |
50 void ViewHierarchyChanged( | |
51 const ViewHierarchyChangedDetails& details) override; | |
52 const char* GetClassName() const override; | |
53 | |
54 // Overrideen from View for keyboard UI purpose. | |
55 bool OnKeyPressed(const ui::KeyEvent& event) override; | |
56 bool OnMouseWheel(const ui::MouseWheelEvent& e) override; | |
57 | |
58 // Overridden from ui::EventHandler. | |
59 void OnGestureEvent(ui::GestureEvent* event) override; | |
60 | |
61 // Overridden from ScrollBar. | |
62 void Update(int viewport_size, int content_size, int current_pos) override; | |
63 int GetPosition() const override; | |
64 int GetLayoutSize() const override; | |
65 | |
66 // init border | |
67 NativeScrollBarWrapper* native_wrapper_; | |
68 | |
69 DISALLOW_COPY_AND_ASSIGN(NativeScrollBar); | |
70 }; | |
71 | |
72 } // namespace views | |
73 | |
74 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_H_ | |
OLD | NEW |