X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTHScroller.java;h=9e9b372ec51854d8bf75e968746d65e58ef1c8c8;hb=df602ccf5e32585c26dc618dd3b4a759b6820943;hp=0b6cf0b919da0f79c88bc3798e61ef1abb9af2f6;hpb=e16dda65585466c8987bd1efd718431450a96605;p=fanfix.git diff --git a/src/jexer/THScroller.java b/src/jexer/THScroller.java index 0b6cf0b..9e9b372 100644 --- a/src/jexer/THScroller.java +++ b/src/jexer/THScroller.java @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2016 Kevin Lamonte + * Copyright (C) 2017 Kevin Lamonte * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -115,6 +115,15 @@ public final class THScroller extends TWidget { */ private int smallChange = 1; + /** + * Get the increment for clicking on an arrow. + * + * @return the increment value + */ + public int getSmallChange() { + return smallChange; + } + /** * Set the increment for clicking on an arrow. * @@ -129,6 +138,16 @@ public final class THScroller extends TWidget { */ private int bigChange = 20; + /** + * Set the increment for clicking in the bar between the box and an + * arrow. + * + * @return the increment value + */ + public int getBigChange() { + return bigChange; + } + /** * Set the increment for clicking in the bar between the box and an * arrow. @@ -218,6 +237,46 @@ public final class THScroller extends TWidget { } } + /** + * Perform a big step change left. + */ + public void bigDecrement() { + if (leftValue == rightValue) { + return; + } + value -= bigChange; + if (value < leftValue) { + value = leftValue; + } + } + + /** + * Perform a big step change right. + */ + public void bigIncrement() { + if (rightValue == leftValue) { + return; + } + value += bigChange; + if (value > rightValue) { + value = rightValue; + } + } + + /** + * Go to the left edge of the scroller. + */ + public void toLeft() { + value = leftValue; + } + + /** + * Go to the right edge of the scroller. + */ + public void toRight() { + value = rightValue; + } + /** * Handle mouse button releases. *