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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 void set_hide_horizontal_scrollbar(bool visible) { | 52 void set_hide_horizontal_scrollbar(bool visible) { |
53 hide_horizontal_scrollbar_ = visible; | 53 hide_horizontal_scrollbar_ = visible; |
54 } | 54 } |
55 | 55 |
56 // Turns this scroll view into a bounded scroll view, with a fixed height. | 56 // Turns this scroll view into a bounded scroll view, with a fixed height. |
57 // By default, a ScrollView will stretch to fill its outer container. | 57 // By default, a ScrollView will stretch to fill its outer container. |
58 void ClipHeightTo(int min_height, int max_height); | 58 void ClipHeightTo(int min_height, int max_height); |
59 | 59 |
60 // Returns whether or not the ScrollView is bounded (as set by ClipHeightTo). | 60 // Returns whether or not the ScrollView is bounded (as set by ClipHeightTo). |
61 bool is_bounded() { return max_height_ >= 0 && min_height_ >= 0; } | 61 bool is_bounded() const { return max_height_ >= 0 && min_height_ >= 0; } |
62 | 62 |
63 // Retrieves the width/height of scrollbars. These return 0 if the scrollbar | 63 // Retrieves the width/height of scrollbars. These return 0 if the scrollbar |
64 // has not yet been created. | 64 // has not yet been created. |
65 int GetScrollBarWidth() const; | 65 int GetScrollBarWidth() const; |
66 int GetScrollBarHeight() const; | 66 int GetScrollBarHeight() const; |
67 | 67 |
68 // Returns the horizontal/vertical scrollbar. This may return NULL. | 68 // Returns the horizontal/vertical scrollbar. This may return NULL. |
69 const ScrollBar* horizontal_scroll_bar() const { return horiz_sb_; } | 69 const ScrollBar* horizontal_scroll_bar() const { return horiz_sb_; } |
70 const ScrollBar* vertical_scroll_bar() const { return vert_sb_; } | 70 const ScrollBar* vertical_scroll_bar() const { return vert_sb_; } |
71 | 71 |
72 // Customize the scrollbar design. ScrollView takes the ownership of the | 72 // Customize the scrollbar design. ScrollView takes the ownership of the |
73 // specified ScrollBar. |horiz_sb| and |vert_sb| cannot be NULL. | 73 // specified ScrollBar. |horiz_sb| and |vert_sb| cannot be NULL. |
74 void SetHorizontalScrollBar(ScrollBar* horiz_sb); | 74 void SetHorizontalScrollBar(ScrollBar* horiz_sb); |
75 void SetVerticalScrollBar(ScrollBar* vert_sb); | 75 void SetVerticalScrollBar(ScrollBar* vert_sb); |
76 | 76 |
77 // View overrides: | 77 // View overrides: |
78 virtual gfx::Size GetPreferredSize() OVERRIDE; | 78 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
79 virtual int GetHeightForWidth(int width) OVERRIDE; | 79 virtual int GetHeightForWidth(int width) const OVERRIDE; |
80 virtual void Layout() OVERRIDE; | 80 virtual void Layout() OVERRIDE; |
81 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 81 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
82 virtual bool OnMouseWheel(const ui::MouseWheelEvent& e) OVERRIDE; | 82 virtual bool OnMouseWheel(const ui::MouseWheelEvent& e) OVERRIDE; |
83 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 83 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
84 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 84 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
85 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 85 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
86 virtual const char* GetClassName() const OVERRIDE; | 86 virtual const char* GetClassName() const OVERRIDE; |
87 | 87 |
88 // ScrollBarController overrides: | 88 // ScrollBarController overrides: |
89 virtual void ScrollToPosition(ScrollBar* source, int position) OVERRIDE; | 89 virtual void ScrollToPosition(ScrollBar* source, int position) OVERRIDE; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 private: | 215 private: |
216 int top_margin_; | 216 int top_margin_; |
217 int row_height_; | 217 int row_height_; |
218 | 218 |
219 DISALLOW_COPY_AND_ASSIGN(FixedRowHeightScrollHelper); | 219 DISALLOW_COPY_AND_ASSIGN(FixedRowHeightScrollHelper); |
220 }; | 220 }; |
221 | 221 |
222 } // namespace views | 222 } // namespace views |
223 | 223 |
224 #endif // UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ | 224 #endif // UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ |
OLD | NEW |