home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WBRUSH.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  5KB  |  163 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.  * WBrush -- Wrapper for the Windows 95 Brush object.
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WBRUSH_HPP_INCLUDED
  18. #define _WBRUSH_HPP_INCLUDED
  19.  
  20. #ifndef _WNO_PRAGMA_PUSH
  21. #pragma pack(push,8);
  22. #pragma enum int;
  23. #endif
  24.  
  25. #ifndef _WBITMAP_HPP_INCLUDED
  26. #  include "wbitmap.hpp"
  27. #endif
  28. #ifndef _WCOLOR_HPP_INCLUDED
  29. #  include "wcolor.hpp"
  30. #endif
  31.  
  32. enum WBrushPattern {
  33.     WBPatternSolid = -1,
  34.     WBPatternHorizontal,
  35.     WBPatternVertical,
  36.     WBPatternFDiagonal,
  37.     WBPatternBDiagonal,
  38.     WBPatternCross,
  39.     WBPatternDiagCross
  40. };
  41.  
  42. enum WBStockBrush {
  43.     WBWhiteBrush = 0,
  44.     WBLightGrayBrush = 1,
  45.     WBGrayBrush = 2,
  46.     WBDarkGrayBrush = 3,
  47.     WBBlackBrush = 4,
  48.     WBInvisibleBrush = 5
  49. };
  50.  
  51. class WBrushReference;
  52.  
  53. class WCMCLASS WBrush : public WObject {
  54.     WDeclareSubclass( WBrush, WObject );
  55.  
  56.     public:
  57.  
  58.         /**********************************************************
  59.          * Constructors and Destructors
  60.          *********************************************************/
  61.  
  62.         WBrush();
  63.         WBrush( WBStockBrush brush );
  64.         WBrush( const WColor & color, WBrushPattern pattern=WBPatternSolid );
  65.         WBrush( const WBitmap & bmp );
  66.         WBrush( const WBrush & brush );
  67.         WBrush( const WBrushHandle handle, WBool deleteHandle=FALSE );
  68.     
  69.         ~WBrush();
  70.     
  71.         /**********************************************************
  72.          * Properties
  73.          *********************************************************/
  74.  
  75.         // Handle
  76.  
  77.         WBrushHandle GetHandle() const;
  78.  
  79.         /**********************************************************
  80.          * Methods
  81.          *********************************************************/
  82.  
  83.         // Clear
  84.  
  85.         WBool Clear();
  86.  
  87.         // Create
  88.  
  89.         WBool Create( WBStockBrush brush );
  90.         WBool Create( const WColor & color, WBrushPattern p=WBPatternSolid );
  91.         WBool Create( const WBitmap & bitmap );
  92.         WBool Create( const WBrush & brush );
  93.         WBool Create( const WBrushHandle handle, WBool deleteHandle=FALSE );
  94.  
  95.         /**********************************************************
  96.          * Static Methods
  97.          *********************************************************/
  98.  
  99.         // IsValidHandle
  100.         //
  101.         //     Returns TRUE if the given handle is valid.  Can
  102.         //     optionally specify whether or not a null handle
  103.         //     is "valid".
  104.  
  105.         static WBool IsValidHandle( WBrushHandle handle,
  106.                                     WBool nullValid=FALSE );
  107.  
  108.         // ResetSystemBrushes
  109.  
  110.         static void ResetSystemBrushes();
  111.  
  112.         /**********************************************************
  113.          * Static Properties
  114.          *********************************************************/
  115.  
  116.         // BlackBrush
  117.  
  118.         static const WBrush & GetBlackBrush();
  119.  
  120.         // InvisibleBrush
  121.  
  122.         static const WBrush & GetInvisibleBrush(); // NOT the same as null brush
  123.  
  124.         // NullBrush
  125.  
  126.         static const WBrush & GetNullBrush();
  127.  
  128.         // WhiteBrush
  129.  
  130.         static const WBrush & GetWhiteBrush();
  131.  
  132.         /**********************************************************
  133.          * Others
  134.          *********************************************************/
  135.  
  136.         WBrush & operator=( const WBrush & b );
  137.         WBrush & operator=( WBStockBrush b );
  138.  
  139.         int operator==( const WBrush &b ) const;
  140.         int operator!=( const WBrush &b ) const;
  141.  
  142.         /**********************************************************
  143.          * Data Members
  144.          *********************************************************/
  145.  
  146.     private:
  147.  
  148.         WBrushReference *       _brushRef;
  149. };
  150.  
  151. #ifdef _DEBUG
  152. #define W_ISBRUSHHANDLE(h) CHECKGDI(WBrush::IsValidHandle((WBrushHandle)h))
  153. #else
  154. #define W_ISBRUSHHANDLE(h)
  155. #endif
  156.  
  157. #ifndef _WNO_PRAGMA_PUSH
  158. #pragma enum pop;
  159. #pragma pack(pop);
  160. #endif
  161.  
  162. #endif // _WBRUSH_HPP_INCLUDED
  163.