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_BASE_SCROLL_BAR_H_ | 5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ |
6 #define UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ | 6 #define UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "ui/views/animation/scroll_animator.h" | 9 #include "ui/views/animation/scroll_animator.h" |
10 #include "ui/views/context_menu_controller.h" | 10 #include "ui/views/context_menu_controller.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 // Scroll the contents by the specified offset (contents coordinates). | 58 // Scroll the contents by the specified offset (contents coordinates). |
59 bool ScrollByContentsOffset(int contents_offset); | 59 bool ScrollByContentsOffset(int contents_offset); |
60 | 60 |
61 // Called when the thumb state has been changed from |old_state| to | 61 // Called when the thumb state has been changed from |old_state| to |
62 // |new_state|. | 62 // |new_state|. |
63 void OnThumbStateChanged(CustomButton::ButtonState old_state, | 63 void OnThumbStateChanged(CustomButton::ButtonState old_state, |
64 CustomButton::ButtonState new_state); | 64 CustomButton::ButtonState new_state); |
65 | 65 |
66 // View overrides: | 66 // View overrides: |
67 virtual gfx::Size GetPreferredSize() const OVERRIDE = 0; | 67 virtual gfx::Size GetPreferredSize() const override = 0; |
68 virtual void Layout() OVERRIDE = 0; | 68 virtual void Layout() override = 0; |
69 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 69 virtual bool OnMousePressed(const ui::MouseEvent& event) override; |
70 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 70 virtual void OnMouseReleased(const ui::MouseEvent& event) override; |
71 virtual void OnMouseCaptureLost() OVERRIDE; | 71 virtual void OnMouseCaptureLost() override; |
72 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 72 virtual void OnMouseEntered(const ui::MouseEvent& event) override; |
73 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 73 virtual void OnMouseExited(const ui::MouseEvent& event) override; |
74 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 74 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; |
75 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; | 75 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) override; |
76 | 76 |
77 // ui::EventHandler overrides: | 77 // ui::EventHandler overrides: |
78 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 78 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
79 | 79 |
80 // ScrollBar overrides: | 80 // ScrollBar overrides: |
81 virtual void Update(int viewport_size, | 81 virtual void Update(int viewport_size, |
82 int content_size, | 82 int content_size, |
83 int contents_scroll_offset) OVERRIDE; | 83 int contents_scroll_offset) override; |
84 virtual int GetLayoutSize() const OVERRIDE = 0; | 84 virtual int GetLayoutSize() const override = 0; |
85 virtual int GetPosition() const OVERRIDE; | 85 virtual int GetPosition() const override; |
86 | 86 |
87 // ScrollDelegate overrides: | 87 // ScrollDelegate overrides: |
88 virtual bool OnScroll(float dx, float dy) OVERRIDE; | 88 virtual bool OnScroll(float dx, float dy) override; |
89 | 89 |
90 // ContextMenuController overrides: | 90 // ContextMenuController overrides: |
91 virtual void ShowContextMenuForView(View* source, | 91 virtual void ShowContextMenuForView(View* source, |
92 const gfx::Point& point, | 92 const gfx::Point& point, |
93 ui::MenuSourceType source_type) OVERRIDE; | 93 ui::MenuSourceType source_type) override; |
94 | 94 |
95 // Menu::Delegate overrides: | 95 // Menu::Delegate overrides: |
96 virtual base::string16 GetLabel(int id) const OVERRIDE; | 96 virtual base::string16 GetLabel(int id) const override; |
97 virtual bool IsCommandEnabled(int id) const OVERRIDE; | 97 virtual bool IsCommandEnabled(int id) const override; |
98 virtual void ExecuteCommand(int id) OVERRIDE; | 98 virtual void ExecuteCommand(int id) override; |
99 | 99 |
100 protected: | 100 protected: |
101 // View overrides: | 101 // View overrides: |
102 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE = 0; | 102 virtual void OnPaint(gfx::Canvas* canvas) override = 0; |
103 | 103 |
104 BaseScrollBarThumb* GetThumb() const; | 104 BaseScrollBarThumb* GetThumb() const; |
105 CustomButton::ButtonState GetThumbTrackState() const; | 105 CustomButton::ButtonState GetThumbTrackState() const; |
106 | 106 |
107 // Wrapper functions that calls the controller. We need this since native | 107 // Wrapper functions that calls the controller. We need this since native |
108 // scrollbars wrap around a different scrollbar. When calling the controller | 108 // scrollbars wrap around a different scrollbar. When calling the controller |
109 // we need to pass in the appropriate scrollbar. For normal scrollbars it's | 109 // we need to pass in the appropriate scrollbar. For normal scrollbars it's |
110 // the |this| scrollbar, for native scrollbars it's the native scrollbar used | 110 // the |this| scrollbar, for native scrollbars it's the native scrollbar used |
111 // to create this. | 111 // to create this. |
112 virtual void ScrollToPosition(int position); | 112 virtual void ScrollToPosition(int position); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // TODO(tdresser): This should be removed when raw pixel scrolling for views | 183 // TODO(tdresser): This should be removed when raw pixel scrolling for views |
184 // is enabled. See crbug.com/329354. | 184 // is enabled. See crbug.com/329354. |
185 gfx::Vector2dF roundoff_error_; | 185 gfx::Vector2dF roundoff_error_; |
186 | 186 |
187 DISALLOW_COPY_AND_ASSIGN(BaseScrollBar); | 187 DISALLOW_COPY_AND_ASSIGN(BaseScrollBar); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace views | 190 } // namespace views |
191 | 191 |
192 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ | 192 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ |
OLD | NEW |