home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Applications / FlyThrough 1.1.2 / src / Source / Misc Utilities / CQTVRCursor.h < prev    next >
Encoding:
Text File  |  1996-07-12  |  2.3 KB  |  103 lines  |  [TEXT/CWIE]

  1. //
  2. //    CQTVRCursor.h
  3. //
  4. //    A class for updating the cursor QTVR vashion.
  5. //    Cursors are copied from Apple's QTVR application.
  6. //    (How else are you going to get a consistant interface?)
  7. //
  8. //    by James Jennings
  9. //    July 12, 1996
  10. //
  11.  
  12. #pragma once
  13.  
  14. enum EQTVRCursor {
  15.     cursor_MouseUp = -19700,
  16.     
  17.     cursor_MouseDown = -19670,
  18.     cursor_DragW    = -19669,
  19.     cursor_StopW    = -19668,
  20.     cursor_DragE    = -19667,
  21.     cursor_StopE    = -19666,
  22.     cursor_DragS    = -19665,
  23.     cursor_StopS    = -19664,
  24.     cursor_DragSW    = -19663,
  25.     cursor_StopS_SW    = -19662,
  26.     cursor_StopW_SW    = -19661,
  27.     cursor_StopSW    = -19660,
  28.     cursor_DragSE    = -19659,
  29.     cursor_StopS_SE    = -19658,
  30.     cursor_StopE_SE    = -19657,
  31.     cursor_StopSE    = -19656,
  32.     cursor_DragN    = -19655,
  33.     cursor_StopN    = -19654,
  34.     cursor_DragNW    = -19653,
  35.     cursor_StopN_NW    = -19652,
  36.     cursor_StopW_NW    = -19651,
  37.     cursor_StopNW    = -19650,
  38.     cursor_DragNE    = -19649,
  39.     cursor_StopN_NE    = -19648,
  40.     cursor_StopE_NE    = -19647,
  41.     cursor_StopNE    = -19646,
  42.     // Another copy of all this stuff starts again at:
  43. //    cursor_MouseDown = -19640,
  44. //    to...
  45. //    cursor_StopNE    = -19616,
  46.     };
  47.  
  48. class CQTVRCursor {
  49. public:
  50.     static void NotTracking();
  51.     static void StopTracking();
  52.     static void Set( Int16 deltah, Int16 deltav );
  53. protected:
  54.     static void SetTheCursor( ResIDT inCursor );
  55. };
  56.  
  57. inline
  58. void CQTVRCursor::SetTheCursor( ResIDT inCursor )
  59. {
  60.     CursHandle h = ::GetCursor( inCursor );
  61.     if ( h )
  62.         ::SetCursor( *h );
  63. }
  64.  
  65. inline 
  66. void CQTVRCursor::NotTracking()
  67. {
  68.     SetTheCursor( cursor_MouseUp );
  69. }
  70.  
  71. inline 
  72. void CQTVRCursor::StopTracking()
  73. {
  74.     SetTheCursor( cursor_MouseDown );
  75. }
  76.  
  77. inline
  78. void    CQTVRCursor::Set( Int16 h, Int16 v )
  79. {
  80.     if (h >= 0) {
  81.         if (v >= 0 ) {    // SE quadrant
  82.             if ( h < v/2 ) SetTheCursor( cursor_DragS );
  83.             else if ( v < h/2 ) SetTheCursor( cursor_DragE );
  84.             else SetTheCursor( cursor_DragSE );
  85.         } else {    // NE quadrant
  86.             if ( h < -v/2 ) SetTheCursor( cursor_DragN );
  87.             else if ( -v < h/2 ) SetTheCursor( cursor_DragE );
  88.             else SetTheCursor( cursor_DragNE );
  89.         }
  90.     } else {
  91.         if (v >= 0 ) {    // SW quadrant
  92.             if ( -h < v/2 ) SetTheCursor( cursor_DragS );
  93.             else if ( v < -h/2 ) SetTheCursor( cursor_DragW );
  94.             else SetTheCursor( cursor_DragSW );
  95.         } else {    // NW quadrant
  96.             if ( -h < -v/2 ) SetTheCursor( cursor_DragN );
  97.             else if ( -v < -h/2 ) SetTheCursor( cursor_DragW );
  98.             else SetTheCursor( cursor_DragNW );
  99.         }
  100.     }
  101. }
  102.  
  103.