Chromium Code Reviews| 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" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 13 #include "ui/views/controls/scrollbar/scroll_bar.h" | 14 #include "ui/views/controls/scrollbar/scroll_bar.h" |
| 14 | 15 |
| 15 namespace views { | 16 namespace views { |
| 16 | 17 |
| 17 ///////////////////////////////////////////////////////////////////////////// | 18 ///////////////////////////////////////////////////////////////////////////// |
| 18 // | 19 // |
| 19 // ScrollView class | 20 // ScrollView class |
| 20 // | 21 // |
| 21 // A ScrollView is used to make any View scrollable. The view is added to | 22 // A ScrollView is used to make any View scrollable. The view is added to |
| 22 // a viewport which takes care of clipping. | 23 // a viewport which takes care of clipping. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 | 62 |
| 62 // Returns whether or not the ScrollView is bounded (as set by ClipHeightTo). | 63 // Returns whether or not the ScrollView is bounded (as set by ClipHeightTo). |
| 63 bool is_bounded() const { return max_height_ >= 0 && min_height_ >= 0; } | 64 bool is_bounded() const { return max_height_ >= 0 && min_height_ >= 0; } |
| 64 | 65 |
| 65 // Retrieves the width/height of scrollbars. These return 0 if the scrollbar | 66 // Retrieves the width/height of scrollbars. These return 0 if the scrollbar |
| 66 // has not yet been created. | 67 // has not yet been created. |
| 67 int GetScrollBarWidth() const; | 68 int GetScrollBarWidth() const; |
| 68 int GetScrollBarHeight() const; | 69 int GetScrollBarHeight() const; |
| 69 | 70 |
| 70 // Returns the horizontal/vertical scrollbar. This may return NULL. | 71 // Returns the horizontal/vertical scrollbar. This may return NULL. |
| 71 const ScrollBar* horizontal_scroll_bar() const { return horiz_sb_; } | 72 const ScrollBar* horizontal_scroll_bar() const { return horiz_sb_.get(); } |
| 72 const ScrollBar* vertical_scroll_bar() const { return vert_sb_; } | 73 const ScrollBar* vertical_scroll_bar() const { return vert_sb_; } |
| 73 | 74 |
| 74 // Customize the scrollbar design. ScrollView takes the ownership of the | 75 // Customize the scrollbar design. ScrollView takes the ownership of the |
| 75 // specified ScrollBar. |horiz_sb| and |vert_sb| cannot be NULL. | 76 // specified ScrollBar. |horiz_sb| and |vert_sb| cannot be NULL. |
| 76 void SetHorizontalScrollBar(ScrollBar* horiz_sb); | 77 void SetHorizontalScrollBar(ScrollBar* horiz_sb); |
| 77 void SetVerticalScrollBar(ScrollBar* vert_sb); | 78 void SetVerticalScrollBar(ScrollBar* vert_sb); |
| 78 | 79 |
| 79 // View overrides: | 80 // View overrides: |
| 80 gfx::Size GetPreferredSize() const override; | 81 gfx::Size GetPreferredSize() const override; |
| 81 int GetHeightForWidth(int width) const override; | 82 int GetHeightForWidth(int width) const override; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 // |contents_viewport_|. | 126 // |contents_viewport_|. |
| 126 View* contents_; | 127 View* contents_; |
| 127 View* contents_viewport_; | 128 View* contents_viewport_; |
| 128 | 129 |
| 129 // The current header and its viewport. |header_| is contained in | 130 // The current header and its viewport. |header_| is contained in |
| 130 // |header_viewport_|. | 131 // |header_viewport_|. |
| 131 View* header_; | 132 View* header_; |
| 132 View* header_viewport_; | 133 View* header_viewport_; |
| 133 | 134 |
| 134 // Horizontal scrollbar. | 135 // Horizontal scrollbar. |
| 135 ScrollBar* horiz_sb_; | 136 scoped_ptr<ScrollBar> horiz_sb_; |
|
tapted
2016/02/09 23:51:48
I don't immediately grok this bit (I may just need
spqchan
2016/02/10 00:35:16
Sorry, this wasn't supposed to be here. This is ac
| |
| 136 | 137 |
| 137 // Vertical scrollbar. | 138 // Vertical scrollbar. |
| 138 ScrollBar* vert_sb_; | 139 ScrollBar* vert_sb_; |
| 139 | 140 |
| 140 // Corner view. | 141 // Corner view. |
| 141 View* corner_view_; | 142 View* corner_view_; |
| 142 | 143 |
| 143 // The min and max height for the bounded scroll view. These are negative | 144 // The min and max height for the bounded scroll view. These are negative |
| 144 // values if the view is not bounded. | 145 // values if the view is not bounded. |
| 145 int min_height_; | 146 int min_height_; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 private: | 219 private: |
| 219 int top_margin_; | 220 int top_margin_; |
| 220 int row_height_; | 221 int row_height_; |
| 221 | 222 |
| 222 DISALLOW_COPY_AND_ASSIGN(FixedRowHeightScrollHelper); | 223 DISALLOW_COPY_AND_ASSIGN(FixedRowHeightScrollHelper); |
| 223 }; | 224 }; |
| 224 | 225 |
| 225 } // namespace views | 226 } // namespace views |
| 226 | 227 |
| 227 #endif // UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ | 228 #endif // UI_VIEWS_CONTROLS_SCROLL_VIEW_H_ |
| OLD | NEW |