home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 035 / kwclass.zip / KVALSET.HPP < prev    next >
Text File  |  1994-10-14  |  8KB  |  163 lines

  1. #ifndef _KVALSET_
  2. #define _KVALSET_
  3. /*******************************************************************************
  4. * FILE NAME: kvalset.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     KValueSet          - Creates and manages a value set control             *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   Licensed Materials - Property of KASEWORKS                                 *
  12. *   (C) Copyright KASEWORKS, Inc 1993                                          *
  13. *   All Rights Reserved                                                        *
  14. *                                                                              *
  15. *******************************************************************************/
  16. #ifndef _ICONTROL_
  17.   #include <icontrol.hpp>
  18. #endif
  19. #ifndef _IBITFLAG_
  20.   #include <ibitflag.hpp>
  21. #endif
  22. #ifndef _ICOLOR_
  23.   #include <icolor.hpp>
  24. #endif
  25.  
  26. // Forward declarations for other classes:
  27. class IPoint;
  28. class ISize;
  29. class IString;
  30. class IRectangle;
  31. class IColor;
  32. class IWindowHandle;
  33. class IResourceId;
  34.  
  35. /*----------------------------------------------------------------------------*/
  36. /* Align classes on four byte boundary.                                       */
  37. /*----------------------------------------------------------------------------*/
  38. #pragma pack(4)
  39.  
  40. class _Export KValueSet : public IControl  
  41. {
  42.   typedef IControl Inherited;
  43.   typedef unsigned long Index;
  44.  
  45.   public:
  46.     class Style;                                 // forward declaration
  47.  
  48. /*------------------------- Constructors ---------------------------------------
  49. | You can construct instances of this class in the following ways:             |
  50. |   -- By using the primary constructor.  This constructor takes seven         |
  51. |      arguments, six of which are required:                                   |
  52. |      - A unique ID for the control.                                          |
  53. |      - A parent window.                                                      |
  54. |      - An owner window.                                                      |
  55. |      - A rectangle that defines the size and placement of the control        |
  56. |        window.                                                               |
  57. |      - An IPair object that defines the number of rows and columns 
  58. |        displayed in the window.
  59. |      - The style of the control.                                             |
  60. |   -- From a dialog window.  This constructor requires two arguments:         |
  61. |      - A unique ID for the control.                                          |
  62. |      - A parent window.                                                      |
  63. |   -- From a window handle.  This constructor requires one argument: the      |
  64. |      window handle of the control.                                           |
  65. ------------------------------------------------------------------------------*/
  66.     KValueSet ( unsigned long        windowId,
  67.                 IWindow*             parent,
  68.                 IWindow*             owner,
  69.                 const IRectangle&    initial,
  70.                 const IPair&         dimension,
  71.                 const Style&         style = defaultStyle() );
  72.     KValueSet ( unsigned long        windowId,
  73.                 IWindow*             parent );
  74.     KValueSet ( const IWindowHandle& handle );
  75.  
  76.     virtual ~KValueSet ( );
  77.  
  78. /*---------------------------------- Style -------------------------------------
  79. | The following functions provide a means to set and query progress indicator  |
  80. | styles:                                                                      |
  81. |                                                                              |
  82. |   Style - Nested class that provides static members that define the set of   |
  83. |           valid value set styles.  These styles can be used in               |
  84. |           conjunction with the styles defined by the nested classes          |
  85. |           IWindow::Style and IControl::Style.  For example, you could        |
  86. |           define an instance of the KValueSet::Style class and initialize    |
  87. |           it like:                                                           |
  88. |              KValueSet::Style style(KValueSet::vertical | IWindow::visible); |
  89. |                                                                              |
  90. |           An object of this type is provided when the value set              |
  91. |           is created.  A customizable default is used if no styles are       |
  92. |           specified.                                                         |
  93. |                                                                              |
  94. |           The declaration of the KValueSet::Style nested class is            |
  95. |           generated by the INESTEDBITFLAGCLASSDEF2 macro.                    |
  96. |                                                                              |
  97. | The following functions provide a means of getting and setting the default   |
  98. | style for this class:                                                        |
  99. |   defaultStyle    - Returns the current default style.  This is the same as  |
  100. |                     classDefaultStyle unless setDefaultStyle has been        |
  101. |                     called.                                                  |
  102. |   setDefaultStyle - Sets the default style for all subsequent progress       |
  103. |                     indicators.                                              |
  104. ------------------------------------------------------------------------------*/
  105. INESTEDBITFLAGCLASSDEF2(Style, KValueSet, IWindow, IControl);
  106. static const Style
  107.       classDefaultStyle,
  108.       bitmapItems,
  109.       iconItems,
  110.       textItems,
  111.       rgbItems,
  112.       colorIndexItems,
  113.       controlBorder,
  114.       itemBorder,
  115.       rightToLeft,
  116.       scaleGraphics,
  117.       ownerDraw;
  118.     
  119.     static Style defaultStyle ( );
  120.     static void  setDefaultStyle ( const Style& style );
  121.  
  122.     typedef enum { text, icon, bitmap, rgb, colorIndex } ItemType;
  123.     ItemType defaultItemType() { return typDefault; }
  124.  
  125.     KValueSet& setItem ( const IPair &item, const IResourceId&    resId );
  126.     KValueSet& setItem ( const IPair &item, const IBitmapHandle&  handle );
  127.     KValueSet& setItem ( const IPair &item, const IPointerHandle& handle );
  128.     KValueSet& setItem ( const IPair &item, const IColor&         color );
  129.     KValueSet& setItem ( const IPair &item, IColor::Color         index );
  130.     KValueSet& setItem ( const IPair &item, const char*           string );
  131.  
  132.     KValueSet& setItemBmp ( const IPair &item, const unsigned long bmpId );
  133.     KValueSet& setItemIco ( const IPair &item, const unsigned long icoId );
  134.  
  135.     KValueSet& setItemType ( const IPair &item, ItemType itemType );
  136.  
  137.     static IPair indexToItem(Index index);
  138.     static Index itemToIndex(const IPair &item);
  139.  
  140.     IPair selectedItem();
  141.     Index selectedIndex();
  142.  
  143.     KValueSet& selectItem(const IPair &item);
  144.     KValueSet& selectIndex(Index index);
  145.  
  146.   private:
  147.     unsigned short usRowCount;
  148.     unsigned short usColumnCount;
  149.     ItemType typDefault;
  150.     KValueSet ( const KValueSet & );
  151.     KValueSet operator = ( const KValueSet & );
  152.     static Style currentDefaultStyle;
  153. };    // KValueSet
  154.  
  155. INESTEDBITFLAGCLASSFUNCS(Style, KValueSet);
  156.  
  157. /*----------------------------------------------------------------------------*/
  158. /* Resume compiler default packing.                                           */
  159. /*----------------------------------------------------------------------------*/
  160. #pragma pack()
  161.  
  162. #endif /* _KVALSET_ */
  163.