home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-12 | 2.3 KB | 103 lines | [TEXT/CWIE] |
- //
- // CQTVRCursor.h
- //
- // A class for updating the cursor QTVR vashion.
- // Cursors are copied from Apple's QTVR application.
- // (How else are you going to get a consistant interface?)
- //
- // by James Jennings
- // July 12, 1996
- //
-
- #pragma once
-
- enum EQTVRCursor {
- cursor_MouseUp = -19700,
-
- cursor_MouseDown = -19670,
- cursor_DragW = -19669,
- cursor_StopW = -19668,
- cursor_DragE = -19667,
- cursor_StopE = -19666,
- cursor_DragS = -19665,
- cursor_StopS = -19664,
- cursor_DragSW = -19663,
- cursor_StopS_SW = -19662,
- cursor_StopW_SW = -19661,
- cursor_StopSW = -19660,
- cursor_DragSE = -19659,
- cursor_StopS_SE = -19658,
- cursor_StopE_SE = -19657,
- cursor_StopSE = -19656,
- cursor_DragN = -19655,
- cursor_StopN = -19654,
- cursor_DragNW = -19653,
- cursor_StopN_NW = -19652,
- cursor_StopW_NW = -19651,
- cursor_StopNW = -19650,
- cursor_DragNE = -19649,
- cursor_StopN_NE = -19648,
- cursor_StopE_NE = -19647,
- cursor_StopNE = -19646,
- // Another copy of all this stuff starts again at:
- // cursor_MouseDown = -19640,
- // to...
- // cursor_StopNE = -19616,
- };
-
- class CQTVRCursor {
- public:
- static void NotTracking();
- static void StopTracking();
- static void Set( Int16 deltah, Int16 deltav );
- protected:
- static void SetTheCursor( ResIDT inCursor );
- };
-
- inline
- void CQTVRCursor::SetTheCursor( ResIDT inCursor )
- {
- CursHandle h = ::GetCursor( inCursor );
- if ( h )
- ::SetCursor( *h );
- }
-
- inline
- void CQTVRCursor::NotTracking()
- {
- SetTheCursor( cursor_MouseUp );
- }
-
- inline
- void CQTVRCursor::StopTracking()
- {
- SetTheCursor( cursor_MouseDown );
- }
-
- inline
- void CQTVRCursor::Set( Int16 h, Int16 v )
- {
- if (h >= 0) {
- if (v >= 0 ) { // SE quadrant
- if ( h < v/2 ) SetTheCursor( cursor_DragS );
- else if ( v < h/2 ) SetTheCursor( cursor_DragE );
- else SetTheCursor( cursor_DragSE );
- } else { // NE quadrant
- if ( h < -v/2 ) SetTheCursor( cursor_DragN );
- else if ( -v < h/2 ) SetTheCursor( cursor_DragE );
- else SetTheCursor( cursor_DragNE );
- }
- } else {
- if (v >= 0 ) { // SW quadrant
- if ( -h < v/2 ) SetTheCursor( cursor_DragS );
- else if ( v < -h/2 ) SetTheCursor( cursor_DragW );
- else SetTheCursor( cursor_DragSW );
- } else { // NW quadrant
- if ( -h < -v/2 ) SetTheCursor( cursor_DragN );
- else if ( -v < -h/2 ) SetTheCursor( cursor_DragW );
- else SetTheCursor( cursor_DragNW );
- }
- }
- }
-
-