TEditor 50% complete
[fanfix.git] / src / jexer / THScroller.java
index 0b6cf0b919da0f79c88bc3798e61ef1abb9af2f6..9e9b372ec51854d8bf75e968746d65e58ef1c8c8 100644 (file)
@@ -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.
      *