| 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_SCROLL_BAR_H_ | 5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_SCROLL_BAR_H_ |
| 6 #define UI_VIEWS_CONTROLS_SCROLLBAR_SCROLL_BAR_H_ | 6 #define UI_VIEWS_CONTROLS_SCROLLBAR_SCROLL_BAR_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // current position | 74 // current position |
| 75 virtual void Update(int viewport_size, int content_size, int current_pos); | 75 virtual void Update(int viewport_size, int content_size, int current_pos); |
| 76 | 76 |
| 77 // Returns the max and min positions. | 77 // Returns the max and min positions. |
| 78 int GetMaxPosition() const; | 78 int GetMaxPosition() const; |
| 79 int GetMinPosition() const; | 79 int GetMinPosition() const; |
| 80 | 80 |
| 81 // Returns the position of the scrollbar. | 81 // Returns the position of the scrollbar. |
| 82 virtual int GetPosition() const = 0; | 82 virtual int GetPosition() const = 0; |
| 83 | 83 |
| 84 // Get the width or height of this scrollbar, for use in layout calculations. | 84 // Get the width or height of this scrollbar. For a vertical scrollbar, this |
| 85 // For a vertical scrollbar, this is the width of the scrollbar, likewise it | 85 // is the width of the scrollbar, likewise it is the height for a horizontal |
| 86 // is the height for a horizontal scrollbar. | 86 // scrollbar. |
| 87 virtual int GetLayoutSize() const = 0; | 87 virtual int GetThickness() const = 0; |
| 88 | 88 |
| 89 // Get the width or height for this scrollbar which overlaps with the content. | 89 // Returns true if the scrollbar should sit on top of the content area (e.g. |
| 90 // Default is 0. | 90 // for overlay scrollbars). |
| 91 virtual int GetContentOverlapSize() const; | 91 virtual bool OverlapsContent() const = 0; |
| 92 | 92 |
| 93 // Called when a ScrollEvent (in any, or no, direction) is seen by the parent | 93 // Called when a ScrollEvent (in any, or no, direction) is seen by the parent |
| 94 // ScrollView. E.g., this may reveal an overlay scrollbar to indicate | 94 // ScrollView. E.g., this may reveal an overlay scrollbar to indicate |
| 95 // possible scrolling directions to the user. | 95 // possible scrolling directions to the user. |
| 96 virtual void ObserveScrollEvent(const ui::ScrollEvent& event); | 96 virtual void ObserveScrollEvent(const ui::ScrollEvent& event); |
| 97 | 97 |
| 98 protected: | 98 protected: |
| 99 // Create new scrollbar, either horizontal or vertical. These are protected | 99 // Create new scrollbar, either horizontal or vertical. These are protected |
| 100 // since you need to be creating either a NativeScrollBar or a | 100 // since you need to be creating either a NativeScrollBar or a |
| 101 // ImageScrollBar. | 101 // ImageScrollBar. |
| 102 explicit ScrollBar(bool is_horiz); | 102 explicit ScrollBar(bool is_horiz); |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 const bool is_horiz_; | 105 const bool is_horiz_; |
| 106 | 106 |
| 107 ScrollBarController* controller_; | 107 ScrollBarController* controller_; |
| 108 | 108 |
| 109 int max_pos_; | 109 int max_pos_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(ScrollBar); | 111 DISALLOW_COPY_AND_ASSIGN(ScrollBar); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace views | 114 } // namespace views |
| 115 | 115 |
| 116 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_SCROLL_BAR_H_ | 116 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_SCROLL_BAR_H_ |
| OLD | NEW |