home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / ibmcli / icolor.hp_ / ICOLOR.HPP
Encoding:
C/C++ Source or Header  |  1992-10-26  |  8.9 KB  |  184 lines

  1. #ifndef _ICOLOR_
  2. #define _ICOLOR_
  3. /*******************************************************************************
  4. * FILE NAME: icolor.hpp                                                        *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IColor - color class                                                     *
  9. *     IDeviceColor - color class                                               *
  10. *     IGUIColor - color class                                                  *
  11. *                                                                              *
  12. * COPYRIGHT:                                                                   *
  13. *   Licensed Materials - Property of IBM                                       *
  14. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  15. *   All Rights Reserved                                                        *
  16. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  17. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  18. *                                                                              *
  19. *$Log:   R:/IBMCLASS/IBASEAPP/VCS/ICOLOR.HPV  $                                                                         *
  20. // 
  21. //    Rev 1.3   25 Oct 1992 17:59:42   nunn
  22. // Brad Broyles changes for external beta
  23.  
  24.       Rev 1.1   05 Sep 1992 12:00:00   KKL
  25.    Move from IWindow; support device and GUI system color
  26.       Rev 1.2   22 Oct 1992 12:00:00   WBB
  27.    Amend to match skeleton.hpp
  28. *******************************************************************************/
  29. #ifndef _IBASE_
  30.   #include <ibase.hpp>
  31. #endif
  32.  
  33. // Forward declarations for other classes:
  34. class IColor;
  35. class IColorIndex;
  36. class IGUIColor;
  37.  
  38. class IColor : public IBase {
  39. /*******************************************************************************
  40. * The IColor class deals with red, green, and blue standard color indices.     *
  41. *******************************************************************************/
  42. public:
  43. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  44. | There are 2 ways to construct instances of this class:                       |
  45. |   1. default (protected)                                                     |
  46. |     red, green, and blue components are all set to zero                      |
  47. |   2. from a Color value                                                      |
  48. |     a specified Color-type value is used to set the RGB components           |
  49. |   3. from separate red, green, and blue values                               |
  50. |     the separate component values are stored                                 |
  51. ------------------------------------------------------------------------------*/
  52.   enum Color {white, black, blue, red, pink, green,
  53.               cyan, yellow, darkGray, darkBlue,
  54.               darkRed, darkPink, darkGreen, darkCyan,
  55.               brown, paleGray };
  56.   IColor(Color value);
  57.   IColor(unsigned char red, unsigned char green,
  58.          unsigned char blue);
  59.  
  60. /*-------------------------------- ACCESSORS -----------------------------------
  61. | These function provide means of getting and setting the accessible           |
  62. | attributes of instances of this class:                                       |
  63. |   redMix - return the value of the red component                             |
  64. |   greenMix - return the value of the green component                         |
  65. |   blueMix - return the value of the blue component                           |
  66. |   asRGBLong - return the RGB color value as a long                           |
  67. |   index - return the color index of the device color closest to the RGB      |
  68. |           color representation                                               |
  69. |   value - determine the Color-type value given a color index                 |
  70. ------------------------------------------------------------------------------*/
  71. unsigned char
  72.   redMix() const,
  73.   greenMix() const,
  74.   blueMix() const;
  75. long
  76.   asRGBLong() const;
  77. virtual long
  78.   index() const;
  79. IColor::Color
  80.   value() const;
  81.  
  82. protected:
  83. /*----------------------------- IMPLEMENTATION ---------------------------------
  84. | IColor - protected default constructor                                       |
  85. | ucClRed - red component of IColor                                            |
  86. | ucClGreen - green component of IColor                                        |
  87. | ucClBlue - blue component of IColor                                          |
  88. ------------------------------------------------------------------------------*/
  89.   IColor();
  90. unsigned char
  91.   ucClRed,
  92.   ucClGreen,
  93.   ucClBlue;
  94. }; // IColor
  95.  
  96. class IDeviceColor : public IColor {
  97. /*******************************************************************************
  98. * The IDeviceColor class deals with device-independent color indices.          *
  99. *******************************************************************************/
  100. typedef IColor inherited;
  101. public:
  102. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  103. | There is one way to construct instances of this class:                       |
  104. |   1. from a DeviceColor value                                                |
  105. |     the internal device color is set from the DeviceColor provided           |
  106. ------------------------------------------------------------------------------*/
  107.   enum DeviceColor { defaultColor, background, neutral };
  108.   IDeviceColor(DeviceColor);
  109.  
  110. /*-------------------------------- ACCESSORS -----------------------------------
  111. | These function provide means of getting and setting the accessible           |
  112. | attributes of instances of this class:                                       |
  113. |   index - return the index value of DeviceColor                              |
  114. ------------------------------------------------------------------------------*/
  115. virtual long
  116.   index() const;
  117.  
  118. private:
  119. /*--------------------------------- PRIVATE ----------------------------------*/
  120. long
  121.   lClDeviceColor;
  122. }; // IDeviceColor
  123.  
  124. class IGUIColor : public IColor {
  125. /*******************************************************************************
  126. * The IGUIColor class with SYSCLR_* values                                     *
  127. *******************************************************************************/
  128. typedef IColor inherited;
  129. public:
  130. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  131. | There is one way to construct instances of this class:                       |
  132. |   1. from a SysColor value                                                   |
  133. |     the internal system color value is set from the SysColor provided        |
  134. ------------------------------------------------------------------------------*/
  135.   enum SysColor {shadowIconHiliteBgnd, shadowIconHiliteFgnd,
  136.                  shadowIconText,
  137.                  entryFieldBgnd, listBoxBgnd,
  138.                  disableMenuText, menuHiliteText,
  139.                  menuHiliteBgnd, notebookPageBgnd,
  140.                  inactiveScrollBar, defaultControl,
  141.                  buttonLight, buttonMiddle,
  142.                  buttonDark, defaultButton,
  143.                  titleLine,
  144.                  menuShadow, dialogShadow,
  145.                  iconText,
  146.                  dialogBgnd, hiliteFgnd,
  147.                  hiliteBgnd, inactiveTitleTextBgnd,
  148.                  activeTitleTextBgnd, inactiveTitleText,
  149.                  activeTitleText, outputText, windowStaticText,
  150.                  scrollBar, desktopBgnd, activeTitleBgnd,
  151.                  inactiveTitleBgnd, menuBgnd, windowBgnd,
  152.                  frameBorder, menuText, windowText,
  153.                  titleText, sizeBar, scrollArrow,
  154.                  activeFrameBorder, inactiveFrameBorder,
  155.                  mainWindowBgnd, helpWindowBgnd,
  156.                  helpText, helpHiliteText };
  157.   IGUIColor(SysColor value);
  158.  
  159. /*-------------------------------- ACCESSORS -----------------------------------
  160. | These function provide means of getting and setting the accessible           |
  161. | attributes of instances of this class:                                       |
  162. |   setColor - change a system color (will not reset to default)               |
  163. |   index - return the sysColor long value                                     |
  164. ------------------------------------------------------------------------------*/
  165. void
  166.   setColor(const IColor& newColor);
  167. virtual long
  168.   index() const;
  169.  
  170. private:
  171. /*--------------------------------- PRIVATE ----------------------------------*/
  172. static long
  173.   index(IGUIColor::SysColor cValue);
  174. long
  175.   lClSysColor;
  176. }; // IGUIColor
  177.  
  178. /*--------------------------------- INLINES ----------------------------------*/
  179. #ifndef I_NO_INLINES
  180.   #include <icolor.inl>
  181. #endif
  182.  
  183. #endif /* _ICOLOR_ */
  184.