home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / OSlider.hpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  6KB  |  157 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // (c) 1994 Matthias Stübner
  4. // (c) Benjamin Stein 1994
  5. // All Rights Reserved
  6. // OSlider.hpp
  7.  
  8. /*
  9.  * Redistribution and use in source and binary forms, with or without
  10.  * modification, are permitted provided that the following conditions
  11.  * are met:
  12.  * 1. Redistributions of source code must retain the above copyright
  13.  *    notice, this list of conditions and the following disclaimer.
  14.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  15.  *    endorse or promote products derived from this software
  16.  *    without specific prior written permission.
  17.  * 3. See OCL.INF for a detailed copyright notice.
  18.  *
  19.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  20.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  23.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29.  * SUCH DAMAGE.
  30.  */
  31.  
  32. // $Header: W:/Projects/OCL/Include/rcs/OSlider.hpp 1.50 1996/08/11 23:47:29 B.STEIN Release $
  33.  
  34. #ifndef OSLIDER_INCLUDED
  35.   #define OSLIDER_INCLUDED
  36.  
  37.  
  38. #ifndef OFRAME_INCLUDED
  39.   #include <OFrame.hpp>
  40. #endif
  41.  
  42.  
  43. /* Possible styles for slider are:
  44.  
  45. - SLS_HORIZONTAL    - Slider is horicontical
  46. - SLS_VERTICAL      - Slider is vertical
  47. - SLS_CENTER        -
  48. - SLS_BOTTOM        -
  49. - SLS_TOP           -
  50. - SLS_LEFT          -
  51. - SLS_RIGHT         -
  52.  
  53. - SLS_PRIMARYSCALE1 - Slider with scale above
  54. - SLS_PRIMARYSCALE2 - Slider with scale beneath
  55.     (if both parameters are used the systems assumes a scale beneath
  56.  
  57. - SLS_HOMELEFT      - starting point left (horicontal slider only)
  58. - SLS_HOMERIGHT     - starting point right (horicontal slider only)
  59. - SLS_HOMEBOTTOM    - starting point at bottom (vertical slider only)
  60. - SLS_HOMETOP       - starting point at top (vertical slider only)
  61. - SLS_BUTTONSLEFT   - control buttons left (horicontal slider only)  
  62. - SLS_BUTTONSRIGHT  - control buttons right (horicontal slider only)
  63. - SLS_BUTTONSBOTTOM - control buttons at bottom (vertical slider only)
  64. - SLS_BUTTONSTOP    - control buttons at top (vertical slider only)
  65. - SLS_SNAPTOINCREMENT    - marker always jumps to next whole number
  66. - SLS_READONLY      - removes slider and control buttons (e.g. progress indicator)
  67. - SLS_RIBBONSTRIP   - fills slider between beginning and end of range with color
  68. - SLS_OWNERDRAW     - if you have to do it by yourself ;-))
  69.  
  70. */
  71.  
  72. typedef class OSlider *pOSlider;
  73.  
  74. class __CPP_EXPORT__ OSlider
  75.   : public OWindow
  76. {
  77.  protected:
  78.     ULONG                   Scale1;
  79.     ULONG                   Space1;
  80.     ULONG                   Scale2;
  81.     ULONG                   Space2;
  82.     SLDCDATA                ctlData;
  83.  
  84.  public:
  85.  
  86. // ctors
  87.     OSlider                (const ULONG id,
  88.                             const HWND  Parent,  // becomes parent and owner of the slider
  89.                             const ULONG scale1,
  90.                             const ULONG space1,
  91.                             const ULONG scale2,
  92.                             const ULONG space2,
  93.                             const ULONG Style);
  94.  
  95.     OSlider                (const ULONG id,
  96.                             const OFrame& Parent,
  97.                             const ULONG scale1,
  98.                             const ULONG space1,
  99.                             const ULONG scale2,
  100.                             const ULONG space2,
  101.                             const ULONG Style);
  102.  
  103.     OSlider                (const ULONG id,
  104.                             const pOFrame Parent,
  105.                             const ULONG scale1,
  106.                             const ULONG space1,
  107.                             const ULONG scale2,
  108.                             const ULONG space2,
  109.                             const ULONG Style);
  110.  
  111. // dtor
  112.     virtual
  113.        ~OSlider            ();
  114.  
  115.     virtual
  116.        PSZ isOfType        () const;
  117.  
  118.  
  119.     OSlider
  120.        &createSlider       (const SHORT x  = 0,
  121.                            const SHORT y  = 0,
  122.                            const SHORT cx = 0, 
  123.                            const SHORT cy = 0),
  124.        &setSliderArmPos    (SHORT pos),
  125.        &setSliderArmSize   (ULONG x, ULONG y),
  126.        &setSliderShaftPos  (SHORT x, SHORT y),
  127.        &setSliderShaftDim  (SHORT dim),
  128.        &incSliderArm       (SHORT delta = 1),
  129.        &decSliderArm       (SHORT delta = 1),
  130.        &setSliderScaleText (PCSZ Text, USHORT pos),
  131.        &setTickSize        (ULONG size = 10, ULONG num = SMA_SETALLTICKS),
  132.        &setSliderStyles    (const ULONG Style),
  133.        &setSliderSize      (const ULONG x, 
  134.                            const ULONG y, 
  135.                            const ULONG cx, 
  136.                            const ULONG cy),
  137.        &getSliderShaftDim  (SHORT *lenght, SHORT *height),
  138.        &getSliderShaftPos  (SHORT *x, SHORT *y),
  139.        &getSliderArmSize   (SHORT *x, SHORT *y),
  140.        &drawSliderElement  (POWNERITEM  item, COLOR color);
  141.  
  142.     OWindow&
  143.        inherit             (const HWND Parent);
  144.  
  145.     ULONG
  146.        addDetent           (SHORT pos),
  147.        getDetentPos        (ULONG id),
  148.        getSliderArmPos     (),
  149.        getTickSize         (SHORT pos);
  150.  
  151.     PSZ
  152.        getScaleText        (SHORT loc, PSZ buf,SHORT len);
  153. };
  154.  
  155.  
  156. #endif // OSLIDER_INCLUDED
  157.