Commit | Line | Data |
---|---|---|
56661844 KL |
1 | /* |
2 | * Jexer - Java Text User Interface | |
3 | * | |
4 | * The MIT License (MIT) | |
5 | * | |
6 | * Copyright (C) 2017 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 | import jexer.event.TKeypressEvent; | |
32 | import jexer.event.TMouseEvent; | |
33 | import static jexer.TKeypress.*; | |
34 | ||
35 | /** | |
36 | * Scrollable provides a public API for horizontal and vertical scrollbars. | |
37 | * Note that not all Scrollables support both horizontal and vertical | |
38 | * scrolling; for those that only support a subset, it is expected that the | |
39 | * methods corresponding to the missing scrollbar quietly succeed without | |
40 | * throwing any exceptions. | |
41 | */ | |
42 | public interface Scrollable { | |
43 | ||
44 | /** | |
45 | * Get the horizontal scrollbar, or null if this Viewport does not | |
46 | * support horizontal scrolling. | |
47 | * | |
48 | * @return the horizontal scrollbar | |
49 | */ | |
50 | public THScroller getHorizontalScroller(); | |
51 | ||
52 | /** | |
53 | * Get the vertical scrollbar, or null if this Viewport does not support | |
54 | * vertical scrolling. | |
55 | * | |
56 | * @return the vertical scrollbar | |
57 | */ | |
58 | public TVScroller getVerticalScroller(); | |
59 | ||
60 | /** | |
61 | * Get the value that corresponds to being on the top edge of the | |
62 | * vertical scroll bar. | |
63 | * | |
64 | * @return the scroll value | |
65 | */ | |
66 | public int getTopValue(); | |
67 | ||
68 | /** | |
69 | * Set the value that corresponds to being on the top edge of the | |
70 | * vertical scroll bar. | |
71 | * | |
72 | * @param topValue the new scroll value | |
73 | */ | |
74 | public void setTopValue(final int topValue); | |
75 | ||
76 | /** | |
77 | * Get the value that corresponds to being on the bottom edge of the | |
78 | * vertical scroll bar. | |
79 | * | |
80 | * @return the scroll value | |
81 | */ | |
82 | public int getBottomValue(); | |
83 | ||
84 | /** | |
85 | * Set the value that corresponds to being on the bottom edge of the | |
86 | * vertical scroll bar. | |
87 | * | |
88 | * @param bottomValue the new scroll value | |
89 | */ | |
90 | public void setBottomValue(final int bottomValue); | |
91 | ||
92 | /** | |
93 | * Get current value of the vertical scroll. | |
94 | * | |
95 | * @return the scroll value | |
96 | */ | |
97 | public int getVerticalValue(); | |
98 | ||
99 | /** | |
100 | * Set current value of the vertical scroll. | |
101 | * | |
102 | * @param value the new scroll value | |
103 | */ | |
104 | public void setVerticalValue(final int value); | |
105 | ||
106 | /** | |
107 | * Get the increment for clicking on an arrow on the vertical scrollbar. | |
108 | * | |
109 | * @return the increment value | |
110 | */ | |
111 | public int getVerticalSmallChange(); | |
112 | ||
113 | /** | |
114 | * Set the increment for clicking on an arrow on the vertical scrollbar. | |
115 | * | |
116 | * @param smallChange the new increment value | |
117 | */ | |
118 | public void setVerticalSmallChange(final int smallChange); | |
119 | ||
120 | /** | |
121 | * Get the increment for clicking in the bar between the box and an | |
122 | * arrow on the vertical scrollbar. | |
123 | * | |
124 | * @return the increment value | |
125 | */ | |
126 | public int getVerticalBigChange(); | |
127 | ||
128 | /** | |
129 | * Set the increment for clicking in the bar between the box and an | |
130 | * arrow on the vertical scrollbar. | |
131 | * | |
132 | * @param bigChange the new increment value | |
133 | */ | |
134 | public void setVerticalBigChange(final int bigChange); | |
135 | ||
136 | /** | |
137 | * Perform a small step change up. | |
138 | */ | |
139 | public void verticalDecrement(); | |
140 | ||
141 | /** | |
142 | * Perform a small step change down. | |
143 | */ | |
144 | public void verticalIncrement(); | |
145 | ||
146 | /** | |
147 | * Perform a big step change up. | |
148 | */ | |
149 | public void bigVerticalDecrement(); | |
150 | ||
151 | /** | |
152 | * Perform a big step change down. | |
153 | */ | |
154 | public void bigVerticalIncrement(); | |
155 | ||
156 | /** | |
157 | * Go to the top edge of the vertical scroller. | |
158 | */ | |
159 | public void toTop(); | |
160 | ||
161 | /** | |
162 | * Go to the bottom edge of the vertical scroller. | |
163 | */ | |
164 | public void toBottom(); | |
165 | ||
166 | /** | |
167 | * Get the value that corresponds to being on the left edge of the | |
168 | * horizontal scroll bar. | |
169 | * | |
170 | * @return the scroll value | |
171 | */ | |
172 | public int getLeftValue(); | |
173 | ||
174 | /** | |
175 | * Set the value that corresponds to being on the left edge of the | |
176 | * horizontal scroll bar. | |
177 | * | |
178 | * @param leftValue the new scroll value | |
179 | */ | |
180 | public void setLeftValue(final int leftValue); | |
181 | ||
182 | /** | |
183 | * Get the value that corresponds to being on the right edge of the | |
184 | * horizontal scroll bar. | |
185 | * | |
186 | * @return the scroll value | |
187 | */ | |
188 | public int getRightValue(); | |
189 | ||
190 | /** | |
191 | * Set the value that corresponds to being on the right edge of the | |
192 | * horizontal scroll bar. | |
193 | * | |
194 | * @param rightValue the new scroll value | |
195 | */ | |
196 | public void setRightValue(final int rightValue); | |
197 | ||
198 | /** | |
199 | * Get current value of the horizontal scroll. | |
200 | * | |
201 | * @return the scroll value | |
202 | */ | |
203 | public int getHorizontalValue(); | |
204 | ||
205 | /** | |
206 | * Set current value of the horizontal scroll. | |
207 | * | |
208 | * @param value the new scroll value | |
209 | */ | |
210 | public void setHorizontalValue(final int value); | |
211 | ||
212 | /** | |
213 | * Get the increment for clicking on an arrow on the horizontal | |
214 | * scrollbar. | |
215 | * | |
216 | * @return the increment value | |
217 | */ | |
218 | public int getHorizontalSmallChange(); | |
219 | ||
220 | /** | |
221 | * Set the increment for clicking on an arrow on the horizontal | |
222 | * scrollbar. | |
223 | * | |
224 | * @param smallChange the new increment value | |
225 | */ | |
226 | public void setHorizontalSmallChange(final int smallChange); | |
227 | ||
228 | /** | |
229 | * Get the increment for clicking in the bar between the box and an | |
230 | * arrow on the horizontal scrollbar. | |
231 | * | |
232 | * @return the increment value | |
233 | */ | |
234 | public int getHorizontalBigChange(); | |
235 | ||
236 | /** | |
237 | * Set the increment for clicking in the bar between the box and an | |
238 | * arrow on the horizontal scrollbar. | |
239 | * | |
240 | * @param bigChange the new increment value | |
241 | */ | |
242 | public void setHorizontalBigChange(final int bigChange); | |
243 | ||
244 | /** | |
245 | * Perform a small step change left. | |
246 | */ | |
247 | public void horizontalDecrement(); | |
248 | ||
249 | /** | |
250 | * Perform a small step change right. | |
251 | */ | |
252 | public void horizontalIncrement(); | |
253 | ||
254 | /** | |
255 | * Perform a big step change left. | |
256 | */ | |
257 | public void bigHorizontalDecrement(); | |
258 | ||
259 | /** | |
260 | * Perform a big step change right. | |
261 | */ | |
262 | public void bigHorizontalIncrement(); | |
263 | ||
264 | /** | |
265 | * Go to the left edge of the horizontal scroller. | |
266 | */ | |
267 | public void toLeft(); | |
268 | ||
269 | /** | |
270 | * Go to the right edge of the horizontal scroller. | |
271 | */ | |
272 | public void toRight(); | |
273 | ||
274 | /** | |
275 | * Go to the top-left edge of the horizontal and vertical scrollers. | |
276 | */ | |
277 | public void toHome(); | |
278 | ||
279 | /** | |
280 | * Go to the bottom-right edge of the horizontal and vertical scrollers. | |
281 | */ | |
282 | public void toEnd(); | |
283 | ||
284 | } |