changelog
[fanfix.git] / src / jexer / Scrollable.java
1 /*
2 * Jexer - Java Text User Interface
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (C) 2019 Kevin Lamonte
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
25 *
26 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
27 * @version 1
28 */
29 package jexer;
30
31 /**
32 * Scrollable provides a public API for horizontal and vertical scrollbars.
33 * Note that not all Scrollables support both horizontal and vertical
34 * scrolling; for those that only support a subset, it is expected that the
35 * methods corresponding to the missing scrollbar quietly succeed without
36 * throwing any exceptions.
37 */
38 public interface Scrollable {
39
40 /**
41 * Get the horizontal scrollbar, or null if this Viewport does not
42 * support horizontal scrolling.
43 *
44 * @return the horizontal scrollbar
45 */
46 public THScroller getHorizontalScroller();
47
48 /**
49 * Get the vertical scrollbar, or null if this Viewport does not support
50 * vertical scrolling.
51 *
52 * @return the vertical scrollbar
53 */
54 public TVScroller getVerticalScroller();
55
56 /**
57 * Get the value that corresponds to being on the top edge of the
58 * vertical scroll bar.
59 *
60 * @return the scroll value
61 */
62 public int getTopValue();
63
64 /**
65 * Set the value that corresponds to being on the top edge of the
66 * vertical scroll bar.
67 *
68 * @param topValue the new scroll value
69 */
70 public void setTopValue(final int topValue);
71
72 /**
73 * Get the value that corresponds to being on the bottom edge of the
74 * vertical scroll bar.
75 *
76 * @return the scroll value
77 */
78 public int getBottomValue();
79
80 /**
81 * Set the value that corresponds to being on the bottom edge of the
82 * vertical scroll bar.
83 *
84 * @param bottomValue the new scroll value
85 */
86 public void setBottomValue(final int bottomValue);
87
88 /**
89 * Get current value of the vertical scroll.
90 *
91 * @return the scroll value
92 */
93 public int getVerticalValue();
94
95 /**
96 * Set current value of the vertical scroll.
97 *
98 * @param value the new scroll value
99 */
100 public void setVerticalValue(final int value);
101
102 /**
103 * Get the increment for clicking on an arrow on the vertical scrollbar.
104 *
105 * @return the increment value
106 */
107 public int getVerticalSmallChange();
108
109 /**
110 * Set the increment for clicking on an arrow on the vertical scrollbar.
111 *
112 * @param smallChange the new increment value
113 */
114 public void setVerticalSmallChange(final int smallChange);
115
116 /**
117 * Get the increment for clicking in the bar between the box and an
118 * arrow on the vertical scrollbar.
119 *
120 * @return the increment value
121 */
122 public int getVerticalBigChange();
123
124 /**
125 * Set the increment for clicking in the bar between the box and an
126 * arrow on the vertical scrollbar.
127 *
128 * @param bigChange the new increment value
129 */
130 public void setVerticalBigChange(final int bigChange);
131
132 /**
133 * Perform a small step change up.
134 */
135 public void verticalDecrement();
136
137 /**
138 * Perform a small step change down.
139 */
140 public void verticalIncrement();
141
142 /**
143 * Perform a big step change up.
144 */
145 public void bigVerticalDecrement();
146
147 /**
148 * Perform a big step change down.
149 */
150 public void bigVerticalIncrement();
151
152 /**
153 * Go to the top edge of the vertical scroller.
154 */
155 public void toTop();
156
157 /**
158 * Go to the bottom edge of the vertical scroller.
159 */
160 public void toBottom();
161
162 /**
163 * Get the value that corresponds to being on the left edge of the
164 * horizontal scroll bar.
165 *
166 * @return the scroll value
167 */
168 public int getLeftValue();
169
170 /**
171 * Set the value that corresponds to being on the left edge of the
172 * horizontal scroll bar.
173 *
174 * @param leftValue the new scroll value
175 */
176 public void setLeftValue(final int leftValue);
177
178 /**
179 * Get the value that corresponds to being on the right edge of the
180 * horizontal scroll bar.
181 *
182 * @return the scroll value
183 */
184 public int getRightValue();
185
186 /**
187 * Set the value that corresponds to being on the right edge of the
188 * horizontal scroll bar.
189 *
190 * @param rightValue the new scroll value
191 */
192 public void setRightValue(final int rightValue);
193
194 /**
195 * Get current value of the horizontal scroll.
196 *
197 * @return the scroll value
198 */
199 public int getHorizontalValue();
200
201 /**
202 * Set current value of the horizontal scroll.
203 *
204 * @param value the new scroll value
205 */
206 public void setHorizontalValue(final int value);
207
208 /**
209 * Get the increment for clicking on an arrow on the horizontal
210 * scrollbar.
211 *
212 * @return the increment value
213 */
214 public int getHorizontalSmallChange();
215
216 /**
217 * Set the increment for clicking on an arrow on the horizontal
218 * scrollbar.
219 *
220 * @param smallChange the new increment value
221 */
222 public void setHorizontalSmallChange(final int smallChange);
223
224 /**
225 * Get the increment for clicking in the bar between the box and an
226 * arrow on the horizontal scrollbar.
227 *
228 * @return the increment value
229 */
230 public int getHorizontalBigChange();
231
232 /**
233 * Set the increment for clicking in the bar between the box and an
234 * arrow on the horizontal scrollbar.
235 *
236 * @param bigChange the new increment value
237 */
238 public void setHorizontalBigChange(final int bigChange);
239
240 /**
241 * Perform a small step change left.
242 */
243 public void horizontalDecrement();
244
245 /**
246 * Perform a small step change right.
247 */
248 public void horizontalIncrement();
249
250 /**
251 * Perform a big step change left.
252 */
253 public void bigHorizontalDecrement();
254
255 /**
256 * Perform a big step change right.
257 */
258 public void bigHorizontalIncrement();
259
260 /**
261 * Go to the left edge of the horizontal scroller.
262 */
263 public void toLeft();
264
265 /**
266 * Go to the right edge of the horizontal scroller.
267 */
268 public void toRight();
269
270 /**
271 * Go to the top-left edge of the horizontal and vertical scrollers.
272 */
273 public void toHome();
274
275 /**
276 * Go to the bottom-right edge of the horizontal and vertical scrollers.
277 */
278 public void toEnd();
279
280 }