home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ocl150a.zip / OCL / Source / OCircSlider.cpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  3KB  |  118 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OCircSlider.cpp
  5.  
  6. /*
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  *    notice, this list of conditions and the following disclaimer.
  12.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  13.  *    endorse or promote products derived from this software
  14.  *    without specific prior written permission.
  15.  * 3. See OCL.INF for a detailed copyright notice.
  16.  *
  17.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  18.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  21.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27.  * SUCH DAMAGE.
  28.  */
  29.  
  30. // $Header: W:/Projects/OCL/Source/rcs/OCircSlider.cpp 1.50 1996/08/11 23:49:11 B.STEIN Release $
  31.  
  32. #define __OCL_SOURCE__
  33.  
  34. #define OINCL_OSTRING
  35. #define OINCL_BASE
  36.  
  37. #include <ocl.hpp>
  38. #include "OCircSlider.hpp"
  39.  
  40.  
  41.  
  42. OCircSlider::OCircSlider(const ULONG id,
  43.                          const HWND  Parent,
  44.                          const ULONG scale,
  45.                          const ULONG space,
  46.                          const ULONG Style)
  47.   : OWindow(id, 0, 0),
  48.     Scale(scale),
  49.     Space(space)
  50. {
  51.  parent = Parent;
  52.  owner  = Parent;
  53.  style  = Style;
  54. }
  55.  
  56.  
  57.  
  58. OCircSlider::OCircSlider(const ULONG id,
  59.                          const OFrame& Parent,
  60.                          const ULONG scale,
  61.                          const ULONG space,
  62.                          const ULONG Style)
  63.   : OWindow(id, 0, 0),
  64.     Scale(scale),
  65.     Space(space)
  66. {
  67.  parent = Parent.hwnd;
  68.  owner  = Parent.hwnd;
  69.  style  = Style;
  70. }
  71.  
  72.  
  73. OCircSlider::OCircSlider(const ULONG id,
  74.                          const pOFrame Parent,
  75.                          const ULONG scale,
  76.                          const ULONG space,
  77.                          const ULONG Style)
  78.   : OWindow(id, 0, 0),
  79.     Scale(scale),
  80.     Space(space)
  81. {
  82.  parent = Parent->hwnd;
  83.  owner  = Parent->hwnd;
  84.  style  = Style;
  85. }
  86.  
  87.  
  88.  
  89. OCircSlider::~OCircSlider() {}
  90.  
  91.  
  92. PSZ OCircSlider::isOfType() const
  93.  return("OCircSlider"); 
  94. }
  95.  
  96.  
  97. OCircSlider& OCircSlider::createCircSlider(const SHORT x, const SHORT y,
  98.                                    const SHORT cx, const SHORT cy)
  99. {
  100.  memset(&ctlData, 0, sizeof(CSBITMAPDATA));
  101.  
  102. #ifdef __OS2_30__
  103.  if (!WinRegisterCircularSlider())
  104.    throw OPMException(OCL::error(155), 0);
  105. #endif
  106.  
  107.  if ((hwnd = WinCreateWindow(parent, WC_CIRCULARSLIDER, NULL, style | WS_VISIBLE,
  108.                              x, y, cx, cy,
  109.                              owner, HWND_TOP, 0,
  110.                              (PVOID)&ctlData, NULL)) == NULLHANDLE)
  111.    throw OPMException(OCL::error(156), 0);  
  112.  return(*this);
  113. }
  114.  
  115.  
  116. // end of source
  117.