Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

210 lines
7.1 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. bltcurs.hxx
  7. BLT cursor wrappers: definition
  8. FILE HISTORY:
  9. beng 15-May-1991 Split from bltmisc.hxx
  10. beng 28-May-1992 Uses IDRESOURCE
  11. beng 28-Jul-1992 Disabled TIME_CURSOR
  12. */
  13. #ifndef _BLT_HXX_
  14. #error "Don't include this file directly; instead, include it through blt.hxx"
  15. #endif // _BLT_HXX_
  16. #ifndef _BLTCURS_HXX_
  17. #define _BLTCURS_HXX_
  18. #include "base.hxx"
  19. #include "bltbitmp.hxx" // DISPLAY_MAP
  20. #include "bltidres.hxx"
  21. DLL_CLASS NLS_STR;
  22. DLL_CLASS WINDOW;
  23. /*************************************************************************
  24. NAME: CURSOR
  25. SYNOPSIS: Provides a set of methods which deal with the mouse cursor
  26. INTERFACE: Set() Sets the cursor
  27. Load() Retrieves the handle of an application cursor
  28. LoadSystem() ...of a system cursor
  29. Show() Changes the display count of the cursor. This
  30. causes the cursor to be displayed/hidden.
  31. Query() Returns current cursor
  32. CAVEATS:
  33. There is no Free counterpart to Load, since Win doesn't require
  34. such.
  35. HISTORY:
  36. rustanl 12-Mar-1991 created
  37. beng 05-Oct-1991 Win32 conversion
  38. beng 16-Oct-1991 Added QueryPos/SetPos
  39. beng 27-May-1992 Added Query, LoadSystem; uses IDRESOURCE
  40. **************************************************************************/
  41. DLL_CLASS CURSOR
  42. {
  43. public:
  44. static HCURSOR Query();
  45. static HCURSOR Set( HCURSOR hCursor );
  46. static HCURSOR Load( const IDRESOURCE & idrsrcCursor );
  47. static HCURSOR LoadSystem( const IDRESOURCE & idrsrcCursor );
  48. static VOID Show( BOOL f = TRUE );
  49. static XYPOINT QueryPos();
  50. static VOID SetPos( const XYPOINT & xy );
  51. };
  52. /*************************************************************************
  53. NAME: AUTO_CURSOR
  54. SYNOPSIS: The purpose of this class is to simplify commonly
  55. performed cursor operations
  56. An object of this class can be in one of two states,
  57. ON and OFF. In the ON state, it uses the cursor specified
  58. to the constructor. In the OFF state, it uses the
  59. cursor used before the constructor was called. The ON
  60. state increa
  61. The constructor always enters the ON state, and the
  62. destructor exits with the object in the OFF state.
  63. INTERFACE: AUTO_CURSOR() Initializes the object, and sets it
  64. to the ON state
  65. ~AUTO_CURSOR() Sets the object to the OFF state, and then
  66. destroys the object.
  67. TurnOn() Sets the object to the ON state
  68. TurnOff() Sends the object to Bolivia. Just kidding.
  69. Sets the object to the OFF state
  70. PARENT: CURSOR
  71. CAVEATS:
  72. It is defined to turn an object OFF (ON) even it is already
  73. is in the OFF (ON) state. This is especially useful since
  74. the destructor turns the object OFF.
  75. In its constructor, an AUTO_CURSOR object loads the new specified
  76. cursor, stores a handle to it, and, after setting the new cursor,
  77. stores the handle of the previously used cursor. This are the
  78. handles that are used in successive turn-ON and turn-OFF operations.
  79. HISTORY:
  80. rustanl 12-Mar-1991 created
  81. beng 05-Oct-1991 Win32 conversion
  82. **************************************************************************/
  83. DLL_CLASS AUTO_CURSOR : public CURSOR
  84. {
  85. private:
  86. HCURSOR _hOnCursor; // used in ON state
  87. HCURSOR _hOffCursor; // used in OFF state
  88. BOOL _fState; // TRUE for ON, FALSE for OFF
  89. INT _cCurs ; // Cursor count
  90. public:
  91. AUTO_CURSOR( const TCHAR * pszCursorName = NULL ); // NULL for IDC_WAIT
  92. ~AUTO_CURSOR();
  93. VOID TurnOn();
  94. VOID TurnOff();
  95. };
  96. #if 0 // Disabled, since nobody's using it
  97. /*************************************************************************
  98. NAME: TIME_CURSOR
  99. SYNOPSIS: The purpose of this class is to simplify precessing the
  100. cursor through a cycle of cursor resources. The best
  101. known example of the is the "wristwatch" cursor, which
  102. is more informative than the standard "hourglass".
  103. On construction, it loads a set of cursor resources which
  104. originate from a common numeric id, and advance stepwise
  105. through the integer number range. The default base is
  106. ID_CURS_BLT_TIME0.
  107. An object of this class can be in one of two states,
  108. ON and OFF. In the ON state, it uses the current cursor
  109. in the cycle. In the OFF state, it uses the cursor
  110. which was in use before the constructor was called.
  111. INTERFACE: TIME_CURSOR() Initializes the object, and sets it
  112. to the ON state
  113. ~TIME_CURSOR() Sets the object to the OFF state, and then
  114. destroys the object.
  115. operator++() Bump to the next cursor in the group.
  116. This will only happen as frequently as
  117. the "cMsInterval" parameter in the
  118. constructor specifies (default 2 seconds).
  119. TurnOn() Sets the object to the ON state
  120. TurnOff() Sets the object to the OFF state
  121. PARENT: CURSOR
  122. CAVEATS:
  123. Unlike AUTO_CURSOR, a TIME_CURSOR returns the cursor to its
  124. prior state.
  125. If you see only an hourglass cursor, then the constructor could
  126. not find your cursor resources.
  127. HISTORY:
  128. DavidHov 18-Mar-1991 created
  129. beng 05-Oct-1991 Win32 conversion
  130. beng 05-Mar-1992 Loads resources by number, not name
  131. **************************************************************************/
  132. #define TIME_CURSOR_MAX 10
  133. #define TIME_CURSOR_INTERVAL 2000
  134. DLL_CLASS TIME_CURSOR : public CURSOR
  135. {
  136. private:
  137. HCURSOR _ahCursors[ TIME_CURSOR_MAX ] ;
  138. UINT _ihCursor;
  139. UINT _cMsInterval;
  140. DWORD _cMsLast;
  141. HCURSOR _hCursPrev;
  142. BOOL _fState; // TRUE for ON, FALSE for OFF
  143. public:
  144. // NULL for wristwatch
  145. TIME_CURSOR( UINT cMsInterval = TIME_CURSOR_INTERVAL,
  146. UINT idResourceOrigin = ID_CURS_BLT_TIME0 );
  147. ~TIME_CURSOR();
  148. VOID TurnOn();
  149. VOID TurnOff();
  150. INT operator++(); // Bump the cursor image
  151. };
  152. #endif // 0
  153. #endif // _BLTCURS_HXX_ - end of file