View Javadoc

1   /**
2    * 
3    */
4   package org.sirius.server.win32.classes.controls;
5   
6   import java.rmi.RemoteException;
7   
8   import org.sirius.server.win32lib.controls.Win32LibControlsClient;
9   import org.sirius.server.win32lib.controls.scrollbar.IScrollBarContractProxy;
10  
11  /**
12   * @author Myk Kolisnyk
13   * 
14   */
15  public class ScrollBar {
16  
17      private final Win32LibControlsClient win32lib;
18      
19      /**
20       * 
21       */
22      public ScrollBar() {
23          win32lib = new Win32LibControlsClient();
24      }
25  
26      /**
27       * @param hwnd
28       * @return
29       * @throws RemoteException
30       * @see org.sirius.server.win32lib.controls.scrollbar.IScrollBarContractProxy#getLowerBound(java.lang.Integer)
31       */
32      public Double getLowerBound(Integer hwnd) throws RemoteException {
33          return win32lib.scrollBar().getLowerBound(hwnd);
34      }
35  
36      /**
37       * @param hwnd
38       * @return
39       * @throws RemoteException
40       * @see org.sirius.server.win32lib.controls.scrollbar.IScrollBarContractProxy#getPosition(java.lang.Integer)
41       */
42      public Double getPosition(Integer hwnd) throws RemoteException {
43          return win32lib.scrollBar().getPosition(hwnd);
44      }
45  
46      /**
47       * @param hwnd
48       * @return
49       * @throws RemoteException
50       * @see org.sirius.server.win32lib.controls.scrollbar.IScrollBarContractProxy#getUpperBound(java.lang.Integer)
51       */
52      public Double getUpperBound(Integer hwnd) throws RemoteException {
53          return win32lib.scrollBar().getUpperBound(hwnd);
54      }
55  
56      /**
57       * @param hwnd
58       * @param pos
59       * @throws RemoteException
60       * @see org.sirius.server.win32lib.controls.scrollbar.IScrollBarContractProxy#setPosition(java.lang.Integer,
61       *      java.lang.Double)
62       */
63      public void setPosition(Integer hwnd, Double pos) throws RemoteException {
64          win32lib.scrollBar().setPosition(hwnd, pos);
65      }
66      
67      public Double getSmallStep(Integer hwnd) throws RemoteException{
68          return win32lib.scrollBar().getSmallStep(hwnd);
69      }
70  
71      public Double getLargeStep(Integer hwnd) throws RemoteException{
72          return win32lib.scrollBar().getLargeStep(hwnd);
73      }
74      
75      public void increment(Integer hwnd) throws RemoteException{
76          double position = this.getPosition(hwnd);
77          double step = this.getSmallStep(hwnd);
78          double max = this.getUpperBound(hwnd);
79          
80          if(position + step <= max ){
81              this.setPosition(hwnd, position + step);
82          }
83      }
84      
85      public void decrement(Integer hwnd) throws RemoteException{
86          double position = this.getPosition(hwnd);
87          double step = this.getSmallStep(hwnd);
88          double min = this.getLowerBound(hwnd);
89          
90          if(position - step >= min ){
91              this.setPosition(hwnd, position - step);
92          }
93      }
94  }