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 "base/macros.h" | 9 #include "base/macros.h" |
10 #include "ui/views/animation/scroll_animator.h" | 10 #include "ui/views/animation/scroll_animator.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 // Scroll the contents by the specified offset (contents coordinates). | 62 // Scroll the contents by the specified offset (contents coordinates). |
63 bool ScrollByContentsOffset(int contents_offset); | 63 bool ScrollByContentsOffset(int contents_offset); |
64 | 64 |
65 // Called when the thumb state has been changed from |old_state| to | 65 // Called when the thumb state has been changed from |old_state| to |
66 // |new_state|. | 66 // |new_state|. |
67 void OnThumbStateChanged(CustomButton::ButtonState old_state, | 67 void OnThumbStateChanged(CustomButton::ButtonState old_state, |
68 CustomButton::ButtonState new_state); | 68 CustomButton::ButtonState new_state); |
69 | 69 |
70 // View overrides: | 70 // View overrides: |
71 gfx::Size GetPreferredSize() const override = 0; | |
72 void Layout() override = 0; | |
73 bool OnMousePressed(const ui::MouseEvent& event) override; | 71 bool OnMousePressed(const ui::MouseEvent& event) override; |
74 void OnMouseReleased(const ui::MouseEvent& event) override; | 72 void OnMouseReleased(const ui::MouseEvent& event) override; |
75 void OnMouseCaptureLost() override; | 73 void OnMouseCaptureLost() override; |
76 void OnMouseEntered(const ui::MouseEvent& event) override; | 74 void OnMouseEntered(const ui::MouseEvent& event) override; |
77 void OnMouseExited(const ui::MouseEvent& event) override; | 75 void OnMouseExited(const ui::MouseEvent& event) override; |
78 bool OnKeyPressed(const ui::KeyEvent& event) override; | 76 bool OnKeyPressed(const ui::KeyEvent& event) override; |
79 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; | 77 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; |
80 | 78 |
81 // ui::EventHandler overrides: | 79 // ui::EventHandler overrides: |
82 void OnGestureEvent(ui::GestureEvent* event) override; | 80 void OnGestureEvent(ui::GestureEvent* event) override; |
(...skipping 12 matching lines...) Expand all Loading... |
95 void ShowContextMenuForView(View* source, | 93 void ShowContextMenuForView(View* source, |
96 const gfx::Point& point, | 94 const gfx::Point& point, |
97 ui::MenuSourceType source_type) override; | 95 ui::MenuSourceType source_type) override; |
98 | 96 |
99 // Menu::Delegate overrides: | 97 // Menu::Delegate overrides: |
100 base::string16 GetLabel(int id) const override; | 98 base::string16 GetLabel(int id) const override; |
101 bool IsCommandEnabled(int id) const override; | 99 bool IsCommandEnabled(int id) const override; |
102 void ExecuteCommand(int id) override; | 100 void ExecuteCommand(int id) override; |
103 | 101 |
104 protected: | 102 protected: |
105 // View overrides: | |
106 void OnPaint(gfx::Canvas* canvas) override = 0; | |
107 | |
108 BaseScrollBarThumb* GetThumb() const; | 103 BaseScrollBarThumb* GetThumb() const; |
109 CustomButton::ButtonState GetThumbTrackState() const; | 104 CustomButton::ButtonState GetThumbTrackState() const; |
110 | 105 |
111 // Wrapper functions that calls the controller. We need this since native | 106 // Wrapper functions that calls the controller. We need this since native |
112 // scrollbars wrap around a different scrollbar. When calling the controller | 107 // scrollbars wrap around a different scrollbar. When calling the controller |
113 // we need to pass in the appropriate scrollbar. For normal scrollbars it's | 108 // we need to pass in the appropriate scrollbar. For normal scrollbars it's |
114 // the |this| scrollbar, for native scrollbars it's the native scrollbar used | 109 // the |this| scrollbar, for native scrollbars it's the native scrollbar used |
115 // to create this. | 110 // to create this. |
116 virtual void ScrollToPosition(int position); | 111 virtual void ScrollToPosition(int position); |
117 virtual int GetScrollIncrement(bool is_page, bool is_positive); | 112 virtual int GetScrollIncrement(bool is_page, bool is_positive); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // TODO(tdresser): This should be removed when raw pixel scrolling for views | 185 // TODO(tdresser): This should be removed when raw pixel scrolling for views |
191 // is enabled. See crbug.com/329354. | 186 // is enabled. See crbug.com/329354. |
192 gfx::Vector2dF roundoff_error_; | 187 gfx::Vector2dF roundoff_error_; |
193 | 188 |
194 DISALLOW_COPY_AND_ASSIGN(BaseScrollBar); | 189 DISALLOW_COPY_AND_ASSIGN(BaseScrollBar); |
195 }; | 190 }; |
196 | 191 |
197 } // namespace views | 192 } // namespace views |
198 | 193 |
199 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ | 194 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ |
OLD | NEW |