home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WCURSOR.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. #ifndef _WCURSOR_HPP_INCLUDED
  12. #define _WCURSOR_HPP_INCLUDED
  13.  
  14. #ifndef _WNO_PRAGMA_PUSH
  15. #pragma pack(push,8);
  16. #pragma enum int;
  17. #endif
  18.  
  19. #ifndef _WPOINT_HPP_INCLUDED
  20. #  include "wpoint.hpp"
  21. #endif
  22. #ifndef _WRECT_HPP_INCLUDED
  23. #  include "wrect.hpp"
  24. #endif
  25. #ifndef _WRESID_HPP_INCLUDED
  26. #  include "wresid.hpp"
  27. #endif
  28.  
  29. enum WStockCursor {
  30.     WSCPointer,
  31.     WSCCrossHair,
  32.     WSCIBeam,
  33.     WSCSize,
  34.     WSCSizeNESW,
  35.     WSCSizeNS,
  36.     WSCSizeNWSE,
  37.     WSCSizeWE,
  38.     WSCWait,
  39.     WSCLast = WSCWait
  40. };
  41.  
  42. enum WCursorColor {
  43.     WCWhite,
  44.     WCBlack,
  45.     WCBlackWhite
  46. };    
  47.  
  48. class WCursorReference;
  49. class WBitmap;
  50.  
  51. class WCMCLASS WCursor : public WObject {
  52.     WDeclareSubclass( WCursor, WObject );
  53.     
  54.     public:
  55.  
  56.         /***************************************************************
  57.          * Constructors and Destructors
  58.          ***************************************************************/
  59.  
  60.         WCursor();
  61.         WCursor( const WResourceID & id, WModuleHandle loadFrom=_ApplicationModule );
  62.         WCursor( const WStockCursor crs );
  63.         WCursor( const WCursorHandle crs, WBool deleteHandle=FALSE );
  64.         WCursor( const WCursor & cursor );
  65.         WCursor( const WChar * file, WBool monochrome );
  66.         WCursor( const WBitmap & bitmap, WPoint hotPoint, WCursorColor color = WCBlack );
  67.     
  68.         ~WCursor();
  69.  
  70.         /***************************************************************
  71.          * Properties
  72.          ***************************************************************/
  73.  
  74.         // Handle
  75.     
  76.         WCursorHandle GetHandle() const;
  77.  
  78.         // Valid
  79.         //
  80.         //     TRUE if cursor was created/loaded.
  81.     
  82.         WBool GetValid() const;
  83.  
  84.         /***************************************************************
  85.          * Methods
  86.          ***************************************************************/
  87.  
  88.         // Clear
  89.  
  90.         void Clear();
  91.  
  92.         // Create
  93.  
  94.         WBool Create( const WResourceID & id, WModuleHandle from=_ApplicationModule );
  95.         WBool Create( const WStockCursor stockCursor );
  96.         WBool Create( const WCursorHandle handle, WBool delHandle=FALSE );
  97.         WBool Create( const WCursor & cursor );
  98.         WBool Create( const WChar * file, WBool monochrome=FALSE );
  99.         WBool Create( const WBitmap & bitmap, WPoint hotPoint, WCursorColor color = WCBlack );
  100.  
  101.         /***************************************************************
  102.          * Static Properties
  103.          ***************************************************************/
  104.  
  105.         // ClipArea
  106.         //
  107.         //     Get or set the clipping area (in screen coordinates) for
  108.         //     the cursor.  A clip area with a width or height of 0
  109.         //     resets the clip area to the whole desktop.
  110.  
  111.         static WRect GetClipArea();
  112.         static WBool SetClipArea( const WRect & r );
  113.  
  114.         // Position
  115.         //
  116.         //     Get or set the position of the cursor on the screen.
  117.         //     Position is in screen coordinates.
  118.  
  119.         static WPoint GetPosition();
  120.         static WBool  SetPosition( const WPoint & pt );
  121.  
  122.         /***************************************************************
  123.          * Static Methods
  124.          ***************************************************************/
  125.  
  126.         // Hide
  127.         //
  128.         //    Decrement the display count for the cursor.  The cursor
  129.         //    is not visible if the display count < 0.  Returns the
  130.         //    new display count.
  131.  
  132.         static WInt Hide();
  133.  
  134.         // Show
  135.         //
  136.         //    Increment the display count for the cursor.  The cursor
  137.         //    is visible only if the display count >= 0.  Returns the
  138.         //    new display count.
  139.  
  140.         static WInt Show();
  141.  
  142.         /***************************************************************
  143.          * Operators
  144.          ***************************************************************/
  145.  
  146.         WCursor & operator=( const WCursor & cursor );
  147.     
  148.         /***************************************************************
  149.          * Data Members
  150.          ***************************************************************/
  151.  
  152.     private:
  153.  
  154.         WCursorReference *      _ref;
  155. };
  156.  
  157. #ifndef _WNO_PRAGMA_PUSH
  158. #pragma enum pop;
  159. #pragma pack(pop);
  160. #endif
  161.  
  162. #endif // _WCURSOR_HPP_INCLUDED
  163.