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

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OValueSet.hpp
  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/Include/rcs/OValueSet.hpp 1.50 1996/08/11 23:47:34 B.STEIN Release $
  31.  
  32. #ifndef OVALUE_INCLUDED
  33.   #define OVALUE_INCLUDED
  34.  
  35.  
  36. #ifndef OFRAME_INCLUDED
  37.   #include <OFrame.hpp>
  38. #endif
  39.  
  40.  
  41. #ifndef OSTRING_INCLUDED
  42.   #include <OString.hpp>
  43. #endif
  44.  
  45. // possible styles for value sets
  46. // VS_ITEMBORDER
  47. // VS_BORDER
  48. // VS_TEXT
  49. // VS_ICON
  50. // VS_BITMAP
  51. // VS_RGB
  52. // VS_COLORINDEX
  53. // VS_RIGHTTOLEFT
  54. // VS_SCALEBITMAPS
  55. // VS_OWNERDRAW
  56.  
  57.  
  58. typedef struct vsItem *pvsItem;
  59.  
  60. struct vsItem
  61. {
  62.  USHORT   row;
  63.  USHORT   col;
  64.  USHORT   colorIndex;
  65.  OString  text;
  66.  HPOINTER icon;
  67.  HBITMAP  bitmap;
  68.  RGB      rgb;
  69. };
  70.  
  71.  
  72. typedef class OValueSet *pOValueSet;
  73.  
  74.  
  75. class __CPP_EXPORT__ OValueSet
  76.   : public OWindow
  77. {
  78.  private:
  79.    VSCDATA             ctlData;
  80.    ULONG               rows;
  81.    ULONG               columns;
  82.    ULONG               margin;
  83.  
  84.  public:
  85.    vsItem              selected;
  86.  
  87. // ctors
  88.    OValueSet          (const ULONG id,
  89.                        const HWND  Parent,     // becomes parent and owner of the set
  90.                        const ULONG Rows    = 2,
  91.                        const ULONG Columns = 2,
  92.                        const ULONG Margin  = 0,
  93.                        const ULONG Style   = VS_ITEMBORDER | VS_BORDER | VS_ICON);
  94.  
  95.    OValueSet          (const ULONG id,
  96.                        const OFrame& Parent,   // becomes parent and owner of the set
  97.                        const ULONG Rows    = 2,
  98.                        const ULONG Columns = 2,
  99.                        const ULONG Margin  = 0,
  100.                        const ULONG Style   = VS_ITEMBORDER | VS_BORDER | VS_ICON);
  101.  
  102.    OValueSet          (const ULONG id,
  103.                        const pOFrame Parent,   // becomes parent and owner of the set
  104.                        const ULONG Rows    = 2,
  105.                        const ULONG Columns = 2,
  106.                        const ULONG Margin  = 0,
  107.                        const ULONG Style   = VS_ITEMBORDER | VS_BORDER | VS_ICON);
  108.  
  109. // dtor
  110.     virtual
  111.        ~OValueSet     ();
  112.  
  113.     virtual
  114.        PSZ isOfType   () const;
  115.  
  116.     OValueSet&
  117.        createValueSet (const SHORT x,
  118.                        const SHORT y,
  119.                        const SHORT cx,
  120.                        const SHORT cy);
  121.  
  122.     BOOL
  123.        querySelected  (),
  124.        queryItem      (ULONG row = 1,
  125.                        ULONG col = 1),
  126.        selectItem     (ULONG row = 1,
  127.                        ULONG col = 1),
  128.        setItem        (ULONG row,
  129.                        ULONG col,
  130.                        ULONG itemInfo),
  131.        setItemAttr    (ULONG row = 1,
  132.                        ULONG col = 1,
  133.                        ULONG attribute = VS_ICON, BOOL set = TRUE),
  134.        setMetrics     (ULONG fMetric,
  135.                        ULONG itemInfo);
  136.  
  137.     ULONG // return value is also placed in OValueSet::selected
  138.        queryItemAttr  (ULONG row = 1,
  139.                        ULONG col = 1),
  140.        queryMetrics   (ULONG fMetric = VMA_ITEMSIZE);
  141.  
  142. };
  143.  
  144.  
  145. #endif // OVALUE_INCLUDED
  146.  
  147.  
  148. // end of source
  149.