home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWToolbx / FWCursor.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.5 KB  |  134 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWCursor.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #if !defined(FWCURSOR_H) && !defined(__ODFRC__)
  11. #define FWCURSOR_H
  12.  
  13. #ifndef FWCURSOR_K
  14. #include "FWCursor.k"
  15. #endif
  16.  
  17. #ifndef FWEXCLIB_H
  18. #include "FWExcLib.h"
  19. #endif
  20.  
  21. #ifndef FWCFMRES_H
  22. #include "FWCFMRes.h"
  23. #endif
  24.  
  25. #ifndef FWSTDDEF_H
  26. #include "FWStdDef.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward Class Declarations
  31. //========================================================================================
  32.  
  33. class FW_PResourceFile;
  34. class FW_CCursor;
  35.  
  36. //========================================================================================
  37. //    Predefined cursors
  38. //========================================================================================
  39.  
  40. extern const FW_CCursor FW_gArrowCursor;
  41. extern const FW_CCursor FW_gIBeamCursor;
  42. extern const FW_CCursor FW_gCrossHairCursor;
  43. extern const FW_CCursor FW_gWaitCursor;
  44. extern const FW_CCursor FW_gOpenHandCursor;
  45. extern const FW_CCursor FW_gClosedHandCursor;
  46. extern const FW_CCursor FW_gSizeWECursor;
  47. extern const FW_CCursor FW_gSizeNSCursor;
  48. extern const FW_CCursor FW_gSizeNWSECursor;
  49. extern const FW_CCursor FW_gSizeNESWCursor;
  50.  
  51. //========================================================================================
  52. //    FW_CCursor
  53. //========================================================================================
  54.  
  55. class FW_CCursor
  56. {    
  57.  
  58. //----------------------------------------------------------------------------------------
  59. //    Constructor/Destructor
  60. //
  61. public:
  62.     FW_DECLARE_AUTO(FW_CCursor)
  63.  
  64.     FW_CCursor();
  65.         // Create an arrow cursor
  66.  
  67.     FW_CCursor(FW_CursorID cursorID, FW_Instance instance = FW_gInstance);
  68.         // loads a cursor
  69.         
  70.     virtual~ FW_CCursor();
  71.  
  72. //----------------------------------------------------------------------------------------
  73. //    New API
  74. //
  75. public:    
  76.     static void Show();
  77.     static void Hide();
  78.     void Select() const;
  79.  
  80.     FW_PlatformCursorHandle GetHandle() const;
  81.         // Attention (Mac Only): GetHandle will return NULL for the Arrow Cursor because the
  82.         // arrow cursor is a pointer not a handle.
  83.         
  84. protected:
  85.     void    PrivLoadCursor();
  86.         
  87. private:
  88.     FW_CCursor(const FW_CCursor& other);
  89.     FW_CCursor& operator=(const FW_CCursor& other);
  90.         // Copy constructor and assignment operator not valid for this class.    
  91.  
  92. //----------------------------------------------------------------------------------------
  93. //    New API
  94. //
  95. private:
  96.     FW_PlatformCursorHandle fCursorHandle;
  97.     
  98.     FW_Instance                fInstance;
  99.     FW_CursorID             fCursorID;
  100.     FW_Boolean                 fMacIsColor;    // Not an error: Defined even for Windows see PrivLoadCursor
  101. };
  102.  
  103. //----------------------------------------------------------------------------------------
  104. //    FW_CCursor::Show
  105. //----------------------------------------------------------------------------------------
  106. inline void FW_CCursor::Show()
  107. {
  108. #ifdef FW_BUILD_MAC
  109.     ::ShowCursor();
  110. #endif
  111.  
  112. #ifdef FW_BUILD_WIN
  113.     ::ShowCursor(TRUE);
  114. #endif
  115. }
  116.  
  117. //----------------------------------------------------------------------------------------
  118. //    FW_CCursor::Hide
  119. //----------------------------------------------------------------------------------------
  120. inline void FW_CCursor::Hide()
  121. {
  122. #ifdef FW_BUILD_MAC
  123.     ::HideCursor();
  124. #endif
  125.  
  126. #ifdef FW_BUILD_WIN
  127.     ::ShowCursor(FALSE);
  128. #endif
  129. }
  130.  
  131. #endif
  132.  
  133.  
  134.