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