home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WPEN.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  4KB  |  152 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.  * WPen -- Wrapper for the Windows 95 Pen object.
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WPEN_HPP_INCLUDED
  18. #define _WPEN_HPP_INCLUDED
  19.  
  20. #ifndef _WNO_PRAGMA_PUSH
  21. #pragma pack(push,8);
  22. #pragma enum int;
  23. #endif
  24.  
  25. #ifndef _WCOLOR_HPP_INCLUDED
  26. #  include "wcolor.hpp"
  27. #endif
  28.  
  29. enum WPStockPen {
  30.     WPWhitePen = 6,
  31.     WPBlackPen = 7,
  32.     WPInvisiblePen = 8
  33. };
  34.  
  35. enum WPStyle {
  36.     WPStyleSolid,
  37.     WPStyleDash,
  38.     WPStyleDot,
  39.     WPStyleDashDot,
  40.     WPStyleDashDotDot,
  41. };
  42.  
  43. class WPenReference;
  44.  
  45. class WCMCLASS WPen : public WObject {
  46.     WDeclareSubclass( WPen, WObject );
  47.  
  48.     public:
  49.  
  50.         /**********************************************************
  51.          * Constructors and Destructors
  52.          *********************************************************/
  53.  
  54.         WPen();
  55.  
  56.         WPen( WPStockPen pen );
  57.         WPen( const WColor & color, WInt width=1,
  58.               WPStyle style=WPStyleSolid );
  59.         WPen( const WPenHandle handle, WBool deleteHandle=FALSE );
  60.         WPen( const WPen & pen );
  61.  
  62.         ~WPen();
  63.     
  64.         /**********************************************************
  65.          * Properties
  66.          *********************************************************/
  67.  
  68.         // Handle
  69.  
  70.         WPenHandle GetHandle() const;
  71.     
  72.         /**********************************************************
  73.          * Methods
  74.          *********************************************************/
  75.  
  76.         // Clear
  77.  
  78.         void Clear();
  79.  
  80.         // Create
  81.  
  82.         WBool Create( WPStockPen pen );
  83.         WBool Create( const WColor & color, WInt width=1,
  84.                       WPStyle style=WPStyleSolid );
  85.         WBool Create( const WPenHandle handle, WBool deleteHandle=FALSE );
  86.         WBool Create( const WPen & pen );
  87.  
  88.         /**********************************************************
  89.          * Static Properties
  90.          *********************************************************/
  91.  
  92.         // BlackPen
  93.  
  94.         static const WPen & GetBlackPen();
  95.  
  96.         // InvisiblePen
  97.  
  98.         static const WPen & GetInvisiblePen();   // NOT same as null pen!
  99.  
  100.         // NullPen
  101.  
  102.         static const WPen & GetNullPen();
  103.  
  104.         // WhitePen
  105.  
  106.         static const WPen & GetWhitePen();
  107.  
  108.         /**********************************************************
  109.          * Static Methods
  110.          *********************************************************/
  111.  
  112.         // IsValidHandle
  113.         //
  114.         //     Returns TRUE if the given handle is valid.  Can
  115.         //     optionally specify whether or not a null handle
  116.         //     is "valid".
  117.  
  118.         static WBool IsValidHandle( WPenHandle handle,
  119.                                     WBool nullValid=FALSE );
  120.  
  121.         /**********************************************************
  122.          * Operators
  123.          *********************************************************/
  124.  
  125.         WPen & operator=( const WPen & p );
  126.         WPen & operator=( WPStockPen p );
  127.  
  128.         int operator==( const WPen & p ) const;
  129.         int operator!=( const WPen & p ) const;
  130.  
  131.         /**********************************************************
  132.          * Data members
  133.          *********************************************************/
  134.  
  135.     private:
  136.  
  137.         WPenReference *         _penRef;
  138. };
  139.  
  140. #ifdef _DEBUG
  141. #define W_ISPENHANDLE(h) CHECKGDI(WPen::IsValidHandle((WPenHandle)h))
  142. #else
  143. #define W_ISPENHANDLE(h)
  144. #endif
  145.  
  146. #ifndef _WNO_PRAGMA_PUSH
  147. #pragma enum pop;
  148. #pragma pack(pop);
  149. #endif
  150.  
  151. #endif // _WPEN_HPP_INCLUDED
  152.