home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / icolor.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  5.5 KB  |  213 lines

  1. #ifndef _ICOLOR_
  2. #define _ICOLOR_
  3. /*******************************************************************************
  4. * FILE NAME: icolor.hpp                                                        *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IColor                                                                   *
  9. *     IDeviceColor                                                             *
  10. *     IGUIColor                                                                *
  11. *                                                                              *
  12. * COPYRIGHT:                                                                   *
  13. *   IBM Open Class Library                                                     *
  14. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  15. *   Licensed Material - Program-Property of IBM - 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. *******************************************************************************/
  20. #include <ivbase.hpp>
  21.  
  22. class IColorData;
  23. class IDeviceColorData;
  24. class IGUIColorData;
  25.  
  26. #pragma pack(4)
  27.  
  28. class IColor : public IVBase {
  29. typedef IVBase
  30.   Inherited;
  31. public:
  32. /*------------------------------- Constructors -------------------------------*/
  33. enum Color {
  34.   white,
  35.   blue,
  36.   red,
  37.   pink,
  38.   green,
  39.   cyan,
  40.   yellow,
  41.   black,
  42.   darkGray,
  43.   darkBlue,
  44.   darkRed,
  45.   darkPink,
  46.   darkGreen,
  47.   darkCyan,
  48.   brown,
  49.   paleGray
  50.   };
  51.  
  52. enum SystemColor {
  53.   shadowIconHiliteBgnd, shadowIconHiliteFgnd, shadowIconText,
  54.   entryFieldBgnd, listBoxBgnd,
  55.   disableMenuText, menuHiliteText, menuHiliteBgnd,
  56.   notebookPageBgnd,
  57.   inactiveScrollBar,
  58.   defaultControl,
  59.   buttonLight, buttonMiddle, buttonDark, defaultButton,
  60.   titleLine,
  61.   menuShadow, dialogShadow,
  62.   iconText,
  63.   dialogBgnd,
  64.   hiliteFgnd, hiliteBgnd,
  65.   inactiveTitleTextBgnd, activeTitleTextBgnd,
  66.   inactiveTitleText, activeTitleText,
  67.   outputText, windowStaticText,
  68.   scrollBar,
  69.   desktopBgnd,
  70.   activeTitleBgnd, inactiveTitleBgnd,
  71.   menuBgnd, windowBgnd,
  72.   frameBorder,
  73.   menuText, windowText, titleText,
  74.   sizeBar, scrollArrow,
  75.   activeFrameBorder, inactiveFrameBorder,
  76.   mainWindowBgnd, helpWindowBgnd,
  77.   helpText, helpHiliteText
  78.   };
  79.  
  80.  
  81.   IColor    ( Color         color );
  82.   IColor    ( unsigned char red,
  83.               unsigned char green,
  84.               unsigned char blue );
  85.   IColor    ( const IColor& color );
  86.   IColor    ( long          index );
  87.   IColor    ( SystemColor value );
  88.  
  89. IColor&
  90.   operator= ( const IColor& color );
  91.  
  92. virtual
  93.  ~IColor    ( );
  94.  
  95. /*-------------------------------- Color Mix ---------------------------------*/
  96. unsigned char
  97.   redMix    ( ) const,
  98.   greenMix  ( ) const,
  99.   blueMix   ( ) const;
  100.  
  101. IColor
  102.  &setRed   ( unsigned char redMix ),
  103.  &setGreen ( unsigned char greenMix ),
  104.  &setBlue  ( unsigned char blueMix );
  105.  
  106. virtual long
  107.   index       ( ) const;
  108. Color
  109.   value       ( ) const;
  110. SystemColor
  111.   systemColor ( ) const;
  112.  
  113. /*------------------------------- Comparisons --------------------------------*/
  114. Boolean
  115.   operator!= ( const IColor& color ) const,
  116.   operator== ( const IColor& color ) const;
  117.  
  118. /*------------------------------- Conversions --------------------------------*/
  119. long
  120.   asRGBLong ( ) const;
  121.  
  122. protected:
  123. /*------------------------------- Constructors -------------------------------*/
  124.   IColor ( );
  125.  
  126. private:
  127. /*--------------------------------- Private ----------------------------------*/
  128. Boolean
  129.   checkSysRGBValue();
  130.  
  131. unsigned char
  132.   ucClRed,
  133.   ucClGreen,
  134.   ucClBlue;
  135.  
  136. long
  137.   cClColor;
  138. unsigned long
  139.   bClColor;
  140.  
  141. IColorData
  142.  *fColorData;
  143. }; // IColor
  144.  
  145.  
  146. class IDeviceColor : public IColor {
  147. typedef IColor
  148.   Inherited;
  149. public:
  150. /*------------------------------- Constructors -------------------------------*/
  151. enum DeviceColor {
  152.   defaultColor,
  153.   background,
  154.   neutral
  155.   };
  156.  
  157.   IDeviceColor ( DeviceColor color );
  158. virtual
  159.  ~IDeviceColor ( );
  160.  
  161. /*--------------------------- Color Representation ---------------------------*/
  162. DeviceColor
  163.   deviceColor ( ) const;
  164.  
  165. private:
  166. /*--------------------------------- Private ----------------------------------*/
  167. DeviceColor
  168.   dcClDeviceColor;
  169.  
  170. IDeviceColorData
  171.  *fDeviceColorData;
  172. }; // IDeviceColor
  173.  
  174.  
  175. class IGUIColor : public IColor {
  176. typedef IColor
  177.   Inherited;
  178. public:
  179. /*------------------------------- Constructors -------------------------------*/
  180.   IGUIColor ( SystemColor value );
  181. virtual
  182.  ~IGUIColor ( );
  183.  
  184. /*--------------------------- Color Representation ---------------------------*/
  185. SystemColor
  186.   systemColor ( ) const;
  187.  
  188. /*-------------------------- Setting System Colors ---------------------------*/
  189. IGUIColor
  190.  &setColor ( const IColor& newColor );
  191.  
  192. private:
  193. /*--------------------------------- Private ----------------------------------*/
  194. SystemColor
  195.   scClSysColor;
  196.  
  197. IGUIColorData
  198.  *fGUIColorData;
  199.  
  200. /*----------------------------- Obsolete Members -----------------------------*/
  201. #if (IC_OBSOLETE > IC_OBSOLETE_1) && (IC_OBSOLETE <= IC_OBSOLETE_2)
  202. public:
  203. typedef SystemColor
  204.   SysColor;
  205. #endif
  206. }; // IGUIColor
  207.  
  208. #pragma pack()
  209.  
  210.   #include <icolor.inl>
  211.  
  212. #endif /* _ICOLOR_ */
  213.