OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_VIEWS_SCROLL_VIEW_H__ | 5 #ifndef CHROME_VIEWS_SCROLL_VIEW_H__ |
6 #define CHROME_VIEWS_SCROLL_VIEW_H__ | 6 #define CHROME_VIEWS_SCROLL_VIEW_H__ |
7 | 7 |
8 #include "chrome/views/scroll_bar.h" | 8 #include "chrome/views/scroll_bar.h" |
9 | 9 |
10 namespace views { | 10 namespace views { |
11 | 11 |
12 ///////////////////////////////////////////////////////////////////////////// | 12 ///////////////////////////////////////////////////////////////////////////// |
13 // | 13 // |
14 // ScrollView class | 14 // ScrollView class |
15 // | 15 // |
16 // A ScrollView is used to make any View scrollable. The view is added to | 16 // A ScrollView is used to make any View scrollable. The view is added to |
17 // a viewport which takes care of clipping. | 17 // a viewport which takes care of clipping. |
18 // | 18 // |
19 // In this current implementation both horizontal and vertical scrollbars are | 19 // In this current implementation both horizontal and vertical scrollbars are |
20 // added as needed. | 20 // added as needed. |
21 // | 21 // |
22 // The scrollview supports keyboard UI and mousewheel. | 22 // The scrollview supports keyboard UI and mousewheel. |
23 // | 23 // |
24 ///////////////////////////////////////////////////////////////////////////// | 24 ///////////////////////////////////////////////////////////////////////////// |
25 | 25 |
26 class ScrollView : public View, | 26 class ScrollView : public View, |
27 public ScrollBarController { | 27 public ScrollBarController { |
28 public: | 28 public: |
29 static const char* const ScrollView::kViewClassName; | 29 static const char* const kViewClassName; |
30 | 30 |
31 ScrollView(); | 31 ScrollView(); |
32 // Initialize with specific views. resize_corner is optional. | 32 // Initialize with specific views. resize_corner is optional. |
33 ScrollView(ScrollBar* horizontal_scrollbar, | 33 ScrollView(ScrollBar* horizontal_scrollbar, |
34 ScrollBar* vertical_scrollbar, | 34 ScrollBar* vertical_scrollbar, |
35 View* resize_corner); | 35 View* resize_corner); |
36 virtual ~ScrollView(); | 36 virtual ~ScrollView(); |
37 | 37 |
38 // Set the contents. Any previous contents will be deleted. The contents | 38 // Set the contents. Any previous contents will be deleted. The contents |
39 // is the view that needs to scroll. | 39 // is the view that needs to scroll. |
40 void SetContents(View* a_view); | 40 void SetContents(View* a_view); |
41 View* GetContents() const; | 41 View* GetContents() const; |
42 | 42 |
43 // Overridden to layout the viewport and scrollbars. | 43 // Overridden to layout the viewport and scrollbars. |
44 virtual void Layout(); | 44 virtual void Layout(); |
45 | 45 |
46 // Returns the visible region of the content View. | 46 // Returns the visible region of the content View. |
47 gfx::Rect GetVisibleRect() const; | 47 gfx::Rect GetVisibleRect() const; |
48 | 48 |
49 // Scrolls the minimum amount necessary to make the specified rectangle | 49 // Scrolls the minimum amount necessary to make the specified rectangle |
50 // visible, in the coordinates of the contents view. The specified rectangle | 50 // visible, in the coordinates of the contents view. The specified rectangle |
51 // is constrained by the bounds of the contents view. This has no effect if | 51 // is constrained by the bounds of the contents view. This has no effect if |
52 // the contents have not been set. | 52 // the contents have not been set. |
53 // | 53 // |
54 // Client code should use ScrollRectToVisible, which invokes this | 54 // Client code should use ScrollRectToVisible, which invokes this |
55 // appropriately. | 55 // appropriately. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 int top_margin_; | 199 int top_margin_; |
200 int row_height_; | 200 int row_height_; |
201 | 201 |
202 DISALLOW_EVIL_CONSTRUCTORS(FixedRowHeightScrollHelper); | 202 DISALLOW_EVIL_CONSTRUCTORS(FixedRowHeightScrollHelper); |
203 }; | 203 }; |
204 | 204 |
205 } // namespace views | 205 } // namespace views |
206 | 206 |
207 #endif // CHROME_VIEWS_SCROLL_VIEW_H__ | 207 #endif // CHROME_VIEWS_SCROLL_VIEW_H__ |
208 | 208 |
OLD | NEW |