| 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_SCROLL_VIEW_H_ | 5 #ifndef UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ |
| 6 #define UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ | 6 #define UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 // Returns the horizontal/vertical scrollbar. This may return NULL. | 82 // Returns the horizontal/vertical scrollbar. This may return NULL. |
| 83 const ScrollBar* horizontal_scroll_bar() const { return horiz_sb_; } | 83 const ScrollBar* horizontal_scroll_bar() const { return horiz_sb_; } |
| 84 const ScrollBar* vertical_scroll_bar() const { return vert_sb_; } | 84 const ScrollBar* vertical_scroll_bar() const { return vert_sb_; } |
| 85 | 85 |
| 86 // Customize the scrollbar design. ScrollView takes the ownership of the | 86 // Customize the scrollbar design. ScrollView takes the ownership of the |
| 87 // specified ScrollBar. |horiz_sb| and |vert_sb| cannot be NULL. | 87 // specified ScrollBar. |horiz_sb| and |vert_sb| cannot be NULL. |
| 88 void SetHorizontalScrollBar(ScrollBar* horiz_sb); | 88 void SetHorizontalScrollBar(ScrollBar* horiz_sb); |
| 89 void SetVerticalScrollBar(ScrollBar* vert_sb); | 89 void SetVerticalScrollBar(ScrollBar* vert_sb); |
| 90 | 90 |
| 91 // Sets whether this ScrollView has a focus ring or not. |
| 92 void SetHasFocusRing(bool has_focus_ring); |
| 93 |
| 91 // View overrides: | 94 // View overrides: |
| 92 gfx::Size GetPreferredSize() const override; | 95 gfx::Size GetPreferredSize() const override; |
| 93 int GetHeightForWidth(int width) const override; | 96 int GetHeightForWidth(int width) const override; |
| 94 void Layout() override; | 97 void Layout() override; |
| 95 bool OnKeyPressed(const ui::KeyEvent& event) override; | 98 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 96 bool OnMouseWheel(const ui::MouseWheelEvent& e) override; | 99 bool OnMouseWheel(const ui::MouseWheelEvent& e) override; |
| 97 void OnMouseEntered(const ui::MouseEvent& event) override; | 100 void OnMouseEntered(const ui::MouseEvent& event) override; |
| 98 void OnMouseExited(const ui::MouseEvent& event) override; | 101 void OnMouseExited(const ui::MouseEvent& event) override; |
| 99 void OnScrollEvent(ui::ScrollEvent* event) override; | 102 void OnScrollEvent(ui::ScrollEvent* event) override; |
| 100 void OnGestureEvent(ui::GestureEvent* event) override; | 103 void OnGestureEvent(ui::GestureEvent* event) override; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 int max_height_; | 177 int max_height_; |
| 175 | 178 |
| 176 // The background color given to the viewport (for overscroll), and to the | 179 // The background color given to the viewport (for overscroll), and to the |
| 177 // contents when scrolling with layers. | 180 // contents when scrolling with layers. |
| 178 SkColor background_color_; | 181 SkColor background_color_; |
| 179 | 182 |
| 180 // If true, never show the horizontal scrollbar (even if the contents is wider | 183 // If true, never show the horizontal scrollbar (even if the contents is wider |
| 181 // than the viewport). | 184 // than the viewport). |
| 182 bool hide_horizontal_scrollbar_; | 185 bool hide_horizontal_scrollbar_; |
| 183 | 186 |
| 187 // Focus ring, if one is installed. |
| 188 View* focus_ring_ = nullptr; |
| 189 |
| 184 DISALLOW_COPY_AND_ASSIGN(ScrollView); | 190 DISALLOW_COPY_AND_ASSIGN(ScrollView); |
| 185 }; | 191 }; |
| 186 | 192 |
| 187 // VariableRowHeightScrollHelper is intended for views that contain rows of | 193 // VariableRowHeightScrollHelper is intended for views that contain rows of |
| 188 // varying height. To use a VariableRowHeightScrollHelper create one supplying | 194 // varying height. To use a VariableRowHeightScrollHelper create one supplying |
| 189 // a Controller and delegate GetPageScrollIncrement and GetLineScrollIncrement | 195 // a Controller and delegate GetPageScrollIncrement and GetLineScrollIncrement |
| 190 // to the helper. VariableRowHeightScrollHelper calls back to the | 196 // to the helper. VariableRowHeightScrollHelper calls back to the |
| 191 // Controller to determine row boundaries. | 197 // Controller to determine row boundaries. |
| 192 class VariableRowHeightScrollHelper { | 198 class VariableRowHeightScrollHelper { |
| 193 public: | 199 public: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 private: | 256 private: |
| 251 int top_margin_; | 257 int top_margin_; |
| 252 int row_height_; | 258 int row_height_; |
| 253 | 259 |
| 254 DISALLOW_COPY_AND_ASSIGN(FixedRowHeightScrollHelper); | 260 DISALLOW_COPY_AND_ASSIGN(FixedRowHeightScrollHelper); |
| 255 }; | 261 }; |
| 256 | 262 |
| 257 } // namespace views | 263 } // namespace views |
| 258 | 264 |
| 259 #endif // UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ | 265 #endif // UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ |
| OLD | NEW |