home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WCOLOR.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  6KB  |  207 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WColor -- Wrapper for the Windows 95 Color object.
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WCOLOR_HPP_INCLUDED
  18. #define _WCOLOR_HPP_INCLUDED
  19.  
  20. #ifndef _WNO_PRAGMA_PUSH
  21. #pragma pack(push,8);
  22. #pragma enum int;
  23. #endif
  24.  
  25. #ifndef _WOBJECT_HPP_INCLUDED
  26. #  include "wobject.hpp"
  27. #endif
  28. #ifndef _WARRAY_HPP_INCLUDED
  29. #  include "warray.hpp"
  30. #endif
  31.  
  32. enum WColorValue {
  33.  
  34.     /**********************************************************
  35.      * Special Color Values
  36.      *********************************************************/
  37.          
  38.     WColorInherited = -2,
  39.     WColorRGB  = -1,
  40.  
  41.     WColorNull =  0,
  42.     WColorDefault = WColorNull,
  43.  
  44.     /**********************************************************
  45.      * Normal Color Values
  46.      *********************************************************/
  47.          
  48.     WColorBrightRed,
  49.     WColorFirst = WColorBrightRed,
  50.     WColorBrightGreen,
  51.     WColorBrightBlue,
  52.     WColorRed,
  53.     WColorGreen,
  54.     WColorBlue,
  55.     WColorBlack,
  56.     WColorWhite,
  57.     WColorDarkGray,
  58.     WColorLightGray,
  59.     WColorBrightPink,
  60.     WColorPink,
  61.     WColorBrightYellow,
  62.     WColorYellow,
  63.     WColorBrightCyan,
  64.     WColorCyan,
  65.     WColorLast = WColorCyan,
  66.  
  67.     /**********************************************************
  68.      * System Color Values
  69.      *********************************************************/
  70.  
  71.     WColorMenu,
  72.                 WColorSystemFirst = WColorMenu,
  73.     WColorMenuText,
  74.     WColorWindow,
  75.     WColorWindowText,
  76.     WColorWindowFrame,
  77.     WColorBtnHighlight,
  78.                 WColorBtnHilight = WColorBtnHighlight,
  79.                 WColor3DHighlight = WColorBtnHighlight,
  80.                 WColor3DHilight = WColorBtnHilight,
  81.     WColorBtnFace,
  82.                 WColor3DFace = WColorBtnFace,
  83.     WColorBtnShadow,
  84.                 WColor3DShadow = WColorBtnShadow,
  85.     WColorTextBox,
  86.                 WColorEditBox = WColorTextBox,
  87.     WColorDialogBackground,
  88.     WColorBackground,
  89.                 WColorDesktop = WColorBackground,
  90.     WColorScrollbar,
  91.     WColorGrayText,
  92.     WColorActiveBorder,
  93.     WColorInactiveBorder,
  94.     WColorAppWorkSpace,
  95.     WColorActiveCaption,
  96.     WColorInactiveCaption,
  97.     WColorCaptionText,
  98.     WColorInactiveCaptionText,
  99.     WColorHighlight,
  100.     WColorHighlightText,
  101.     WColorInfoText,
  102.     WColorInfoBack,
  103.     WColor3DDarkShadow,
  104.     WColor3DLight,
  105.     WColorBtnText,
  106.  
  107.     WColorSystemLastPlusOne,
  108.     WColorSystemLast = WColorSystemLastPlusOne - 1,
  109.  
  110.     /**********************************************************
  111.      * Special Color Value
  112.      *********************************************************/
  113.  
  114.     // forces enum to a long
  115.  
  116.     WColorEnd = 66000
  117.  
  118. };
  119.  
  120. typedef WULong WRGBValue;
  121.  
  122. class WCMCLASS WColor : public WObject {
  123.     WDeclareSubclass( WColor, WObject );
  124.  
  125.     public:
  126.  
  127.         /**********************************************************
  128.          * Constructors and Destructors
  129.          *********************************************************/
  130.  
  131.         WColor( WColorValue col=WColorDefault );
  132.         WColor( const WColor & color );
  133.         WColor( WUChar red, WUChar green, WUChar blue );
  134.  
  135.         ~WColor();
  136.  
  137.         WColor & operator=( const WColor & );
  138.  
  139.         // Equality
  140.  
  141.         int operator==( const WColor & color ) const;
  142.         int operator!=( const WColor & color ) const;
  143.  
  144.         /**********************************************************
  145.          * Properties
  146.          *********************************************************/
  147.  
  148.         // ColorValue
  149.  
  150.         WColorValue GetColorValue() const { return _value; }
  151.         WBool       SetColorValue( WColorValue value );
  152.  
  153.         // RGB
  154.  
  155.         WBool     SetRGB( WRGBValue val );
  156.         WBool     SetRGB( WUChar red, WUChar green, WUChar blue );
  157.         WRGBValue GetRGB() const;
  158.  
  159.         // Red
  160.  
  161.         WBool  SetRed( WUChar red );
  162.         WUChar GetRed() const;
  163.  
  164.         // Green
  165.  
  166.         WBool  SetGreen( WUChar green );
  167.         WUChar GetGreen() const;
  168.  
  169.         // Blue
  170.  
  171.         WBool  SetBlue( WUChar blue );
  172.         WUChar GetBlue() const;
  173.  
  174.         /**********************************************************
  175.          * Methods
  176.          *********************************************************/
  177.  
  178.         // Create
  179.  
  180.         WBool Create( WColorValue col=WColorDefault );
  181.         WBool Create( const WColor & color );
  182.         WBool Create( WUChar red, WUChar green, WUChar blue );
  183.  
  184.         // ResetSystemColors
  185.  
  186.         static void ResetSystemColors();
  187.  
  188.         /**********************************************************
  189.          * Data members
  190.          *********************************************************/
  191.  
  192.     private:
  193.         WColorValue  _value;
  194.         WRGBValue    _rgbValue; // valid only if _value is WColorRGB
  195. };
  196.  
  197. extern template WArrayReference<WColor>;
  198. extern template WArray<WColor>;
  199. typedef WArray<WColor>                  WColorArray;
  200.  
  201. #ifndef _WNO_PRAGMA_PUSH
  202. #pragma enum pop;
  203. #pragma pack(pop);
  204. #endif
  205.  
  206. #endif // _WCOLOR_HPP_INCLUDED
  207.