Common Scrollable interface
[fanfix.git] / src / jexer / THScroller.java
index d488ebf417db22b156484951fb856a31fb0a64bb..9e9b372ec51854d8bf75e968746d65e58ef1c8c8 100644 (file)
@@ -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.
      *