1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.support.v4.view;
18 
19 /**
20  * An interface that can be implemented by Views to provide scroll related APIs.
21  */
22 public interface ScrollingView {
23     /**
24      * <p>Compute the horizontal range that the horizontal scrollbar
25      * represents.</p>
26      *
27      * <p>The range is expressed in arbitrary units that must be the same as the
28      * units used by {@link #computeHorizontalScrollExtent()} and
29      * {@link #computeHorizontalScrollOffset()}.</p>
30      *
31      * <p>The default range is the drawing width of this view.</p>
32      *
33      * @return the total horizontal range represented by the horizontal
34      *         scrollbar
35      *
36      * @see #computeHorizontalScrollExtent()
37      * @see #computeHorizontalScrollOffset()
38      * @see android.widget.ScrollBarDrawable
39      */
computeHorizontalScrollRange()40     int computeHorizontalScrollRange();
41 
42     /**
43      * <p>Compute the horizontal offset of the horizontal scrollbar's thumb
44      * within the horizontal range. This value is used to compute the position
45      * of the thumb within the scrollbar's track.</p>
46      *
47      * <p>The range is expressed in arbitrary units that must be the same as the
48      * units used by {@link #computeHorizontalScrollRange()} and
49      * {@link #computeHorizontalScrollExtent()}.</p>
50      *
51      * <p>The default offset is the scroll offset of this view.</p>
52      *
53      * @return the horizontal offset of the scrollbar's thumb
54      *
55      * @see #computeHorizontalScrollRange()
56      * @see #computeHorizontalScrollExtent()
57      * @see android.widget.ScrollBarDrawable
58      */
computeHorizontalScrollOffset()59     int computeHorizontalScrollOffset();
60 
61     /**
62      * <p>Compute the horizontal extent of the horizontal scrollbar's thumb
63      * within the horizontal range. This value is used to compute the length
64      * of the thumb within the scrollbar's track.</p>
65      *
66      * <p>The range is expressed in arbitrary units that must be the same as the
67      * units used by {@link #computeHorizontalScrollRange()} and
68      * {@link #computeHorizontalScrollOffset()}.</p>
69      *
70      * <p>The default extent is the drawing width of this view.</p>
71      *
72      * @return the horizontal extent of the scrollbar's thumb
73      *
74      * @see #computeHorizontalScrollRange()
75      * @see #computeHorizontalScrollOffset()
76      * @see android.widget.ScrollBarDrawable
77      */
computeHorizontalScrollExtent()78     int computeHorizontalScrollExtent();
79 
80     /**
81      * <p>Compute the vertical range that the vertical scrollbar represents.</p>
82      *
83      * <p>The range is expressed in arbitrary units that must be the same as the
84      * units used by {@link #computeVerticalScrollExtent()} and
85      * {@link #computeVerticalScrollOffset()}.</p>
86      *
87      * @return the total vertical range represented by the vertical scrollbar
88      *
89      * <p>The default range is the drawing height of this view.</p>
90      *
91      * @see #computeVerticalScrollExtent()
92      * @see #computeVerticalScrollOffset()
93      * @see android.widget.ScrollBarDrawable
94      */
computeVerticalScrollRange()95     int computeVerticalScrollRange();
96 
97     /**
98      * <p>Compute the vertical offset of the vertical scrollbar's thumb
99      * within the horizontal range. This value is used to compute the position
100      * of the thumb within the scrollbar's track.</p>
101      *
102      * <p>The range is expressed in arbitrary units that must be the same as the
103      * units used by {@link #computeVerticalScrollRange()} and
104      * {@link #computeVerticalScrollExtent()}.</p>
105      *
106      * <p>The default offset is the scroll offset of this view.</p>
107      *
108      * @return the vertical offset of the scrollbar's thumb
109      *
110      * @see #computeVerticalScrollRange()
111      * @see #computeVerticalScrollExtent()
112      * @see android.widget.ScrollBarDrawable
113      */
computeVerticalScrollOffset()114     int computeVerticalScrollOffset();
115 
116     /**
117      * <p>Compute the vertical extent of the vertical scrollbar's thumb
118      * within the vertical range. This value is used to compute the length
119      * of the thumb within the scrollbar's track.</p>
120      *
121      * <p>The range is expressed in arbitrary units that must be the same as the
122      * units used by {@link #computeVerticalScrollRange()} and
123      * {@link #computeVerticalScrollOffset()}.</p>
124      *
125      * <p>The default extent is the drawing height of this view.</p>
126      *
127      * @return the vertical extent of the scrollbar's thumb
128      *
129      * @see #computeVerticalScrollRange()
130      * @see #computeVerticalScrollOffset()
131      * @see android.widget.ScrollBarDrawable
132      */
computeVerticalScrollExtent()133     int computeVerticalScrollExtent();
134 }
135