5a065827af50dd5a32261f47c50e37bc8f622d15
2 * Jexer - Java Text User Interface
4 * The MIT License (MIT)
6 * Copyright (C) 2017 Kevin Lamonte
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:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
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.
26 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
31 import jexer
.event
.TKeypressEvent
;
32 import jexer
.event
.TMouseEvent
;
33 import static jexer
.TKeypress
.*;
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.
42 public interface Scrollable
{
45 * Get the horizontal scrollbar, or null if this Viewport does not
46 * support horizontal scrolling.
48 * @return the horizontal scrollbar
50 public THScroller
getHorizontalScroller();
53 * Get the vertical scrollbar, or null if this Viewport does not support
56 * @return the vertical scrollbar
58 public TVScroller
getVerticalScroller();
61 * Get the value that corresponds to being on the top edge of the
62 * vertical scroll bar.
64 * @return the scroll value
66 public int getTopValue();
69 * Set the value that corresponds to being on the top edge of the
70 * vertical scroll bar.
72 * @param topValue the new scroll value
74 public void setTopValue(final int topValue
);
77 * Get the value that corresponds to being on the bottom edge of the
78 * vertical scroll bar.
80 * @return the scroll value
82 public int getBottomValue();
85 * Set the value that corresponds to being on the bottom edge of the
86 * vertical scroll bar.
88 * @param bottomValue the new scroll value
90 public void setBottomValue(final int bottomValue
);
93 * Get current value of the vertical scroll.
95 * @return the scroll value
97 public int getVerticalValue();
100 * Set current value of the vertical scroll.
102 * @param value the new scroll value
104 public void setVerticalValue(final int value
);
107 * Get the increment for clicking on an arrow on the vertical scrollbar.
109 * @return the increment value
111 public int getVerticalSmallChange();
114 * Set the increment for clicking on an arrow on the vertical scrollbar.
116 * @param smallChange the new increment value
118 public void setVerticalSmallChange(final int smallChange
);
121 * Get the increment for clicking in the bar between the box and an
122 * arrow on the vertical scrollbar.
124 * @return the increment value
126 public int getVerticalBigChange();
129 * Set the increment for clicking in the bar between the box and an
130 * arrow on the vertical scrollbar.
132 * @param bigChange the new increment value
134 public void setVerticalBigChange(final int bigChange
);
137 * Perform a small step change up.
139 public void verticalDecrement();
142 * Perform a small step change down.
144 public void verticalIncrement();
147 * Perform a big step change up.
149 public void bigVerticalDecrement();
152 * Perform a big step change down.
154 public void bigVerticalIncrement();
157 * Go to the top edge of the vertical scroller.
162 * Go to the bottom edge of the vertical scroller.
164 public void toBottom();
167 * Get the value that corresponds to being on the left edge of the
168 * horizontal scroll bar.
170 * @return the scroll value
172 public int getLeftValue();
175 * Set the value that corresponds to being on the left edge of the
176 * horizontal scroll bar.
178 * @param leftValue the new scroll value
180 public void setLeftValue(final int leftValue
);
183 * Get the value that corresponds to being on the right edge of the
184 * horizontal scroll bar.
186 * @return the scroll value
188 public int getRightValue();
191 * Set the value that corresponds to being on the right edge of the
192 * horizontal scroll bar.
194 * @param rightValue the new scroll value
196 public void setRightValue(final int rightValue
);
199 * Get current value of the horizontal scroll.
201 * @return the scroll value
203 public int getHorizontalValue();
206 * Set current value of the horizontal scroll.
208 * @param value the new scroll value
210 public void setHorizontalValue(final int value
);
213 * Get the increment for clicking on an arrow on the horizontal
216 * @return the increment value
218 public int getHorizontalSmallChange();
221 * Set the increment for clicking on an arrow on the horizontal
224 * @param smallChange the new increment value
226 public void setHorizontalSmallChange(final int smallChange
);
229 * Get the increment for clicking in the bar between the box and an
230 * arrow on the horizontal scrollbar.
232 * @return the increment value
234 public int getHorizontalBigChange();
237 * Set the increment for clicking in the bar between the box and an
238 * arrow on the horizontal scrollbar.
240 * @param bigChange the new increment value
242 public void setHorizontalBigChange(final int bigChange
);
245 * Perform a small step change left.
247 public void horizontalDecrement();
250 * Perform a small step change right.
252 public void horizontalIncrement();
255 * Perform a big step change left.
257 public void bigHorizontalDecrement();
260 * Perform a big step change right.
262 public void bigHorizontalIncrement();
265 * Go to the left edge of the horizontal scroller.
267 public void toLeft();
270 * Go to the right edge of the horizontal scroller.
272 public void toRight();
275 * Go to the top-left edge of the horizontal and vertical scrollers.
277 public void toHome();
280 * Go to the bottom-right edge of the horizontal and vertical scrollers.